From f57c93017bdfbb8612004cd05c606ea4684ea907 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Tue, 7 Dec 2004 00:55:26 +0000 Subject: Patch from Lucas Rocha to use the GOption API for the 2004-12-07 Glynn Foster Patch from Lucas Rocha to use the GOption API for the zenity parsing options, with some spacing fixes from Glynn. * configure.in: zenity now requires glib-2.0 >= 2.5.3 to build because now it uses GOption. popt requirement removed. * src/Makefile.am: update for new files * src/main.c: use GOption API * src/option.c, src/option.h: New files to implement the new functionality. * src/zenity.h: Fix spacing. --- src/option.c | 1364 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1364 insertions(+) create mode 100644 src/option.c (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c new file mode 100644 index 00000000..b230633b --- /dev/null +++ b/src/option.c @@ -0,0 +1,1364 @@ +/* + * option.h + * + * Copyright (C) 2002 Sun Microsystems, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: Glynn Foster + * Lucas Rocha + */ + +#include "option.h" + +/* General Options */ +gchar *zenity_general_dialog_title; +gchar *zenity_general_window_icon; +int zenity_general_width; +int zenity_general_height; +gchar *zenity_general_dialog_text; +gchar *zenity_general_separator; +gboolean zenity_general_editable; +gchar *zenity_general_uri; + +/* Calendar Dialog Options */ +gboolean zenity_calendar_active; +int zenity_calendar_day; +int zenity_calendar_month; +int zenity_calendar_year; +gchar *zenity_calendar_date_format; + +/* Entry Dialog Options */ +gboolean zenity_entry_active; +gchar *zenity_entry_entry_text; +gboolean zenity_entry_visible; + +/* Error Dialog Options */ +gboolean zenity_error_active; + +/* Info Dialog Options */ +gboolean zenity_info_active; + +/* File Selection Dialog Options */ +gboolean zenity_file_active; +gboolean zenity_file_multiple; +gboolean zenity_file_directory; +gboolean zenity_file_save; + +/* List Dialog Options */ +gboolean zenity_list_active; +gchar **zenity_list_columns; +gboolean zenity_list_checklist; +gboolean zenity_list_radiolist; +gchar *zenity_list_print_column; + +/* Notification Dialog Options */ +gboolean zenity_notification_active; +gboolean zenity_notification_listen; + +/* Progress Dialog Options */ +gboolean zenity_progress_active; +int zenity_progress_percentage; +gboolean zenity_progress_pulsate; +gboolean zenity_progress_auto_close; + +/* Question Dialog Options */ +gboolean zenity_question_active; + +/* Text Dialog Options */ +gboolean zenity_text_active; + +/* Warning Dialog Options */ +gboolean zenity_warning_active; + +/* Miscelaneus Options */ +gboolean zenity_misc_about; +gboolean zenity_misc_version; + +GOptionEntry general_options[] = { + { + "title", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_title, + N_("Set the dialog title"), + N_("TITLE") + }, + { + "window-icon", + '\0', + 0, + G_OPTION_ARG_FILENAME, + &zenity_general_window_icon, + N_("Set the window icon"), + N_("ICONPATH") + }, + { + "width", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_general_width, + N_("Set the width"), + N_("WIDTH") + }, + { + "height", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_general_height, + N_("Set the height"), + N_("HEIGHT") + }, + { + NULL + } +}; + +GOptionEntry calendar_options[] = { + { + "calendar", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_calendar_active, + N_("Display calendar dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + "day", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_calendar_day, + N_("Set the calendar day"), + NULL + }, + { + "month", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_calendar_month, + N_("Set the calendar month"), + NULL + }, + { + "year", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_calendar_year, + N_("Set the calendar year"), + NULL + }, + { "date-format", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_calendar_date_format, + N_("Set the format for the returned date"), + NULL + }, + { + NULL + } +}; + +GOptionEntry entry_options[] = { + { + "entry", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_entry_active, + N_("Display text entry dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + "entry-text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_entry_entry_text, + N_("Set the entry text"), + NULL + }, + { + "hide-text", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_entry_visible, + N_("Hide the entry text"), + NULL + }, + { + NULL + } +}; + + +GOptionEntry error_options[] = { + { + "error", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_error_active, + N_("Display error dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + NULL + } +}; + +GOptionEntry info_options[] = { + { + "info", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_info_active, + N_("Display info dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + NULL + } +}; + +GOptionEntry file_selection_options[] = { + { + "file-selection", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_file_active, + N_("Display file selection dialog"), + NULL + }, + { + "filename", + '\0', + 0, + G_OPTION_ARG_FILENAME, + &zenity_general_uri, + N_("Set the filename"), + N_("FILENAME") + }, + { + "multiple", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_multiple, + N_("Allow multiple files to be selected"), + NULL + }, + { + "directory", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_directory, + N_("Activate directory-only selection"), + NULL + }, + { + "save", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_save, + N_("Activate save mode"), + NULL + }, + { + "separator", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_separator, + N_("Set output separator character"), + N_("SEPARATOR") + }, + { + NULL + } +}; + +GOptionEntry list_options[] = { + { + "list", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_list_active, + N_("Display list dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + "column", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_list_columns, + N_("Set the column header"), + NULL + }, + { + "checklist", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_list_checklist, + N_("Use check boxes for first column"), + NULL + }, + { + "radiolist", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_list_radiolist, + N_("Use radio buttons for first column"), + NULL + }, + { + "separator", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_separator, + N_("Set output separator character"), + N_("SEPARATOR") + }, + { + "editable", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_editable, + N_("Allow changes to text"), + NULL + }, + { + "print-column", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_list_print_column, + N_("Print a specific column (Default is 1. 'ALL' can be used to print all columns)"), + NULL + }, + { + NULL + } +}; + +GOptionEntry notification_options[] = { + { + "notification", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_notification_active, + N_("Display notification"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the notification text"), + NULL + }, + { + "listen", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_notification_listen, + N_("Listen for commands on stdin"), + NULL + }, + { + NULL + } +}; + +GOptionEntry progress_options[] = { + { + "progress", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_progress_active, + N_("Display progress indication dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + "percentage", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_progress_percentage, + N_("Set initial percentage"), + NULL + }, + { + "pulsate", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_pulsate, + N_("Pulsate progress bar"), + NULL + }, + { + "auto-close", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_auto_close, + /* xgettext: no-c-format */ + N_("Dismiss the dialog when 100% has been reached"), + NULL + }, + { + NULL + } +}; + +GOptionEntry question_options[] = { + { + "question", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_question_active, + N_("Display question dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + NULL + } +}; + +GOptionEntry text_options[] = { + { + "text-info", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_text_active, + N_("Display text information dialog"), + NULL + }, + { + "filename", + '\0', + 0, + G_OPTION_ARG_FILENAME, + &zenity_general_uri, + N_("Open file"), + N_("FILENAME") + }, + { + "editable", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_editable, + N_("Allow changes to text"), + NULL + }, + { + NULL + } +}; + +GOptionEntry warning_options[] = { + { + "warning", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_warning_active, + N_("Display warning dialog"), + NULL + }, + { + "text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + NULL + } +}; + +GOptionEntry miscellaneous_options[] = { + { + "about", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_misc_about, + N_("About zenity"), + NULL + }, + { + "version", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_misc_version, + N_("Print version"), + NULL + }, + { + NULL + } +}; + +ZenityParsingOptions *results; +GOptionContext *ctx; + +void +zenity_option_init (void) { + + results = g_new0 (ZenityParsingOptions, 1); + + /* Initialize the various dialog structures */ + results->mode = MODE_LAST; + results->data = g_new0 (ZenityData, 1); + results->calendar_data = g_new0 (ZenityCalendarData, 1); + results->msg_data = g_new0 (ZenityMsgData, 1); + results->file_data = g_new0 (ZenityFileData, 1); + results->entry_data = g_new0 (ZenityEntryData, 1); + results->progress_data = g_new0 (ZenityProgressData, 1); + results->text_data = g_new0 (ZenityTextData, 1); + results->tree_data = g_new0 (ZenityTreeData, 1); + results->notification_data = g_new0 (ZenityNotificationData, 1); +} + +void +zenity_option_free (void) { + if (zenity_general_dialog_title) + g_free (zenity_general_dialog_title); + if (zenity_general_window_icon) + g_free (zenity_general_window_icon); + if (zenity_general_dialog_text) + g_free (zenity_general_dialog_text); + if (zenity_general_uri) + g_free (zenity_general_uri); + g_free (zenity_general_separator); + + if (zenity_calendar_date_format) + g_free (zenity_calendar_date_format); + + if (zenity_entry_entry_text) + g_free (zenity_entry_entry_text); + + if (zenity_list_columns) + g_strfreev (zenity_list_columns); + if (zenity_list_print_column) + g_free (zenity_list_print_column); + + g_option_context_free (ctx); +} + +void +zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) +{ + if (is_active == TRUE) { + if (results->mode == MODE_LAST) + results->mode = mode; + else + zenity_option_error (NULL, ERROR_DIALOG); + } +} + +gchar * +zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) +{ + int i; + + for (i = 1; entries[i].long_name != NULL; i++) { + if (entries[i].arg_data == arg_data) + return (gchar *) entries[i].long_name; + } +} + +/* Error callback */ +void zenity_option_error_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_error (NULL, ERROR_SYNTAX); +} + +/* Pre parse callbacks set the default option values */ + +gboolean +zenity_general_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_general_dialog_title = NULL; + zenity_general_window_icon = NULL; + zenity_general_width = -1; + zenity_general_height = -1; + zenity_general_dialog_text = NULL; + zenity_general_separator = g_strdup ("|"); + zenity_general_editable = FALSE; + zenity_general_uri = NULL; + + return TRUE; +} + +gboolean +zenity_calendar_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_calendar_active = FALSE; + zenity_calendar_date_format = NULL; + zenity_calendar_day = 0; + zenity_calendar_month = 0; + zenity_calendar_year = 0; + + return TRUE; +} + +gboolean +zenity_entry_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_entry_active = FALSE; + zenity_entry_entry_text = NULL; + zenity_entry_visible = FALSE; + + return TRUE; +} + +gboolean +zenity_error_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_error_active = FALSE; + + return TRUE; +} + +gboolean +zenity_info_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_info_active = FALSE; + + return TRUE; +} + +gboolean +zenity_file_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_file_active = FALSE; + zenity_file_multiple = FALSE; + zenity_file_directory = FALSE; + zenity_file_save = FALSE; + + return TRUE; +} + +gboolean +zenity_list_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_list_active = FALSE; + zenity_list_columns = NULL; + zenity_list_checklist = FALSE; + zenity_list_radiolist = FALSE; + zenity_list_print_column = NULL; + + return TRUE; +} + +gboolean +zenity_notification_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_notification_active = FALSE; + zenity_notification_listen = FALSE; + + return TRUE; +} + +gboolean +zenity_progress_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_progress_active = FALSE; + zenity_progress_percentage = 0; + zenity_progress_pulsate = FALSE; + zenity_progress_auto_close = FALSE; + + return TRUE; +} + +gboolean +zenity_question_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_question_active = FALSE; + + return TRUE; +} + +gboolean +zenity_text_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_text_active = FALSE; + + return TRUE; +} + +gboolean +zenity_warning_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_warning_active = FALSE; + + return TRUE; +} + +gboolean +zenity_misc_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_misc_about = FALSE; + zenity_misc_version = FALSE; + + return TRUE; +} + +/* Post parse callbacks assign the option values to + parsing result and makes some post condition tests */ + +gboolean +zenity_general_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + results->data->dialog_title = zenity_general_dialog_title; + results->data->window_icon = zenity_general_window_icon; + results->data->width = zenity_general_width; + results->data->height = zenity_general_height; + + return TRUE; +} + +gboolean +zenity_calendar_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + int i; + + zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR); + + if (results->mode == MODE_CALENDAR) { + results->calendar_data->dialog_text = zenity_general_dialog_text; + results->calendar_data->day = zenity_calendar_day; + results->calendar_data->month = zenity_calendar_month; + results->calendar_data->year = zenity_calendar_year; + if (zenity_calendar_date_format) + results->calendar_data->date_format = zenity_calendar_date_format; + else + results->calendar_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); + } else { + if (zenity_calendar_day) + zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_day), + ERROR_SUPPORT); + + if (zenity_calendar_month) + zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_month), + ERROR_SUPPORT); + + if (zenity_calendar_year) + zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_year), + ERROR_SUPPORT); + + if (zenity_calendar_date_format) + zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_date_format), + ERROR_SUPPORT); + } + + return TRUE; +} + +gboolean +zenity_entry_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_entry_active, MODE_ENTRY); + + if (results->mode == MODE_ENTRY) { + results->entry_data->dialog_text = zenity_general_dialog_text; + results->entry_data->entry_text = zenity_entry_entry_text; + results->entry_data->visible = !zenity_entry_visible; + } else { + if (zenity_entry_entry_text) + zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_entry_text), + ERROR_SUPPORT); + + if (zenity_entry_visible) + zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_visible), + ERROR_SUPPORT); + } + + return TRUE; +} + +gboolean +zenity_error_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_error_active, MODE_ERROR); + + if (results->mode == MODE_ERROR) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->mode = ZENITY_MSG_ERROR; + } + + return TRUE; +} + +gboolean +zenity_info_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_info_active, MODE_INFO); + + if (results->mode == MODE_INFO) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->mode = ZENITY_MSG_INFO; + } + + return TRUE; +} + +gboolean +zenity_file_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_file_active, MODE_FILE); + + if (results->mode == MODE_FILE) { + results->file_data->uri = zenity_general_uri; + results->file_data->multi = zenity_file_multiple; + results->file_data->directory = zenity_file_directory; + results->file_data->save = zenity_file_save; + results->file_data->separator = zenity_general_separator; + } else { + if (zenity_file_multiple) + zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_multiple), + ERROR_SUPPORT); + + if (zenity_file_directory) + zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_directory), + ERROR_SUPPORT); + + if (zenity_file_save) + zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_save), + ERROR_SUPPORT); + } + + return TRUE; +} + +gboolean +zenity_list_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + int i = 0; + gchar *column; + + zenity_option_set_dialog_mode (zenity_list_active, MODE_LIST); + + if (results->mode == MODE_LIST) { + results->tree_data->dialog_text = zenity_general_dialog_text; + + if (zenity_list_columns) { + column = zenity_list_columns[0]; + while (column != NULL) { + results->tree_data->columns = g_slist_append (results->tree_data->columns, column); + column = zenity_list_columns[++i]; + } + } + + results->tree_data->checkbox = zenity_list_checklist; + results->tree_data->radiobox = zenity_list_radiolist; + results->tree_data->editable = zenity_general_editable; + results->tree_data->print_column = zenity_list_print_column; + results->tree_data->separator = zenity_general_separator; + } else { + if (zenity_list_columns) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_columns), + ERROR_SUPPORT); + + if (zenity_list_checklist) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_checklist), + ERROR_SUPPORT); + + if (zenity_list_radiolist) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_radiolist), + ERROR_SUPPORT); + + if (zenity_list_print_column) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_print_column), + ERROR_SUPPORT); + } + + return TRUE; +} + +gboolean +zenity_notification_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_notification_active, MODE_NOTIFICATION); + + if (results->mode == MODE_NOTIFICATION) { + results->notification_data->notification_text = zenity_general_dialog_text; + results->notification_data->listen = zenity_notification_listen; + } else { + if (zenity_notification_listen) + zenity_option_error (zenity_option_get_name (notification_options, &zenity_notification_listen), + ERROR_SUPPORT); + } + + return TRUE; +} + +gboolean +zenity_progress_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS); + + if (results->mode == MODE_PROGRESS) { + results->progress_data->dialog_text = zenity_general_dialog_text; + results->progress_data->pulsate = zenity_progress_pulsate; + results->progress_data->autoclose = zenity_progress_auto_close; + results->progress_data->percentage = zenity_progress_percentage; + } else { + if (zenity_progress_pulsate) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate), + ERROR_SUPPORT); + + if (zenity_progress_percentage) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_percentage), + ERROR_SUPPORT); + + if (zenity_progress_auto_close) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_close), + ERROR_SUPPORT); + } + + return TRUE; +} + +gboolean +zenity_question_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION); + + + if (results->mode == MODE_QUESTION) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->mode = ZENITY_MSG_QUESTION; + } + + return TRUE; +} + +gboolean +zenity_text_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_text_active, MODE_TEXTINFO); + + if (results->mode == MODE_TEXTINFO) { + results->text_data->uri = zenity_general_uri; + results->text_data->editable = zenity_general_editable; + } + + return TRUE; +} + +gboolean +zenity_warning_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_warning_active, MODE_WARNING); + + if (results->mode == MODE_WARNING) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->mode = ZENITY_MSG_WARNING; + } + + return TRUE; +} + +gboolean +zenity_misc_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_misc_about, MODE_ABOUT); + zenity_option_set_dialog_mode (zenity_misc_version, MODE_VERSION); + + return TRUE; +} + +GOptionContext * +zenity_create_context (void) +{ + GOptionContext *tmp_ctx; + GOptionGroup *a_group; + + tmp_ctx = g_option_context_new(NULL); + + /* Adds general option entries */ + a_group = g_option_group_new("general", + N_("General options"), + N_("Show general options"), NULL, 0); + g_option_group_add_entries(a_group, general_options); + g_option_group_set_parse_hooks (a_group, + zenity_general_pre_callback, zenity_general_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds calendar option entries */ + a_group = g_option_group_new("calendar", + N_("Calendar options"), + N_("Show calendar options"), NULL, 0); + g_option_group_add_entries(a_group, calendar_options); + g_option_group_set_parse_hooks (a_group, + zenity_calendar_pre_callback, zenity_calendar_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds entry option entries */ + a_group = g_option_group_new("entry", + N_("Text entry options"), + N_("Show text entry options"), NULL, 0); + g_option_group_add_entries(a_group, entry_options); + g_option_group_set_parse_hooks (a_group, + zenity_entry_pre_callback, zenity_entry_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds error option entries */ + a_group = g_option_group_new("error", + N_("Error options"), + N_("Show error options"), NULL, 0); + g_option_group_add_entries(a_group, error_options); + g_option_group_set_parse_hooks (a_group, + zenity_error_pre_callback, zenity_error_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds info option entries */ + a_group = g_option_group_new("info", + N_("Info options"), + N_("Show info options"), NULL, 0); + g_option_group_add_entries(a_group, info_options); + g_option_group_set_parse_hooks (a_group, + zenity_info_pre_callback, zenity_info_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds file selection option entries */ + a_group = g_option_group_new("file-selection", + N_("File selection options"), + N_("Show file selection options"), NULL, 0); + g_option_group_add_entries(a_group, file_selection_options); + g_option_group_set_parse_hooks (a_group, + zenity_file_pre_callback, zenity_file_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds list option entries */ + a_group = g_option_group_new("list", + N_("List options"), + N_("Show list options"), NULL, 0); + g_option_group_add_entries(a_group, list_options); + g_option_group_set_parse_hooks (a_group, + zenity_list_pre_callback, zenity_list_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds notification option entries */ + a_group = g_option_group_new("notification", + N_("Notication options"), + N_("Show notification options"), NULL, 0); + g_option_group_add_entries(a_group, notification_options); + g_option_group_set_parse_hooks (a_group, + zenity_notification_pre_callback, zenity_notification_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds progress option entries */ + a_group = g_option_group_new("progress", + N_("Progress options"), + N_("Show progress options"), NULL, 0); + g_option_group_add_entries(a_group, progress_options); + g_option_group_set_parse_hooks (a_group, + zenity_progress_pre_callback, zenity_progress_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds question option entries */ + a_group = g_option_group_new("question", + N_("Question options"), + N_("Show question options"), NULL, 0); + g_option_group_add_entries(a_group, question_options); + g_option_group_set_parse_hooks (a_group, + zenity_question_pre_callback, zenity_question_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds warning option entries */ + a_group = g_option_group_new("warning", + N_("Warning options"), + N_("Show warning options"), NULL, 0); + g_option_group_add_entries(a_group, warning_options); + g_option_group_set_parse_hooks (a_group, + zenity_warning_pre_callback, zenity_warning_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds text option entries */ + a_group = g_option_group_new("text", + N_("Text options"), + N_("Show text options"), NULL, 0); + g_option_group_add_entries(a_group, text_options); + g_option_group_set_parse_hooks (a_group, + zenity_text_pre_callback, zenity_text_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds misc option entries */ + a_group = g_option_group_new("misc", + N_("Miscellaneous options"), + N_("Show miscellaneous options"), NULL, 0); + g_option_group_add_entries(a_group, miscellaneous_options); + g_option_group_set_parse_hooks (a_group, + zenity_misc_pre_callback, zenity_misc_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_context_add_group(tmp_ctx, a_group); + + /* Adds gtk option entries */ + a_group = gtk_get_option_group(TRUE); + g_option_context_add_group(tmp_ctx, a_group); + + /* Enable help options */ + g_option_context_set_help_enabled (tmp_ctx, TRUE); + g_option_context_set_ignore_unknown_options (tmp_ctx, FALSE); + + return tmp_ctx; +} + +void +zenity_option_error (gchar *string, ZenityError error) +{ + switch (error) { + case ERROR_SYNTAX: + g_printerr (_("Syntax error\n")); + zenity_option_free (); + exit (-1); + case ERROR_SUPPORT: + g_printerr (_("--%s is not supported for this dialog\n"), string); + zenity_option_free (); + exit (-1); + case ERROR_DIALOG: + g_printerr (_("Two or more dialog options specified\n")); + zenity_option_free (); + exit (-1); + default: + return; + } +} + +ZenityParsingOptions * +zenity_option_parse (gint argc, gchar **argv) +{ + GError *error = NULL; + + zenity_option_init (); + + ctx = zenity_create_context (); + + g_option_context_parse (ctx, &argc, &argv, &error); + + /* Some option pointer a shared among more than one group and don't + have their post condition tested. This test is done here. */ + + if (zenity_general_dialog_text) + if (results->mode == MODE_ABOUT || results->mode == MODE_VERSION) + zenity_option_error (zenity_option_get_name (calendar_options, &zenity_general_dialog_text), ERROR_SUPPORT); + + if (strcmp (zenity_general_separator, "|") != 0) + if (results->mode != MODE_LIST && results->mode != MODE_FILE) + zenity_option_error (zenity_option_get_name (list_options, &zenity_general_separator), ERROR_SUPPORT); + + if (zenity_general_editable) + if (results->mode != MODE_TEXTINFO && results->mode != MODE_LIST) + zenity_option_error (zenity_option_get_name (list_options, &zenity_general_editable), ERROR_SUPPORT); + + if (zenity_general_uri) + if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); + + return results; +} -- cgit From 6798192ed825aaeefd296fc1769cbadf5c20e29e Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Tue, 7 Dec 2004 01:19:45 +0000 Subject: Fix spacing issue. 2004-12-07 Glynn Foster * src/option.c: Fix spacing issue. --- src/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index b230633b..7337f488 100644 --- a/src/option.c +++ b/src/option.c @@ -176,7 +176,8 @@ GOptionEntry calendar_options[] = { N_("Set the calendar year"), NULL }, - { "date-format", + { + "date-format", '\0', 0, G_OPTION_ARG_STRING, -- cgit From c52435f74846b59e9a475f864d18838cfcde01f4 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Mon, 20 Dec 2004 22:25:29 +0000 Subject: Fix tyop for #161774, as reported by Christian. 2004-12-21 Glynn Foster * src/option.c: Fix tyop for #161774, as reported by Christian. --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 7337f488..0b892973 100644 --- a/src/option.c +++ b/src/option.c @@ -1241,7 +1241,7 @@ zenity_create_context (void) /* Adds notification option entries */ a_group = g_option_group_new("notification", - N_("Notication options"), + N_("Notification options"), N_("Show notification options"), NULL, 0); g_option_group_add_entries(a_group, notification_options); g_option_group_set_parse_hooks (a_group, -- cgit From 4643fbc3e75d5789500198938395de4def9a3ec0 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Fri, 7 Jan 2005 01:55:11 +0000 Subject: Pre-load the year, because gtk_calendar* is dumb and you need to select 2005-01-07 Glynn Foster * src/option.c: Pre-load the year, because gtk_calendar* is dumb and you need to select the year to change the month. Fixes #162297. --- src/option.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 0b892973..f6fe4b26 100644 --- a/src/option.c +++ b/src/option.c @@ -23,6 +23,7 @@ */ #include "option.h" +#include /* General Options */ gchar *zenity_general_dialog_title; @@ -713,11 +714,17 @@ zenity_calendar_pre_callback (GOptionContext *context, gpointer data, GError **error) { + struct tm *t; + time_t current_time; + + time (¤t_time); + t = localtime (¤t_time); + zenity_calendar_active = FALSE; zenity_calendar_date_format = NULL; zenity_calendar_day = 0; zenity_calendar_month = 0; - zenity_calendar_year = 0; + zenity_calendar_year = t->tm_year + 1900; return TRUE; } -- cgit From 516f9944095b4308a055eaca9a9220cfeb66b669 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Sun, 9 Jan 2005 20:04:30 +0000 Subject: Really fix #162297, and preload the current dates if they aren't already 2005-01-07 Glynn Foster * src/option.c, src/calendar.c: Really fix #162297, and preload the current dates if they aren't already set. --- src/option.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index f6fe4b26..65b5373c 100644 --- a/src/option.c +++ b/src/option.c @@ -714,17 +714,11 @@ zenity_calendar_pre_callback (GOptionContext *context, gpointer data, GError **error) { - struct tm *t; - time_t current_time; - - time (¤t_time); - t = localtime (¤t_time); - zenity_calendar_active = FALSE; zenity_calendar_date_format = NULL; - zenity_calendar_day = 0; - zenity_calendar_month = 0; - zenity_calendar_year = t->tm_year + 1900; + zenity_calendar_day = -1; + zenity_calendar_month = -1; + zenity_calendar_year = -1; return TRUE; } @@ -892,6 +886,19 @@ zenity_calendar_post_callback (GOptionContext *context, zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR); if (results->mode == MODE_CALENDAR) { + struct tm *t; + time_t current_time; + + time (¤t_time); + t = localtime (¤t_time); + + if (zenity_calendar_day < 0) + zenity_calendar_day = t->tm_mday; + if (zenity_calendar_month < 0) + zenity_calendar_month = t->tm_mon + 1; + if (zenity_calendar_year < 0) + zenity_calendar_year = t->tm_year + 1900; + results->calendar_data->dialog_text = zenity_general_dialog_text; results->calendar_data->day = zenity_calendar_day; results->calendar_data->month = zenity_calendar_month; @@ -900,16 +907,17 @@ zenity_calendar_post_callback (GOptionContext *context, results->calendar_data->date_format = zenity_calendar_date_format; else results->calendar_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); + } else { - if (zenity_calendar_day) + if (zenity_calendar_day > -1) zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_day), ERROR_SUPPORT); - if (zenity_calendar_month) + if (zenity_calendar_month > -1) zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_month), ERROR_SUPPORT); - if (zenity_calendar_year) + if (zenity_calendar_year > -1) zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_year), ERROR_SUPPORT); -- cgit From a4777781d1b7c0294048e78dbc758de238b386c2 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Mon, 31 Jan 2005 22:17:38 +0000 Subject: Patch from Chris Lahey for #165456. Updated. 2005-02-01 Glynn Foster * src/notification.c, src/option.c: Patch from Chris Lahey for #165456. * src/about.c, THANKS: Updated. --- src/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 65b5373c..cfc95e95 100644 --- a/src/option.c +++ b/src/option.c @@ -676,7 +676,8 @@ zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) for (i = 1; entries[i].long_name != NULL; i++) { if (entries[i].arg_data == arg_data) return (gchar *) entries[i].long_name; - } + } + return NULL; } /* Error callback */ -- cgit From 717b814028ea3ade38710d32b561af46615358b9 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Sun, 6 Feb 2005 23:13:16 +0000 Subject: Update docs to add the new goption help stuff. Update to be in line with 2005-02-07 Glynn Foster * help/C/zenity.xml: Update docs to add the new goption help stuff. * src/option.c: Update to be in line with the documentation descriptions. --- src/option.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index cfc95e95..603ce04b 100644 --- a/src/option.c +++ b/src/option.c @@ -1257,8 +1257,8 @@ zenity_create_context (void) /* Adds notification option entries */ a_group = g_option_group_new("notification", - N_("Notification options"), - N_("Show notification options"), NULL, 0); + N_("Notification icon options"), + N_("Show notification icon options"), NULL, 0); g_option_group_add_entries(a_group, notification_options); g_option_group_set_parse_hooks (a_group, zenity_notification_pre_callback, zenity_notification_post_callback); @@ -1296,9 +1296,9 @@ zenity_create_context (void) g_option_context_add_group(tmp_ctx, a_group); /* Adds text option entries */ - a_group = g_option_group_new("text", - N_("Text options"), - N_("Show text options"), NULL, 0); + a_group = g_option_group_new("text-info", + N_("Text information options"), + N_("Show text information options"), NULL, 0); g_option_group_add_entries(a_group, text_options); g_option_group_set_parse_hooks (a_group, zenity_text_pre_callback, zenity_text_post_callback); -- cgit From 6e6eeaf79c01b6cc755b57dac7e7ff2d36038316 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Wed, 20 Apr 2005 01:59:42 +0000 Subject: Bug fix for #149290, based on contributions from Timo Aaltonen, Lucas 2005-04-20 Glynn Foster * src/msg.c, src/option.c, src/zenity.h: Bug fix for #149290, based on contributions from Timo Aaltonen, Lucas Rocha, and Carlos Parra. * THANKS: Update. --- src/option.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 603ce04b..08359120 100644 --- a/src/option.c +++ b/src/option.c @@ -34,6 +34,7 @@ gchar *zenity_general_dialog_text; gchar *zenity_general_separator; gboolean zenity_general_editable; gchar *zenity_general_uri; +gboolean zenity_general_dialog_no_wrap; /* Calendar Dialog Options */ gboolean zenity_calendar_active; @@ -253,6 +254,15 @@ GOptionEntry error_options[] = { N_("Set the dialog text"), NULL }, + { + "no-wrap", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_("Do not enable text wrapping"), + NULL + }, { NULL } @@ -277,6 +287,15 @@ GOptionEntry info_options[] = { N_("Set the dialog text"), NULL }, + { + "no-wrap", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_("Do not enable text wrapping"), + NULL + }, { NULL } @@ -524,6 +543,15 @@ GOptionEntry question_options[] = { N_("Set the dialog text"), NULL }, + { + "no-wrap", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_("Do not enable text wrapping"), + NULL + }, { NULL } @@ -581,6 +609,15 @@ GOptionEntry warning_options[] = { N_("Set the dialog text"), NULL }, + { + "no-wrap", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_("Do not enable text wrapping"), + NULL + }, { NULL } @@ -705,6 +742,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_separator = g_strdup ("|"); zenity_general_editable = FALSE; zenity_general_uri = NULL; + zenity_general_dialog_no_wrap = FALSE; return TRUE; } @@ -966,6 +1004,7 @@ zenity_error_post_callback (GOptionContext *context, if (results->mode == MODE_ERROR) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_ERROR; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; } return TRUE; @@ -982,6 +1021,7 @@ zenity_info_post_callback (GOptionContext *context, if (results->mode == MODE_INFO) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_INFO; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; } return TRUE; @@ -1128,6 +1168,7 @@ zenity_question_post_callback (GOptionContext *context, if (results->mode == MODE_QUESTION) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_QUESTION; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; } return TRUE; @@ -1160,6 +1201,7 @@ zenity_warning_post_callback (GOptionContext *context, if (results->mode == MODE_WARNING) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_WARNING; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; } return TRUE; @@ -1377,5 +1419,9 @@ zenity_option_parse (gint argc, gchar **argv) if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); + if (zenity_general_dialog_no_wrap) + if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); + return results; } -- cgit From 403c8104aefc11954398106ab4fa39f9a79233c6 Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Wed, 20 Apr 2005 03:00:57 +0000 Subject: Clean up the code a little bit. 2005-04-20 Glynn Foster * src/entry.c, src/option.c, src/zenity.h: Clean up the code a little bit. --- src/option.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 08359120..44fd74a5 100644 --- a/src/option.c +++ b/src/option.c @@ -46,7 +46,7 @@ gchar *zenity_calendar_date_format; /* Entry Dialog Options */ gboolean zenity_entry_active; gchar *zenity_entry_entry_text; -gboolean zenity_entry_visible; +gboolean zenity_entry_hide_text; /* Error Dialog Options */ gboolean zenity_error_active; @@ -225,7 +225,7 @@ GOptionEntry entry_options[] = { '\0', 0, G_OPTION_ARG_NONE, - &zenity_entry_visible, + &zenity_entry_hide_text, N_("Hide the entry text"), NULL }, @@ -770,7 +770,7 @@ zenity_entry_pre_callback (GOptionContext *context, { zenity_entry_active = FALSE; zenity_entry_entry_text = NULL; - zenity_entry_visible = FALSE; + zenity_entry_hide_text = FALSE; return TRUE; } @@ -979,14 +979,14 @@ zenity_entry_post_callback (GOptionContext *context, if (results->mode == MODE_ENTRY) { results->entry_data->dialog_text = zenity_general_dialog_text; results->entry_data->entry_text = zenity_entry_entry_text; - results->entry_data->visible = !zenity_entry_visible; + results->entry_data->hide_text= zenity_entry_hide_text; } else { if (zenity_entry_entry_text) zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_entry_text), ERROR_SUPPORT); - if (zenity_entry_visible) - zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_visible), + if (zenity_entry_hide_text) + zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_hide_text), ERROR_SUPPORT); } @@ -1373,7 +1373,7 @@ zenity_option_error (gchar *string, ZenityError error) { switch (error) { case ERROR_SYNTAX: - g_printerr (_("Syntax error\n")); + g_printerr (_("This option is not available. Please see --help for all possible usages.\n")); zenity_option_free (); exit (-1); case ERROR_SUPPORT: -- cgit From 6abd93050f533752e47b75158e95431575c652ac Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Mon, 25 Apr 2005 03:20:45 +0000 Subject: COPYING, src/about.c, src/calendar.c, src/eggtrayicon.c, src/entry.c, 2005-04-25 Glynn Foster * COPYING, src/about.c, src/calendar.c, src/eggtrayicon.c, * src/entry.c, src/fileselection.c, src/main.c, src/msg.c, * src/notification.c, src/option.c, src/progress.c, * src/text.c, src/tree.c, src/util.c: Update the FSF address to point to 51 Franklin Street, Fifth Floor as per forwarded mail from Alvaro Lopez Ortega. --- src/option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 44fd74a5..33a185f5 100644 --- a/src/option.c +++ b/src/option.c @@ -15,8 +15,8 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. * * Authors: Glynn Foster * Lucas Rocha -- cgit From 9c792cb86a8d0422a07a716a3b024f25d9bca1bb Mon Sep 17 00:00:00 2001 From: Lucas Almeida Rocha Date: Mon, 27 Jun 2005 03:13:37 +0000 Subject: Changed list dialog Selection behavior --- src/option.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 33a185f5..a1674883 100644 --- a/src/option.c +++ b/src/option.c @@ -32,6 +32,7 @@ int zenity_general_width; int zenity_general_height; gchar *zenity_general_dialog_text; gchar *zenity_general_separator; +gboolean zenity_general_multiple; gboolean zenity_general_editable; gchar *zenity_general_uri; gboolean zenity_general_dialog_no_wrap; @@ -56,7 +57,6 @@ gboolean zenity_info_active; /* File Selection Dialog Options */ gboolean zenity_file_active; -gboolean zenity_file_multiple; gboolean zenity_file_directory; gboolean zenity_file_save; @@ -325,7 +325,7 @@ GOptionEntry file_selection_options[] = { '\0', 0, G_OPTION_ARG_NONE, - &zenity_file_multiple, + &zenity_general_multiple, N_("Allow multiple files to be selected"), NULL }, @@ -416,6 +416,15 @@ GOptionEntry list_options[] = { N_("Set output separator character"), N_("SEPARATOR") }, + { + "multiple", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_general_multiple, + N_("Allow multiple rows to be selected"), + NULL + }, { "editable", '\0', @@ -740,6 +749,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_height = -1; zenity_general_dialog_text = NULL; zenity_general_separator = g_strdup ("|"); + zenity_general_multiple = FALSE; zenity_general_editable = FALSE; zenity_general_uri = NULL; zenity_general_dialog_no_wrap = FALSE; @@ -804,7 +814,6 @@ zenity_file_pre_callback (GOptionContext *context, GError **error) { zenity_file_active = FALSE; - zenity_file_multiple = FALSE; zenity_file_directory = FALSE; zenity_file_save = FALSE; @@ -1037,15 +1046,11 @@ zenity_file_post_callback (GOptionContext *context, if (results->mode == MODE_FILE) { results->file_data->uri = zenity_general_uri; - results->file_data->multi = zenity_file_multiple; + results->file_data->multi = zenity_general_multiple; results->file_data->directory = zenity_file_directory; results->file_data->save = zenity_file_save; results->file_data->separator = zenity_general_separator; } else { - if (zenity_file_multiple) - zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_multiple), - ERROR_SUPPORT); - if (zenity_file_directory) zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_directory), ERROR_SUPPORT); @@ -1082,6 +1087,7 @@ zenity_list_post_callback (GOptionContext *context, results->tree_data->checkbox = zenity_list_checklist; results->tree_data->radiobox = zenity_list_radiolist; + results->tree_data->multi = zenity_general_multiple; results->tree_data->editable = zenity_general_editable; results->tree_data->print_column = zenity_list_print_column; results->tree_data->separator = zenity_general_separator; @@ -1411,6 +1417,10 @@ zenity_option_parse (gint argc, gchar **argv) if (results->mode != MODE_LIST && results->mode != MODE_FILE) zenity_option_error (zenity_option_get_name (list_options, &zenity_general_separator), ERROR_SUPPORT); + if (zenity_general_multiple) + if (results->mode != MODE_FILE && results->mode != MODE_LIST) + zenity_option_error (zenity_option_get_name (list_options, &zenity_general_multiple), ERROR_SUPPORT); + if (zenity_general_editable) if (results->mode != MODE_TEXTINFO && results->mode != MODE_LIST) zenity_option_error (zenity_option_get_name (list_options, &zenity_general_editable), ERROR_SUPPORT); -- cgit From 8ba040f33b37ef92976b75be79a1a342bceb91f9 Mon Sep 17 00:00:00 2001 From: Lucas Almeida Rocha Date: Fri, 1 Jul 2005 21:28:36 +0000 Subject: New --hide-column option. --- src/option.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index a1674883..b4d35bca 100644 --- a/src/option.c +++ b/src/option.c @@ -66,6 +66,7 @@ gchar **zenity_list_columns; gboolean zenity_list_checklist; gboolean zenity_list_radiolist; gchar *zenity_list_print_column; +gchar *zenity_list_hide_column; /* Notification Dialog Options */ gboolean zenity_notification_active; @@ -443,6 +444,15 @@ GOptionEntry list_options[] = { N_("Print a specific column (Default is 1. 'ALL' can be used to print all columns)"), NULL }, + { + "hide-column", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_list_hide_column, + N_("Hide a specific column"), + NULL + }, { NULL } @@ -699,6 +709,8 @@ zenity_option_free (void) { g_strfreev (zenity_list_columns); if (zenity_list_print_column) g_free (zenity_list_print_column); + if (zenity_list_hide_column) + g_free (zenity_list_hide_column); g_option_context_free (ctx); } @@ -831,6 +843,7 @@ zenity_list_pre_callback (GOptionContext *context, zenity_list_checklist = FALSE; zenity_list_radiolist = FALSE; zenity_list_print_column = NULL; + zenity_list_hide_column = NULL; return TRUE; } @@ -1090,6 +1103,7 @@ zenity_list_post_callback (GOptionContext *context, results->tree_data->multi = zenity_general_multiple; results->tree_data->editable = zenity_general_editable; results->tree_data->print_column = zenity_list_print_column; + results->tree_data->hide_column = zenity_list_hide_column; results->tree_data->separator = zenity_general_separator; } else { if (zenity_list_columns) @@ -1107,6 +1121,10 @@ zenity_list_post_callback (GOptionContext *context, if (zenity_list_print_column) zenity_option_error (zenity_option_get_name (list_options, &zenity_list_print_column), ERROR_SUPPORT); + + if (zenity_list_hide_column) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_hide_column), + ERROR_SUPPORT); } return TRUE; -- cgit From 4c328078b6ff16a0ba648f53c3bee7a68fe4dbc5 Mon Sep 17 00:00:00 2001 From: Lucas Almeida Rocha Date: Wed, 6 Jul 2005 20:13:11 +0000 Subject: Include cleanups (config.h) --- src/option.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index b4d35bca..69c83dda 100644 --- a/src/option.c +++ b/src/option.c @@ -22,8 +22,12 @@ * Lucas Rocha */ +#include "config.h" + #include "option.h" #include +#include +#include /* General Options */ gchar *zenity_general_dialog_title; -- cgit From d6f1d76768fe99c0f67545a9b6da98411733ffca Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Fri, 8 Jul 2005 13:39:27 +0000 Subject: marks static many functions and global variables. Contribution from MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2005-07-08 Lucas Rocha * src/about.c, src/option.c, src/fileselection.c: marks static many functions and global variables. Contribution from BenoĆ®t Dejean. --- src/option.c | 179 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 90 insertions(+), 89 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 69c83dda..1d47be81 100644 --- a/src/option.c +++ b/src/option.c @@ -30,72 +30,72 @@ #include /* General Options */ -gchar *zenity_general_dialog_title; -gchar *zenity_general_window_icon; -int zenity_general_width; -int zenity_general_height; -gchar *zenity_general_dialog_text; -gchar *zenity_general_separator; -gboolean zenity_general_multiple; -gboolean zenity_general_editable; -gchar *zenity_general_uri; -gboolean zenity_general_dialog_no_wrap; +static gchar *zenity_general_dialog_title; +static gchar *zenity_general_window_icon; +static int zenity_general_width; +static int zenity_general_height; +static gchar *zenity_general_dialog_text; +static gchar *zenity_general_separator; +static gboolean zenity_general_multiple; +static gboolean zenity_general_editable; +static gchar *zenity_general_uri; +static gboolean zenity_general_dialog_no_wrap; /* Calendar Dialog Options */ -gboolean zenity_calendar_active; -int zenity_calendar_day; -int zenity_calendar_month; -int zenity_calendar_year; -gchar *zenity_calendar_date_format; +static gboolean zenity_calendar_active; +static int zenity_calendar_day; +static int zenity_calendar_month; +static int zenity_calendar_year; +static gchar *zenity_calendar_date_format; /* Entry Dialog Options */ -gboolean zenity_entry_active; -gchar *zenity_entry_entry_text; -gboolean zenity_entry_hide_text; +static gboolean zenity_entry_active; +static gchar *zenity_entry_entry_text; +static gboolean zenity_entry_hide_text; /* Error Dialog Options */ -gboolean zenity_error_active; +static gboolean zenity_error_active; /* Info Dialog Options */ -gboolean zenity_info_active; +static gboolean zenity_info_active; /* File Selection Dialog Options */ -gboolean zenity_file_active; -gboolean zenity_file_directory; -gboolean zenity_file_save; +static gboolean zenity_file_active; +static gboolean zenity_file_directory; +static gboolean zenity_file_save; /* List Dialog Options */ -gboolean zenity_list_active; -gchar **zenity_list_columns; -gboolean zenity_list_checklist; -gboolean zenity_list_radiolist; -gchar *zenity_list_print_column; -gchar *zenity_list_hide_column; +static gboolean zenity_list_active; +static gchar **zenity_list_columns; +static gboolean zenity_list_checklist; +static gboolean zenity_list_radiolist; +static gchar *zenity_list_print_column; +static gchar *zenity_list_hide_column; /* Notification Dialog Options */ -gboolean zenity_notification_active; -gboolean zenity_notification_listen; +static gboolean zenity_notification_active; +static gboolean zenity_notification_listen; /* Progress Dialog Options */ -gboolean zenity_progress_active; -int zenity_progress_percentage; -gboolean zenity_progress_pulsate; -gboolean zenity_progress_auto_close; +static gboolean zenity_progress_active; +static int zenity_progress_percentage; +static gboolean zenity_progress_pulsate; +static gboolean zenity_progress_auto_close; /* Question Dialog Options */ -gboolean zenity_question_active; +static gboolean zenity_question_active; /* Text Dialog Options */ -gboolean zenity_text_active; +static gboolean zenity_text_active; /* Warning Dialog Options */ -gboolean zenity_warning_active; +static gboolean zenity_warning_active; /* Miscelaneus Options */ -gboolean zenity_misc_about; -gboolean zenity_misc_version; +static gboolean zenity_misc_about; +static gboolean zenity_misc_version; -GOptionEntry general_options[] = { +static GOptionEntry general_options[] = { { "title", '\0', @@ -137,7 +137,7 @@ GOptionEntry general_options[] = { } }; -GOptionEntry calendar_options[] = { +static GOptionEntry calendar_options[] = { { "calendar", '\0', @@ -197,7 +197,7 @@ GOptionEntry calendar_options[] = { } }; -GOptionEntry entry_options[] = { +static GOptionEntry entry_options[] = { { "entry", '\0', @@ -240,7 +240,7 @@ GOptionEntry entry_options[] = { }; -GOptionEntry error_options[] = { +static GOptionEntry error_options[] = { { "error", '\0', @@ -273,7 +273,7 @@ GOptionEntry error_options[] = { } }; -GOptionEntry info_options[] = { +static GOptionEntry info_options[] = { { "info", '\0', @@ -306,7 +306,7 @@ GOptionEntry info_options[] = { } }; -GOptionEntry file_selection_options[] = { +static GOptionEntry file_selection_options[] = { { "file-selection", '\0', @@ -366,7 +366,7 @@ GOptionEntry file_selection_options[] = { } }; -GOptionEntry list_options[] = { +static GOptionEntry list_options[] = { { "list", '\0', @@ -462,7 +462,7 @@ GOptionEntry list_options[] = { } }; -GOptionEntry notification_options[] = { +static GOptionEntry notification_options[] = { { "notification", '\0', @@ -495,7 +495,7 @@ GOptionEntry notification_options[] = { } }; -GOptionEntry progress_options[] = { +static GOptionEntry progress_options[] = { { "progress", '\0', @@ -547,7 +547,7 @@ GOptionEntry progress_options[] = { } }; -GOptionEntry question_options[] = { +static GOptionEntry question_options[] = { { "question", '\0', @@ -580,7 +580,7 @@ GOptionEntry question_options[] = { } }; -GOptionEntry text_options[] = { +static GOptionEntry text_options[] = { { "text-info", '\0', @@ -613,7 +613,7 @@ GOptionEntry text_options[] = { } }; -GOptionEntry warning_options[] = { +static GOptionEntry warning_options[] = { { "warning", '\0', @@ -646,7 +646,7 @@ GOptionEntry warning_options[] = { } }; -GOptionEntry miscellaneous_options[] = { +static GOptionEntry miscellaneous_options[] = { { "about", '\0', @@ -670,10 +670,10 @@ GOptionEntry miscellaneous_options[] = { } }; -ZenityParsingOptions *results; -GOptionContext *ctx; +static ZenityParsingOptions *results; +static GOptionContext *ctx; -void +static void zenity_option_init (void) { results = g_new0 (ZenityParsingOptions, 1); @@ -719,7 +719,7 @@ zenity_option_free (void) { g_option_context_free (ctx); } -void +static void zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) { if (is_active == TRUE) { @@ -730,7 +730,7 @@ zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) } } -gchar * +static gchar * zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) { int i; @@ -743,17 +743,18 @@ zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) } /* Error callback */ -void zenity_option_error_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) +static void +zenity_option_error_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) { zenity_option_error (NULL, ERROR_SYNTAX); } /* Pre parse callbacks set the default option values */ -gboolean +static gboolean zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -773,7 +774,7 @@ zenity_general_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_calendar_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -788,7 +789,7 @@ zenity_calendar_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -801,7 +802,7 @@ zenity_entry_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -812,7 +813,7 @@ zenity_error_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -823,7 +824,7 @@ zenity_info_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -836,7 +837,7 @@ zenity_file_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -852,7 +853,7 @@ zenity_list_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -864,7 +865,7 @@ zenity_notification_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -878,7 +879,7 @@ zenity_progress_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_question_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -889,7 +890,7 @@ zenity_question_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_text_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -900,7 +901,7 @@ zenity_text_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_warning_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -911,7 +912,7 @@ zenity_warning_pre_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -926,7 +927,7 @@ zenity_misc_pre_callback (GOptionContext *context, /* Post parse callbacks assign the option values to parsing result and makes some post condition tests */ -gboolean +static gboolean zenity_general_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -940,7 +941,7 @@ zenity_general_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -994,7 +995,7 @@ zenity_calendar_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_entry_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1019,7 +1020,7 @@ zenity_entry_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_error_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1036,7 +1037,7 @@ zenity_error_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_info_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1053,7 +1054,7 @@ zenity_info_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_file_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1080,7 +1081,7 @@ zenity_file_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_list_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1134,7 +1135,7 @@ zenity_list_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_notification_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1154,7 +1155,7 @@ zenity_notification_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1184,7 +1185,7 @@ zenity_progress_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_question_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1202,7 +1203,7 @@ zenity_question_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_text_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1218,7 +1219,7 @@ zenity_text_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1235,7 +1236,7 @@ zenity_warning_post_callback (GOptionContext *context, return TRUE; } -gboolean +static gboolean zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group, gpointer data, @@ -1247,7 +1248,7 @@ zenity_misc_post_callback (GOptionContext *context, return TRUE; } -GOptionContext * +static GOptionContext * zenity_create_context (void) { GOptionContext *tmp_ctx; -- cgit From 21f7bc6a54636c749cf5514e091feb68cc88907b Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Fri, 8 Jul 2005 23:21:34 +0000 Subject: general code cleanups. Contribution from BenoĆ®t Dejean. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2005-07-08 Lucas Rocha * src/about.c, src/calendar.c, src/fileselection.c, src/option.c, src/progress.c, src/text.c, src/tree.c, src/util.c: general code cleanups. Contribution from BenoĆ®t Dejean. --- src/option.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 1d47be81..362751f2 100644 --- a/src/option.c +++ b/src/option.c @@ -947,8 +947,6 @@ zenity_calendar_post_callback (GOptionContext *context, gpointer data, GError **error) { - int i; - zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR); if (results->mode == MODE_CALENDAR) { -- cgit From 68ab19d2c4567a6855fa3ca5f0c71ddc323cd32e Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Tue, 12 Jul 2005 13:46:50 +0000 Subject: activate option help translations in GOption. 2005-07-12 Lucas Rocha * src/option.c: activate option help translations in GOption. --- src/option.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 362751f2..574fd91d 100644 --- a/src/option.c +++ b/src/option.c @@ -1262,6 +1262,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_general_pre_callback, zenity_general_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds calendar option entries */ @@ -1272,6 +1273,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_calendar_pre_callback, zenity_calendar_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds entry option entries */ @@ -1282,6 +1284,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_entry_pre_callback, zenity_entry_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds error option entries */ @@ -1292,6 +1295,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_error_pre_callback, zenity_error_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds info option entries */ @@ -1302,6 +1306,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_info_pre_callback, zenity_info_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds file selection option entries */ @@ -1312,6 +1317,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_file_pre_callback, zenity_file_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds list option entries */ @@ -1322,6 +1328,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_list_pre_callback, zenity_list_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds notification option entries */ @@ -1332,6 +1339,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_notification_pre_callback, zenity_notification_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds progress option entries */ @@ -1342,6 +1350,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_progress_pre_callback, zenity_progress_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds question option entries */ @@ -1352,6 +1361,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_question_pre_callback, zenity_question_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds warning option entries */ @@ -1362,6 +1372,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_warning_pre_callback, zenity_warning_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds text option entries */ @@ -1372,6 +1383,7 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_text_pre_callback, zenity_text_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds misc option entries */ @@ -1382,10 +1394,12 @@ zenity_create_context (void) g_option_group_set_parse_hooks (a_group, zenity_misc_pre_callback, zenity_misc_post_callback); g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Adds gtk option entries */ a_group = gtk_get_option_group(TRUE); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); /* Enable help options */ -- cgit From beffc3f8a93dbd5d809690322043e074005a250b Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 13 Jul 2005 03:28:15 +0000 Subject: dependency on glib >= 2.7.3 Add G_OPTION_FLAG_NOALIAS flag on options that 2005-07-12 Lucas Rocha * configure.in: dependency on glib >= 2.7.3 * src/option.c: Add G_OPTION_FLAG_NOALIAS flag on options that are present in more than on group. --- src/option.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 574fd91d..c8640f3f 100644 --- a/src/option.c +++ b/src/option.c @@ -150,7 +150,7 @@ static GOptionEntry calendar_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -210,7 +210,7 @@ static GOptionEntry entry_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -220,7 +220,7 @@ static GOptionEntry entry_options[] = { "entry-text", '\0', 0, - G_OPTION_ARG_STRING, + G_OPTION_ARG_STRING | G_OPTION_FLAG_NOALIAS, &zenity_entry_entry_text, N_("Set the entry text"), NULL @@ -253,7 +253,7 @@ static GOptionEntry error_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -262,7 +262,7 @@ static GOptionEntry error_options[] = { { "no-wrap", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_wrap, N_("Do not enable text wrapping"), @@ -286,7 +286,7 @@ static GOptionEntry info_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -295,7 +295,7 @@ static GOptionEntry info_options[] = { { "no-wrap", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_wrap, N_("Do not enable text wrapping"), @@ -319,7 +319,7 @@ static GOptionEntry file_selection_options[] = { { "filename", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_FILENAME, &zenity_general_uri, N_("Set the filename"), @@ -328,7 +328,7 @@ static GOptionEntry file_selection_options[] = { { "multiple", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_multiple, N_("Allow multiple files to be selected"), @@ -355,7 +355,7 @@ static GOptionEntry file_selection_options[] = { { "separator", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_separator, N_("Set output separator character"), @@ -379,7 +379,7 @@ static GOptionEntry list_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -424,7 +424,7 @@ static GOptionEntry list_options[] = { { "multiple", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_multiple, N_("Allow multiple rows to be selected"), @@ -433,7 +433,7 @@ static GOptionEntry list_options[] = { { "editable", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_editable, N_("Allow changes to text"), @@ -475,7 +475,7 @@ static GOptionEntry notification_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the notification text"), @@ -508,7 +508,7 @@ static GOptionEntry progress_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -560,7 +560,7 @@ static GOptionEntry question_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -569,7 +569,7 @@ static GOptionEntry question_options[] = { { "no-wrap", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_wrap, N_("Do not enable text wrapping"), @@ -593,7 +593,7 @@ static GOptionEntry text_options[] = { { "filename", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_FILENAME, &zenity_general_uri, N_("Open file"), @@ -602,7 +602,7 @@ static GOptionEntry text_options[] = { { "editable", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_editable, N_("Allow changes to text"), @@ -626,7 +626,7 @@ static GOptionEntry warning_options[] = { { "text", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), @@ -635,7 +635,7 @@ static GOptionEntry warning_options[] = { { "no-wrap", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_wrap, N_("Do not enable text wrapping"), -- cgit From 0086a9363f9c94f19d6d5ad2424680fcac0e7a7a Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Sat, 24 Sep 2005 15:04:02 +0000 Subject: fixed bug #317033. 2005-09-24 Lucas Rocha * src/option.c: fixed bug #317033. --- src/option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index c8640f3f..19089305 100644 --- a/src/option.c +++ b/src/option.c @@ -211,7 +211,7 @@ static GOptionEntry entry_options[] = { "text", '\0', G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, + G_OPTION_ARG_STRING | G_OPTION_FLAG_NOALIAS, &zenity_general_dialog_text, N_("Set the dialog text"), NULL @@ -220,7 +220,7 @@ static GOptionEntry entry_options[] = { "entry-text", '\0', 0, - G_OPTION_ARG_STRING | G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, &zenity_entry_entry_text, N_("Set the entry text"), NULL -- cgit From 285cb79bafd2616f2d2dd7eb2ae82527942ef4cc Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Tue, 13 Dec 2005 04:18:58 +0000 Subject: new scale dialog for selecting a value from a range (Fixes #322399). 2005-12-13 Lucas Rocha * data/Makefile.am, data/zenity-scale.png, src/Makefile.am, src/main.c, src/option.c, src/option.h, src/scale.c, src/zenity.glade, src/zenity.h: new scale dialog for selecting a value from a range (Fixes #322399). --- src/option.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 19089305..f3f26b3a 100644 --- a/src/option.c +++ b/src/option.c @@ -91,6 +91,14 @@ static gboolean zenity_text_active; /* Warning Dialog Options */ static gboolean zenity_warning_active; +/* Scale Dialog Options */ +static gboolean zenity_scale_active; +static gint zenity_scale_value; +static gint zenity_scale_min_value; +static gint zenity_scale_max_value; +static gint zenity_scale_step; +static gboolean zenity_scale_print_partial; + /* Miscelaneus Options */ static gboolean zenity_misc_about; static gboolean zenity_misc_version; @@ -646,6 +654,75 @@ static GOptionEntry warning_options[] = { } }; +static GOptionEntry scale_options[] = { + { + "scale", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_scale_active, + N_("Display scale dialog"), + NULL + }, + { + "text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + NULL + }, + { + "value", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_value, + N_("Set initial value"), + NULL + }, + { + "min-value", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_min_value, + N_("Set minimum value"), + NULL + }, + { + "max-value", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_max_value, + N_("Set maximum value"), + NULL + }, + { + "step", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_step, + N_("Set step size"), + NULL + }, + { + "print-partial", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_scale_print_partial, + N_("Print partial values"), + NULL + }, + { + NULL + } +}; + static GOptionEntry miscellaneous_options[] = { { "about", @@ -683,6 +760,7 @@ zenity_option_init (void) { results->data = g_new0 (ZenityData, 1); results->calendar_data = g_new0 (ZenityCalendarData, 1); results->msg_data = g_new0 (ZenityMsgData, 1); + results->scale_data = g_new0 (ZenityScaleData, 1); results->file_data = g_new0 (ZenityFileData, 1); results->entry_data = g_new0 (ZenityEntryData, 1); results->progress_data = g_new0 (ZenityProgressData, 1); @@ -912,6 +990,22 @@ zenity_warning_pre_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_scale_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_scale_active = FALSE; + zenity_scale_value = 0; + zenity_scale_min_value = 0; + zenity_scale_max_value = 100; + zenity_scale_step = 1; + zenity_scale_print_partial = FALSE; + + return TRUE; +} + static gboolean zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group, @@ -1234,6 +1328,26 @@ zenity_warning_post_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_scale_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_scale_active, MODE_SCALE); + + if (results->mode == MODE_SCALE) { + results->scale_data->dialog_text = zenity_general_dialog_text; + results->scale_data->value = zenity_scale_value; + results->scale_data->min_value = zenity_scale_min_value; + results->scale_data->max_value = zenity_scale_max_value; + results->scale_data->step = zenity_scale_step; + results->scale_data->print_partial = zenity_scale_print_partial; + } + + return TRUE; +} + static gboolean zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group, @@ -1375,6 +1489,17 @@ zenity_create_context (void) g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); + /* Adds scale option entries */ + a_group = g_option_group_new("scale", + N_("Scale options"), + N_("Show scale options"), NULL, 0); + g_option_group_add_entries(a_group, scale_options); + g_option_group_set_parse_hooks (a_group, + zenity_scale_pre_callback, zenity_scale_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group(tmp_ctx, a_group); + /* Adds text option entries */ a_group = g_option_group_new("text-info", N_("Text information options"), -- cgit From 4ac6730868c97e7cc800cee8eba6721a23181678 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Thu, 15 Dec 2005 05:40:15 +0000 Subject: add --hide-value to scale dialog. 2005-12-15 Lucas Rocha * src/option.c, src/scale.c, src/zenity.h: add --hide-value to scale dialog. --- src/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index f3f26b3a..2268ef7e 100644 --- a/src/option.c +++ b/src/option.c @@ -98,6 +98,7 @@ static gint zenity_scale_min_value; static gint zenity_scale_max_value; static gint zenity_scale_step; static gboolean zenity_scale_print_partial; +static gboolean zenity_scale_hide_value; /* Miscelaneus Options */ static gboolean zenity_misc_about; @@ -718,6 +719,15 @@ static GOptionEntry scale_options[] = { N_("Print partial values"), NULL }, + { + "hide-value", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_scale_hide_value, + N_("Hide value"), + NULL + }, { NULL } @@ -1002,6 +1012,7 @@ zenity_scale_pre_callback (GOptionContext *context, zenity_scale_max_value = 100; zenity_scale_step = 1; zenity_scale_print_partial = FALSE; + zenity_scale_hide_value = FALSE; return TRUE; } @@ -1343,6 +1354,7 @@ zenity_scale_post_callback (GOptionContext *context, results->scale_data->max_value = zenity_scale_max_value; results->scale_data->step = zenity_scale_step; results->scale_data->print_partial = zenity_scale_print_partial; + results->scale_data->hide_value = zenity_scale_hide_value; } return TRUE; -- cgit From 17989a09c1212985c7124c9d9198a99bfa654834 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Tue, 7 Mar 2006 19:04:04 +0000 Subject: add G_OPTION_FLAG_NOALIAS to separator option for list dialog. Patch from 2006-03-07 Lucas Rocha * src/option.c: add G_OPTION_FLAG_NOALIAS to separator option for list dialog. Patch from Glynn Foster . --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 2268ef7e..dcc1da04 100644 --- a/src/option.c +++ b/src/option.c @@ -424,7 +424,7 @@ static GOptionEntry list_options[] = { { "separator", '\0', - 0, + G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_separator, N_("Set output separator character"), -- cgit From 6645316bc935dfc2b4f8a1cad95a98f90cd710c1 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Thu, 23 Mar 2006 20:08:17 +0000 Subject: add --confirm-overwrite to file selection dialog to pop a confirmation 2006-03-23 Lucas Rocha * src/fileselection.c, zenity.h, option.c: add --confirm-overwrite to file selection dialog to pop a confirmation dialog when selecting an existing filename. --- src/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index dcc1da04..7917c91e 100644 --- a/src/option.c +++ b/src/option.c @@ -63,6 +63,7 @@ static gboolean zenity_info_active; static gboolean zenity_file_active; static gboolean zenity_file_directory; static gboolean zenity_file_save; +static gboolean zenity_file_confirm_overwrite; /* List Dialog Options */ static gboolean zenity_list_active; @@ -370,6 +371,15 @@ static GOptionEntry file_selection_options[] = { N_("Set output separator character"), N_("SEPARATOR") }, + { + "confirm-overwrite", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_confirm_overwrite, + N_("Confirm file selection if filename already exists"), + NULL + }, { NULL } @@ -921,6 +931,7 @@ zenity_file_pre_callback (GOptionContext *context, zenity_file_active = FALSE; zenity_file_directory = FALSE; zenity_file_save = FALSE; + zenity_file_confirm_overwrite = FALSE; return TRUE; } @@ -1170,6 +1181,7 @@ zenity_file_post_callback (GOptionContext *context, results->file_data->multi = zenity_general_multiple; results->file_data->directory = zenity_file_directory; results->file_data->save = zenity_file_save; + results->file_data->confirm_overwrite = zenity_file_confirm_overwrite; results->file_data->separator = zenity_general_separator; } else { if (zenity_file_directory) -- cgit From 07618f9daa007f7cabfee3b25845e9088330abcd Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Thu, 11 May 2006 01:31:35 +0000 Subject: add optional dropdown menu to entry dialog (Fixed bug #311038). Patch from 2006-05-10 Lucas Rocha * src/entry.c (zenity_entry_fill_entries, zenity_entry), src/main.c, src/option.c, src/zenity.glade, src/zenity.h: add optional dropdown menu to entry dialog (Fixed bug #311038). Patch from Diego Escalante Urrelo . --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 7917c91e..2be45500 100644 --- a/src/option.c +++ b/src/option.c @@ -1116,7 +1116,7 @@ zenity_entry_post_callback (GOptionContext *context, GError **error) { zenity_option_set_dialog_mode (zenity_entry_active, MODE_ENTRY); - + if (results->mode == MODE_ENTRY) { results->entry_data->dialog_text = zenity_general_dialog_text; results->entry_data->entry_text = zenity_entry_entry_text; -- cgit From 09c4a49800992d979845e3c7a05122b5aa1ceaed Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Sat, 2 Dec 2006 10:54:45 +0000 Subject: add "auto-kill" option to progress dialog. Now the user can choose whether 2006-12-02 Lucas Rocha * src/zenity.h, src/progress.c, src/option.c: add "auto-kill" option to progress dialog. Now the user can choose whether to kill parent process or not (Fixes bug #310824). Patch from Diego Escalante Urrelo . --- src/option.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 2be45500..79c327a2 100644 --- a/src/option.c +++ b/src/option.c @@ -82,6 +82,7 @@ static gboolean zenity_progress_active; static int zenity_progress_percentage; static gboolean zenity_progress_pulsate; static gboolean zenity_progress_auto_close; +static gboolean zenity_progress_auto_kill; /* Question Dialog Options */ static gboolean zenity_question_active; @@ -561,6 +562,16 @@ static GOptionEntry progress_options[] = { N_("Dismiss the dialog when 100% has been reached"), NULL }, + { + "auto-kill", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_auto_kill, + /* xgettext: no-c-format */ + N_("Kill parent process if cancel button is pressed"), + NULL + }, { NULL } @@ -974,6 +985,7 @@ zenity_progress_pre_callback (GOptionContext *context, zenity_progress_percentage = 0; zenity_progress_pulsate = FALSE; zenity_progress_auto_close = FALSE; + zenity_progress_auto_kill = FALSE; return TRUE; } @@ -1282,6 +1294,7 @@ zenity_progress_post_callback (GOptionContext *context, results->progress_data->dialog_text = zenity_general_dialog_text; results->progress_data->pulsate = zenity_progress_pulsate; results->progress_data->autoclose = zenity_progress_auto_close; + results->progress_data->autokill = zenity_progress_auto_kill; results->progress_data->percentage = zenity_progress_percentage; } else { if (zenity_progress_pulsate) @@ -1295,6 +1308,10 @@ zenity_progress_post_callback (GOptionContext *context, if (zenity_progress_auto_close) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_close), ERROR_SUPPORT); + + if (zenity_progress_auto_kill) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill), + ERROR_SUPPORT); } return TRUE; -- cgit From 7a58e9e4c77f835ec51b87e618bcfab1b4ad0764 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 4 Dec 2006 20:35:48 +0000 Subject: complete list dialog options with respective arguments (Fixes bug 2006-12-04 Lucas Rocha * src/option.c: complete list dialog options with respective arguments (Fixes bug #353320). Patch from Glynn Foster . --- src/option.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 79c327a2..5fe5dbce 100644 --- a/src/option.c +++ b/src/option.c @@ -165,7 +165,7 @@ static GOptionEntry calendar_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "day", @@ -174,7 +174,7 @@ static GOptionEntry calendar_options[] = { G_OPTION_ARG_INT, &zenity_calendar_day, N_("Set the calendar day"), - NULL + N_("DAY") }, { "month", @@ -183,7 +183,7 @@ static GOptionEntry calendar_options[] = { G_OPTION_ARG_INT, &zenity_calendar_month, N_("Set the calendar month"), - NULL + N_("MONTH") }, { "year", @@ -192,7 +192,7 @@ static GOptionEntry calendar_options[] = { G_OPTION_ARG_INT, &zenity_calendar_year, N_("Set the calendar year"), - NULL + N_("YEAR") }, { "date-format", @@ -201,7 +201,7 @@ static GOptionEntry calendar_options[] = { G_OPTION_ARG_STRING, &zenity_calendar_date_format, N_("Set the format for the returned date"), - NULL + N_("PATTERN") }, { NULL @@ -225,7 +225,7 @@ static GOptionEntry entry_options[] = { G_OPTION_ARG_STRING | G_OPTION_FLAG_NOALIAS, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "entry-text", @@ -234,7 +234,7 @@ static GOptionEntry entry_options[] = { G_OPTION_ARG_STRING, &zenity_entry_entry_text, N_("Set the entry text"), - NULL + N_("TEXT") }, { "hide-text", @@ -243,7 +243,7 @@ static GOptionEntry entry_options[] = { G_OPTION_ARG_NONE, &zenity_entry_hide_text, N_("Hide the entry text"), - NULL + N_("TEXT") }, { NULL @@ -268,7 +268,7 @@ static GOptionEntry error_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "no-wrap", @@ -301,7 +301,7 @@ static GOptionEntry info_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "no-wrap", @@ -403,7 +403,7 @@ static GOptionEntry list_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "column", @@ -412,7 +412,7 @@ static GOptionEntry list_options[] = { G_OPTION_ARG_STRING_ARRAY, &zenity_list_columns, N_("Set the column header"), - NULL + N_("COLUMN") }, { "checklist", @@ -466,7 +466,7 @@ static GOptionEntry list_options[] = { G_OPTION_ARG_STRING, &zenity_list_print_column, N_("Print a specific column (Default is 1. 'ALL' can be used to print all columns)"), - NULL + N_("NUMBER") }, { "hide-column", @@ -475,7 +475,7 @@ static GOptionEntry list_options[] = { G_OPTION_ARG_STRING, &zenity_list_hide_column, N_("Hide a specific column"), - NULL + N_("NUMBER") }, { NULL @@ -499,7 +499,7 @@ static GOptionEntry notification_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the notification text"), - NULL + N_("TEXT") }, { "listen", @@ -532,7 +532,7 @@ static GOptionEntry progress_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "percentage", @@ -541,7 +541,7 @@ static GOptionEntry progress_options[] = { G_OPTION_ARG_INT, &zenity_progress_percentage, N_("Set initial percentage"), - NULL + N_("PERCENTAGE") }, { "pulsate", @@ -594,7 +594,7 @@ static GOptionEntry question_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "no-wrap", @@ -660,7 +660,7 @@ static GOptionEntry warning_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "no-wrap", @@ -693,7 +693,7 @@ static GOptionEntry scale_options[] = { G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), - NULL + N_("TEXT") }, { "value", @@ -702,7 +702,7 @@ static GOptionEntry scale_options[] = { G_OPTION_ARG_INT, &zenity_scale_value, N_("Set initial value"), - NULL + N_("VALUE") }, { "min-value", @@ -711,7 +711,7 @@ static GOptionEntry scale_options[] = { G_OPTION_ARG_INT, &zenity_scale_min_value, N_("Set minimum value"), - NULL + N_("VALUE") }, { "max-value", @@ -720,7 +720,7 @@ static GOptionEntry scale_options[] = { G_OPTION_ARG_INT, &zenity_scale_max_value, N_("Set maximum value"), - NULL + N_("VALUE") }, { "step", @@ -729,7 +729,7 @@ static GOptionEntry scale_options[] = { G_OPTION_ARG_INT, &zenity_scale_step, N_("Set step size"), - NULL + N_("VALUE") }, { "print-partial", -- cgit From adee9db56646cc297fd226db983d40f3ba0d4793 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 14 May 2007 21:26:08 +0000 Subject: general cleanups for build warnings (Fixes bug #416196). Patch from 2007-05-14 Lucas Rocha * src/progress.c (zenity_progress_handle_stdin), src/option.c (zenity_create_context), src/about.c, src/notification.c (zenity_notification_handle_stdin): general cleanups for build warnings (Fixes bug #416196). Patch from Kjartan Maraas . svn path=/trunk/; revision=1208 --- src/option.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 5fe5dbce..25a74402 100644 --- a/src/option.c +++ b/src/option.c @@ -222,7 +222,7 @@ static GOptionEntry entry_options[] = { "text", '\0', G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING | G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, &zenity_general_dialog_text, N_("Set the dialog text"), N_("TEXT") @@ -1412,7 +1412,7 @@ zenity_create_context (void) /* Adds general option entries */ a_group = g_option_group_new("general", N_("General options"), - N_("Show general options"), NULL, 0); + N_("Show general options"), NULL, NULL); g_option_group_add_entries(a_group, general_options); g_option_group_set_parse_hooks (a_group, zenity_general_pre_callback, zenity_general_post_callback); @@ -1423,7 +1423,7 @@ zenity_create_context (void) /* Adds calendar option entries */ a_group = g_option_group_new("calendar", N_("Calendar options"), - N_("Show calendar options"), NULL, 0); + N_("Show calendar options"), NULL, NULL); g_option_group_add_entries(a_group, calendar_options); g_option_group_set_parse_hooks (a_group, zenity_calendar_pre_callback, zenity_calendar_post_callback); @@ -1434,7 +1434,7 @@ zenity_create_context (void) /* Adds entry option entries */ a_group = g_option_group_new("entry", N_("Text entry options"), - N_("Show text entry options"), NULL, 0); + N_("Show text entry options"), NULL, NULL); g_option_group_add_entries(a_group, entry_options); g_option_group_set_parse_hooks (a_group, zenity_entry_pre_callback, zenity_entry_post_callback); @@ -1445,7 +1445,7 @@ zenity_create_context (void) /* Adds error option entries */ a_group = g_option_group_new("error", N_("Error options"), - N_("Show error options"), NULL, 0); + N_("Show error options"), NULL, NULL); g_option_group_add_entries(a_group, error_options); g_option_group_set_parse_hooks (a_group, zenity_error_pre_callback, zenity_error_post_callback); @@ -1456,7 +1456,7 @@ zenity_create_context (void) /* Adds info option entries */ a_group = g_option_group_new("info", N_("Info options"), - N_("Show info options"), NULL, 0); + N_("Show info options"), NULL, NULL); g_option_group_add_entries(a_group, info_options); g_option_group_set_parse_hooks (a_group, zenity_info_pre_callback, zenity_info_post_callback); @@ -1467,7 +1467,7 @@ zenity_create_context (void) /* Adds file selection option entries */ a_group = g_option_group_new("file-selection", N_("File selection options"), - N_("Show file selection options"), NULL, 0); + N_("Show file selection options"), NULL, NULL); g_option_group_add_entries(a_group, file_selection_options); g_option_group_set_parse_hooks (a_group, zenity_file_pre_callback, zenity_file_post_callback); @@ -1478,7 +1478,7 @@ zenity_create_context (void) /* Adds list option entries */ a_group = g_option_group_new("list", N_("List options"), - N_("Show list options"), NULL, 0); + N_("Show list options"), NULL, NULL); g_option_group_add_entries(a_group, list_options); g_option_group_set_parse_hooks (a_group, zenity_list_pre_callback, zenity_list_post_callback); @@ -1489,7 +1489,7 @@ zenity_create_context (void) /* Adds notification option entries */ a_group = g_option_group_new("notification", N_("Notification icon options"), - N_("Show notification icon options"), NULL, 0); + N_("Show notification icon options"), NULL, NULL); g_option_group_add_entries(a_group, notification_options); g_option_group_set_parse_hooks (a_group, zenity_notification_pre_callback, zenity_notification_post_callback); @@ -1500,7 +1500,7 @@ zenity_create_context (void) /* Adds progress option entries */ a_group = g_option_group_new("progress", N_("Progress options"), - N_("Show progress options"), NULL, 0); + N_("Show progress options"), NULL, NULL); g_option_group_add_entries(a_group, progress_options); g_option_group_set_parse_hooks (a_group, zenity_progress_pre_callback, zenity_progress_post_callback); @@ -1511,7 +1511,7 @@ zenity_create_context (void) /* Adds question option entries */ a_group = g_option_group_new("question", N_("Question options"), - N_("Show question options"), NULL, 0); + N_("Show question options"), NULL, NULL); g_option_group_add_entries(a_group, question_options); g_option_group_set_parse_hooks (a_group, zenity_question_pre_callback, zenity_question_post_callback); @@ -1522,7 +1522,7 @@ zenity_create_context (void) /* Adds warning option entries */ a_group = g_option_group_new("warning", N_("Warning options"), - N_("Show warning options"), NULL, 0); + N_("Show warning options"), NULL, NULL); g_option_group_add_entries(a_group, warning_options); g_option_group_set_parse_hooks (a_group, zenity_warning_pre_callback, zenity_warning_post_callback); @@ -1533,7 +1533,7 @@ zenity_create_context (void) /* Adds scale option entries */ a_group = g_option_group_new("scale", N_("Scale options"), - N_("Show scale options"), NULL, 0); + N_("Show scale options"), NULL, NULL); g_option_group_add_entries(a_group, scale_options); g_option_group_set_parse_hooks (a_group, zenity_scale_pre_callback, zenity_scale_post_callback); @@ -1544,7 +1544,7 @@ zenity_create_context (void) /* Adds text option entries */ a_group = g_option_group_new("text-info", N_("Text information options"), - N_("Show text information options"), NULL, 0); + N_("Show text information options"), NULL, NULL); g_option_group_add_entries(a_group, text_options); g_option_group_set_parse_hooks (a_group, zenity_text_pre_callback, zenity_text_post_callback); @@ -1555,7 +1555,7 @@ zenity_create_context (void) /* Adds misc option entries */ a_group = g_option_group_new("misc", N_("Miscellaneous options"), - N_("Show miscellaneous options"), NULL, 0); + N_("Show miscellaneous options"), NULL, NULL); g_option_group_add_entries(a_group, miscellaneous_options); g_option_group_set_parse_hooks (a_group, zenity_misc_pre_callback, zenity_misc_post_callback); -- cgit From 8b16d4d4122e6337517ec16b9ca22dd27df0dafb Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 13 Aug 2007 20:36:29 +0000 Subject: added timeout option to all dialogs (Fixes bug #160654). Based on patch 2007-08-13 Lucas Rocha * src/*.c: added timeout option to all dialogs (Fixes bug #160654). Based on patch from Muthiah Annamalai . svn path=/trunk/; revision=1231 --- src/option.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 25a74402..cbb50816 100644 --- a/src/option.c +++ b/src/option.c @@ -40,6 +40,7 @@ static gboolean zenity_general_multiple; static gboolean zenity_general_editable; static gchar *zenity_general_uri; static gboolean zenity_general_dialog_no_wrap; +static guint zenity_general_timeout_delay; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; @@ -143,6 +144,15 @@ static GOptionEntry general_options[] = { N_("Set the height"), N_("HEIGHT") }, + { + "timeout", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_general_timeout_delay, + N_("Set dialog timeout in seconds"), + NULL + }, { NULL } @@ -879,6 +889,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_editable = FALSE; zenity_general_uri = NULL; zenity_general_dialog_no_wrap = FALSE; + zenity_general_timeout_delay = -1; return TRUE; } @@ -1065,7 +1076,7 @@ zenity_general_post_callback (GOptionContext *context, results->data->window_icon = zenity_general_window_icon; results->data->width = zenity_general_width; results->data->height = zenity_general_height; - + results->data->timeout_delay=zenity_general_timeout_delay; return TRUE; } -- cgit From 67baada43072de56c7a9f0c88fd29d1056cf31a3 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 17 Mar 2008 19:16:31 +0000 Subject: added comment on a string in order clarify its meaning for translators 2007-03-17 Lucas Rocha * src/option.c: added comment on a string in order clarify its meaning for translators (Fixes bug #520847). svn path=/trunk/; revision=1335 --- src/option.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index cbb50816..68d655f7 100644 --- a/src/option.c +++ b/src/option.c @@ -476,6 +476,7 @@ static GOptionEntry list_options[] = { G_OPTION_ARG_STRING, &zenity_list_print_column, N_("Print a specific column (Default is 1. 'ALL' can be used to print all columns)"), + /* Column index number to print out on a list dialog */ N_("NUMBER") }, { -- cgit From 69390b9e435e71acd9c965ce3b9c1a73b77dc16f Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 17 Mar 2008 19:28:49 +0000 Subject: added arg_description for --timeout option (Fixes bug #516876). Patch from 2008-03-17 Lucas Rocha * src/option.c: added arg_description for --timeout option (Fixes bug #516876). Patch from Luca Ferretti . svn path=/trunk/; revision=1341 --- src/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 68d655f7..babe4e9c 100644 --- a/src/option.c +++ b/src/option.c @@ -151,7 +151,8 @@ static GOptionEntry general_options[] = { G_OPTION_ARG_INT, &zenity_general_timeout_delay, N_("Set dialog timeout in seconds"), - NULL + /* Timeout for closing the dialog */ + N_("TIMEOUT") }, { NULL -- cgit From 2141cb9184c20be91e469b2bd4e4bb22e57faba3 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Sat, 29 Mar 2008 22:13:50 +0000 Subject: Allow question dialogs to use custom button label text (Fixes bug 2008-03-30 Lucas Rocha Allow question dialogs to use custom button label text (Fixes bug #335763). Patch from Cosimo Cecchi and Thomas Thurman . * src/msg.c (zenity_msg_construct_question_dialog), (zenity_msg): dynamically add dialog buttons with provided labels. * src/option.c (zenity_option_free): free input labels. (zenity_question_post_callback): set button labels provided by the respective command line options. * src/zenity.glade: remove pre-defined dialog button from question dialog. * src/zenity.h: added ok_label and cancel_label to ZenityMsgData. svn path=/trunk/; revision=1346 --- src/option.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index babe4e9c..b56d5f09 100644 --- a/src/option.c +++ b/src/option.c @@ -87,6 +87,8 @@ static gboolean zenity_progress_auto_kill; /* Question Dialog Options */ static gboolean zenity_question_active; +static gchar *zenity_question_ok_button; +static gchar *zenity_question_cancel_button; /* Text Dialog Options */ static gboolean zenity_text_active; @@ -608,6 +610,24 @@ static GOptionEntry question_options[] = { N_("Set the dialog text"), N_("TEXT") }, + { + "ok-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_question_ok_button, + N_("Sets the label of the Ok button"), + N_("TEXT") + }, + { + "cancel-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_question_cancel_button, + N_("Sets the label of the Cancel button"), + N_("TEXT") + }, { "no-wrap", '\0', @@ -837,6 +857,11 @@ zenity_option_free (void) { if (zenity_list_hide_column) g_free (zenity_list_hide_column); + if (zenity_question_ok_button) + g_free (zenity_question_ok_button); + if (zenity_question_cancel_button) + g_free (zenity_question_cancel_button); + g_option_context_free (ctx); } @@ -1342,7 +1367,9 @@ zenity_question_post_callback (GOptionContext *context, if (results->mode == MODE_QUESTION) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_QUESTION; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->ok_label = zenity_question_ok_button; + results->msg_data->cancel_label = zenity_question_cancel_button; } return TRUE; -- cgit From 8cda6025f0a11278c8d2f01482ad1656a2b5e5b1 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 21 Apr 2008 20:47:38 +0000 Subject: Add support for file filter in file selection dialog through the new 2008-04-21 Lucas Rocha Add support for file filter in file selection dialog through the new --file-filter command line option (Fixes bug #409843). * src/option.c, src/zenity.h: added supporting variable and new GOptionEntry entry for the new command line option. * src/fileselection.c (zenity_fileselection): add file filters based on command line input. svn path=/trunk/; revision=1362 --- src/option.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index b56d5f09..9cbf490c 100644 --- a/src/option.c +++ b/src/option.c @@ -61,10 +61,11 @@ static gboolean zenity_error_active; static gboolean zenity_info_active; /* File Selection Dialog Options */ -static gboolean zenity_file_active; -static gboolean zenity_file_directory; -static gboolean zenity_file_save; -static gboolean zenity_file_confirm_overwrite; +static gboolean zenity_file_active; +static gboolean zenity_file_directory; +static gboolean zenity_file_save; +static gboolean zenity_file_confirm_overwrite; +static GtkFileFilter *zenity_file_filter; /* List Dialog Options */ static gboolean zenity_list_active; @@ -394,6 +395,15 @@ static GOptionEntry file_selection_options[] = { N_("Confirm file selection if filename already exists"), NULL }, + { + "file-filter", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_file_filter, + N_("Sets a filename filter"), + N_("NAME | PATTERN1 PATTERN2 ..."), + }, { NULL } @@ -981,6 +991,7 @@ zenity_file_pre_callback (GOptionContext *context, zenity_file_directory = FALSE; zenity_file_save = FALSE; zenity_file_confirm_overwrite = FALSE; + zenity_file_filter = NULL; return TRUE; } @@ -1233,6 +1244,7 @@ zenity_file_post_callback (GOptionContext *context, results->file_data->save = zenity_file_save; results->file_data->confirm_overwrite = zenity_file_confirm_overwrite; results->file_data->separator = zenity_general_separator; + results->file_data->filter = zenity_file_filter; } else { if (zenity_file_directory) zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_directory), @@ -1241,6 +1253,10 @@ zenity_file_post_callback (GOptionContext *context, if (zenity_file_save) zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_save), ERROR_SUPPORT); + + if (zenity_file_filter) + zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_filter), + ERROR_SUPPORT); } return TRUE; -- cgit From c6da35807bee14b9a7e813e6bbcf757472cbf9e0 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Fri, 9 Jan 2009 00:17:40 +0000 Subject: translator comment for file-filter option string (Fixes bug #547202). 2009-01-09 Lucas Rocha * src/option.c: translator comment for file-filter option string (Fixes bug #547202). Patch from Frederic Peters . svn path=/trunk/; revision=1464 --- src/option.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 9cbf490c..c7a8b35e 100644 --- a/src/option.c +++ b/src/option.c @@ -402,6 +402,7 @@ static GOptionEntry file_selection_options[] = { G_OPTION_ARG_STRING_ARRAY, &zenity_file_filter, N_("Sets a filename filter"), + /* Help for file-filter argument (name and patterns for file selection) */ N_("NAME | PATTERN1 PATTERN2 ..."), }, { -- cgit From 62a1292d1ea8b611b539ab2cc5dc4dfe479225d8 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 23 Apr 2009 19:55:12 +0200 Subject: Bug 579999 ā€“ zenity sets a huge but finite timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Declare timeout delay as signed, so that assigning -1 does not act as setting a huge (but finite) timeout (this has been noticed by resetting the clock) --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index c7a8b35e..93a09a21 100644 --- a/src/option.c +++ b/src/option.c @@ -40,7 +40,7 @@ static gboolean zenity_general_multiple; static gboolean zenity_general_editable; static gchar *zenity_general_uri; static gboolean zenity_general_dialog_no_wrap; -static guint zenity_general_timeout_delay; +static gint zenity_general_timeout_delay; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; -- cgit From 4bba7c63f81b2d198bbe9fe2988005fed96b72ba Mon Sep 17 00:00:00 2001 From: Matt Keenan Date: Mon, 10 Aug 2009 03:36:13 +0100 Subject: Bug 549404 - --help-entry for hide-text incorrect --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 93a09a21..5742648c 100644 --- a/src/option.c +++ b/src/option.c @@ -257,7 +257,7 @@ static GOptionEntry entry_options[] = { G_OPTION_ARG_NONE, &zenity_entry_hide_text, N_("Hide the entry text"), - N_("TEXT") + NULL }, { NULL -- cgit From bf53ffc6f2d9e6345d04e9a8a88752ac9a071bdf Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 10 Aug 2009 03:40:59 +0100 Subject: [option] Fix type of filters variable --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 5742648c..2367d089 100644 --- a/src/option.c +++ b/src/option.c @@ -65,7 +65,7 @@ static gboolean zenity_file_active; static gboolean zenity_file_directory; static gboolean zenity_file_save; static gboolean zenity_file_confirm_overwrite; -static GtkFileFilter *zenity_file_filter; +static gchar **zenity_file_filter; /* List Dialog Options */ static gboolean zenity_list_active; -- cgit From 82f63f94d5f7204a77d22fea7eb0331ce5d59311 Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Mon, 10 Aug 2009 03:44:00 +0100 Subject: [option] Free file filter list on exit --- src/option.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 2367d089..1bc2eafc 100644 --- a/src/option.c +++ b/src/option.c @@ -861,6 +861,9 @@ zenity_option_free (void) { if (zenity_entry_entry_text) g_free (zenity_entry_entry_text); + if (zenity_file_filter) + g_strfreev (zenity_file_filter); + if (zenity_list_columns) g_strfreev (zenity_list_columns); if (zenity_list_print_column) -- cgit From 8e190dbb1f39eae31210f7d4c97a4c5ebb496907 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Mon, 10 Aug 2009 04:10:53 +0100 Subject: Bug 552971 - Add a hide-header option to list dialog --- src/option.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 1bc2eafc..58ea5381 100644 --- a/src/option.c +++ b/src/option.c @@ -74,6 +74,7 @@ static gboolean zenity_list_checklist; static gboolean zenity_list_radiolist; static gchar *zenity_list_print_column; static gchar *zenity_list_hide_column; +static gchar *zenity_list_hide_header; /* Notification Dialog Options */ static gboolean zenity_notification_active; @@ -502,6 +503,15 @@ static GOptionEntry list_options[] = { N_("Hide a specific column"), N_("NUMBER") }, + { + "hide-header", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_list_hide_header, + N_("Hides the column headers"), + NULL + }, { NULL } @@ -1010,6 +1020,7 @@ zenity_list_pre_callback (GOptionContext *context, zenity_list_columns = NULL; zenity_list_checklist = FALSE; zenity_list_radiolist = FALSE; + zenity_list_hide_header = FALSE; zenity_list_print_column = NULL; zenity_list_hide_column = NULL; @@ -1294,6 +1305,7 @@ zenity_list_post_callback (GOptionContext *context, results->tree_data->editable = zenity_general_editable; results->tree_data->print_column = zenity_list_print_column; results->tree_data->hide_column = zenity_list_hide_column; + results->tree_data->hide_header = zenity_list_hide_header; results->tree_data->separator = zenity_general_separator; } else { if (zenity_list_columns) @@ -1315,6 +1327,10 @@ zenity_list_post_callback (GOptionContext *context, if (zenity_list_hide_column) zenity_option_error (zenity_option_get_name (list_options, &zenity_list_hide_column), ERROR_SUPPORT); + + if (zenity_list_hide_header) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_hide_header), + ERROR_SUPPORT); } return TRUE; -- cgit From 3b4f73ce466eb76c746920ba25e9c2f00374017a Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Tue, 23 Feb 2010 17:53:38 +0000 Subject: [options] Use correct type in hide_header variable --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 58ea5381..0e3ede5f 100644 --- a/src/option.c +++ b/src/option.c @@ -74,7 +74,7 @@ static gboolean zenity_list_checklist; static gboolean zenity_list_radiolist; static gchar *zenity_list_print_column; static gchar *zenity_list_hide_column; -static gchar *zenity_list_hide_header; +static gboolean zenity_list_hide_header; /* Notification Dialog Options */ static gboolean zenity_notification_active; -- cgit From 3c17a5a8870422b9a9145ff805d6d3bb872dacea Mon Sep 17 00:00:00 2001 From: Huzaifa Sidhpurwala Date: Tue, 23 Feb 2010 18:07:08 +0000 Subject: Bug 593926 - --progress needs a --nocancel option --- src/option.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 0e3ede5f..bc09009a 100644 --- a/src/option.c +++ b/src/option.c @@ -86,6 +86,7 @@ static int zenity_progress_percentage; static gboolean zenity_progress_pulsate; static gboolean zenity_progress_auto_close; static gboolean zenity_progress_auto_kill; +static gboolean zenity_progress_no_cancel; /* Question Dialog Options */ static gboolean zenity_question_active; @@ -607,6 +608,16 @@ static GOptionEntry progress_options[] = { N_("Kill parent process if cancel button is pressed"), NULL }, + { + "no-cancel", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_no_cancel, + /* xgettext: no-c-format */ + N_("Hide cancel button"), + NULL + }, { NULL } @@ -1050,7 +1061,7 @@ zenity_progress_pre_callback (GOptionContext *context, zenity_progress_pulsate = FALSE; zenity_progress_auto_close = FALSE; zenity_progress_auto_kill = FALSE; - + zenity_progress_no_cancel = FALSE; return TRUE; } @@ -1370,6 +1381,7 @@ zenity_progress_post_callback (GOptionContext *context, results->progress_data->autoclose = zenity_progress_auto_close; results->progress_data->autokill = zenity_progress_auto_kill; results->progress_data->percentage = zenity_progress_percentage; + results->progress_data->no_cancel = zenity_progress_no_cancel; } else { if (zenity_progress_pulsate) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate), @@ -1386,6 +1398,9 @@ zenity_progress_post_callback (GOptionContext *context, if (zenity_progress_auto_kill) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill), ERROR_SUPPORT); + if (zenity_progress_no_cancel) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_no_cancel), + ERROR_SUPPORT); } return TRUE; -- cgit From 4ccc7f6fac79a189e0c0c4896bb2f0f38d38d7c7 Mon Sep 17 00:00:00 2001 From: Berislav Kovacki Date: Tue, 23 Feb 2010 18:24:20 +0000 Subject: Bug 540169 - Zenity should offer color selection dialog --- src/option.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index bc09009a..00467452 100644 --- a/src/option.c +++ b/src/option.c @@ -108,6 +108,11 @@ static gint zenity_scale_step; static gboolean zenity_scale_print_partial; static gboolean zenity_scale_hide_value; +/* Color Selection Dialog Options */ +static gboolean zenity_colorsel_active; +static gchar *zenity_colorsel_color; +static gboolean zenity_colorsel_show_palette; + /* Miscelaneus Options */ static gboolean zenity_misc_about; static gboolean zenity_misc_version; @@ -818,6 +823,39 @@ static GOptionEntry scale_options[] = { } }; +static GOptionEntry color_selection_options[] = { + { + "color-selection", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_colorsel_active, + N_("Display color selection dialog"), + NULL + }, + { + "color", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_colorsel_color, + N_("Set the color"), + N_("VALUE") + }, + { + "show-palette", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_colorsel_show_palette, + N_("Show the palette"), + NULL + }, + { + NULL + } +}; + static GOptionEntry miscellaneous_options[] = { { "about", @@ -862,6 +900,7 @@ zenity_option_init (void) { results->text_data = g_new0 (ZenityTextData, 1); results->tree_data = g_new0 (ZenityTreeData, 1); results->notification_data = g_new0 (ZenityNotificationData, 1); + results->color_data = g_new0 (ZenityColorData, 1); } void @@ -897,6 +936,9 @@ zenity_option_free (void) { if (zenity_question_cancel_button) g_free (zenity_question_cancel_button); + if (zenity_colorsel_color) + g_free (zenity_colorsel_color); + g_option_context_free (ctx); } @@ -1115,6 +1157,19 @@ zenity_scale_pre_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_color_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_colorsel_active = FALSE; + zenity_colorsel_color = NULL; + zenity_colorsel_show_palette = FALSE; + + return TRUE; +} + static gboolean zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group, @@ -1480,6 +1535,30 @@ zenity_scale_post_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_color_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_colorsel_active, MODE_COLOR); + + if (results->mode == MODE_COLOR) { + results->color_data->color = zenity_colorsel_color; + results->color_data->show_palette = zenity_colorsel_show_palette; + } else { + if (zenity_colorsel_color) + zenity_option_error (zenity_option_get_name(color_selection_options, &zenity_colorsel_color), + ERROR_SUPPORT); + + if (zenity_colorsel_show_palette) + zenity_option_error (zenity_option_get_name(color_selection_options, &zenity_colorsel_show_palette), + ERROR_SUPPORT); + } + + return TRUE; +} + static gboolean zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group, @@ -1643,6 +1722,17 @@ zenity_create_context (void) g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); + /* Adds color selection option entries */ + a_group = g_option_group_new("color-selection", + N_("Color selection options"), + N_("Show color selection options"), NULL, NULL); + g_option_group_add_entries(a_group, color_selection_options); + g_option_group_set_parse_hooks (a_group, + zenity_color_pre_callback, zenity_color_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group(tmp_ctx, a_group); + /* Adds misc option entries */ a_group = g_option_group_new("misc", N_("Miscellaneous options"), -- cgit From 10d038022014a8069495bd72ccf9ed47fdf9d14d Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Sat, 10 Jul 2010 16:13:40 -0300 Subject: Add new password dialog --- src/option.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 00467452..b9694fde 100644 --- a/src/option.c +++ b/src/option.c @@ -113,6 +113,10 @@ static gboolean zenity_colorsel_active; static gchar *zenity_colorsel_color; static gboolean zenity_colorsel_show_palette; +/* Password Dialog Options */ +static gboolean zenity_password_active; +static gboolean zenity_password_show_username; + /* Miscelaneus Options */ static gboolean zenity_misc_about; static gboolean zenity_misc_version; @@ -823,6 +827,30 @@ static GOptionEntry scale_options[] = { } }; +static GOptionEntry password_dialog_options[] = { + { + "password", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_password_active, + N_("Display password dialog"), + NULL + }, + { + "username", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_password_show_username, + N_("Display the username option"), + NULL + }, + { + NULL + } +}; + static GOptionEntry color_selection_options[] = { { "color-selection", @@ -901,6 +929,7 @@ zenity_option_init (void) { results->tree_data = g_new0 (ZenityTreeData, 1); results->notification_data = g_new0 (ZenityNotificationData, 1); results->color_data = g_new0 (ZenityColorData, 1); + results->password_data = g_new0 (ZenityPasswordData, 1); } void @@ -938,7 +967,7 @@ zenity_option_free (void) { if (zenity_colorsel_color) g_free (zenity_colorsel_color); - + g_option_context_free (ctx); } @@ -1170,6 +1199,18 @@ zenity_color_pre_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_password_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_password_active = FALSE; + zenity_password_show_username = FALSE; + + return TRUE; +} + static gboolean zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group, @@ -1559,6 +1600,24 @@ zenity_color_post_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_password_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_password_active, MODE_PASSWORD); + if (results->mode == MODE_PASSWORD) { + results->password_data->username = zenity_password_show_username; + } else { + if (zenity_password_show_username) + zenity_option_error (zenity_option_get_name(password_dialog_options, &zenity_password_show_username), + ERROR_SUPPORT); + } + + return TRUE; +} + static gboolean zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group, @@ -1733,6 +1792,17 @@ zenity_create_context (void) g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); + /* Adds password dialog option entries */ + a_group = g_option_group_new("password", + N_("Password dialog options"), + N_("Show password dialog options"), NULL, NULL); + g_option_group_add_entries (a_group, password_dialog_options); + g_option_group_set_parse_hooks (a_group, + zenity_password_pre_callback, zenity_password_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group(tmp_ctx, a_group); + /* Adds misc option entries */ a_group = g_option_group_new("misc", N_("Miscellaneous options"), -- cgit From 3ae7f89228297d88bb4fd12c64f5f2f0377201d1 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Wed, 21 Jul 2010 20:22:16 -0300 Subject: Change cancel button messages to be capitalized --- src/option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index b9694fde..af206a02 100644 --- a/src/option.c +++ b/src/option.c @@ -614,7 +614,7 @@ static GOptionEntry progress_options[] = { G_OPTION_ARG_NONE, &zenity_progress_auto_kill, /* xgettext: no-c-format */ - N_("Kill parent process if cancel button is pressed"), + N_("Kill parent process if Cancel button is pressed"), NULL }, { @@ -624,7 +624,7 @@ static GOptionEntry progress_options[] = { G_OPTION_ARG_NONE, &zenity_progress_no_cancel, /* xgettext: no-c-format */ - N_("Hide cancel button"), + N_("Hide Cancel button"), NULL }, { -- cgit From 079254bb48c28f62d15270028e64308347888a76 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 4 Nov 2010 17:12:52 -0200 Subject: Add libnotify as optional in zenity instalation --- src/option.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index af206a02..f4813450 100644 --- a/src/option.c +++ b/src/option.c @@ -76,9 +76,11 @@ static gchar *zenity_list_print_column; static gchar *zenity_list_hide_column; static gboolean zenity_list_hide_header; +#ifdef HAVE_LIBNOTIFY /* Notification Dialog Options */ static gboolean zenity_notification_active; static gboolean zenity_notification_listen; +#endif /* Progress Dialog Options */ static gboolean zenity_progress_active; @@ -527,6 +529,7 @@ static GOptionEntry list_options[] = { } }; +#ifdef HAVE_LIBNOTIFY static GOptionEntry notification_options[] = { { "notification", @@ -560,6 +563,8 @@ static GOptionEntry notification_options[] = { } }; +#endif + static GOptionEntry progress_options[] = { { "progress", @@ -927,7 +932,9 @@ zenity_option_init (void) { results->progress_data = g_new0 (ZenityProgressData, 1); results->text_data = g_new0 (ZenityTextData, 1); results->tree_data = g_new0 (ZenityTreeData, 1); +#ifdef HAVE_LIBNOTIFY results->notification_data = g_new0 (ZenityNotificationData, 1); +#endif results->color_data = g_new0 (ZenityColorData, 1); results->password_data = g_new0 (ZenityPasswordData, 1); } @@ -1109,6 +1116,7 @@ zenity_list_pre_callback (GOptionContext *context, return TRUE; } +#ifdef HAVE_LIBNOTIFY static gboolean zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group, @@ -1120,6 +1128,7 @@ zenity_notification_pre_callback (GOptionContext *context, return TRUE; } +#endif static gboolean zenity_progress_pre_callback (GOptionContext *context, @@ -1443,6 +1452,7 @@ zenity_list_post_callback (GOptionContext *context, return TRUE; } +#ifdef HAVE_LIBNOTIFY static gboolean zenity_notification_post_callback (GOptionContext *context, GOptionGroup *group, @@ -1462,6 +1472,7 @@ zenity_notification_post_callback (GOptionContext *context, return TRUE; } +#endif static gboolean zenity_progress_post_callback (GOptionContext *context, @@ -1714,7 +1725,8 @@ zenity_create_context (void) g_option_group_set_error_hook (a_group, zenity_option_error_callback); g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); - + +#ifdef HAVE_LIBNOTIFY /* Adds notification option entries */ a_group = g_option_group_new("notification", N_("Notification icon options"), @@ -1725,6 +1737,7 @@ zenity_create_context (void) g_option_group_set_error_hook (a_group, zenity_option_error_callback); g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); +#endif /* Adds progress option entries */ a_group = g_option_group_new("progress", -- cgit From e5467650a641694c82d85cc5d34a5ece28fd51f0 Mon Sep 17 00:00:00 2001 From: muzuiget Date: Thu, 19 Aug 2010 05:40:57 +0800 Subject: Add font and no wrap mode support in text dialog --- src/option.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index f4813450..2d6d8a4c 100644 --- a/src/option.c +++ b/src/option.c @@ -97,6 +97,7 @@ static gchar *zenity_question_cancel_button; /* Text Dialog Options */ static gboolean zenity_text_active; +static gchar *zenity_text_font; /* Warning Dialog Options */ static gboolean zenity_warning_active; @@ -716,6 +717,15 @@ static GOptionEntry text_options[] = { N_("Allow changes to text"), NULL }, + { + "font", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_text_font, + N_("Set the text font"), + N_("TEXT") + }, { NULL } @@ -972,6 +982,9 @@ zenity_option_free (void) { if (zenity_question_cancel_button) g_free (zenity_question_cancel_button); + if (zenity_text_font) + g_free (zenity_text_font); + if (zenity_colorsel_color) g_free (zenity_colorsel_color); @@ -1163,6 +1176,7 @@ zenity_text_pre_callback (GOptionContext *context, GError **error) { zenity_text_active = FALSE; + zenity_text_font = NULL; return TRUE; } @@ -1544,7 +1558,13 @@ zenity_text_post_callback (GOptionContext *context, if (results->mode == MODE_TEXTINFO) { results->text_data->uri = zenity_general_uri; results->text_data->editable = zenity_general_editable; - } + results->text_data->no_wrap = zenity_general_dialog_no_wrap; + results->text_data->font = zenity_text_font; + } else { + if (zenity_text_font) + zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), + ERROR_SUPPORT); + } return TRUE; } @@ -1895,7 +1915,7 @@ zenity_option_parse (gint argc, gchar **argv) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); if (zenity_general_dialog_no_wrap) - if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING) + if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); return results; -- cgit From 9c32783a1442f95f77a6a997058baa8c720011c8 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Mon, 17 Jan 2011 12:20:21 -0200 Subject: Adding missed files and code for --forms option. --- src/option.c | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 2d6d8a4c..cd812091 100644 --- a/src/option.c +++ b/src/option.c @@ -120,10 +120,20 @@ static gboolean zenity_colorsel_show_palette; static gboolean zenity_password_active; static gboolean zenity_password_show_username; +/* Forms Dialog Options */ +static gboolean zenity_forms_active; +static gchar *zenity_forms_date_format; + /* Miscelaneus Options */ static gboolean zenity_misc_about; static gboolean zenity_misc_version; +static gboolean +zenity_forms_callback (const gchar *option_name, + const gchar *value, + gpointer data, + GError **error); + static GOptionEntry general_options[] = { { "title", @@ -842,6 +852,75 @@ static GOptionEntry scale_options[] = { } }; +static GOptionEntry forms_dialog_options[] = { + { + "forms", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_forms_active, + N_("Display forms dialog"), + NULL + }, + { + "add-entry", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_("Add a new Entry in forms dialog"), + N_("Field name") + }, + { + "add-password", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_("Add a new Password Entry in forms dialog"), + N_("Field name") + }, + { + "add-calendar", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_("Add a new Calendar in forms dialog"), + N_("Calendar field name") + }, + { + "text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_("Set the dialog text"), + N_("TEXT") + }, + { + "separator", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_separator, + N_("Set output separator character"), + N_("SEPARATOR") + }, + { + "date-format", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_forms_date_format, + N_("Set the format for the returned date"), + N_("PATTERN") + }, + { + NULL + } +}; + static GOptionEntry password_dialog_options[] = { { "password", @@ -947,6 +1026,7 @@ zenity_option_init (void) { #endif results->color_data = g_new0 (ZenityColorData, 1); results->password_data = g_new0 (ZenityPasswordData, 1); + results->forms_data = g_new0 (ZenityFormsData, 1); } void @@ -964,6 +1044,9 @@ zenity_option_free (void) { if (zenity_calendar_date_format) g_free (zenity_calendar_date_format); + if (zenity_forms_date_format) + g_free (zenity_forms_date_format); + if (zenity_entry_entry_text) g_free (zenity_entry_entry_text); @@ -1014,6 +1097,27 @@ zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) return NULL; } +/* Forms callback */ +static gboolean +zenity_forms_callback (const gchar *option_name, + const gchar *value, + gpointer data, + GError **error) +{ + ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1); + forms_value->option_value = g_strdup(value); + if (g_strcmp0(option_name, "--add-entry") == 0) + forms_value->type = ZENITY_FORMS_ENTRY; + else if (g_strcmp0(option_name, "--add-calendar") == 0) + forms_value->type = ZENITY_FORMS_CALENDAR; + else if (g_strcmp0(option_name, "--add-password") == 0) + forms_value->type = ZENITY_FORMS_PASSWORD; + + results->forms_data->list = g_slist_append(results->forms_data->list, forms_value); + + return TRUE; +} + /* Error callback */ static void zenity_option_error_callback (GOptionContext *context, @@ -1234,6 +1338,17 @@ zenity_password_pre_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_forms_pre_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_forms_active = FALSE; + zenity_forms_date_format = NULL; + return TRUE; +} + static gboolean zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group, @@ -1631,6 +1746,30 @@ zenity_color_post_callback (GOptionContext *context, return TRUE; } +static gboolean +zenity_forms_post_callback (GOptionContext *context, + GOptionGroup *group, + gpointer data, + GError **error) +{ + zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS); + if (results->mode == MODE_FORMS) { + results->forms_data->dialog_text = zenity_general_dialog_text; + results->forms_data->separator = zenity_general_separator; + if (zenity_forms_date_format) + results->forms_data->date_format = zenity_forms_date_format; + else + results->forms_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); + } else { + if (zenity_forms_date_format) + zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_date_format), + ERROR_SUPPORT); + } + + return TRUE; +} + + static gboolean zenity_password_post_callback (GOptionContext *context, GOptionGroup *group, @@ -1836,6 +1975,17 @@ zenity_create_context (void) g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); g_option_context_add_group(tmp_ctx, a_group); + /* Adds forms dialog option entries */ + a_group = g_option_group_new("forms", + N_("Forms dialog options"), + N_("Show forms dialog options"), NULL, NULL); + g_option_group_add_entries (a_group, forms_dialog_options); + g_option_group_set_parse_hooks (a_group, + zenity_forms_pre_callback, zenity_forms_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group(tmp_ctx, a_group); + /* Adds misc option entries */ a_group = g_option_group_new("misc", N_("Miscellaneous options"), @@ -1899,7 +2049,7 @@ zenity_option_parse (gint argc, gchar **argv) zenity_option_error (zenity_option_get_name (calendar_options, &zenity_general_dialog_text), ERROR_SUPPORT); if (strcmp (zenity_general_separator, "|") != 0) - if (results->mode != MODE_LIST && results->mode != MODE_FILE) + if (results->mode != MODE_LIST && results->mode != MODE_FILE && results->mode != MODE_FORMS) zenity_option_error (zenity_option_get_name (list_options, &zenity_general_separator), ERROR_SUPPORT); if (zenity_general_multiple) -- cgit From dc0c483b915c2185399fac3dd4d56466c0026fb0 Mon Sep 17 00:00:00 2001 From: Luca Ferretti Date: Thu, 17 Mar 2011 12:02:20 +0100 Subject: Use proper case in forms dialog option values --- src/option.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index cd812091..5e3032e4 100644 --- a/src/option.c +++ b/src/option.c @@ -869,7 +869,7 @@ static GOptionEntry forms_dialog_options[] = { G_OPTION_ARG_CALLBACK, zenity_forms_callback, N_("Add a new Entry in forms dialog"), - N_("Field name") + N_("FIELDNAME") }, { "add-password", @@ -878,7 +878,7 @@ static GOptionEntry forms_dialog_options[] = { G_OPTION_ARG_CALLBACK, zenity_forms_callback, N_("Add a new Password Entry in forms dialog"), - N_("Field name") + N_("FIELDNAME") }, { "add-calendar", @@ -887,7 +887,7 @@ static GOptionEntry forms_dialog_options[] = { G_OPTION_ARG_CALLBACK, zenity_forms_callback, N_("Add a new Calendar in forms dialog"), - N_("Calendar field name") + N_("CALENDARNAME") }, { "text", -- cgit From 40cae89ace1678b7b4c77276e20ce756b1263648 Mon Sep 17 00:00:00 2001 From: Luca Ferretti Date: Thu, 17 Mar 2011 12:56:28 +0100 Subject: Revert mistakely pushed string change --- src/option.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 5e3032e4..cd812091 100644 --- a/src/option.c +++ b/src/option.c @@ -869,7 +869,7 @@ static GOptionEntry forms_dialog_options[] = { G_OPTION_ARG_CALLBACK, zenity_forms_callback, N_("Add a new Entry in forms dialog"), - N_("FIELDNAME") + N_("Field name") }, { "add-password", @@ -878,7 +878,7 @@ static GOptionEntry forms_dialog_options[] = { G_OPTION_ARG_CALLBACK, zenity_forms_callback, N_("Add a new Password Entry in forms dialog"), - N_("FIELDNAME") + N_("Field name") }, { "add-calendar", @@ -887,7 +887,7 @@ static GOptionEntry forms_dialog_options[] = { G_OPTION_ARG_CALLBACK, zenity_forms_callback, N_("Add a new Calendar in forms dialog"), - N_("CALENDARNAME") + N_("Calendar field name") }, { "text", -- cgit From 5872558feef3727e3ff1bb2bf395dfc6bd896f74 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 28 Jun 2011 17:09:04 -0300 Subject: This change add a new functionality to text-info: * Added a cancel button returning 1 if clicked * Renamed the Close button to Ok, still returning 0 if clicked * Added --ok-label=TEXT option to change the Ok button label * Added --cancel-label=TEXT option to change the Cancel button label * Added --checkbox=TEXT option to show an "I Agree and accept the terms" checkbox If --checkbox is enabled, the Ok button will be disabled if the checkbox isn't checked. --- src/option.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 17 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index cd812091..954ba648 100644 --- a/src/option.c +++ b/src/option.c @@ -41,6 +41,8 @@ static gboolean zenity_general_editable; static gchar *zenity_general_uri; static gboolean zenity_general_dialog_no_wrap; static gint zenity_general_timeout_delay; +static gchar *zenity_general_ok_button; +static gchar *zenity_general_cancel_button; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; @@ -92,12 +94,11 @@ static gboolean zenity_progress_no_cancel; /* Question Dialog Options */ static gboolean zenity_question_active; -static gchar *zenity_question_ok_button; -static gchar *zenity_question_cancel_button; /* Text Dialog Options */ static gboolean zenity_text_active; static gchar *zenity_text_font; +static gchar *zenity_text_checkbox; /* Warning Dialog Options */ static gboolean zenity_warning_active; @@ -672,7 +673,7 @@ static GOptionEntry question_options[] = { '\0', G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, - &zenity_question_ok_button, + &zenity_general_ok_button, N_("Sets the label of the Ok button"), N_("TEXT") }, @@ -681,7 +682,7 @@ static GOptionEntry question_options[] = { '\0', G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, - &zenity_question_cancel_button, + &zenity_general_cancel_button, N_("Sets the label of the Cancel button"), N_("TEXT") }, @@ -736,6 +737,33 @@ static GOptionEntry text_options[] = { N_("Set the text font"), N_("TEXT") }, + { + "ok-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_ok_button, + N_("Sets the label of the Ok button"), + N_("TEXT") + }, + { + "cancel-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_cancel_button, + N_("Sets the label of the Cancel button"), + N_("TEXT") + }, + { + "checkbox", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_text_checkbox, + N_("Enable a I read and agree checkbox"), + N_("TEXT") + }, { NULL } @@ -1040,6 +1068,10 @@ zenity_option_free (void) { if (zenity_general_uri) g_free (zenity_general_uri); g_free (zenity_general_separator); + if (zenity_general_ok_button) + g_free (zenity_general_ok_button); + if (zenity_general_cancel_button) + g_free (zenity_general_cancel_button); if (zenity_calendar_date_format) g_free (zenity_calendar_date_format); @@ -1060,13 +1092,10 @@ zenity_option_free (void) { if (zenity_list_hide_column) g_free (zenity_list_hide_column); - if (zenity_question_ok_button) - g_free (zenity_question_ok_button); - if (zenity_question_cancel_button) - g_free (zenity_question_cancel_button); - if (zenity_text_font) g_free (zenity_text_font); + if (zenity_text_checkbox) + g_free (zenity_text_checkbox); if (zenity_colorsel_color) g_free (zenity_colorsel_color); @@ -1145,6 +1174,8 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_multiple = FALSE; zenity_general_editable = FALSE; zenity_general_uri = NULL; + zenity_general_ok_button = NULL; + zenity_general_cancel_button = NULL; zenity_general_dialog_no_wrap = FALSE; zenity_general_timeout_delay = -1; @@ -1281,7 +1312,7 @@ zenity_text_pre_callback (GOptionContext *context, { zenity_text_active = FALSE; zenity_text_font = NULL; - + zenity_text_checkbox = NULL; return TRUE; } @@ -1610,7 +1641,6 @@ zenity_progress_post_callback (GOptionContext *context, GError **error) { zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS); - if (results->mode == MODE_PROGRESS) { results->progress_data->dialog_text = zenity_general_dialog_text; results->progress_data->pulsate = zenity_progress_pulsate; @@ -1649,14 +1679,12 @@ zenity_question_post_callback (GOptionContext *context, GError **error) { zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION); - - if (results->mode == MODE_QUESTION) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; - results->msg_data->ok_label = zenity_question_ok_button; - results->msg_data->cancel_label = zenity_question_cancel_button; + results->msg_data->ok_label = zenity_general_ok_button; + results->msg_data->cancel_label = zenity_general_cancel_button; } return TRUE; @@ -1675,12 +1703,14 @@ zenity_text_post_callback (GOptionContext *context, results->text_data->editable = zenity_general_editable; results->text_data->no_wrap = zenity_general_dialog_no_wrap; results->text_data->font = zenity_text_font; + results->text_data->ok_label = zenity_general_ok_button; + results->text_data->cancel_label = zenity_general_cancel_button; + results->text_data->checkbox = zenity_text_checkbox; } else { - if (zenity_text_font) + if (zenity_text_font) zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), ERROR_SUPPORT); } - return TRUE; } @@ -2063,7 +2093,15 @@ zenity_option_parse (gint argc, gchar **argv) if (zenity_general_uri) if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); + + if (zenity_general_ok_button) + if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_ok_button), ERROR_SUPPORT); + if (zenity_general_cancel_button) + if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_cancel_button), ERROR_SUPPORT); + if (zenity_general_dialog_no_wrap) if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); -- cgit From d8954d9222654f645ebdcc1752c70be97faaae45 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Wed, 6 Jul 2011 14:55:30 -0300 Subject: Patch for bug #621907 This patch add the option --no-markup in the info, warning, error and question dialogs So if the user wants to use & \ ' and other symbols, now he can, and no error will be showed. --- src/option.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 954ba648..079bd02e 100644 --- a/src/option.c +++ b/src/option.c @@ -40,6 +40,7 @@ static gboolean zenity_general_multiple; static gboolean zenity_general_editable; static gchar *zenity_general_uri; static gboolean zenity_general_dialog_no_wrap; +static gboolean zenity_general_dialog_no_markup; static gint zenity_general_timeout_delay; static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; @@ -318,6 +319,14 @@ static GOptionEntry error_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -351,6 +360,14 @@ static GOptionEntry info_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -695,6 +712,14 @@ static GOptionEntry question_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -797,6 +822,14 @@ static GOptionEntry warning_options[] = { N_("Do not enable text wrapping"), NULL }, + { + "no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_("Do not enable pango markup") + }, { NULL } @@ -1177,6 +1210,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_ok_button = NULL; zenity_general_cancel_button = NULL; zenity_general_dialog_no_wrap = FALSE; + zenity_general_dialog_no_markup = FALSE; zenity_general_timeout_delay = -1; return TRUE; @@ -1498,6 +1532,7 @@ zenity_error_post_callback (GOptionContext *context, results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_ERROR; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; } return TRUE; @@ -1514,7 +1549,8 @@ zenity_info_post_callback (GOptionContext *context, if (results->mode == MODE_INFO) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_INFO; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; } return TRUE; @@ -1683,6 +1719,7 @@ zenity_question_post_callback (GOptionContext *context, results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; results->msg_data->ok_label = zenity_general_ok_button; results->msg_data->cancel_label = zenity_general_cancel_button; } @@ -1725,7 +1762,8 @@ zenity_warning_post_callback (GOptionContext *context, if (results->mode == MODE_WARNING) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->mode = ZENITY_MSG_WARNING; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; } return TRUE; -- cgit From 1d339e29a782de8962379652635c9ee42988d99c Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 19 Jul 2011 14:33:28 -0300 Subject: Enable html support in --text-info option. This fix bug #598655, thanks for the work from Francis Meyvis francis.meyvis at gmail dot com. Two new options in --text-info: * --html - enable HTML support. * --url - load an url If you need to load a local html file, you can use --filename=patch/to/html. Examples: * zenity --text-info --html --filename=file.html * zenity --text-info --html --url=www.gnome.org Zenity will add http:// if isn't declared in --url --- src/option.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 079bd02e..e5f79b9e 100644 --- a/src/option.c +++ b/src/option.c @@ -100,6 +100,10 @@ static gboolean zenity_question_active; static gboolean zenity_text_active; static gchar *zenity_text_font; static gchar *zenity_text_checkbox; +#ifdef HAVE_WEBKITGTK +static gboolean zenity_text_enable_html; +static gchar *zenity_text_url; +#endif /* Warning Dialog Options */ static gboolean zenity_warning_active; @@ -786,9 +790,29 @@ static GOptionEntry text_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_text_checkbox, - N_("Enable a I read and agree checkbox"), + N_("Enable an I read and agree checkbox"), N_("TEXT") }, +#ifdef HAVE_WEBKITGTK + { + "html", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_text_enable_html, + N_("Enable html support"), + NULL + }, + { + "url", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_text_url, + N_("Sets an url instead of a file. Only works if you use --html option"), + N_("URL") + }, +#endif { NULL } @@ -1347,6 +1371,10 @@ zenity_text_pre_callback (GOptionContext *context, zenity_text_active = FALSE; zenity_text_font = NULL; zenity_text_checkbox = NULL; +#ifdef HAVE_WEBKITGTK + zenity_text_enable_html = FALSE; + zenity_text_url = NULL; +#endif return TRUE; } @@ -1743,6 +1771,10 @@ zenity_text_post_callback (GOptionContext *context, results->text_data->ok_label = zenity_general_ok_button; results->text_data->cancel_label = zenity_general_cancel_button; results->text_data->checkbox = zenity_text_checkbox; +#ifdef HAVE_WEBKITGTK + results->text_data->html = zenity_text_enable_html; + results->text_data->url = zenity_text_url; +#endif } else { if (zenity_text_font) zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), -- cgit From 6768a40e997697d05008aecdb41815e1dbae61c6 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 26 Jul 2011 14:00:28 -0300 Subject: Fix for bug #611297 Now Zenity have --ok-label and --cancel-label in all dialogs. This patch doesn't break old zenity scripts. --- src/option.c | 76 +++++++++++++++++++++++------------------------------------- 1 file changed, 29 insertions(+), 47 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index e5f79b9e..e9d370d0 100644 --- a/src/option.c +++ b/src/option.c @@ -187,6 +187,24 @@ static GOptionEntry general_options[] = { /* Timeout for closing the dialog */ N_("TIMEOUT") }, + { + "ok-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_ok_button, + N_("Sets the label of the Ok button"), + N_("TEXT") + }, + { + "cancel-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_cancel_button, + N_("Sets the label of the Cancel button"), + N_("TEXT") + }, { NULL } @@ -689,24 +707,6 @@ static GOptionEntry question_options[] = { N_("Set the dialog text"), N_("TEXT") }, - { - "ok-label", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_ok_button, - N_("Sets the label of the Ok button"), - N_("TEXT") - }, - { - "cancel-label", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_cancel_button, - N_("Sets the label of the Cancel button"), - N_("TEXT") - }, { "no-wrap", '\0', @@ -766,24 +766,6 @@ static GOptionEntry text_options[] = { N_("Set the text font"), N_("TEXT") }, - { - "ok-label", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_ok_button, - N_("Sets the label of the Ok button"), - N_("TEXT") - }, - { - "cancel-label", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_cancel_button, - N_("Sets the label of the Cancel button"), - N_("TEXT") - }, { "checkbox", '\0', @@ -1467,7 +1449,9 @@ zenity_general_post_callback (GOptionContext *context, results->data->window_icon = zenity_general_window_icon; results->data->width = zenity_general_width; results->data->height = zenity_general_height; - results->data->timeout_delay=zenity_general_timeout_delay; + results->data->timeout_delay = zenity_general_timeout_delay; + results->data->ok_label = zenity_general_ok_button; + results->data->cancel_label = zenity_general_cancel_button; return TRUE; } @@ -1497,6 +1481,7 @@ zenity_calendar_post_callback (GOptionContext *context, results->calendar_data->day = zenity_calendar_day; results->calendar_data->month = zenity_calendar_month; results->calendar_data->year = zenity_calendar_year; + if (zenity_calendar_date_format) results->calendar_data->date_format = zenity_calendar_date_format; else @@ -1748,8 +1733,6 @@ zenity_question_post_callback (GOptionContext *context, results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; - results->msg_data->ok_label = zenity_general_ok_button; - results->msg_data->cancel_label = zenity_general_cancel_button; } return TRUE; @@ -1768,8 +1751,6 @@ zenity_text_post_callback (GOptionContext *context, results->text_data->editable = zenity_general_editable; results->text_data->no_wrap = zenity_general_dialog_no_wrap; results->text_data->font = zenity_text_font; - results->text_data->ok_label = zenity_general_ok_button; - results->text_data->cancel_label = zenity_general_cancel_button; results->text_data->checkbox = zenity_text_checkbox; #ifdef HAVE_WEBKITGTK results->text_data->html = zenity_text_enable_html; @@ -2163,15 +2144,16 @@ zenity_option_parse (gint argc, gchar **argv) if (zenity_general_uri) if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); - + if (zenity_general_ok_button) - if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) - zenity_option_error (zenity_option_get_name (text_options, &zenity_general_ok_button), ERROR_SUPPORT); + if(results->mode == MODE_FILE) + zenity_option_error (zenity_option_get_name (general_options, &zenity_general_ok_button), ERROR_SUPPORT); if (zenity_general_cancel_button) - if(results->mode != MODE_QUESTION && results->mode != MODE_TEXTINFO) - zenity_option_error (zenity_option_get_name (text_options, &zenity_general_cancel_button), ERROR_SUPPORT); - + if(results->mode == MODE_FILE || results->mode == MODE_ERROR || results->mode == MODE_WARNING || results->mode == MODE_INFO) + zenity_option_error (zenity_option_get_name (general_options, &zenity_general_cancel_button), ERROR_SUPPORT); + + if (zenity_general_dialog_no_wrap) if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); -- cgit From ed825cf92b9d786b9b13361db4a0e696af347a59 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 13 Oct 2011 13:40:40 -0300 Subject: Initial support for list/tree on --forms option Added zenity --add-list and --list-values on --forms option. This is an initial support. Next steps add support to multiple selections and multiple columns --- src/option.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index e9d370d0..8cfed08b 100644 --- a/src/option.c +++ b/src/option.c @@ -129,6 +129,7 @@ static gboolean zenity_password_show_username; /* Forms Dialog Options */ static gboolean zenity_forms_active; static gchar *zenity_forms_date_format; +static gchar **zenity_forms_list_values; /* Miscelaneus Options */ static gboolean zenity_misc_about; @@ -956,6 +957,24 @@ static GOptionEntry forms_dialog_options[] = { N_("Add a new Calendar in forms dialog"), N_("Calendar field name") }, + { + "add-list", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_("Add a new List in forms dialog"), + N_("List field and header name") + }, + { + "list-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_list_values, + N_("List of values for List"), + N_("List of values separated by |") + }, { "text", '\0', @@ -1117,6 +1136,8 @@ zenity_option_free (void) { if (zenity_forms_date_format) g_free (zenity_forms_date_format); + if (zenity_forms_list_values) + g_strfreev (zenity_forms_list_values); if (zenity_entry_entry_text) g_free (zenity_entry_entry_text); @@ -1173,13 +1194,17 @@ zenity_forms_callback (const gchar *option_name, GError **error) { ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1); - forms_value->option_value = g_strdup(value); - if (g_strcmp0(option_name, "--add-entry") == 0) + + forms_value->option_value = g_strdup (value); + + if (g_strcmp0 (option_name, "--add-entry") == 0) forms_value->type = ZENITY_FORMS_ENTRY; - else if (g_strcmp0(option_name, "--add-calendar") == 0) + else if (g_strcmp0 (option_name, "--add-calendar") == 0) forms_value->type = ZENITY_FORMS_CALENDAR; - else if (g_strcmp0(option_name, "--add-password") == 0) + else if (g_strcmp0 (option_name, "--add-password") == 0) forms_value->type = ZENITY_FORMS_PASSWORD; + else if (g_strcmp0 (option_name, "--add-list") == 0) + forms_value->type = ZENITY_FORMS_LIST; results->forms_data->list = g_slist_append(results->forms_data->list, forms_value); @@ -1833,10 +1858,20 @@ zenity_forms_post_callback (GOptionContext *context, gpointer data, GError **error) { + gchar *values; + int i = 0; + zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS); if (results->mode == MODE_FORMS) { results->forms_data->dialog_text = zenity_general_dialog_text; results->forms_data->separator = zenity_general_separator; + if (zenity_forms_list_values) { + values = zenity_forms_list_values[0]; + while (values != NULL) { + results->forms_data->list_values = g_slist_append (results->forms_data->list_values, values); + values = zenity_forms_list_values[++i]; + } + } if (zenity_forms_date_format) results->forms_data->date_format = zenity_forms_date_format; else -- cgit From de352548229f60940ed9cc09bcedc883d104f311 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 13 Oct 2011 15:21:32 -0300 Subject: Revert "Initial support for list/tree on --forms option Added zenity --add-list and --list-values on --forms option. This is an initial support. Next steps add support to multiple selections and multiple columns" This reverts commit ed825cf92b9d786b9b13361db4a0e696af347a59. --- src/option.c | 43 ++++--------------------------------------- 1 file changed, 4 insertions(+), 39 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 8cfed08b..e9d370d0 100644 --- a/src/option.c +++ b/src/option.c @@ -129,7 +129,6 @@ static gboolean zenity_password_show_username; /* Forms Dialog Options */ static gboolean zenity_forms_active; static gchar *zenity_forms_date_format; -static gchar **zenity_forms_list_values; /* Miscelaneus Options */ static gboolean zenity_misc_about; @@ -957,24 +956,6 @@ static GOptionEntry forms_dialog_options[] = { N_("Add a new Calendar in forms dialog"), N_("Calendar field name") }, - { - "add-list", - '\0', - 0, - G_OPTION_ARG_CALLBACK, - zenity_forms_callback, - N_("Add a new List in forms dialog"), - N_("List field and header name") - }, - { - "list-values", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_forms_list_values, - N_("List of values for List"), - N_("List of values separated by |") - }, { "text", '\0', @@ -1136,8 +1117,6 @@ zenity_option_free (void) { if (zenity_forms_date_format) g_free (zenity_forms_date_format); - if (zenity_forms_list_values) - g_strfreev (zenity_forms_list_values); if (zenity_entry_entry_text) g_free (zenity_entry_entry_text); @@ -1194,17 +1173,13 @@ zenity_forms_callback (const gchar *option_name, GError **error) { ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1); - - forms_value->option_value = g_strdup (value); - - if (g_strcmp0 (option_name, "--add-entry") == 0) + forms_value->option_value = g_strdup(value); + if (g_strcmp0(option_name, "--add-entry") == 0) forms_value->type = ZENITY_FORMS_ENTRY; - else if (g_strcmp0 (option_name, "--add-calendar") == 0) + else if (g_strcmp0(option_name, "--add-calendar") == 0) forms_value->type = ZENITY_FORMS_CALENDAR; - else if (g_strcmp0 (option_name, "--add-password") == 0) + else if (g_strcmp0(option_name, "--add-password") == 0) forms_value->type = ZENITY_FORMS_PASSWORD; - else if (g_strcmp0 (option_name, "--add-list") == 0) - forms_value->type = ZENITY_FORMS_LIST; results->forms_data->list = g_slist_append(results->forms_data->list, forms_value); @@ -1858,20 +1833,10 @@ zenity_forms_post_callback (GOptionContext *context, gpointer data, GError **error) { - gchar *values; - int i = 0; - zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS); if (results->mode == MODE_FORMS) { results->forms_data->dialog_text = zenity_general_dialog_text; results->forms_data->separator = zenity_general_separator; - if (zenity_forms_list_values) { - values = zenity_forms_list_values[0]; - while (values != NULL) { - results->forms_data->list_values = g_slist_append (results->forms_data->list_values, values); - values = zenity_forms_list_values[++i]; - } - } if (zenity_forms_date_format) results->forms_data->date_format = zenity_forms_date_format; else -- cgit From 82d09a41f2d7f6c13f207d05f2c594f3657fc599 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Wed, 21 Dec 2011 10:20:29 -0200 Subject: Added support to lists on zenity --forms --- src/option.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 99 insertions(+), 5 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index e9d370d0..7fdb7f1d 100644 --- a/src/option.c +++ b/src/option.c @@ -128,7 +128,11 @@ static gboolean zenity_password_show_username; /* Forms Dialog Options */ static gboolean zenity_forms_active; +static gboolean zenity_forms_show_header; static gchar *zenity_forms_date_format; +//static gchar *zenity_forms_hide_column; +static gchar **zenity_forms_list_values; +static gchar **zenity_forms_column_values; /* Miscelaneus Options */ static gboolean zenity_misc_about; @@ -956,6 +960,52 @@ static GOptionEntry forms_dialog_options[] = { N_("Add a new Calendar in forms dialog"), N_("Calendar field name") }, + { + "add-list", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_("Add a new List in forms dialog"), + N_("List field and header name") + }, + { + "list-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_list_values, + N_("List of values for List"), + N_("List of values separated by |") + }, + { + "column-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_column_values, + N_("List of values for columns"), + N_("List of values separated by |") + }, + /* TODO: Implement how to hide specifc column + { + "hide-column", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_forms_hide_column, + N_("Hide a specific column"), + N_("NUMBER") + },*/ + { + "show-header", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_forms_show_header, + N_("Show the columns header"), + NULL + }, { "text", '\0', @@ -1117,7 +1167,12 @@ zenity_option_free (void) { if (zenity_forms_date_format) g_free (zenity_forms_date_format); - + if (zenity_forms_list_values) + g_strfreev (zenity_forms_list_values); + if (zenity_forms_column_values) + g_strfreev (zenity_forms_column_values); +// if (zenity_forms_hide_column) +// g_free (zenity_forms_hide_column); if (zenity_entry_entry_text) g_free (zenity_entry_entry_text); @@ -1173,13 +1228,17 @@ zenity_forms_callback (const gchar *option_name, GError **error) { ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1); - forms_value->option_value = g_strdup(value); - if (g_strcmp0(option_name, "--add-entry") == 0) + + forms_value->option_value = g_strdup (value); + + if (g_strcmp0 (option_name, "--add-entry") == 0) forms_value->type = ZENITY_FORMS_ENTRY; - else if (g_strcmp0(option_name, "--add-calendar") == 0) + else if (g_strcmp0 (option_name, "--add-calendar") == 0) forms_value->type = ZENITY_FORMS_CALENDAR; - else if (g_strcmp0(option_name, "--add-password") == 0) + else if (g_strcmp0 (option_name, "--add-password") == 0) forms_value->type = ZENITY_FORMS_PASSWORD; + else if (g_strcmp0 (option_name, "--add-list") == 0) + forms_value->type = ZENITY_FORMS_LIST; results->forms_data->list = g_slist_append(results->forms_data->list, forms_value); @@ -1420,7 +1479,9 @@ zenity_forms_pre_callback (GOptionContext *context, GError **error) { zenity_forms_active = FALSE; + zenity_forms_show_header = FALSE; zenity_forms_date_format = NULL; +// zenity_forms_hide_column = NULL; return TRUE; } @@ -1833,10 +1894,31 @@ zenity_forms_post_callback (GOptionContext *context, gpointer data, GError **error) { + gchar *values; + int i = 0; + zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS); if (results->mode == MODE_FORMS) { results->forms_data->dialog_text = zenity_general_dialog_text; results->forms_data->separator = zenity_general_separator; +// results->forms_data->hide_column = zenity_forms_hide_column; + results->forms_data->show_header = zenity_forms_show_header; + + if (zenity_forms_list_values) { + values = zenity_forms_list_values[0]; + while (values != NULL) { + results->forms_data->list_values = g_slist_append (results->forms_data->list_values, values); + values = zenity_forms_list_values[++i]; + } + } + if (zenity_forms_column_values) { + i = 0; + values = zenity_forms_column_values[0]; + while (values != NULL) { + results->forms_data->column_values = g_slist_append (results->forms_data->column_values, values); + values = zenity_forms_list_values[++i]; + } + } if (zenity_forms_date_format) results->forms_data->date_format = zenity_forms_date_format; else @@ -1845,6 +1927,18 @@ zenity_forms_post_callback (GOptionContext *context, if (zenity_forms_date_format) zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_date_format), ERROR_SUPPORT); + if (zenity_forms_list_values) + zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_list_values), + ERROR_SUPPORT); +// if (zenity_forms_hide_column) +// zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_hide_column), +// ERROR_SUPPORT); + if (zenity_forms_column_values) + zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_column_values), + ERROR_SUPPORT); + if (zenity_forms_show_header) + zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_show_header), + ERROR_SUPPORT); } return TRUE; -- cgit From d845087870a8994dfb0842bf72ca7a5d5138fbef Mon Sep 17 00:00:00 2001 From: Alexandre Rostovtsev Date: Sat, 19 May 2012 20:53:27 -0400 Subject: Do not crash in --forms --add-list without column values Be a bit more user friendly, and instead of crashing, add a default column name if the user forgot to use --column-values with a --forms list. https://bugzilla.gnome.org/show_bug.cgi?id=676406 --- src/option.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 7fdb7f1d..334ec86a 100644 --- a/src/option.c +++ b/src/option.c @@ -1918,7 +1918,9 @@ zenity_forms_post_callback (GOptionContext *context, results->forms_data->column_values = g_slist_append (results->forms_data->column_values, values); values = zenity_forms_list_values[++i]; } - } + } else + results->forms_data->column_values = g_slist_append (NULL, "column"); + if (zenity_forms_date_format) results->forms_data->date_format = zenity_forms_date_format; else -- cgit From c17eff5863009c69196e92520b150643f1f7937d Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 19 Jul 2012 14:22:25 -0300 Subject: Added support to --imagelist on tree. Thanks to Joshua Nathaniel Pritikin now the first column can have an image. --- src/option.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 334ec86a..ee0e9c28 100644 --- a/src/option.c +++ b/src/option.c @@ -78,6 +78,7 @@ static gboolean zenity_list_radiolist; static gchar *zenity_list_print_column; static gchar *zenity_list_hide_column; static gboolean zenity_list_hide_header; +static gboolean zenity_list_imagelist; #ifdef HAVE_LIBNOTIFY /* Notification Dialog Options */ @@ -524,6 +525,15 @@ static GOptionEntry list_options[] = { N_("Use radio buttons for first column"), NULL }, + { + "imagelist", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_list_imagelist, + N_("Use an image for first column"), + NULL + }, { "separator", '\0', @@ -1356,6 +1366,7 @@ zenity_list_pre_callback (GOptionContext *context, zenity_list_columns = NULL; zenity_list_checklist = FALSE; zenity_list_radiolist = FALSE; + zenity_list_imagelist = FALSE; zenity_list_hide_header = FALSE; zenity_list_print_column = NULL; zenity_list_hide_column = NULL; @@ -1687,6 +1698,7 @@ zenity_list_post_callback (GOptionContext *context, results->tree_data->checkbox = zenity_list_checklist; results->tree_data->radiobox = zenity_list_radiolist; + results->tree_data->imagebox = zenity_list_imagelist; results->tree_data->multi = zenity_general_multiple; results->tree_data->editable = zenity_general_editable; results->tree_data->print_column = zenity_list_print_column; @@ -1706,6 +1718,10 @@ zenity_list_post_callback (GOptionContext *context, zenity_option_error (zenity_option_get_name (list_options, &zenity_list_radiolist), ERROR_SUPPORT); + if (zenity_list_imagelist) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_imagelist), + ERROR_SUPPORT); + if (zenity_list_print_column) zenity_option_error (zenity_option_get_name (list_options, &zenity_list_print_column), ERROR_SUPPORT); -- cgit From 8777940f499a4a37fdb7c118de50f39cfa62f34b Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 19 Jul 2012 14:44:53 -0300 Subject: Fixing string freeze --- src/option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index ee0e9c28..19fbbc72 100644 --- a/src/option.c +++ b/src/option.c @@ -525,7 +525,7 @@ static GOptionEntry list_options[] = { N_("Use radio buttons for first column"), NULL }, - { + /* { "imagelist", '\0', 0, @@ -533,7 +533,7 @@ static GOptionEntry list_options[] = { &zenity_list_imagelist, N_("Use an image for first column"), NULL - }, + },*/ { "separator", '\0', -- cgit From 31eef0cd8acf91aba30b5b94d5544247ebaff6bd Mon Sep 17 00:00:00 2001 From: Piotr Drąg Date: Sat, 21 Jul 2012 01:07:48 +0200 Subject: Revert "Fixing string freeze" This reverts commit 8777940f499a4a37fdb7c118de50f39cfa62f34b. The master branch is not yet affected by the string freeze. --- src/option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 19fbbc72..ee0e9c28 100644 --- a/src/option.c +++ b/src/option.c @@ -525,7 +525,7 @@ static GOptionEntry list_options[] = { N_("Use radio buttons for first column"), NULL }, - /* { + { "imagelist", '\0', 0, @@ -533,7 +533,7 @@ static GOptionEntry list_options[] = { &zenity_list_imagelist, N_("Use an image for first column"), NULL - },*/ + }, { "separator", '\0', -- cgit From 0628bd3291aad936b6b553366600590cca360bfa Mon Sep 17 00:00:00 2001 From: Florian MĆ¼llner Date: Tue, 18 Sep 2012 18:33:07 +0200 Subject: util: Add an option to request dialogs being modal As WMs cannot open windows themselves, Mutter uses zenity to open "Force Quit" dialogs for unresponsive windows; as those are strongly tied to the corresponding window, it makes sense to make them modal (in particular when attaching them to their parent). https://bugzilla.gnome.org/show_bug.cgi?id=684322 --- src/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index ee0e9c28..ba4691d0 100644 --- a/src/option.c +++ b/src/option.c @@ -44,6 +44,7 @@ static gboolean zenity_general_dialog_no_markup; static gint zenity_general_timeout_delay; static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; +static gboolean zenity_general_modal; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; @@ -210,6 +211,15 @@ static GOptionEntry general_options[] = { N_("Sets the label of the Cancel button"), N_("TEXT") }, + { + "modal", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_modal, + N_("Set the modal hint"), + NULL + }, { NULL } @@ -1287,6 +1297,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_dialog_no_wrap = FALSE; zenity_general_dialog_no_markup = FALSE; zenity_general_timeout_delay = -1; + zenity_general_modal = FALSE; return TRUE; } @@ -1524,6 +1535,7 @@ zenity_general_post_callback (GOptionContext *context, results->data->timeout_delay = zenity_general_timeout_delay; results->data->ok_label = zenity_general_ok_button; results->data->cancel_label = zenity_general_cancel_button; + results->data->modal = zenity_general_modal; return TRUE; } -- cgit From bbcb2a3783de925b93707b8e76110ec9ebaed552 Mon Sep 17 00:00:00 2001 From: Florian MĆ¼llner Date: Tue, 18 Sep 2012 22:51:08 +0200 Subject: msg: Add an option to set a custom dialog icon The predefined dialog icons work well in many cases, but sometimes it makes sense to use a more specific icon, so add an option to specify an icon-name to use instead. https://bugzilla.gnome.org/show_bug.cgi?id=684329 --- src/option.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index ba4691d0..13275d1c 100644 --- a/src/option.c +++ b/src/option.c @@ -35,6 +35,7 @@ static gchar *zenity_general_window_icon; static int zenity_general_width; static int zenity_general_height; static gchar *zenity_general_dialog_text; +static gchar *zenity_general_dialog_icon; static gchar *zenity_general_separator; static gboolean zenity_general_multiple; static gboolean zenity_general_editable; @@ -347,6 +348,15 @@ static GOptionEntry error_options[] = { N_("Set the dialog text"), N_("TEXT") }, + { + "icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_("Set the dialog icon"), + N_("ICON-NAME") + }, { "no-wrap", '\0', @@ -388,6 +398,15 @@ static GOptionEntry info_options[] = { N_("Set the dialog text"), N_("TEXT") }, + { + "icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_("Set the dialog icon"), + N_("ICON-NAME") + }, { "no-wrap", '\0', @@ -731,6 +750,15 @@ static GOptionEntry question_options[] = { N_("Set the dialog text"), N_("TEXT") }, + { + "icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_("Set the dialog icon"), + N_("ICON-NAME") + }, { "no-wrap", '\0', @@ -843,6 +871,15 @@ static GOptionEntry warning_options[] = { N_("Set the dialog text"), N_("TEXT") }, + { + "icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_("Set the dialog icon"), + N_("ICON-NAME") + }, { "no-wrap", '\0', @@ -1627,6 +1664,7 @@ zenity_error_post_callback (GOptionContext *context, if (results->mode == MODE_ERROR) { results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; results->msg_data->mode = ZENITY_MSG_ERROR; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; @@ -1645,6 +1683,7 @@ zenity_info_post_callback (GOptionContext *context, if (results->mode == MODE_INFO) { results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; results->msg_data->mode = ZENITY_MSG_INFO; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; @@ -1819,6 +1858,7 @@ zenity_question_post_callback (GOptionContext *context, zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION); if (results->mode == MODE_QUESTION) { results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; @@ -1863,6 +1903,7 @@ zenity_warning_post_callback (GOptionContext *context, if (results->mode == MODE_WARNING) { results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; results->msg_data->mode = ZENITY_MSG_WARNING; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; -- cgit From 156a99e304247504a486f0911596ab5765ad1add Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 25 Sep 2012 18:49:50 -0400 Subject: Don't break the string freeze I'm out of time waiting for a second string freeze break approval, so the strings will be untranslated for now. --- src/option.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 13275d1c..ae2dc080 100644 --- a/src/option.c +++ b/src/option.c @@ -218,7 +218,7 @@ static GOptionEntry general_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_modal, - N_("Set the modal hint"), + "Set the modal hint", NULL }, { @@ -354,8 +354,8 @@ static GOptionEntry error_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_icon, - N_("Set the dialog icon"), - N_("ICON-NAME") + "Set the dialog icon", + "ICON-NAME" }, { "no-wrap", -- cgit From cabf7b76bc258e3f2bb72db5d59e9956def7c6d8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 25 Sep 2012 19:44:46 -0400 Subject: Revert "Don't break the string freeze" This reverts commit 156a99e304247504a486f0911596ab5765ad1add. I got the second string freeze approval after all, so lets add the new strings back. --- src/option.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index ae2dc080..13275d1c 100644 --- a/src/option.c +++ b/src/option.c @@ -218,7 +218,7 @@ static GOptionEntry general_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_modal, - "Set the modal hint", + N_("Set the modal hint"), NULL }, { @@ -354,8 +354,8 @@ static GOptionEntry error_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_dialog_icon, - "Set the dialog icon", - "ICON-NAME" + N_("Set the dialog icon"), + N_("ICON-NAME") }, { "no-wrap", -- cgit From 74d867c2aa9dde9dc21297c67af9e6432124b054 Mon Sep 17 00:00:00 2001 From: Nuno Araujo Date: Thu, 14 Feb 2013 01:08:56 +0100 Subject: Allow to specify notification's hints Desktop Notifications Specification [1] specifies that hints can be used to provide extra data to a notification server. A new command line option --hint allows to add a hint to the notification to display. This option can be used multiple times, one for each hint to add. --hint option format is name:value. The new 'hints' command allow to specify hints in 'listen' mode. Same format that in the command line option is used. Several hints can be passed by separating them by '\n'. Hints of value type '(iiibiiay)' are not supported. This value type is used to pass a raw data image as a hint value. This new change is useful for implementing the NotificationSource [2] GNOME Goal. A application using zenity and having a desktop file, can now specify that it is a notification emitter and it's notifications can be filtered in the new Notifications GNOME control panel pane. [1] http://people.gnome.org/~mccann/docs/notification-spec/notification-spec-latest.html#hints [2] https://live.gnome.org/GnomeGoals/NotificationSource https://bugzilla.gnome.org/show_bug.cgi?id=693751 --- src/option.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 13275d1c..2ca9f1d7 100644 --- a/src/option.c +++ b/src/option.c @@ -86,6 +86,7 @@ static gboolean zenity_list_imagelist; /* Notification Dialog Options */ static gboolean zenity_notification_active; static gboolean zenity_notification_listen; +static gchar **zenity_notification_hints; #endif /* Progress Dialog Options */ @@ -652,6 +653,15 @@ static GOptionEntry notification_options[] = { N_("Listen for commands on stdin"), NULL }, + { + "hint", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING_ARRAY, + &zenity_notification_hints, + N_("Set the notification hints"), + N_("TEXT") + }, { NULL } @@ -1243,6 +1253,11 @@ zenity_option_free (void) { if (zenity_list_hide_column) g_free (zenity_list_hide_column); +#ifdef HAVE_LIBNOTIFY + if (zenity_notification_hints) + g_strfreev (zenity_notification_hints); +#endif + if (zenity_text_font) g_free (zenity_text_font); if (zenity_text_checkbox) @@ -1801,6 +1816,7 @@ zenity_notification_post_callback (GOptionContext *context, if (results->mode == MODE_NOTIFICATION) { results->notification_data->notification_text = zenity_general_dialog_text; results->notification_data->listen = zenity_notification_listen; + results->notification_data->notification_hints = zenity_notification_hints; } else { if (zenity_notification_listen) zenity_option_error (zenity_option_get_name (notification_options, &zenity_notification_listen), -- cgit From 009523d5da827392b027ac6da1a50f94314e3a35 Mon Sep 17 00:00:00 2001 From: Weitian Leung Date: Fri, 23 Aug 2013 09:15:07 +0800 Subject: added attach option for transient window --- src/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 2ca9f1d7..7658e8b4 100644 --- a/src/option.c +++ b/src/option.c @@ -46,6 +46,7 @@ static gint zenity_general_timeout_delay; static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; static gboolean zenity_general_modal; +static gint zenity_general_attach; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; @@ -222,6 +223,15 @@ static GOptionEntry general_options[] = { N_("Set the modal hint"), NULL }, + { + "attach", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_INT, + &zenity_general_attach, + N_("Set the parent window to attach to"), + N_("WINDOW") + }, { NULL } @@ -1350,6 +1360,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_dialog_no_markup = FALSE; zenity_general_timeout_delay = -1; zenity_general_modal = FALSE; + zenity_general_attach = 0; return TRUE; } @@ -1588,6 +1599,7 @@ zenity_general_post_callback (GOptionContext *context, results->data->ok_label = zenity_general_ok_button; results->data->cancel_label = zenity_general_cancel_button; results->data->modal = zenity_general_modal; + results->data->attach = zenity_general_attach; return TRUE; } -- cgit From 8888114fed6e65da0bf9d4a1642a0b591f14d32f Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Wed, 25 Sep 2013 09:34:25 -0300 Subject: Added combobox support on forms dialog --- src/option.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 7658e8b4..d3004fe2 100644 --- a/src/option.c +++ b/src/option.c @@ -138,6 +138,7 @@ static gchar *zenity_forms_date_format; //static gchar *zenity_forms_hide_column; static gchar **zenity_forms_list_values; static gchar **zenity_forms_column_values; +static gchar **zenity_forms_combo_values; /* Miscelaneus Options */ static gboolean zenity_misc_about; @@ -1064,6 +1065,24 @@ static GOptionEntry forms_dialog_options[] = { N_("List of values for columns"), N_("List of values separated by |") }, + { + "add-combo", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_("Add a new combo box in forms dialog"), + N_("Combo box field name") + }, + { + "combo-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_combo_values, + N_("List of values for combo box"), + N_("List of values separated by |") + }, /* TODO: Implement how to hide specifc column { "hide-column", @@ -1246,6 +1265,8 @@ zenity_option_free (void) { g_free (zenity_forms_date_format); if (zenity_forms_list_values) g_strfreev (zenity_forms_list_values); + if (zenity_forms_combo_values) + g_strfreev (zenity_forms_combo_values); if (zenity_forms_column_values) g_strfreev (zenity_forms_column_values); // if (zenity_forms_hide_column) @@ -1321,6 +1342,8 @@ zenity_forms_callback (const gchar *option_name, forms_value->type = ZENITY_FORMS_PASSWORD; else if (g_strcmp0 (option_name, "--add-list") == 0) forms_value->type = ZENITY_FORMS_LIST; + else if (g_strcmp0 (option_name, "--add-combo") == 0) + forms_value->type = ZENITY_FORMS_COMBO; results->forms_data->list = g_slist_append(results->forms_data->list, forms_value); @@ -2018,6 +2041,14 @@ zenity_forms_post_callback (GOptionContext *context, } else results->forms_data->column_values = g_slist_append (NULL, "column"); + if (zenity_forms_combo_values) { + i = 0; + values = zenity_forms_combo_values[0]; + while (values != NULL) { + results->forms_data->combo_values = g_slist_append (results->forms_data->combo_values, values); + values = zenity_forms_combo_values[++i]; + } + } if (zenity_forms_date_format) results->forms_data->date_format = zenity_forms_date_format; else @@ -2035,6 +2066,9 @@ zenity_forms_post_callback (GOptionContext *context, if (zenity_forms_column_values) zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_column_values), ERROR_SUPPORT); + if (zenity_forms_combo_values) + zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_combo_values), + ERROR_SUPPORT); if (zenity_forms_show_header) zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_show_header), ERROR_SUPPORT); -- cgit From b0fc720fe4584530d1090cd3e9175905e6381c85 Mon Sep 17 00:00:00 2001 From: Berislav Kovacki Date: Sat, 23 Nov 2013 16:44:26 -0200 Subject: Bug #534935 Need hability to specify default answer in --question dialog --- src/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index d3004fe2..46112d04 100644 --- a/src/option.c +++ b/src/option.c @@ -100,6 +100,7 @@ static gboolean zenity_progress_no_cancel; /* Question Dialog Options */ static gboolean zenity_question_active; +static gboolean zenity_question_default_cancel; /* Text Dialog Options */ static gboolean zenity_text_active; @@ -797,6 +798,15 @@ static GOptionEntry question_options[] = { &zenity_general_dialog_no_markup, N_("Do not enable pango markup") }, + { + "default-cancel", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_question_default_cancel, + N_("Give cancel button focus by default"), + NULL + }, { NULL } @@ -1507,6 +1517,7 @@ zenity_question_pre_callback (GOptionContext *context, GError **error) { zenity_question_active = FALSE; + zenity_question_default_cancel = FALSE; return TRUE; } @@ -1913,6 +1924,7 @@ zenity_question_post_callback (GOptionContext *context, results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->default_cancel = zenity_question_default_cancel; } return TRUE; -- cgit From 4681d74c02e49c2f3af1da5ce9457807dbcf3f9e Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Sat, 23 Nov 2013 20:32:51 -0200 Subject: Bug #600533 zenity --text-info should have an auto scroll option This is a request to add a auto-scroll option. For now it's only works when text-info is getting the text from stdin. Example usage: cat file.txt | zenity --text-info --auto-scroll --- src/option.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 46112d04..fb25f37c 100644 --- a/src/option.c +++ b/src/option.c @@ -106,6 +106,8 @@ static gboolean zenity_question_default_cancel; static gboolean zenity_text_active; static gchar *zenity_text_font; static gchar *zenity_text_checkbox; +static gboolean zenity_text_auto_scroll; + #ifdef HAVE_WEBKITGTK static gboolean zenity_text_enable_html; static gchar *zenity_text_url; @@ -878,6 +880,15 @@ static GOptionEntry text_options[] = { N_("URL") }, #endif + { + "auto-scroll", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_text_auto_scroll, + N_("Auto scroll the text to the end. Only when text is captured from stdin"), + NULL + }, { NULL } @@ -1531,6 +1542,7 @@ zenity_text_pre_callback (GOptionContext *context, zenity_text_active = FALSE; zenity_text_font = NULL; zenity_text_checkbox = NULL; + zenity_text_auto_scroll = FALSE; #ifdef HAVE_WEBKITGTK zenity_text_enable_html = FALSE; zenity_text_url = NULL; @@ -1944,6 +1956,7 @@ zenity_text_post_callback (GOptionContext *context, results->text_data->no_wrap = zenity_general_dialog_no_wrap; results->text_data->font = zenity_text_font; results->text_data->checkbox = zenity_text_checkbox; + results->text_data->auto_scroll = zenity_text_auto_scroll; #ifdef HAVE_WEBKITGTK results->text_data->html = zenity_text_enable_html; results->text_data->url = zenity_text_url; -- cgit From ec0c2f3292b3db0fdad7f02ed068a97b66f7a2ea Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 20 May 2014 16:05:32 -0300 Subject: Add the --ellipsize option to info, error, warning and question dialogs This option will help people who need to add huge texts in their dialogs and the window size get's very huge due amount of size that GtkLabel requests --- src/option.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index fb25f37c..1b2bb5c9 100644 --- a/src/option.c +++ b/src/option.c @@ -47,6 +47,7 @@ static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; static gboolean zenity_general_modal; static gint zenity_general_attach; +static gboolean zenity_general_dialog_ellipsize; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; @@ -389,6 +390,14 @@ static GOptionEntry error_options[] = { &zenity_general_dialog_no_markup, N_("Do not enable pango markup") }, + { + "ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + }, { NULL } @@ -439,6 +448,14 @@ static GOptionEntry info_options[] = { &zenity_general_dialog_no_markup, N_("Do not enable pango markup") }, + { + "ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + }, { NULL } @@ -809,6 +826,14 @@ static GOptionEntry question_options[] = { N_("Give cancel button focus by default"), NULL }, + { + "ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + }, { NULL } @@ -939,6 +964,14 @@ static GOptionEntry warning_options[] = { &zenity_general_dialog_no_markup, N_("Do not enable pango markup") }, + { + "ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + }, { NULL } @@ -1646,6 +1679,7 @@ zenity_general_post_callback (GOptionContext *context, results->data->cancel_label = zenity_general_cancel_button; results->data->modal = zenity_general_modal; results->data->attach = zenity_general_attach; + return TRUE; } @@ -1741,6 +1775,7 @@ zenity_error_post_callback (GOptionContext *context, results->msg_data->mode = ZENITY_MSG_ERROR; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; } return TRUE; @@ -1760,6 +1795,7 @@ zenity_info_post_callback (GOptionContext *context, results->msg_data->mode = ZENITY_MSG_INFO; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; } return TRUE; @@ -1936,6 +1972,7 @@ zenity_question_post_callback (GOptionContext *context, results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; results->msg_data->default_cancel = zenity_question_default_cancel; } @@ -1983,6 +2020,7 @@ zenity_warning_post_callback (GOptionContext *context, results->msg_data->mode = ZENITY_MSG_WARNING; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; } return TRUE; @@ -2405,10 +2443,13 @@ zenity_option_parse (gint argc, gchar **argv) if(results->mode == MODE_FILE || results->mode == MODE_ERROR || results->mode == MODE_WARNING || results->mode == MODE_INFO) zenity_option_error (zenity_option_get_name (general_options, &zenity_general_cancel_button), ERROR_SUPPORT); - if (zenity_general_dialog_no_wrap) if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); - + + if (zenity_general_dialog_ellipsize) + if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING) + zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_ellipsize), ERROR_SUPPORT); + return results; } -- cgit From c4895ee9a0f3e6ca5aa4113b4bbc3ced0f3d6067 Mon Sep 17 00:00:00 2001 From: Piotr Drąg Date: Tue, 20 May 2014 21:33:52 +0200 Subject: Improve grammar in new translatable strings --- src/option.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 1b2bb5c9..f5c84d54 100644 --- a/src/option.c +++ b/src/option.c @@ -396,7 +396,7 @@ static GOptionEntry error_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_ellipsize, - N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") }, { NULL @@ -454,7 +454,7 @@ static GOptionEntry info_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_ellipsize, - N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") }, { NULL @@ -832,7 +832,7 @@ static GOptionEntry question_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_ellipsize, - N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") }, { NULL @@ -970,7 +970,7 @@ static GOptionEntry warning_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_ellipsize, - N_("Enable ellipsize in dialog text. This fix the high window size with big texts") + N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") }, { NULL -- cgit From 673550b6d326e111867fa78ba4d796045715202e Mon Sep 17 00:00:00 2001 From: Scott Pakin Date: Tue, 5 Aug 2014 15:22:12 -0600 Subject: Added time-remaining support to progress bars Introduced a --time-remaining command-line option that uses the time and percent complete to extrapolate the time remaining until progress reaches 100%. --- src/option.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index f5c84d54..c1e3a77f 100644 --- a/src/option.c +++ b/src/option.c @@ -98,6 +98,7 @@ static gboolean zenity_progress_pulsate; static gboolean zenity_progress_auto_close; static gboolean zenity_progress_auto_kill; static gboolean zenity_progress_no_cancel; +static gboolean zenity_progress_time_remaining; /* Question Dialog Options */ static gboolean zenity_question_active; @@ -767,6 +768,15 @@ static GOptionEntry progress_options[] = { N_("Hide Cancel button"), NULL }, + { + "time-remaining", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_time_remaining, + N_("Estimate when progress will reach 100%"), + NULL + }, { NULL } @@ -1551,6 +1561,7 @@ zenity_progress_pre_callback (GOptionContext *context, zenity_progress_auto_close = FALSE; zenity_progress_auto_kill = FALSE; zenity_progress_no_cancel = FALSE; + zenity_progress_time_remaining = FALSE; return TRUE; } @@ -1935,6 +1946,7 @@ zenity_progress_post_callback (GOptionContext *context, results->progress_data->autokill = zenity_progress_auto_kill; results->progress_data->percentage = zenity_progress_percentage; results->progress_data->no_cancel = zenity_progress_no_cancel; + results->progress_data->time_remaining = zenity_progress_time_remaining; } else { if (zenity_progress_pulsate) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate), @@ -1951,9 +1963,14 @@ zenity_progress_post_callback (GOptionContext *context, if (zenity_progress_auto_kill) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill), ERROR_SUPPORT); + if (zenity_progress_no_cancel) zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_no_cancel), ERROR_SUPPORT); + + if (zenity_progress_time_remaining) + zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_time_remaining), + ERROR_SUPPORT); } return TRUE; -- cgit From 15e2759668a1d17bb1570a890bf294aaa796cbf5 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 21 Oct 2014 18:30:35 +0200 Subject: Bug #685051 Adding --mid-search option to --list This will enable users to find a row with a text matching the middle of the row. Consider the following list: Little piggy one Little piggy two Little piggy three As a user I would expect that entering 'th' would focus the last row, because it's the first one that contains 'th' --- src/option.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index c1e3a77f..e11c1ba9 100644 --- a/src/option.c +++ b/src/option.c @@ -83,6 +83,7 @@ static gchar *zenity_list_print_column; static gchar *zenity_list_hide_column; static gboolean zenity_list_hide_header; static gboolean zenity_list_imagelist; +static gboolean zenity_list_mid_search; #ifdef HAVE_LIBNOTIFY /* Notification Dialog Options */ @@ -651,6 +652,15 @@ static GOptionEntry list_options[] = { N_("Hides the column headers"), NULL }, + { + "mid-search", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_list_mid_search, + N_("Change list default search function searching for text in the middle, not on the beginning"), + NULL + }, { NULL } @@ -1531,6 +1541,7 @@ zenity_list_pre_callback (GOptionContext *context, zenity_list_hide_header = FALSE; zenity_list_print_column = NULL; zenity_list_hide_column = NULL; + zenity_list_mid_search = FALSE; return TRUE; } @@ -1876,6 +1887,7 @@ zenity_list_post_callback (GOptionContext *context, results->tree_data->hide_column = zenity_list_hide_column; results->tree_data->hide_header = zenity_list_hide_header; results->tree_data->separator = zenity_general_separator; + results->tree_data->mid_search = zenity_list_mid_search; } else { if (zenity_list_columns) zenity_option_error (zenity_option_get_name (list_options, &zenity_list_columns), @@ -1904,6 +1916,9 @@ zenity_list_post_callback (GOptionContext *context, if (zenity_list_hide_header) zenity_option_error (zenity_option_get_name (list_options, &zenity_list_hide_header), ERROR_SUPPORT); + if (zenity_list_mid_search) + zenity_option_error (zenity_option_get_name (list_options, &zenity_list_mid_search), + ERROR_SUPPORT); } return TRUE; -- cgit From 5b0553e9ef4fcabebefbc510a088b009af73d4ab Mon Sep 17 00:00:00 2001 From: Kernc Date: Sat, 30 Aug 2014 17:07:52 +0200 Subject: Allow user to interact with --text-info --html WebView This commit changes the default --text-view behavior (when --html is also in effect) so that the clicked links are opened in the default browser (closes #732626). Additionally, a new option is introduced, --prevent-interaction, which disables above behavior. --- src/option.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index e11c1ba9..eb0a03a3 100644 --- a/src/option.c +++ b/src/option.c @@ -113,6 +113,7 @@ static gboolean zenity_text_auto_scroll; #ifdef HAVE_WEBKITGTK static gboolean zenity_text_enable_html; +static gboolean zenity_text_no_interaction; static gchar *zenity_text_url; #endif @@ -915,6 +916,15 @@ static GOptionEntry text_options[] = { N_("Enable html support"), NULL }, + { + "no-interaction", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_text_no_interaction, + N_("Do not enable user interaction with the WebView. Only works if you use --html option"), + NULL + }, { "url", '\0', @@ -1600,6 +1610,7 @@ zenity_text_pre_callback (GOptionContext *context, zenity_text_auto_scroll = FALSE; #ifdef HAVE_WEBKITGTK zenity_text_enable_html = FALSE; + zenity_text_no_interaction = FALSE; zenity_text_url = NULL; #endif return TRUE; @@ -2028,6 +2039,7 @@ zenity_text_post_callback (GOptionContext *context, results->text_data->auto_scroll = zenity_text_auto_scroll; #ifdef HAVE_WEBKITGTK results->text_data->html = zenity_text_enable_html; + results->text_data->no_interaction = zenity_text_no_interaction; results->text_data->url = zenity_text_url; #endif } else { -- cgit From ba5ea0386de2a80a664fb28d3af7e8d395968314 Mon Sep 17 00:00:00 2001 From: Gama Anderson Date: Sat, 28 Feb 2015 20:06:09 +0100 Subject: ADD gchar **extra_label TO struct ZenityData this is done to keep the name of the extra buttons ADD general option "extra-button" with string array as argument This will upon consecutive calls save the name of buttons in an array of strings To all MODES, except notification.c and about.c ADD if (data->extra_label) { gint i=0; while(data->extra_label[i]!=NULL){ gtk_dialog_add_button (GTK_DIALOG (dialog), data->extra_label[i], i); i++; } } This add the extra buttons to the dialog. The response is the number of the button To all MODES response, except notification.c and about.c ADD default: if (response < g_strv_length(zen_data->extra_label)) printf("%s\n",zen_data->extra_label[response]); This will print the button name to stdout when they are pressed ADD question option "switch" This will suppress the standard "ok" and "cancel" button in question. This just wort in combination with --extra-button, otherwise error is raised. https://bugzilla.gnome.org/show_bug.cgi?id=118016 --- src/option.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index eb0a03a3..7ec4b634 100644 --- a/src/option.c +++ b/src/option.c @@ -45,6 +45,7 @@ static gboolean zenity_general_dialog_no_markup; static gint zenity_general_timeout_delay; static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; +static gchar **zenity_general_extra_buttons; static gboolean zenity_general_modal; static gint zenity_general_attach; static gboolean zenity_general_dialog_ellipsize; @@ -104,6 +105,7 @@ static gboolean zenity_progress_time_remaining; /* Question Dialog Options */ static gboolean zenity_question_active; static gboolean zenity_question_default_cancel; +static gboolean zenity_question_switch; /* Text Dialog Options */ static gboolean zenity_text_active; @@ -222,6 +224,15 @@ static GOptionEntry general_options[] = { N_("Sets the label of the Cancel button"), N_("TEXT") }, + { + "extra-button", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_general_extra_buttons, + N_("Add extra-button"), + N_("TEXT") + }, { "modal", '\0', @@ -855,6 +866,15 @@ static GOptionEntry question_options[] = { &zenity_general_dialog_ellipsize, N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") }, + { + "switch", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_question_switch, + N_("Supress ok and cancel buttons"), + NULL + }, { NULL } @@ -1341,7 +1361,9 @@ zenity_option_free (void) { g_free (zenity_general_ok_button); if (zenity_general_cancel_button) g_free (zenity_general_cancel_button); - + if (zenity_general_extra_buttons) + g_strfreev (zenity_general_extra_buttons); + if (zenity_calendar_date_format) g_free (zenity_calendar_date_format); @@ -1463,6 +1485,7 @@ zenity_general_pre_callback (GOptionContext *context, zenity_general_uri = NULL; zenity_general_ok_button = NULL; zenity_general_cancel_button = NULL; + zenity_general_extra_buttons = NULL; zenity_general_dialog_no_wrap = FALSE; zenity_general_dialog_no_markup = FALSE; zenity_general_timeout_delay = -1; @@ -1594,7 +1617,7 @@ zenity_question_pre_callback (GOptionContext *context, { zenity_question_active = FALSE; zenity_question_default_cancel = FALSE; - + zenity_question_switch = FALSE; return TRUE; } @@ -1710,6 +1733,7 @@ zenity_general_post_callback (GOptionContext *context, results->data->timeout_delay = zenity_general_timeout_delay; results->data->ok_label = zenity_general_ok_button; results->data->cancel_label = zenity_general_cancel_button; + results->data->extra_label = zenity_general_extra_buttons; results->data->modal = zenity_general_modal; results->data->attach = zenity_general_attach; @@ -2012,13 +2036,18 @@ zenity_question_post_callback (GOptionContext *context, if (results->mode == MODE_QUESTION) { results->msg_data->dialog_text = zenity_general_dialog_text; results->msg_data->dialog_icon = zenity_general_dialog_icon; - results->msg_data->mode = ZENITY_MSG_QUESTION; + if(zenity_question_switch) + results->msg_data->mode = ZENITY_MSG_SWITCH; + else + results->msg_data->mode = ZENITY_MSG_QUESTION; results->msg_data->no_wrap = zenity_general_dialog_no_wrap; results->msg_data->no_markup = zenity_general_dialog_no_markup; - results->msg_data->ellipsize = zenity_general_dialog_ellipsize; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; results->msg_data->default_cancel = zenity_question_default_cancel; } - + if(zenity_question_switch && zenity_general_extra_buttons==NULL) + zenity_option_error (zenity_option_get_name (question_options, &zenity_question_switch), ERROR_SYNTAX); + return TRUE; } @@ -2495,5 +2524,6 @@ zenity_option_parse (gint argc, gchar **argv) if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING) zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_ellipsize), ERROR_SUPPORT); + return results; } -- cgit From fd024c53e67b55a8979f24952d5340a779248fe7 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 21 Apr 2015 14:59:29 +0200 Subject: option.c: Fixing typo in extra-button option --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 7ec4b634..6a95dea7 100644 --- a/src/option.c +++ b/src/option.c @@ -872,7 +872,7 @@ static GOptionEntry question_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_question_switch, - N_("Supress ok and cancel buttons"), + N_("Suppress ok and cancel buttons"), NULL }, { -- cgit From 996711f016c68dacaa204cfa9b8568e0d4564477 Mon Sep 17 00:00:00 2001 From: Piotr Drąg Date: Wed, 22 Apr 2015 00:49:31 +0200 Subject: Improve some strings --- src/option.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 6a95dea7..431b9b60 100644 --- a/src/option.c +++ b/src/option.c @@ -212,7 +212,7 @@ static GOptionEntry general_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_ok_button, - N_("Sets the label of the Ok button"), + N_("Set the label of the OK button"), N_("TEXT") }, { @@ -221,7 +221,7 @@ static GOptionEntry general_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_general_cancel_button, - N_("Sets the label of the Cancel button"), + N_("Set the label of the Cancel button"), N_("TEXT") }, { @@ -230,7 +230,7 @@ static GOptionEntry general_options[] = { 0, G_OPTION_ARG_STRING_ARRAY, &zenity_general_extra_buttons, - N_("Add extra-button"), + N_("Add an extra button"), N_("TEXT") }, { @@ -402,7 +402,7 @@ static GOptionEntry error_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_markup, - N_("Do not enable pango markup") + N_("Do not enable Pango markup") }, { "ellipsize", @@ -460,7 +460,7 @@ static GOptionEntry info_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_markup, - N_("Do not enable pango markup") + N_("Do not enable Pango markup") }, { "ellipsize", @@ -545,7 +545,7 @@ static GOptionEntry file_selection_options[] = { 0, G_OPTION_ARG_STRING_ARRAY, &zenity_file_filter, - N_("Sets a filename filter"), + N_("Set a filename filter"), /* Help for file-filter argument (name and patterns for file selection) */ N_("NAME | PATTERN1 PATTERN2 ..."), }, @@ -588,7 +588,7 @@ static GOptionEntry list_options[] = { 0, G_OPTION_ARG_NONE, &zenity_list_checklist, - N_("Use check boxes for first column"), + N_("Use check boxes for the first column"), NULL }, { @@ -597,7 +597,7 @@ static GOptionEntry list_options[] = { 0, G_OPTION_ARG_NONE, &zenity_list_radiolist, - N_("Use radio buttons for first column"), + N_("Use radio buttons for the first column"), NULL }, { @@ -606,7 +606,7 @@ static GOptionEntry list_options[] = { 0, G_OPTION_ARG_NONE, &zenity_list_imagelist, - N_("Use an image for first column"), + N_("Use an image for the first column"), NULL }, { @@ -661,7 +661,7 @@ static GOptionEntry list_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_list_hide_header, - N_("Hides the column headers"), + N_("Hide the column headers"), NULL }, { @@ -776,7 +776,6 @@ static GOptionEntry progress_options[] = { 0, G_OPTION_ARG_NONE, &zenity_progress_auto_kill, - /* xgettext: no-c-format */ N_("Kill parent process if Cancel button is pressed"), NULL }, @@ -786,7 +785,6 @@ static GOptionEntry progress_options[] = { 0, G_OPTION_ARG_NONE, &zenity_progress_no_cancel, - /* xgettext: no-c-format */ N_("Hide Cancel button"), NULL }, @@ -796,6 +794,7 @@ static GOptionEntry progress_options[] = { 0, G_OPTION_ARG_NONE, &zenity_progress_time_remaining, + /* xgettext: no-c-format */ N_("Estimate when progress will reach 100%"), NULL }, @@ -847,7 +846,7 @@ static GOptionEntry question_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_markup, - N_("Do not enable pango markup") + N_("Do not enable Pango markup") }, { "default-cancel", @@ -855,7 +854,7 @@ static GOptionEntry question_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_question_default_cancel, - N_("Give cancel button focus by default"), + N_("Give Cancel button focus by default"), NULL }, { @@ -872,7 +871,7 @@ static GOptionEntry question_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_question_switch, - N_("Suppress ok and cancel buttons"), + N_("Suppress OK and Cancel buttons"), NULL }, { @@ -933,7 +932,7 @@ static GOptionEntry text_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_text_enable_html, - N_("Enable html support"), + N_("Enable HTML support"), NULL }, { @@ -951,7 +950,7 @@ static GOptionEntry text_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_STRING, &zenity_text_url, - N_("Sets an url instead of a file. Only works if you use --html option"), + N_("Set an URL instead of a file. Only works if you use --html option"), N_("URL") }, #endif @@ -1012,7 +1011,7 @@ static GOptionEntry warning_options[] = { G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &zenity_general_dialog_no_markup, - N_("Do not enable pango markup") + N_("Do not enable Pango markup") }, { "ellipsize", -- cgit From d59ce70285a0c5d7dd634ba5cc746b331edac4ce Mon Sep 17 00:00:00 2001 From: Javier JardĆ³n Date: Wed, 22 Apr 2015 19:59:56 +0100 Subject: Do not make zenity_util_show_dialog() X11 specific --- src/option.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 431b9b60..3e351448 100644 --- a/src/option.c +++ b/src/option.c @@ -47,7 +47,7 @@ static gchar *zenity_general_ok_button; static gchar *zenity_general_cancel_button; static gchar **zenity_general_extra_buttons; static gboolean zenity_general_modal; -static gint zenity_general_attach; +static guintptr zenity_general_attach; static gboolean zenity_general_dialog_ellipsize; /* Calendar Dialog Options */ -- cgit From fac40e9c46160a0915d528062dfd19c1afaeac0e Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Fri, 2 Oct 2015 13:41:57 +0200 Subject: Fixing html option being parsed to other dialogs rather then text-info --- src/option.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 3e351448..79a6f926 100644 --- a/src/option.c +++ b/src/option.c @@ -2074,6 +2074,9 @@ zenity_text_post_callback (GOptionContext *context, if (zenity_text_font) zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), ERROR_SUPPORT); + if (zenity_text_enable_html) + zenity_option_error (zenity_option_get_name (text_options, &zenity_text_enable_html), + ERROR_SUPPORT); } return TRUE; } -- cgit From 61c53a042418562c30e816fdd0c63caf2fa9f1b3 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Sat, 17 Oct 2015 17:52:44 +0100 Subject: fix compilation when webkitgtk is not installed --- src/option.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 79a6f926..246cf226 100644 --- a/src/option.c +++ b/src/option.c @@ -2074,9 +2074,11 @@ zenity_text_post_callback (GOptionContext *context, if (zenity_text_font) zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), ERROR_SUPPORT); +#ifdef HAVE_WEBKITGTK if (zenity_text_enable_html) zenity_option_error (zenity_option_get_name (text_options, &zenity_text_enable_html), ERROR_SUPPORT); +#endif } return TRUE; } -- cgit From 4eddb202cafdcabc254aa941ad1348ff09372627 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Fri, 7 Apr 2017 14:00:42 +0200 Subject: Fix style Fixing style in all zenity code, removing useless spaces, empty lines, all code in 80 columns, etc. --- src/option.c | 4180 +++++++++++++++++++++++++++------------------------------- 1 file changed, 1938 insertions(+), 2242 deletions(-) (limited to 'src/option.c') diff --git a/src/option.c b/src/option.c index 246cf226..61df34d3 100644 --- a/src/option.c +++ b/src/option.c @@ -25,41 +25,41 @@ #include "config.h" #include "option.h" -#include #include #include +#include /* General Options */ -static gchar *zenity_general_dialog_title; -static gchar *zenity_general_window_icon; -static int zenity_general_width; -static int zenity_general_height; -static gchar *zenity_general_dialog_text; -static gchar *zenity_general_dialog_icon; -static gchar *zenity_general_separator; +static gchar *zenity_general_dialog_title; +static gchar *zenity_general_window_icon; +static int zenity_general_width; +static int zenity_general_height; +static gchar *zenity_general_dialog_text; +static gchar *zenity_general_dialog_icon; +static gchar *zenity_general_separator; static gboolean zenity_general_multiple; static gboolean zenity_general_editable; -static gchar *zenity_general_uri; +static gchar *zenity_general_uri; static gboolean zenity_general_dialog_no_wrap; static gboolean zenity_general_dialog_no_markup; -static gint zenity_general_timeout_delay; -static gchar *zenity_general_ok_button; -static gchar *zenity_general_cancel_button; -static gchar **zenity_general_extra_buttons; +static gint zenity_general_timeout_delay; +static gchar *zenity_general_ok_button; +static gchar *zenity_general_cancel_button; +static gchar **zenity_general_extra_buttons; static gboolean zenity_general_modal; static guintptr zenity_general_attach; static gboolean zenity_general_dialog_ellipsize; /* Calendar Dialog Options */ static gboolean zenity_calendar_active; -static int zenity_calendar_day; -static int zenity_calendar_month; -static int zenity_calendar_year; -static gchar *zenity_calendar_date_format; +static int zenity_calendar_day; +static int zenity_calendar_month; +static int zenity_calendar_year; +static gchar *zenity_calendar_date_format; /* Entry Dialog Options */ static gboolean zenity_entry_active; -static gchar *zenity_entry_entry_text; +static gchar *zenity_entry_entry_text; static gboolean zenity_entry_hide_text; /* Error Dialog Options */ @@ -69,19 +69,19 @@ static gboolean zenity_error_active; static gboolean zenity_info_active; /* File Selection Dialog Options */ -static gboolean zenity_file_active; -static gboolean zenity_file_directory; -static gboolean zenity_file_save; -static gboolean zenity_file_confirm_overwrite; -static gchar **zenity_file_filter; +static gboolean zenity_file_active; +static gboolean zenity_file_directory; +static gboolean zenity_file_save; +static gboolean zenity_file_confirm_overwrite; +static gchar **zenity_file_filter; /* List Dialog Options */ static gboolean zenity_list_active; -static gchar **zenity_list_columns; +static gchar **zenity_list_columns; static gboolean zenity_list_checklist; static gboolean zenity_list_radiolist; -static gchar *zenity_list_print_column; -static gchar *zenity_list_hide_column; +static gchar *zenity_list_print_column; +static gchar *zenity_list_hide_column; static gboolean zenity_list_hide_header; static gboolean zenity_list_imagelist; static gboolean zenity_list_mid_search; @@ -90,12 +90,12 @@ static gboolean zenity_list_mid_search; /* Notification Dialog Options */ static gboolean zenity_notification_active; static gboolean zenity_notification_listen; -static gchar **zenity_notification_hints; +static gchar **zenity_notification_hints; #endif /* Progress Dialog Options */ static gboolean zenity_progress_active; -static int zenity_progress_percentage; +static int zenity_progress_percentage; static gboolean zenity_progress_pulsate; static gboolean zenity_progress_auto_close; static gboolean zenity_progress_auto_kill; @@ -109,14 +109,14 @@ static gboolean zenity_question_switch; /* Text Dialog Options */ static gboolean zenity_text_active; -static gchar *zenity_text_font; -static gchar *zenity_text_checkbox; +static gchar *zenity_text_font; +static gchar *zenity_text_checkbox; static gboolean zenity_text_auto_scroll; #ifdef HAVE_WEBKITGTK static gboolean zenity_text_enable_html; static gboolean zenity_text_no_interaction; -static gchar *zenity_text_url; +static gchar *zenity_text_url; #endif /* Warning Dialog Options */ @@ -133,7 +133,7 @@ static gboolean zenity_scale_hide_value; /* Color Selection Dialog Options */ static gboolean zenity_colorsel_active; -static gchar *zenity_colorsel_color; +static gchar *zenity_colorsel_color; static gboolean zenity_colorsel_show_palette; /* Password Dialog Options */ @@ -143,1180 +143,893 @@ static gboolean zenity_password_show_username; /* Forms Dialog Options */ static gboolean zenity_forms_active; static gboolean zenity_forms_show_header; -static gchar *zenity_forms_date_format; -//static gchar *zenity_forms_hide_column; -static gchar **zenity_forms_list_values; -static gchar **zenity_forms_column_values; -static gchar **zenity_forms_combo_values; +static gchar *zenity_forms_date_format; +// static gchar *zenity_forms_hide_column; +static gchar **zenity_forms_list_values; +static gchar **zenity_forms_column_values; +static gchar **zenity_forms_combo_values; /* Miscelaneus Options */ static gboolean zenity_misc_about; static gboolean zenity_misc_version; -static gboolean -zenity_forms_callback (const gchar *option_name, - const gchar *value, - gpointer data, - GError **error); - -static GOptionEntry general_options[] = { - { - "title", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_general_dialog_title, - N_("Set the dialog title"), - N_("TITLE") - }, - { - "window-icon", - '\0', - 0, - G_OPTION_ARG_FILENAME, - &zenity_general_window_icon, - N_("Set the window icon"), - N_("ICONPATH") - }, - { - "width", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_general_width, - N_("Set the width"), - N_("WIDTH") - }, - { - "height", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_general_height, - N_("Set the height"), - N_("HEIGHT") - }, - { - "timeout", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_general_timeout_delay, - N_("Set dialog timeout in seconds"), - /* Timeout for closing the dialog */ - N_("TIMEOUT") - }, - { - "ok-label", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_ok_button, - N_("Set the label of the OK button"), - N_("TEXT") - }, - { - "cancel-label", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_cancel_button, - N_("Set the label of the Cancel button"), - N_("TEXT") - }, - { - "extra-button", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_general_extra_buttons, - N_("Add an extra button"), - N_("TEXT") - }, - { - "modal", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_modal, - N_("Set the modal hint"), - NULL - }, - { - "attach", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_INT, - &zenity_general_attach, - N_("Set the parent window to attach to"), - N_("WINDOW") - }, - { - NULL - } -}; - -static GOptionEntry calendar_options[] = { - { - "calendar", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_calendar_active, - N_("Display calendar dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "day", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_calendar_day, - N_("Set the calendar day"), - N_("DAY") - }, - { - "month", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_calendar_month, - N_("Set the calendar month"), - N_("MONTH") - }, - { - "year", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_calendar_year, - N_("Set the calendar year"), - N_("YEAR") - }, - { - "date-format", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_calendar_date_format, - N_("Set the format for the returned date"), - N_("PATTERN") - }, - { - NULL - } -}; - -static GOptionEntry entry_options[] = { - { - "entry", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_entry_active, - N_("Display text entry dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "entry-text", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_entry_entry_text, - N_("Set the entry text"), - N_("TEXT") - }, - { - "hide-text", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_entry_hide_text, - N_("Hide the entry text"), - NULL - }, - { - NULL - } -}; - - -static GOptionEntry error_options[] = { - { - "error", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_error_active, - N_("Display error dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "icon-name", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_icon, - N_("Set the dialog icon"), - N_("ICON-NAME") - }, - { - "no-wrap", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_wrap, - N_("Do not enable text wrapping"), - NULL - }, - { - "no-markup", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_markup, - N_("Do not enable Pango markup") - }, - { - "ellipsize", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_ellipsize, - N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") - }, - { - NULL - } -}; - -static GOptionEntry info_options[] = { - { - "info", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_info_active, - N_("Display info dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "icon-name", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_icon, - N_("Set the dialog icon"), - N_("ICON-NAME") - }, - { - "no-wrap", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_wrap, - N_("Do not enable text wrapping"), - NULL - }, - { - "no-markup", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_markup, - N_("Do not enable Pango markup") - }, - { - "ellipsize", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_ellipsize, - N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") - }, - { - NULL - } -}; - -static GOptionEntry file_selection_options[] = { - { - "file-selection", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_file_active, - N_("Display file selection dialog"), - NULL - }, - { - "filename", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_FILENAME, - &zenity_general_uri, - N_("Set the filename"), - N_("FILENAME") - }, - { - "multiple", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_multiple, - N_("Allow multiple files to be selected"), - NULL - }, - { - "directory", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_file_directory, - N_("Activate directory-only selection"), - NULL - }, - { - "save", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_file_save, - N_("Activate save mode"), - NULL - }, - { - "separator", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_separator, - N_("Set output separator character"), - N_("SEPARATOR") - }, - { - "confirm-overwrite", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_file_confirm_overwrite, - N_("Confirm file selection if filename already exists"), - NULL - }, - { - "file-filter", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_file_filter, - N_("Set a filename filter"), - /* Help for file-filter argument (name and patterns for file selection) */ - N_("NAME | PATTERN1 PATTERN2 ..."), - }, - { - NULL - } -}; - -static GOptionEntry list_options[] = { - { - "list", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_list_active, - N_("Display list dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "column", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_list_columns, - N_("Set the column header"), - N_("COLUMN") - }, - { - "checklist", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_list_checklist, - N_("Use check boxes for the first column"), - NULL - }, - { - "radiolist", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_list_radiolist, - N_("Use radio buttons for the first column"), - NULL - }, - { - "imagelist", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_list_imagelist, - N_("Use an image for the first column"), - NULL - }, - { - "separator", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_separator, - N_("Set output separator character"), - N_("SEPARATOR") - }, - { - "multiple", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_multiple, - N_("Allow multiple rows to be selected"), - NULL - }, - { - "editable", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_editable, - N_("Allow changes to text"), - NULL - }, - { - "print-column", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_list_print_column, - N_("Print a specific column (Default is 1. 'ALL' can be used to print all columns)"), - /* Column index number to print out on a list dialog */ - N_("NUMBER") - }, - { - "hide-column", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_list_hide_column, - N_("Hide a specific column"), - N_("NUMBER") - }, - { - "hide-header", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_list_hide_header, - N_("Hide the column headers"), - NULL - }, - { - "mid-search", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_list_mid_search, - N_("Change list default search function searching for text in the middle, not on the beginning"), - NULL - }, - { - NULL - } -}; +static gboolean zenity_forms_callback (const gchar *option_name, + const gchar *value, gpointer data, GError **error); + +static GOptionEntry general_options[] = {{"title", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_general_dialog_title, + N_ ("Set the dialog title"), + N_ ("TITLE")}, + {"window-icon", + '\0', + 0, + G_OPTION_ARG_FILENAME, + &zenity_general_window_icon, + N_ ("Set the window icon"), + N_ ("ICONPATH")}, + {"width", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_general_width, + N_ ("Set the width"), + N_ ("WIDTH")}, + {"height", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_general_height, + N_ ("Set the height"), + N_ ("HEIGHT")}, + {"timeout", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_general_timeout_delay, + N_ ("Set dialog timeout in seconds"), + /* Timeout for closing the dialog */ + N_ ("TIMEOUT")}, + {"ok-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_ok_button, + N_ ("Set the label of the OK button"), + N_ ("TEXT")}, + {"cancel-label", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_cancel_button, + N_ ("Set the label of the Cancel button"), + N_ ("TEXT")}, + {"extra-button", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_general_extra_buttons, + N_ ("Add an extra button"), + N_ ("TEXT")}, + {"modal", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_modal, + N_ ("Set the modal hint"), + NULL}, + {"attach", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_INT, + &zenity_general_attach, + N_ ("Set the parent window to attach to"), + N_ ("WINDOW")}, + {NULL}}; + +static GOptionEntry calendar_options[] = {{"calendar", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_calendar_active, + N_ ("Display calendar dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"day", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_calendar_day, + N_ ("Set the calendar day"), + N_ ("DAY")}, + {"month", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_calendar_month, + N_ ("Set the calendar month"), + N_ ("MONTH")}, + {"year", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_calendar_year, + N_ ("Set the calendar year"), + N_ ("YEAR")}, + {"date-format", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_calendar_date_format, + N_ ("Set the format for the returned date"), + N_ ("PATTERN")}, + {NULL}}; + +static GOptionEntry entry_options[] = {{"entry", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_entry_active, + N_ ("Display text entry dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"entry-text", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_entry_entry_text, + N_ ("Set the entry text"), + N_ ("TEXT")}, + {"hide-text", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_entry_hide_text, + N_ ("Hide the entry text"), + NULL}, + {NULL}}; + +static GOptionEntry error_options[] = {{"error", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_error_active, + N_ ("Display error dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_ ("Set the dialog icon"), + N_ ("ICON-NAME")}, + {"no-wrap", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_ ("Do not enable text wrapping"), + NULL}, + {"no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_ ("Do not enable Pango markup")}, + {"ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_ ("Enable ellipsizing in the dialog text. This fixes the high window " + "size with long texts")}, + {NULL}}; + +static GOptionEntry info_options[] = {{"info", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_info_active, + N_ ("Display info dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_ ("Set the dialog icon"), + N_ ("ICON-NAME")}, + {"no-wrap", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_ ("Do not enable text wrapping"), + NULL}, + {"no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_ ("Do not enable Pango markup")}, + {"ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_ ("Enable ellipsizing in the dialog text. This fixes the high window " + "size with long texts")}, + {NULL}}; + +static GOptionEntry file_selection_options[] = + {{"file-selection", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_file_active, + N_ ("Display file selection dialog"), + NULL}, + {"filename", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_FILENAME, + &zenity_general_uri, + N_ ("Set the filename"), + N_ ("FILENAME")}, + {"multiple", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_multiple, + N_ ("Allow multiple files to be selected"), + NULL}, + {"directory", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_directory, + N_ ("Activate directory-only selection"), + NULL}, + {"save", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_save, + N_ ("Activate save mode"), + NULL}, + {"separator", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_separator, + N_ ("Set output separator character"), + N_ ("SEPARATOR")}, + {"confirm-overwrite", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_file_confirm_overwrite, + N_ ("Confirm file selection if filename already exists"), + NULL}, + { + "file-filter", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_file_filter, + N_ ("Set a filename filter"), + /* Help for file-filter argument (name and patterns for file + selection) */ + N_ ("NAME | PATTERN1 PATTERN2 ..."), + }, + {NULL}}; + +static GOptionEntry list_options[] = {{"list", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_list_active, + N_ ("Display list dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"column", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_list_columns, + N_ ("Set the column header"), + N_ ("COLUMN")}, + {"checklist", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_list_checklist, + N_ ("Use check boxes for the first column"), + NULL}, + {"radiolist", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_list_radiolist, + N_ ("Use radio buttons for the first column"), + NULL}, + {"imagelist", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_list_imagelist, + N_ ("Use an image for the first column"), + NULL}, + {"separator", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_separator, + N_ ("Set output separator character"), + N_ ("SEPARATOR")}, + {"multiple", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_multiple, + N_ ("Allow multiple rows to be selected"), + NULL}, + {"editable", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_editable, + N_ ("Allow changes to text"), + NULL}, + {"print-column", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_list_print_column, + N_ ("Print a specific column (Default is 1. 'ALL' can be used to print " + "all columns)"), + /* Column index number to print out on a list dialog */ + N_ ("NUMBER")}, + {"hide-column", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_list_hide_column, + N_ ("Hide a specific column"), + N_ ("NUMBER")}, + {"hide-header", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_list_hide_header, + N_ ("Hide the column headers"), + NULL}, + {"mid-search", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_list_mid_search, + N_ ("Change list default search function searching for text in the " + "middle, not on the beginning"), + NULL}, + {NULL}}; #ifdef HAVE_LIBNOTIFY -static GOptionEntry notification_options[] = { - { - "notification", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_notification_active, - N_("Display notification"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the notification text"), - N_("TEXT") - }, - { - "listen", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_notification_listen, - N_("Listen for commands on stdin"), - NULL - }, - { - "hint", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING_ARRAY, - &zenity_notification_hints, - N_("Set the notification hints"), - N_("TEXT") - }, - { - NULL - } -}; +static GOptionEntry notification_options[] = {{"notification", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_notification_active, + N_ ("Display notification"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the notification text"), + N_ ("TEXT")}, + {"listen", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_notification_listen, + N_ ("Listen for commands on stdin"), + NULL}, + {"hint", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING_ARRAY, + &zenity_notification_hints, + N_ ("Set the notification hints"), + N_ ("TEXT")}, + {NULL}}; #endif static GOptionEntry progress_options[] = { - { - "progress", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_progress_active, - N_("Display progress indication dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "percentage", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_progress_percentage, - N_("Set initial percentage"), - N_("PERCENTAGE") - }, - { - "pulsate", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_progress_pulsate, - N_("Pulsate progress bar"), - NULL - }, - { - "auto-close", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_progress_auto_close, - /* xgettext: no-c-format */ - N_("Dismiss the dialog when 100% has been reached"), - NULL - }, - { - "auto-kill", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_progress_auto_kill, - N_("Kill parent process if Cancel button is pressed"), - NULL - }, - { - "no-cancel", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_progress_no_cancel, - N_("Hide Cancel button"), - NULL - }, - { - "time-remaining", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_progress_time_remaining, - /* xgettext: no-c-format */ - N_("Estimate when progress will reach 100%"), - NULL - }, - { - NULL - } -}; - -static GOptionEntry question_options[] = { - { - "question", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_question_active, - N_("Display question dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "icon-name", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_icon, - N_("Set the dialog icon"), - N_("ICON-NAME") - }, - { - "no-wrap", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_wrap, - N_("Do not enable text wrapping"), - NULL - }, - { - "no-markup", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_markup, - N_("Do not enable Pango markup") - }, - { - "default-cancel", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_question_default_cancel, - N_("Give Cancel button focus by default"), - NULL - }, - { - "ellipsize", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_ellipsize, - N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") - }, - { - "switch", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_question_switch, - N_("Suppress OK and Cancel buttons"), - NULL - }, - { - NULL - } -}; + {"progress", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_progress_active, + N_ ("Display progress indication dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"percentage", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_progress_percentage, + N_ ("Set initial percentage"), + N_ ("PERCENTAGE")}, + {"pulsate", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_pulsate, + N_ ("Pulsate progress bar"), + NULL}, + {"auto-close", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_auto_close, + /* xgettext: no-c-format */ + N_ ("Dismiss the dialog when 100% has been reached"), + NULL}, + {"auto-kill", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_auto_kill, + N_ ("Kill parent process if Cancel button is pressed"), + NULL}, + {"no-cancel", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_no_cancel, + N_ ("Hide Cancel button"), + NULL}, + {"time-remaining", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_progress_time_remaining, + /* xgettext: no-c-format */ + N_ ("Estimate when progress will reach 100%"), + NULL}, + {NULL}}; + +static GOptionEntry question_options[] = {{"question", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_question_active, + N_ ("Display question dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_ ("Set the dialog icon"), + N_ ("ICON-NAME")}, + {"no-wrap", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_ ("Do not enable text wrapping"), + NULL}, + {"no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_ ("Do not enable Pango markup")}, + {"default-cancel", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_question_default_cancel, + N_ ("Give Cancel button focus by default"), + NULL}, + {"ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_ ("Enable ellipsizing in the dialog text. This fixes the high window " + "size with long texts")}, + {"switch", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_question_switch, + N_ ("Suppress OK and Cancel buttons"), + NULL}, + {NULL}}; static GOptionEntry text_options[] = { - { - "text-info", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_text_active, - N_("Display text information dialog"), - NULL - }, - { - "filename", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_FILENAME, - &zenity_general_uri, - N_("Open file"), - N_("FILENAME") - }, - { - "editable", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_editable, - N_("Allow changes to text"), - NULL - }, - { - "font", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_text_font, - N_("Set the text font"), - N_("TEXT") - }, - { - "checkbox", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_text_checkbox, - N_("Enable an I read and agree checkbox"), - N_("TEXT") - }, + {"text-info", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_text_active, + N_ ("Display text information dialog"), + NULL}, + {"filename", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_FILENAME, + &zenity_general_uri, + N_ ("Open file"), + N_ ("FILENAME")}, + {"editable", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_editable, + N_ ("Allow changes to text"), + NULL}, + {"font", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_text_font, + N_ ("Set the text font"), + N_ ("TEXT")}, + {"checkbox", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_text_checkbox, + N_ ("Enable an I read and agree checkbox"), + N_ ("TEXT")}, #ifdef HAVE_WEBKITGTK - { - "html", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_text_enable_html, - N_("Enable HTML support"), - NULL - }, - { - "no-interaction", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_text_no_interaction, - N_("Do not enable user interaction with the WebView. Only works if you use --html option"), - NULL - }, - { - "url", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_text_url, - N_("Set an URL instead of a file. Only works if you use --html option"), - N_("URL") - }, + {"html", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_text_enable_html, + N_ ("Enable HTML support"), + NULL}, + {"no-interaction", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_text_no_interaction, + N_ ("Do not enable user interaction with the WebView. Only works if " + "you use --html option"), + NULL}, + {"url", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_text_url, + N_ ("Set an URL instead of a file. Only works if you use --html " + "option"), + N_ ("URL")}, #endif - { - "auto-scroll", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_text_auto_scroll, - N_("Auto scroll the text to the end. Only when text is captured from stdin"), - NULL - }, - { - NULL - } -}; - -static GOptionEntry warning_options[] = { - { - "warning", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_warning_active, - N_("Display warning dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "icon-name", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_icon, - N_("Set the dialog icon"), - N_("ICON-NAME") - }, - { - "no-wrap", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_wrap, - N_("Do not enable text wrapping"), - NULL - }, - { - "no-markup", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_no_markup, - N_("Do not enable Pango markup") - }, - { - "ellipsize", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_NONE, - &zenity_general_dialog_ellipsize, - N_("Enable ellipsizing in the dialog text. This fixes the high window size with long texts") - }, - { - NULL - } -}; - -static GOptionEntry scale_options[] = { - { - "scale", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_scale_active, - N_("Display scale dialog"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "value", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_scale_value, - N_("Set initial value"), - N_("VALUE") - }, - { - "min-value", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_scale_min_value, - N_("Set minimum value"), - N_("VALUE") - }, - { - "max-value", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_scale_max_value, - N_("Set maximum value"), - N_("VALUE") - }, - { - "step", - '\0', - 0, - G_OPTION_ARG_INT, - &zenity_scale_step, - N_("Set step size"), - N_("VALUE") - }, - { - "print-partial", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_scale_print_partial, - N_("Print partial values"), - NULL - }, - { - "hide-value", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_scale_hide_value, - N_("Hide value"), - NULL - }, - { - NULL - } -}; - -static GOptionEntry forms_dialog_options[] = { - { - "forms", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_forms_active, - N_("Display forms dialog"), - NULL - }, - { - "add-entry", - '\0', - 0, - G_OPTION_ARG_CALLBACK, - zenity_forms_callback, - N_("Add a new Entry in forms dialog"), - N_("Field name") - }, - { - "add-password", - '\0', - 0, - G_OPTION_ARG_CALLBACK, - zenity_forms_callback, - N_("Add a new Password Entry in forms dialog"), - N_("Field name") - }, - { - "add-calendar", - '\0', - 0, - G_OPTION_ARG_CALLBACK, - zenity_forms_callback, - N_("Add a new Calendar in forms dialog"), - N_("Calendar field name") - }, - { - "add-list", - '\0', - 0, - G_OPTION_ARG_CALLBACK, - zenity_forms_callback, - N_("Add a new List in forms dialog"), - N_("List field and header name") - }, - { - "list-values", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_forms_list_values, - N_("List of values for List"), - N_("List of values separated by |") - }, - { - "column-values", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_forms_column_values, - N_("List of values for columns"), - N_("List of values separated by |") - }, - { - "add-combo", - '\0', - 0, - G_OPTION_ARG_CALLBACK, - zenity_forms_callback, - N_("Add a new combo box in forms dialog"), - N_("Combo box field name") - }, - { - "combo-values", - '\0', - 0, - G_OPTION_ARG_STRING_ARRAY, - &zenity_forms_combo_values, - N_("List of values for combo box"), - N_("List of values separated by |") - }, - /* TODO: Implement how to hide specifc column - { - "hide-column", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_forms_hide_column, - N_("Hide a specific column"), - N_("NUMBER") - },*/ - { - "show-header", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_forms_show_header, - N_("Show the columns header"), - NULL - }, - { - "text", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_dialog_text, - N_("Set the dialog text"), - N_("TEXT") - }, - { - "separator", - '\0', - G_OPTION_FLAG_NOALIAS, - G_OPTION_ARG_STRING, - &zenity_general_separator, - N_("Set output separator character"), - N_("SEPARATOR") - }, - { - "date-format", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_forms_date_format, - N_("Set the format for the returned date"), - N_("PATTERN") - }, - { - NULL - } -}; + {"auto-scroll", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_text_auto_scroll, + N_ ("Auto scroll the text to the end. Only when text is captured from " + "stdin"), + NULL}, + {NULL}}; + +static GOptionEntry warning_options[] = {{"warning", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_warning_active, + N_ ("Display warning dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"icon-name", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_icon, + N_ ("Set the dialog icon"), + N_ ("ICON-NAME")}, + {"no-wrap", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_wrap, + N_ ("Do not enable text wrapping"), + NULL}, + {"no-markup", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_no_markup, + N_ ("Do not enable Pango markup")}, + {"ellipsize", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_NONE, + &zenity_general_dialog_ellipsize, + N_ ("Enable ellipsizing in the dialog text. This fixes the high window " + "size with long texts")}, + {NULL}}; + +static GOptionEntry scale_options[] = {{"scale", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_scale_active, + N_ ("Display scale dialog"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"value", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_value, + N_ ("Set initial value"), + N_ ("VALUE")}, + {"min-value", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_min_value, + N_ ("Set minimum value"), + N_ ("VALUE")}, + {"max-value", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_max_value, + N_ ("Set maximum value"), + N_ ("VALUE")}, + {"step", + '\0', + 0, + G_OPTION_ARG_INT, + &zenity_scale_step, + N_ ("Set step size"), + N_ ("VALUE")}, + {"print-partial", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_scale_print_partial, + N_ ("Print partial values"), + NULL}, + {"hide-value", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_scale_hide_value, + N_ ("Hide value"), + NULL}, + {NULL}}; + +static GOptionEntry forms_dialog_options[] = {{"forms", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_forms_active, + N_ ("Display forms dialog"), + NULL}, + {"add-entry", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_ ("Add a new Entry in forms dialog"), + N_ ("Field name")}, + {"add-password", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_ ("Add a new Password Entry in forms dialog"), + N_ ("Field name")}, + {"add-calendar", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_ ("Add a new Calendar in forms dialog"), + N_ ("Calendar field name")}, + {"add-list", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_ ("Add a new List in forms dialog"), + N_ ("List field and header name")}, + {"list-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_list_values, + N_ ("List of values for List"), + N_ ("List of values separated by |")}, + {"column-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_column_values, + N_ ("List of values for columns"), + N_ ("List of values separated by |")}, + {"add-combo", + '\0', + 0, + G_OPTION_ARG_CALLBACK, + zenity_forms_callback, + N_ ("Add a new combo box in forms dialog"), + N_ ("Combo box field name")}, + {"combo-values", + '\0', + 0, + G_OPTION_ARG_STRING_ARRAY, + &zenity_forms_combo_values, + N_ ("List of values for combo box"), + N_ ("List of values separated by |")}, + /* TODO: Implement how to hide specifc column + { + "hide-column", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_forms_hide_column, + N_("Hide a specific column"), + N_("NUMBER") + },*/ + {"show-header", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_forms_show_header, + N_ ("Show the columns header"), + NULL}, + {"text", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_dialog_text, + N_ ("Set the dialog text"), + N_ ("TEXT")}, + {"separator", + '\0', + G_OPTION_FLAG_NOALIAS, + G_OPTION_ARG_STRING, + &zenity_general_separator, + N_ ("Set output separator character"), + N_ ("SEPARATOR")}, + {"date-format", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_forms_date_format, + N_ ("Set the format for the returned date"), + N_ ("PATTERN")}, + {NULL}}; static GOptionEntry password_dialog_options[] = { - { - "password", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_password_active, - N_("Display password dialog"), - NULL - }, - { - "username", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_password_show_username, - N_("Display the username option"), - NULL - }, - { - NULL - } -}; + {"password", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_password_active, + N_ ("Display password dialog"), + NULL}, + {"username", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_password_show_username, + N_ ("Display the username option"), + NULL}, + {NULL}}; static GOptionEntry color_selection_options[] = { - { - "color-selection", - '\0', - G_OPTION_FLAG_IN_MAIN, - G_OPTION_ARG_NONE, - &zenity_colorsel_active, - N_("Display color selection dialog"), - NULL - }, - { - "color", - '\0', - 0, - G_OPTION_ARG_STRING, - &zenity_colorsel_color, - N_("Set the color"), - N_("VALUE") - }, - { - "show-palette", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_colorsel_show_palette, - N_("Show the palette"), - NULL - }, - { - NULL - } -}; - -static GOptionEntry miscellaneous_options[] = { - { - "about", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_misc_about, - N_("About zenity"), - NULL - }, - { - "version", - '\0', - 0, - G_OPTION_ARG_NONE, - &zenity_misc_version, - N_("Print version"), - NULL - }, - { - NULL - } -}; + {"color-selection", + '\0', + G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, + &zenity_colorsel_active, + N_ ("Display color selection dialog"), + NULL}, + {"color", + '\0', + 0, + G_OPTION_ARG_STRING, + &zenity_colorsel_color, + N_ ("Set the color"), + N_ ("VALUE")}, + {"show-palette", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_colorsel_show_palette, + N_ ("Show the palette"), + NULL}, + {NULL}}; + +static GOptionEntry miscellaneous_options[] = {{"about", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_misc_about, + N_ ("About zenity"), + NULL}, + {"version", + '\0', + 0, + G_OPTION_ARG_NONE, + &zenity_misc_version, + N_ ("Print version"), + NULL}, + {NULL}}; static ZenityParsingOptions *results; static GOptionContext *ctx; @@ -1324,1210 +1037,1193 @@ static GOptionContext *ctx; static void zenity_option_init (void) { - results = g_new0 (ZenityParsingOptions, 1); - - /* Initialize the various dialog structures */ - results->mode = MODE_LAST; - results->data = g_new0 (ZenityData, 1); - results->calendar_data = g_new0 (ZenityCalendarData, 1); - results->msg_data = g_new0 (ZenityMsgData, 1); - results->scale_data = g_new0 (ZenityScaleData, 1); - results->file_data = g_new0 (ZenityFileData, 1); - results->entry_data = g_new0 (ZenityEntryData, 1); - results->progress_data = g_new0 (ZenityProgressData, 1); - results->text_data = g_new0 (ZenityTextData, 1); - results->tree_data = g_new0 (ZenityTreeData, 1); + results = g_new0 (ZenityParsingOptions, 1); + + /* Initialize the various dialog structures */ + results->mode = MODE_LAST; + results->data = g_new0 (ZenityData, 1); + results->calendar_data = g_new0 (ZenityCalendarData, 1); + results->msg_data = g_new0 (ZenityMsgData, 1); + results->scale_data = g_new0 (ZenityScaleData, 1); + results->file_data = g_new0 (ZenityFileData, 1); + results->entry_data = g_new0 (ZenityEntryData, 1); + results->progress_data = g_new0 (ZenityProgressData, 1); + results->text_data = g_new0 (ZenityTextData, 1); + results->tree_data = g_new0 (ZenityTreeData, 1); #ifdef HAVE_LIBNOTIFY - results->notification_data = g_new0 (ZenityNotificationData, 1); + results->notification_data = g_new0 (ZenityNotificationData, 1); #endif - results->color_data = g_new0 (ZenityColorData, 1); - results->password_data = g_new0 (ZenityPasswordData, 1); - results->forms_data = g_new0 (ZenityFormsData, 1); + results->color_data = g_new0 (ZenityColorData, 1); + results->password_data = g_new0 (ZenityPasswordData, 1); + results->forms_data = g_new0 (ZenityFormsData, 1); } void zenity_option_free (void) { - if (zenity_general_dialog_title) - g_free (zenity_general_dialog_title); - if (zenity_general_window_icon) - g_free (zenity_general_window_icon); - if (zenity_general_dialog_text) - g_free (zenity_general_dialog_text); - if (zenity_general_uri) - g_free (zenity_general_uri); - g_free (zenity_general_separator); - if (zenity_general_ok_button) - g_free (zenity_general_ok_button); - if (zenity_general_cancel_button) - g_free (zenity_general_cancel_button); - if (zenity_general_extra_buttons) - g_strfreev (zenity_general_extra_buttons); - - if (zenity_calendar_date_format) - g_free (zenity_calendar_date_format); - - if (zenity_forms_date_format) - g_free (zenity_forms_date_format); - if (zenity_forms_list_values) - g_strfreev (zenity_forms_list_values); - if (zenity_forms_combo_values) - g_strfreev (zenity_forms_combo_values); - if (zenity_forms_column_values) - g_strfreev (zenity_forms_column_values); -// if (zenity_forms_hide_column) -// g_free (zenity_forms_hide_column); - if (zenity_entry_entry_text) - g_free (zenity_entry_entry_text); - - if (zenity_file_filter) - g_strfreev (zenity_file_filter); - - if (zenity_list_columns) - g_strfreev (zenity_list_columns); - if (zenity_list_print_column) - g_free (zenity_list_print_column); - if (zenity_list_hide_column) - g_free (zenity_list_hide_column); + if (zenity_general_dialog_title) + g_free (zenity_general_dialog_title); + if (zenity_general_window_icon) + g_free (zenity_general_window_icon); + if (zenity_general_dialog_text) + g_free (zenity_general_dialog_text); + if (zenity_general_uri) + g_free (zenity_general_uri); + g_free (zenity_general_separator); + if (zenity_general_ok_button) + g_free (zenity_general_ok_button); + if (zenity_general_cancel_button) + g_free (zenity_general_cancel_button); + if (zenity_general_extra_buttons) + g_strfreev (zenity_general_extra_buttons); + + if (zenity_calendar_date_format) + g_free (zenity_calendar_date_format); + + if (zenity_forms_date_format) + g_free (zenity_forms_date_format); + if (zenity_forms_list_values) + g_strfreev (zenity_forms_list_values); + if (zenity_forms_combo_values) + g_strfreev (zenity_forms_combo_values); + if (zenity_forms_column_values) + g_strfreev (zenity_forms_column_values); + // if (zenity_forms_hide_column) + // g_free (zenity_forms_hide_column); + if (zenity_entry_entry_text) + g_free (zenity_entry_entry_text); + + if (zenity_file_filter) + g_strfreev (zenity_file_filter); + + if (zenity_list_columns) + g_strfreev (zenity_list_columns); + if (zenity_list_print_column) + g_free (zenity_list_print_column); + if (zenity_list_hide_column) + g_free (zenity_list_hide_column); #ifdef HAVE_LIBNOTIFY - if (zenity_notification_hints) - g_strfreev (zenity_notification_hints); + if (zenity_notification_hints) + g_strfreev (zenity_notification_hints); #endif - if (zenity_text_font) - g_free (zenity_text_font); - if (zenity_text_checkbox) - g_free (zenity_text_checkbox); + if (zenity_text_font) + g_free (zenity_text_font); + if (zenity_text_checkbox) + g_free (zenity_text_checkbox); - if (zenity_colorsel_color) - g_free (zenity_colorsel_color); - - g_option_context_free (ctx); + if (zenity_colorsel_color) + g_free (zenity_colorsel_color); + + g_option_context_free (ctx); } static void -zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) -{ - if (is_active == TRUE) { - if (results->mode == MODE_LAST) - results->mode = mode; - else - zenity_option_error (NULL, ERROR_DIALOG); - } +zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) { + if (is_active == TRUE) { + if (results->mode == MODE_LAST) + results->mode = mode; + else + zenity_option_error (NULL, ERROR_DIALOG); + } } static gchar * -zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) -{ - int i; - - for (i = 1; entries[i].long_name != NULL; i++) { - if (entries[i].arg_data == arg_data) - return (gchar *) entries[i].long_name; - } - return NULL; +zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) { + int i; + + for (i = 1; entries[i].long_name != NULL; i++) { + if (entries[i].arg_data == arg_data) + return (gchar *) entries[i].long_name; + } + return NULL; } /* Forms callback */ static gboolean -zenity_forms_callback (const gchar *option_name, - const gchar *value, - gpointer data, - GError **error) -{ - ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1); - - forms_value->option_value = g_strdup (value); - - if (g_strcmp0 (option_name, "--add-entry") == 0) - forms_value->type = ZENITY_FORMS_ENTRY; - else if (g_strcmp0 (option_name, "--add-calendar") == 0) - forms_value->type = ZENITY_FORMS_CALENDAR; - else if (g_strcmp0 (option_name, "--add-password") == 0) - forms_value->type = ZENITY_FORMS_PASSWORD; - else if (g_strcmp0 (option_name, "--add-list") == 0) - forms_value->type = ZENITY_FORMS_LIST; - else if (g_strcmp0 (option_name, "--add-combo") == 0) - forms_value->type = ZENITY_FORMS_COMBO; - - results->forms_data->list = g_slist_append(results->forms_data->list, forms_value); - - return TRUE; +zenity_forms_callback (const gchar *option_name, const gchar *value, + gpointer data, GError **error) { + ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1); + + forms_value->option_value = g_strdup (value); + + if (g_strcmp0 (option_name, "--add-entry") == 0) + forms_value->type = ZENITY_FORMS_ENTRY; + else if (g_strcmp0 (option_name, "--add-calendar") == 0) + forms_value->type = ZENITY_FORMS_CALENDAR; + else if (g_strcmp0 (option_name, "--add-password") == 0) + forms_value->type = ZENITY_FORMS_PASSWORD; + else if (g_strcmp0 (option_name, "--add-list") == 0) + forms_value->type = ZENITY_FORMS_LIST; + else if (g_strcmp0 (option_name, "--add-combo") == 0) + forms_value->type = ZENITY_FORMS_COMBO; + + results->forms_data->list = + g_slist_append (results->forms_data->list, forms_value); + + return TRUE; } /* Error callback */ -static void -zenity_option_error_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_error (NULL, ERROR_SYNTAX); +static void +zenity_option_error_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_error (NULL, ERROR_SYNTAX); } /* Pre parse callbacks set the default option values */ static gboolean -zenity_general_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_general_dialog_title = NULL; - zenity_general_window_icon = NULL; - zenity_general_width = -1; - zenity_general_height = -1; - zenity_general_dialog_text = NULL; - zenity_general_separator = g_strdup ("|"); - zenity_general_multiple = FALSE; - zenity_general_editable = FALSE; - zenity_general_uri = NULL; - zenity_general_ok_button = NULL; - zenity_general_cancel_button = NULL; - zenity_general_extra_buttons = NULL; - zenity_general_dialog_no_wrap = FALSE; - zenity_general_dialog_no_markup = FALSE; - zenity_general_timeout_delay = -1; - zenity_general_modal = FALSE; - zenity_general_attach = 0; - - return TRUE; +zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_general_dialog_title = NULL; + zenity_general_window_icon = NULL; + zenity_general_width = -1; + zenity_general_height = -1; + zenity_general_dialog_text = NULL; + zenity_general_separator = g_strdup ("|"); + zenity_general_multiple = FALSE; + zenity_general_editable = FALSE; + zenity_general_uri = NULL; + zenity_general_ok_button = NULL; + zenity_general_cancel_button = NULL; + zenity_general_extra_buttons = NULL; + zenity_general_dialog_no_wrap = FALSE; + zenity_general_dialog_no_markup = FALSE; + zenity_general_timeout_delay = -1; + zenity_general_modal = FALSE; + zenity_general_attach = 0; + + return TRUE; } static gboolean -zenity_calendar_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_calendar_active = FALSE; - zenity_calendar_date_format = NULL; - zenity_calendar_day = -1; - zenity_calendar_month = -1; - zenity_calendar_year = -1; - - return TRUE; +zenity_calendar_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_calendar_active = FALSE; + zenity_calendar_date_format = NULL; + zenity_calendar_day = -1; + zenity_calendar_month = -1; + zenity_calendar_year = -1; + + return TRUE; } static gboolean -zenity_entry_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_entry_active = FALSE; - zenity_entry_entry_text = NULL; - zenity_entry_hide_text = FALSE; - - return TRUE; +zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_entry_active = FALSE; + zenity_entry_entry_text = NULL; + zenity_entry_hide_text = FALSE; + + return TRUE; } static gboolean -zenity_error_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_error_active = FALSE; - - return TRUE; +zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_error_active = FALSE; + + return TRUE; } static gboolean -zenity_info_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_info_active = FALSE; - - return TRUE; +zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_info_active = FALSE; + + return TRUE; } static gboolean -zenity_file_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_file_active = FALSE; - zenity_file_directory = FALSE; - zenity_file_save = FALSE; - zenity_file_confirm_overwrite = FALSE; - zenity_file_filter = NULL; - - return TRUE; +zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_file_active = FALSE; + zenity_file_directory = FALSE; + zenity_file_save = FALSE; + zenity_file_confirm_overwrite = FALSE; + zenity_file_filter = NULL; + + return TRUE; } static gboolean -zenity_list_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_list_active = FALSE; - zenity_list_columns = NULL; - zenity_list_checklist = FALSE; - zenity_list_radiolist = FALSE; - zenity_list_imagelist = FALSE; - zenity_list_hide_header = FALSE; - zenity_list_print_column = NULL; - zenity_list_hide_column = NULL; - zenity_list_mid_search = FALSE; - - return TRUE; +zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_list_active = FALSE; + zenity_list_columns = NULL; + zenity_list_checklist = FALSE; + zenity_list_radiolist = FALSE; + zenity_list_imagelist = FALSE; + zenity_list_hide_header = FALSE; + zenity_list_print_column = NULL; + zenity_list_hide_column = NULL; + zenity_list_mid_search = FALSE; + + return TRUE; } #ifdef HAVE_LIBNOTIFY static gboolean -zenity_notification_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_notification_active = FALSE; - zenity_notification_listen = FALSE; - - return TRUE; +zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_notification_active = FALSE; + zenity_notification_listen = FALSE; + + return TRUE; } #endif static gboolean -zenity_progress_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_progress_active = FALSE; - zenity_progress_percentage = 0; - zenity_progress_pulsate = FALSE; - zenity_progress_auto_close = FALSE; - zenity_progress_auto_kill = FALSE; - zenity_progress_no_cancel = FALSE; - zenity_progress_time_remaining = FALSE; - return TRUE; +zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_progress_active = FALSE; + zenity_progress_percentage = 0; + zenity_progress_pulsate = FALSE; + zenity_progress_auto_close = FALSE; + zenity_progress_auto_kill = FALSE; + zenity_progress_no_cancel = FALSE; + zenity_progress_time_remaining = FALSE; + return TRUE; } static gboolean -zenity_question_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_question_active = FALSE; - zenity_question_default_cancel = FALSE; - zenity_question_switch = FALSE; - return TRUE; +zenity_question_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_question_active = FALSE; + zenity_question_default_cancel = FALSE; + zenity_question_switch = FALSE; + return TRUE; } static gboolean -zenity_text_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_text_active = FALSE; - zenity_text_font = NULL; - zenity_text_checkbox = NULL; - zenity_text_auto_scroll = FALSE; +zenity_text_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_text_active = FALSE; + zenity_text_font = NULL; + zenity_text_checkbox = NULL; + zenity_text_auto_scroll = FALSE; #ifdef HAVE_WEBKITGTK - zenity_text_enable_html = FALSE; - zenity_text_no_interaction = FALSE; - zenity_text_url = NULL; + zenity_text_enable_html = FALSE; + zenity_text_no_interaction = FALSE; + zenity_text_url = NULL; #endif - return TRUE; + return TRUE; } static gboolean -zenity_warning_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_warning_active = FALSE; - - return TRUE; +zenity_warning_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_warning_active = FALSE; + + return TRUE; } static gboolean -zenity_scale_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_scale_active = FALSE; - zenity_scale_value = 0; - zenity_scale_min_value = 0; - zenity_scale_max_value = 100; - zenity_scale_step = 1; - zenity_scale_print_partial = FALSE; - zenity_scale_hide_value = FALSE; - - return TRUE; +zenity_scale_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_scale_active = FALSE; + zenity_scale_value = 0; + zenity_scale_min_value = 0; + zenity_scale_max_value = 100; + zenity_scale_step = 1; + zenity_scale_print_partial = FALSE; + zenity_scale_hide_value = FALSE; + + return TRUE; } static gboolean -zenity_color_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_colorsel_active = FALSE; - zenity_colorsel_color = NULL; - zenity_colorsel_show_palette = FALSE; - - return TRUE; +zenity_color_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_colorsel_active = FALSE; + zenity_colorsel_color = NULL; + zenity_colorsel_show_palette = FALSE; + + return TRUE; } static gboolean -zenity_password_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_password_active = FALSE; - zenity_password_show_username = FALSE; - - return TRUE; +zenity_password_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_password_active = FALSE; + zenity_password_show_username = FALSE; + + return TRUE; } static gboolean -zenity_forms_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_forms_active = FALSE; - zenity_forms_show_header = FALSE; - zenity_forms_date_format = NULL; -// zenity_forms_hide_column = NULL; - return TRUE; +zenity_forms_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_forms_active = FALSE; + zenity_forms_show_header = FALSE; + zenity_forms_date_format = NULL; + // zenity_forms_hide_column = NULL; + return TRUE; } static gboolean -zenity_misc_pre_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_misc_about = FALSE; - zenity_misc_version = FALSE; - - return TRUE; +zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_misc_about = FALSE; + zenity_misc_version = FALSE; + + return TRUE; } /* Post parse callbacks assign the option values to parsing result and makes some post condition tests */ static gboolean -zenity_general_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - results->data->dialog_title = zenity_general_dialog_title; - results->data->window_icon = zenity_general_window_icon; - results->data->width = zenity_general_width; - results->data->height = zenity_general_height; - results->data->timeout_delay = zenity_general_timeout_delay; - results->data->ok_label = zenity_general_ok_button; - results->data->cancel_label = zenity_general_cancel_button; - results->data->extra_label = zenity_general_extra_buttons; - results->data->modal = zenity_general_modal; - results->data->attach = zenity_general_attach; - - return TRUE; +zenity_general_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + results->data->dialog_title = zenity_general_dialog_title; + results->data->window_icon = zenity_general_window_icon; + results->data->width = zenity_general_width; + results->data->height = zenity_general_height; + results->data->timeout_delay = zenity_general_timeout_delay; + results->data->ok_label = zenity_general_ok_button; + results->data->cancel_label = zenity_general_cancel_button; + results->data->extra_label = zenity_general_extra_buttons; + results->data->modal = zenity_general_modal; + results->data->attach = zenity_general_attach; + + return TRUE; } static gboolean -zenity_calendar_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR); - - if (results->mode == MODE_CALENDAR) { - struct tm *t; - time_t current_time; - - time (¤t_time); - t = localtime (¤t_time); - - if (zenity_calendar_day < 0) - zenity_calendar_day = t->tm_mday; - if (zenity_calendar_month < 0) - zenity_calendar_month = t->tm_mon + 1; - if (zenity_calendar_year < 0) - zenity_calendar_year = t->tm_year + 1900; - - results->calendar_data->dialog_text = zenity_general_dialog_text; - results->calendar_data->day = zenity_calendar_day; - results->calendar_data->month = zenity_calendar_month; - results->calendar_data->year = zenity_calendar_year; - - if (zenity_calendar_date_format) - results->calendar_data->date_format = zenity_calendar_date_format; - else - results->calendar_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); - - } else { - if (zenity_calendar_day > -1) - zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_day), - ERROR_SUPPORT); - - if (zenity_calendar_month > -1) - zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_month), - ERROR_SUPPORT); - - if (zenity_calendar_year > -1) - zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_year), - ERROR_SUPPORT); - - if (zenity_calendar_date_format) - zenity_option_error (zenity_option_get_name (calendar_options, &zenity_calendar_date_format), - ERROR_SUPPORT); - } - - return TRUE; +zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR); + + if (results->mode == MODE_CALENDAR) { + struct tm *t; + time_t current_time; + + time (¤t_time); + t = localtime (¤t_time); + + if (zenity_calendar_day < 0) + zenity_calendar_day = t->tm_mday; + if (zenity_calendar_month < 0) + zenity_calendar_month = t->tm_mon + 1; + if (zenity_calendar_year < 0) + zenity_calendar_year = t->tm_year + 1900; + + results->calendar_data->dialog_text = zenity_general_dialog_text; + results->calendar_data->day = zenity_calendar_day; + results->calendar_data->month = zenity_calendar_month; + results->calendar_data->year = zenity_calendar_year; + + if (zenity_calendar_date_format) + results->calendar_data->date_format = zenity_calendar_date_format; + else + results->calendar_data->date_format = + g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); + + } else { + if (zenity_calendar_day > -1) + zenity_option_error ( + zenity_option_get_name (calendar_options, &zenity_calendar_day), + ERROR_SUPPORT); + + if (zenity_calendar_month > -1) + zenity_option_error (zenity_option_get_name ( + calendar_options, &zenity_calendar_month), + ERROR_SUPPORT); + + if (zenity_calendar_year > -1) + zenity_option_error (zenity_option_get_name ( + calendar_options, &zenity_calendar_year), + ERROR_SUPPORT); + + if (zenity_calendar_date_format) + zenity_option_error (zenity_option_get_name (calendar_options, + &zenity_calendar_date_format), + ERROR_SUPPORT); + } + + return TRUE; } static gboolean -zenity_entry_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_entry_active, MODE_ENTRY); - - if (results->mode == MODE_ENTRY) { - results->entry_data->dialog_text = zenity_general_dialog_text; - results->entry_data->entry_text = zenity_entry_entry_text; - results->entry_data->hide_text= zenity_entry_hide_text; - } else { - if (zenity_entry_entry_text) - zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_entry_text), - ERROR_SUPPORT); - - if (zenity_entry_hide_text) - zenity_option_error (zenity_option_get_name (entry_options, &zenity_entry_hide_text), - ERROR_SUPPORT); - } - - return TRUE; +zenity_entry_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_entry_active, MODE_ENTRY); + + if (results->mode == MODE_ENTRY) { + results->entry_data->dialog_text = zenity_general_dialog_text; + results->entry_data->entry_text = zenity_entry_entry_text; + results->entry_data->hide_text = zenity_entry_hide_text; + } else { + if (zenity_entry_entry_text) + zenity_option_error (zenity_option_get_name ( + entry_options, &zenity_entry_entry_text), + ERROR_SUPPORT); + + if (zenity_entry_hide_text) + zenity_option_error ( + zenity_option_get_name (entry_options, &zenity_entry_hide_text), + ERROR_SUPPORT); + } + + return TRUE; } static gboolean -zenity_error_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_error_active, MODE_ERROR); - - if (results->mode == MODE_ERROR) { - results->msg_data->dialog_text = zenity_general_dialog_text; - results->msg_data->dialog_icon = zenity_general_dialog_icon; - results->msg_data->mode = ZENITY_MSG_ERROR; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; - results->msg_data->no_markup = zenity_general_dialog_no_markup; - results->msg_data->ellipsize = zenity_general_dialog_ellipsize; - } - - return TRUE; +zenity_error_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_error_active, MODE_ERROR); + + if (results->mode == MODE_ERROR) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; + results->msg_data->mode = ZENITY_MSG_ERROR; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; + } + + return TRUE; } static gboolean -zenity_info_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_info_active, MODE_INFO); - - if (results->mode == MODE_INFO) { - results->msg_data->dialog_text = zenity_general_dialog_text; - results->msg_data->dialog_icon = zenity_general_dialog_icon; - results->msg_data->mode = ZENITY_MSG_INFO; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; - results->msg_data->no_markup = zenity_general_dialog_no_markup; - results->msg_data->ellipsize = zenity_general_dialog_ellipsize; - } - - return TRUE; +zenity_info_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_info_active, MODE_INFO); + + if (results->mode == MODE_INFO) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; + results->msg_data->mode = ZENITY_MSG_INFO; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; + } + + return TRUE; } static gboolean -zenity_file_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_file_active, MODE_FILE); - - if (results->mode == MODE_FILE) { - results->file_data->uri = zenity_general_uri; - results->file_data->multi = zenity_general_multiple; - results->file_data->directory = zenity_file_directory; - results->file_data->save = zenity_file_save; - results->file_data->confirm_overwrite = zenity_file_confirm_overwrite; - results->file_data->separator = zenity_general_separator; - results->file_data->filter = zenity_file_filter; - } else { - if (zenity_file_directory) - zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_directory), - ERROR_SUPPORT); - - if (zenity_file_save) - zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_save), - ERROR_SUPPORT); - - if (zenity_file_filter) - zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_filter), - ERROR_SUPPORT); - } - - return TRUE; +zenity_file_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_file_active, MODE_FILE); + + if (results->mode == MODE_FILE) { + results->file_data->uri = zenity_general_uri; + results->file_data->multi = zenity_general_multiple; + results->file_data->directory = zenity_file_directory; + results->file_data->save = zenity_file_save; + results->file_data->confirm_overwrite = zenity_file_confirm_overwrite; + results->file_data->separator = zenity_general_separator; + results->file_data->filter = zenity_file_filter; + } else { + if (zenity_file_directory) + zenity_option_error (zenity_option_get_name (file_selection_options, + &zenity_file_directory), + ERROR_SUPPORT); + + if (zenity_file_save) + zenity_option_error (zenity_option_get_name ( + file_selection_options, &zenity_file_save), + ERROR_SUPPORT); + + if (zenity_file_filter) + zenity_option_error (zenity_option_get_name (file_selection_options, + &zenity_file_filter), + ERROR_SUPPORT); + } + + return TRUE; } static gboolean -zenity_list_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - int i = 0; - gchar *column; - - zenity_option_set_dialog_mode (zenity_list_active, MODE_LIST); - - if (results->mode == MODE_LIST) { - results->tree_data->dialog_text = zenity_general_dialog_text; - - if (zenity_list_columns) { - column = zenity_list_columns[0]; - while (column != NULL) { - results->tree_data->columns = g_slist_append (results->tree_data->columns, column); - column = zenity_list_columns[++i]; - } - } - - results->tree_data->checkbox = zenity_list_checklist; - results->tree_data->radiobox = zenity_list_radiolist; - results->tree_data->imagebox = zenity_list_imagelist; - results->tree_data->multi = zenity_general_multiple; - results->tree_data->editable = zenity_general_editable; - results->tree_data->print_column = zenity_list_print_column; - results->tree_data->hide_column = zenity_list_hide_column; - results->tree_data->hide_header = zenity_list_hide_header; - results->tree_data->separator = zenity_general_separator; - results->tree_data->mid_search = zenity_list_mid_search; - } else { - if (zenity_list_columns) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_columns), - ERROR_SUPPORT); - - if (zenity_list_checklist) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_checklist), - ERROR_SUPPORT); - - if (zenity_list_radiolist) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_radiolist), - ERROR_SUPPORT); - - if (zenity_list_imagelist) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_imagelist), - ERROR_SUPPORT); - - if (zenity_list_print_column) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_print_column), - ERROR_SUPPORT); - - if (zenity_list_hide_column) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_hide_column), - ERROR_SUPPORT); - - if (zenity_list_hide_header) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_hide_header), - ERROR_SUPPORT); - if (zenity_list_mid_search) - zenity_option_error (zenity_option_get_name (list_options, &zenity_list_mid_search), - ERROR_SUPPORT); - } - - return TRUE; +zenity_list_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + int i = 0; + gchar *column; + + zenity_option_set_dialog_mode (zenity_list_active, MODE_LIST); + + if (results->mode == MODE_LIST) { + results->tree_data->dialog_text = zenity_general_dialog_text; + + if (zenity_list_columns) { + column = zenity_list_columns[0]; + while (column != NULL) { + results->tree_data->columns = + g_slist_append (results->tree_data->columns, column); + column = zenity_list_columns[++i]; + } + } + + results->tree_data->checkbox = zenity_list_checklist; + results->tree_data->radiobox = zenity_list_radiolist; + results->tree_data->imagebox = zenity_list_imagelist; + results->tree_data->multi = zenity_general_multiple; + results->tree_data->editable = zenity_general_editable; + results->tree_data->print_column = zenity_list_print_column; + results->tree_data->hide_column = zenity_list_hide_column; + results->tree_data->hide_header = zenity_list_hide_header; + results->tree_data->separator = zenity_general_separator; + results->tree_data->mid_search = zenity_list_mid_search; + } else { + if (zenity_list_columns) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_columns), + ERROR_SUPPORT); + + if (zenity_list_checklist) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_checklist), + ERROR_SUPPORT); + + if (zenity_list_radiolist) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_radiolist), + ERROR_SUPPORT); + + if (zenity_list_imagelist) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_imagelist), + ERROR_SUPPORT); + + if (zenity_list_print_column) + zenity_option_error (zenity_option_get_name ( + list_options, &zenity_list_print_column), + ERROR_SUPPORT); + + if (zenity_list_hide_column) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_hide_column), + ERROR_SUPPORT); + + if (zenity_list_hide_header) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_hide_header), + ERROR_SUPPORT); + if (zenity_list_mid_search) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_list_mid_search), + ERROR_SUPPORT); + } + + return TRUE; } #ifdef HAVE_LIBNOTIFY static gboolean -zenity_notification_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_notification_active, MODE_NOTIFICATION); - - if (results->mode == MODE_NOTIFICATION) { - results->notification_data->notification_text = zenity_general_dialog_text; - results->notification_data->listen = zenity_notification_listen; - results->notification_data->notification_hints = zenity_notification_hints; - } else { - if (zenity_notification_listen) - zenity_option_error (zenity_option_get_name (notification_options, &zenity_notification_listen), - ERROR_SUPPORT); - } - - return TRUE; +zenity_notification_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode ( + zenity_notification_active, MODE_NOTIFICATION); + + if (results->mode == MODE_NOTIFICATION) { + results->notification_data->notification_text = + zenity_general_dialog_text; + results->notification_data->listen = zenity_notification_listen; + results->notification_data->notification_hints = + zenity_notification_hints; + } else { + if (zenity_notification_listen) + zenity_option_error (zenity_option_get_name (notification_options, + &zenity_notification_listen), + ERROR_SUPPORT); + } + + return TRUE; } #endif static gboolean -zenity_progress_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS); - if (results->mode == MODE_PROGRESS) { - results->progress_data->dialog_text = zenity_general_dialog_text; - results->progress_data->pulsate = zenity_progress_pulsate; - results->progress_data->autoclose = zenity_progress_auto_close; - results->progress_data->autokill = zenity_progress_auto_kill; - results->progress_data->percentage = zenity_progress_percentage; - results->progress_data->no_cancel = zenity_progress_no_cancel; - results->progress_data->time_remaining = zenity_progress_time_remaining; - } else { - if (zenity_progress_pulsate) - zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_pulsate), - ERROR_SUPPORT); - - if (zenity_progress_percentage) - zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_percentage), - ERROR_SUPPORT); - - if (zenity_progress_auto_close) - zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_close), - ERROR_SUPPORT); - - if (zenity_progress_auto_kill) - zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_auto_kill), - ERROR_SUPPORT); - - if (zenity_progress_no_cancel) - zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_no_cancel), - ERROR_SUPPORT); - - if (zenity_progress_time_remaining) - zenity_option_error (zenity_option_get_name (progress_options, &zenity_progress_time_remaining), - ERROR_SUPPORT); - } - - return TRUE; +zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS); + if (results->mode == MODE_PROGRESS) { + results->progress_data->dialog_text = zenity_general_dialog_text; + results->progress_data->pulsate = zenity_progress_pulsate; + results->progress_data->autoclose = zenity_progress_auto_close; + results->progress_data->autokill = zenity_progress_auto_kill; + results->progress_data->percentage = zenity_progress_percentage; + results->progress_data->no_cancel = zenity_progress_no_cancel; + results->progress_data->time_remaining = zenity_progress_time_remaining; + } else { + if (zenity_progress_pulsate) + zenity_option_error (zenity_option_get_name (progress_options, + &zenity_progress_pulsate), + ERROR_SUPPORT); + + if (zenity_progress_percentage) + zenity_option_error (zenity_option_get_name (progress_options, + &zenity_progress_percentage), + ERROR_SUPPORT); + + if (zenity_progress_auto_close) + zenity_option_error (zenity_option_get_name (progress_options, + &zenity_progress_auto_close), + ERROR_SUPPORT); + + if (zenity_progress_auto_kill) + zenity_option_error (zenity_option_get_name (progress_options, + &zenity_progress_auto_kill), + ERROR_SUPPORT); + + if (zenity_progress_no_cancel) + zenity_option_error (zenity_option_get_name (progress_options, + &zenity_progress_no_cancel), + ERROR_SUPPORT); + + if (zenity_progress_time_remaining) + zenity_option_error (zenity_option_get_name (progress_options, + &zenity_progress_time_remaining), + ERROR_SUPPORT); + } + + return TRUE; } static gboolean -zenity_question_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION); - if (results->mode == MODE_QUESTION) { - results->msg_data->dialog_text = zenity_general_dialog_text; - results->msg_data->dialog_icon = zenity_general_dialog_icon; - if(zenity_question_switch) - results->msg_data->mode = ZENITY_MSG_SWITCH; - else - results->msg_data->mode = ZENITY_MSG_QUESTION; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; - results->msg_data->no_markup = zenity_general_dialog_no_markup; - results->msg_data->ellipsize = zenity_general_dialog_ellipsize; - results->msg_data->default_cancel = zenity_question_default_cancel; - } - if(zenity_question_switch && zenity_general_extra_buttons==NULL) - zenity_option_error (zenity_option_get_name (question_options, &zenity_question_switch), ERROR_SYNTAX); - - return TRUE; +zenity_question_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION); + if (results->mode == MODE_QUESTION) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; + if (zenity_question_switch) + results->msg_data->mode = ZENITY_MSG_SWITCH; + else + results->msg_data->mode = ZENITY_MSG_QUESTION; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; + results->msg_data->default_cancel = zenity_question_default_cancel; + } + if (zenity_question_switch && zenity_general_extra_buttons == NULL) + zenity_option_error ( + zenity_option_get_name (question_options, &zenity_question_switch), + ERROR_SYNTAX); + + return TRUE; } static gboolean -zenity_text_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_text_active, MODE_TEXTINFO); - - if (results->mode == MODE_TEXTINFO) { - results->text_data->uri = zenity_general_uri; - results->text_data->editable = zenity_general_editable; - results->text_data->no_wrap = zenity_general_dialog_no_wrap; - results->text_data->font = zenity_text_font; - results->text_data->checkbox = zenity_text_checkbox; - results->text_data->auto_scroll = zenity_text_auto_scroll; +zenity_text_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_text_active, MODE_TEXTINFO); + + if (results->mode == MODE_TEXTINFO) { + results->text_data->uri = zenity_general_uri; + results->text_data->editable = zenity_general_editable; + results->text_data->no_wrap = zenity_general_dialog_no_wrap; + results->text_data->font = zenity_text_font; + results->text_data->checkbox = zenity_text_checkbox; + results->text_data->auto_scroll = zenity_text_auto_scroll; #ifdef HAVE_WEBKITGTK - results->text_data->html = zenity_text_enable_html; - results->text_data->no_interaction = zenity_text_no_interaction; - results->text_data->url = zenity_text_url; + results->text_data->html = zenity_text_enable_html; + results->text_data->no_interaction = zenity_text_no_interaction; + results->text_data->url = zenity_text_url; #endif - } else { - if (zenity_text_font) - zenity_option_error (zenity_option_get_name (text_options, &zenity_text_font), - ERROR_SUPPORT); + } else { + if (zenity_text_font) + zenity_option_error ( + zenity_option_get_name (text_options, &zenity_text_font), + ERROR_SUPPORT); #ifdef HAVE_WEBKITGTK - if (zenity_text_enable_html) - zenity_option_error (zenity_option_get_name (text_options, &zenity_text_enable_html), - ERROR_SUPPORT); + if (zenity_text_enable_html) + zenity_option_error ( + zenity_option_get_name (text_options, &zenity_text_enable_html), + ERROR_SUPPORT); #endif - } - return TRUE; + } + return TRUE; } static gboolean -zenity_warning_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_warning_active, MODE_WARNING); - - if (results->mode == MODE_WARNING) { - results->msg_data->dialog_text = zenity_general_dialog_text; - results->msg_data->dialog_icon = zenity_general_dialog_icon; - results->msg_data->mode = ZENITY_MSG_WARNING; - results->msg_data->no_wrap = zenity_general_dialog_no_wrap; - results->msg_data->no_markup = zenity_general_dialog_no_markup; - results->msg_data->ellipsize = zenity_general_dialog_ellipsize; - } - - return TRUE; +zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_warning_active, MODE_WARNING); + + if (results->mode == MODE_WARNING) { + results->msg_data->dialog_text = zenity_general_dialog_text; + results->msg_data->dialog_icon = zenity_general_dialog_icon; + results->msg_data->mode = ZENITY_MSG_WARNING; + results->msg_data->no_wrap = zenity_general_dialog_no_wrap; + results->msg_data->no_markup = zenity_general_dialog_no_markup; + results->msg_data->ellipsize = zenity_general_dialog_ellipsize; + } + + return TRUE; } static gboolean -zenity_scale_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_scale_active, MODE_SCALE); - - if (results->mode == MODE_SCALE) { - results->scale_data->dialog_text = zenity_general_dialog_text; - results->scale_data->value = zenity_scale_value; - results->scale_data->min_value = zenity_scale_min_value; - results->scale_data->max_value = zenity_scale_max_value; - results->scale_data->step = zenity_scale_step; - results->scale_data->print_partial = zenity_scale_print_partial; - results->scale_data->hide_value = zenity_scale_hide_value; - } - - return TRUE; +zenity_scale_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_scale_active, MODE_SCALE); + + if (results->mode == MODE_SCALE) { + results->scale_data->dialog_text = zenity_general_dialog_text; + results->scale_data->value = zenity_scale_value; + results->scale_data->min_value = zenity_scale_min_value; + results->scale_data->max_value = zenity_scale_max_value; + results->scale_data->step = zenity_scale_step; + results->scale_data->print_partial = zenity_scale_print_partial; + results->scale_data->hide_value = zenity_scale_hide_value; + } + + return TRUE; } static gboolean -zenity_color_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_colorsel_active, MODE_COLOR); - - if (results->mode == MODE_COLOR) { - results->color_data->color = zenity_colorsel_color; - results->color_data->show_palette = zenity_colorsel_show_palette; - } else { - if (zenity_colorsel_color) - zenity_option_error (zenity_option_get_name(color_selection_options, &zenity_colorsel_color), - ERROR_SUPPORT); - - if (zenity_colorsel_show_palette) - zenity_option_error (zenity_option_get_name(color_selection_options, &zenity_colorsel_show_palette), - ERROR_SUPPORT); - } - - return TRUE; +zenity_color_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_colorsel_active, MODE_COLOR); + + if (results->mode == MODE_COLOR) { + results->color_data->color = zenity_colorsel_color; + results->color_data->show_palette = zenity_colorsel_show_palette; + } else { + if (zenity_colorsel_color) + zenity_option_error ( + zenity_option_get_name ( + color_selection_options, &zenity_colorsel_color), + ERROR_SUPPORT); + + if (zenity_colorsel_show_palette) + zenity_option_error ( + zenity_option_get_name ( + color_selection_options, &zenity_colorsel_show_palette), + ERROR_SUPPORT); + } + + return TRUE; } static gboolean -zenity_forms_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - gchar *values; - int i = 0; - - zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS); - if (results->mode == MODE_FORMS) { - results->forms_data->dialog_text = zenity_general_dialog_text; - results->forms_data->separator = zenity_general_separator; -// results->forms_data->hide_column = zenity_forms_hide_column; - results->forms_data->show_header = zenity_forms_show_header; - - if (zenity_forms_list_values) { - values = zenity_forms_list_values[0]; - while (values != NULL) { - results->forms_data->list_values = g_slist_append (results->forms_data->list_values, values); - values = zenity_forms_list_values[++i]; - } - } - if (zenity_forms_column_values) { - i = 0; - values = zenity_forms_column_values[0]; - while (values != NULL) { - results->forms_data->column_values = g_slist_append (results->forms_data->column_values, values); - values = zenity_forms_list_values[++i]; - } - } else - results->forms_data->column_values = g_slist_append (NULL, "column"); - - if (zenity_forms_combo_values) { - i = 0; - values = zenity_forms_combo_values[0]; - while (values != NULL) { - results->forms_data->combo_values = g_slist_append (results->forms_data->combo_values, values); - values = zenity_forms_combo_values[++i]; - } - } - if (zenity_forms_date_format) - results->forms_data->date_format = zenity_forms_date_format; - else - results->forms_data->date_format = g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); - } else { - if (zenity_forms_date_format) - zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_date_format), - ERROR_SUPPORT); - if (zenity_forms_list_values) - zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_list_values), - ERROR_SUPPORT); -// if (zenity_forms_hide_column) -// zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_hide_column), -// ERROR_SUPPORT); - if (zenity_forms_column_values) - zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_column_values), - ERROR_SUPPORT); - if (zenity_forms_combo_values) - zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_combo_values), - ERROR_SUPPORT); - if (zenity_forms_show_header) - zenity_option_error (zenity_option_get_name (forms_dialog_options, &zenity_forms_show_header), - ERROR_SUPPORT); - } - - return TRUE; +zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + gchar *values; + int i = 0; + + zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS); + if (results->mode == MODE_FORMS) { + results->forms_data->dialog_text = zenity_general_dialog_text; + results->forms_data->separator = zenity_general_separator; + // results->forms_data->hide_column = zenity_forms_hide_column; + results->forms_data->show_header = zenity_forms_show_header; + + if (zenity_forms_list_values) { + values = zenity_forms_list_values[0]; + while (values != NULL) { + results->forms_data->list_values = + g_slist_append (results->forms_data->list_values, values); + values = zenity_forms_list_values[++i]; + } + } + if (zenity_forms_column_values) { + i = 0; + values = zenity_forms_column_values[0]; + while (values != NULL) { + results->forms_data->column_values = + g_slist_append (results->forms_data->column_values, values); + values = zenity_forms_list_values[++i]; + } + } else + results->forms_data->column_values = + g_slist_append (NULL, "column"); + + if (zenity_forms_combo_values) { + i = 0; + values = zenity_forms_combo_values[0]; + while (values != NULL) { + results->forms_data->combo_values = + g_slist_append (results->forms_data->combo_values, values); + values = zenity_forms_combo_values[++i]; + } + } + if (zenity_forms_date_format) + results->forms_data->date_format = zenity_forms_date_format; + else + results->forms_data->date_format = + g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL); + } else { + if (zenity_forms_date_format) + zenity_option_error (zenity_option_get_name (forms_dialog_options, + &zenity_forms_date_format), + ERROR_SUPPORT); + if (zenity_forms_list_values) + zenity_option_error (zenity_option_get_name (forms_dialog_options, + &zenity_forms_list_values), + ERROR_SUPPORT); + // if (zenity_forms_hide_column) + // zenity_option_error (zenity_option_get_name + // (forms_dialog_options, &zenity_forms_hide_column), + // ERROR_SUPPORT); + if (zenity_forms_column_values) + zenity_option_error (zenity_option_get_name (forms_dialog_options, + &zenity_forms_column_values), + ERROR_SUPPORT); + if (zenity_forms_combo_values) + zenity_option_error (zenity_option_get_name (forms_dialog_options, + &zenity_forms_combo_values), + ERROR_SUPPORT); + if (zenity_forms_show_header) + zenity_option_error (zenity_option_get_name (forms_dialog_options, + &zenity_forms_show_header), + ERROR_SUPPORT); + } + + return TRUE; } - static gboolean -zenity_password_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_password_active, MODE_PASSWORD); - if (results->mode == MODE_PASSWORD) { - results->password_data->username = zenity_password_show_username; - } else { - if (zenity_password_show_username) - zenity_option_error (zenity_option_get_name(password_dialog_options, &zenity_password_show_username), - ERROR_SUPPORT); - } - - return TRUE; +zenity_password_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_password_active, MODE_PASSWORD); + if (results->mode == MODE_PASSWORD) { + results->password_data->username = zenity_password_show_username; + } else { + if (zenity_password_show_username) + zenity_option_error ( + zenity_option_get_name ( + password_dialog_options, &zenity_password_show_username), + ERROR_SUPPORT); + } + + return TRUE; } static gboolean -zenity_misc_post_callback (GOptionContext *context, - GOptionGroup *group, - gpointer data, - GError **error) -{ - zenity_option_set_dialog_mode (zenity_misc_about, MODE_ABOUT); - zenity_option_set_dialog_mode (zenity_misc_version, MODE_VERSION); - - return TRUE; +zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group, + gpointer data, GError **error) { + zenity_option_set_dialog_mode (zenity_misc_about, MODE_ABOUT); + zenity_option_set_dialog_mode (zenity_misc_version, MODE_VERSION); + + return TRUE; } static GOptionContext * -zenity_create_context (void) -{ - GOptionContext *tmp_ctx; - GOptionGroup *a_group; - - tmp_ctx = g_option_context_new(NULL); - - /* Adds general option entries */ - a_group = g_option_group_new("general", - N_("General options"), - N_("Show general options"), NULL, NULL); - g_option_group_add_entries(a_group, general_options); - g_option_group_set_parse_hooks (a_group, - zenity_general_pre_callback, zenity_general_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds calendar option entries */ - a_group = g_option_group_new("calendar", - N_("Calendar options"), - N_("Show calendar options"), NULL, NULL); - g_option_group_add_entries(a_group, calendar_options); - g_option_group_set_parse_hooks (a_group, - zenity_calendar_pre_callback, zenity_calendar_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds entry option entries */ - a_group = g_option_group_new("entry", - N_("Text entry options"), - N_("Show text entry options"), NULL, NULL); - g_option_group_add_entries(a_group, entry_options); - g_option_group_set_parse_hooks (a_group, - zenity_entry_pre_callback, zenity_entry_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds error option entries */ - a_group = g_option_group_new("error", - N_("Error options"), - N_("Show error options"), NULL, NULL); - g_option_group_add_entries(a_group, error_options); - g_option_group_set_parse_hooks (a_group, - zenity_error_pre_callback, zenity_error_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds info option entries */ - a_group = g_option_group_new("info", - N_("Info options"), - N_("Show info options"), NULL, NULL); - g_option_group_add_entries(a_group, info_options); - g_option_group_set_parse_hooks (a_group, - zenity_info_pre_callback, zenity_info_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds file selection option entries */ - a_group = g_option_group_new("file-selection", - N_("File selection options"), - N_("Show file selection options"), NULL, NULL); - g_option_group_add_entries(a_group, file_selection_options); - g_option_group_set_parse_hooks (a_group, - zenity_file_pre_callback, zenity_file_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds list option entries */ - a_group = g_option_group_new("list", - N_("List options"), - N_("Show list options"), NULL, NULL); - g_option_group_add_entries(a_group, list_options); - g_option_group_set_parse_hooks (a_group, - zenity_list_pre_callback, zenity_list_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - -#ifdef HAVE_LIBNOTIFY - /* Adds notification option entries */ - a_group = g_option_group_new("notification", - N_("Notification icon options"), - N_("Show notification icon options"), NULL, NULL); - g_option_group_add_entries(a_group, notification_options); - g_option_group_set_parse_hooks (a_group, - zenity_notification_pre_callback, zenity_notification_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); +zenity_create_context (void) { + GOptionContext *tmp_ctx; + GOptionGroup *a_group; + + tmp_ctx = g_option_context_new (NULL); + + /* Adds general option entries */ + a_group = g_option_group_new ("general", + N_ ("General options"), + N_ ("Show general options"), + NULL, + NULL); + g_option_group_add_entries (a_group, general_options); + g_option_group_set_parse_hooks ( + a_group, zenity_general_pre_callback, zenity_general_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds calendar option entries */ + a_group = g_option_group_new ("calendar", + N_ ("Calendar options"), + N_ ("Show calendar options"), + NULL, + NULL); + g_option_group_add_entries (a_group, calendar_options); + g_option_group_set_parse_hooks ( + a_group, zenity_calendar_pre_callback, zenity_calendar_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds entry option entries */ + a_group = g_option_group_new ("entry", + N_ ("Text entry options"), + N_ ("Show text entry options"), + NULL, + NULL); + g_option_group_add_entries (a_group, entry_options); + g_option_group_set_parse_hooks ( + a_group, zenity_entry_pre_callback, zenity_entry_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds error option entries */ + a_group = g_option_group_new ( + "error", N_ ("Error options"), N_ ("Show error options"), NULL, NULL); + g_option_group_add_entries (a_group, error_options); + g_option_group_set_parse_hooks ( + a_group, zenity_error_pre_callback, zenity_error_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds info option entries */ + a_group = g_option_group_new ( + "info", N_ ("Info options"), N_ ("Show info options"), NULL, NULL); + g_option_group_add_entries (a_group, info_options); + g_option_group_set_parse_hooks ( + a_group, zenity_info_pre_callback, zenity_info_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds file selection option entries */ + a_group = g_option_group_new ("file-selection", + N_ ("File selection options"), + N_ ("Show file selection options"), + NULL, + NULL); + g_option_group_add_entries (a_group, file_selection_options); + g_option_group_set_parse_hooks ( + a_group, zenity_file_pre_callback, zenity_file_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds list option entries */ + a_group = g_option_group_new ( + "list", N_ ("List options"), N_ ("Show list options"), NULL, NULL); + g_option_group_add_entries (a_group, list_options); + g_option_group_set_parse_hooks ( + a_group, zenity_list_pre_callback, zenity_list_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + +#ifdef HAVE_LIBNOTIFY + /* Adds notification option entries */ + a_group = g_option_group_new ("notification", + N_ ("Notification icon options"), + N_ ("Show notification icon options"), + NULL, + NULL); + g_option_group_add_entries (a_group, notification_options); + g_option_group_set_parse_hooks (a_group, + zenity_notification_pre_callback, + zenity_notification_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); #endif - - /* Adds progress option entries */ - a_group = g_option_group_new("progress", - N_("Progress options"), - N_("Show progress options"), NULL, NULL); - g_option_group_add_entries(a_group, progress_options); - g_option_group_set_parse_hooks (a_group, - zenity_progress_pre_callback, zenity_progress_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds question option entries */ - a_group = g_option_group_new("question", - N_("Question options"), - N_("Show question options"), NULL, NULL); - g_option_group_add_entries(a_group, question_options); - g_option_group_set_parse_hooks (a_group, - zenity_question_pre_callback, zenity_question_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds warning option entries */ - a_group = g_option_group_new("warning", - N_("Warning options"), - N_("Show warning options"), NULL, NULL); - g_option_group_add_entries(a_group, warning_options); - g_option_group_set_parse_hooks (a_group, - zenity_warning_pre_callback, zenity_warning_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds scale option entries */ - a_group = g_option_group_new("scale", - N_("Scale options"), - N_("Show scale options"), NULL, NULL); - g_option_group_add_entries(a_group, scale_options); - g_option_group_set_parse_hooks (a_group, - zenity_scale_pre_callback, zenity_scale_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds text option entries */ - a_group = g_option_group_new("text-info", - N_("Text information options"), - N_("Show text information options"), NULL, NULL); - g_option_group_add_entries(a_group, text_options); - g_option_group_set_parse_hooks (a_group, - zenity_text_pre_callback, zenity_text_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds color selection option entries */ - a_group = g_option_group_new("color-selection", - N_("Color selection options"), - N_("Show color selection options"), NULL, NULL); - g_option_group_add_entries(a_group, color_selection_options); - g_option_group_set_parse_hooks (a_group, - zenity_color_pre_callback, zenity_color_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds password dialog option entries */ - a_group = g_option_group_new("password", - N_("Password dialog options"), - N_("Show password dialog options"), NULL, NULL); - g_option_group_add_entries (a_group, password_dialog_options); - g_option_group_set_parse_hooks (a_group, - zenity_password_pre_callback, zenity_password_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds forms dialog option entries */ - a_group = g_option_group_new("forms", - N_("Forms dialog options"), - N_("Show forms dialog options"), NULL, NULL); - g_option_group_add_entries (a_group, forms_dialog_options); - g_option_group_set_parse_hooks (a_group, - zenity_forms_pre_callback, zenity_forms_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds misc option entries */ - a_group = g_option_group_new("misc", - N_("Miscellaneous options"), - N_("Show miscellaneous options"), NULL, NULL); - g_option_group_add_entries(a_group, miscellaneous_options); - g_option_group_set_parse_hooks (a_group, - zenity_misc_pre_callback, zenity_misc_post_callback); - g_option_group_set_error_hook (a_group, zenity_option_error_callback); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Adds gtk option entries */ - a_group = gtk_get_option_group(TRUE); - g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); - g_option_context_add_group(tmp_ctx, a_group); - - /* Enable help options */ - g_option_context_set_help_enabled (tmp_ctx, TRUE); - g_option_context_set_ignore_unknown_options (tmp_ctx, FALSE); - - return tmp_ctx; + + /* Adds progress option entries */ + a_group = g_option_group_new ("progress", + N_ ("Progress options"), + N_ ("Show progress options"), + NULL, + NULL); + g_option_group_add_entries (a_group, progress_options); + g_option_group_set_parse_hooks ( + a_group, zenity_progress_pre_callback, zenity_progress_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds question option entries */ + a_group = g_option_group_new ("question", + N_ ("Question options"), + N_ ("Show question options"), + NULL, + NULL); + g_option_group_add_entries (a_group, question_options); + g_option_group_set_parse_hooks ( + a_group, zenity_question_pre_callback, zenity_question_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds warning option entries */ + a_group = g_option_group_new ("warning", + N_ ("Warning options"), + N_ ("Show warning options"), + NULL, + NULL); + g_option_group_add_entries (a_group, warning_options); + g_option_group_set_parse_hooks ( + a_group, zenity_warning_pre_callback, zenity_warning_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds scale option entries */ + a_group = g_option_group_new ( + "scale", N_ ("Scale options"), N_ ("Show scale options"), NULL, NULL); + g_option_group_add_entries (a_group, scale_options); + g_option_group_set_parse_hooks ( + a_group, zenity_scale_pre_callback, zenity_scale_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds text option entries */ + a_group = g_option_group_new ("text-info", + N_ ("Text information options"), + N_ ("Show text information options"), + NULL, + NULL); + g_option_group_add_entries (a_group, text_options); + g_option_group_set_parse_hooks ( + a_group, zenity_text_pre_callback, zenity_text_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds color selection option entries */ + a_group = g_option_group_new ("color-selection", + N_ ("Color selection options"), + N_ ("Show color selection options"), + NULL, + NULL); + g_option_group_add_entries (a_group, color_selection_options); + g_option_group_set_parse_hooks ( + a_group, zenity_color_pre_callback, zenity_color_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds password dialog option entries */ + a_group = g_option_group_new ("password", + N_ ("Password dialog options"), + N_ ("Show password dialog options"), + NULL, + NULL); + g_option_group_add_entries (a_group, password_dialog_options); + g_option_group_set_parse_hooks ( + a_group, zenity_password_pre_callback, zenity_password_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds forms dialog option entries */ + a_group = g_option_group_new ("forms", + N_ ("Forms dialog options"), + N_ ("Show forms dialog options"), + NULL, + NULL); + g_option_group_add_entries (a_group, forms_dialog_options); + g_option_group_set_parse_hooks ( + a_group, zenity_forms_pre_callback, zenity_forms_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds misc option entries */ + a_group = g_option_group_new ("misc", + N_ ("Miscellaneous options"), + N_ ("Show miscellaneous options"), + NULL, + NULL); + g_option_group_add_entries (a_group, miscellaneous_options); + g_option_group_set_parse_hooks ( + a_group, zenity_misc_pre_callback, zenity_misc_post_callback); + g_option_group_set_error_hook (a_group, zenity_option_error_callback); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Adds gtk option entries */ + a_group = gtk_get_option_group (TRUE); + g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE); + g_option_context_add_group (tmp_ctx, a_group); + + /* Enable help options */ + g_option_context_set_help_enabled (tmp_ctx, TRUE); + g_option_context_set_ignore_unknown_options (tmp_ctx, FALSE); + + return tmp_ctx; } void -zenity_option_error (gchar *string, ZenityError error) -{ - switch (error) { - case ERROR_SYNTAX: - g_printerr (_("This option is not available. Please see --help for all possible usages.\n")); - zenity_option_free (); - exit (-1); - case ERROR_SUPPORT: - g_printerr (_("--%s is not supported for this dialog\n"), string); - zenity_option_free (); - exit (-1); - case ERROR_DIALOG: - g_printerr (_("Two or more dialog options specified\n")); - zenity_option_free (); - exit (-1); - default: - return; - } +zenity_option_error (gchar *string, ZenityError error) { + switch (error) { + case ERROR_SYNTAX: + g_printerr (_ ("This option is not available. Please see --help " + "for all possible usages.\n")); + zenity_option_free (); + exit (-1); + case ERROR_SUPPORT: + g_printerr (_ ("--%s is not supported for this dialog\n"), string); + zenity_option_free (); + exit (-1); + case ERROR_DIALOG: + g_printerr (_ ("Two or more dialog options specified\n")); + zenity_option_free (); + exit (-1); + default: + return; + } } ZenityParsingOptions * -zenity_option_parse (gint argc, gchar **argv) -{ - GError *error = NULL; - - zenity_option_init (); - - ctx = zenity_create_context (); - - g_option_context_parse (ctx, &argc, &argv, &error); - - /* Some option pointer a shared among more than one group and don't - have their post condition tested. This test is done here. */ - - if (zenity_general_dialog_text) - if (results->mode == MODE_ABOUT || results->mode == MODE_VERSION) - zenity_option_error (zenity_option_get_name (calendar_options, &zenity_general_dialog_text), ERROR_SUPPORT); - - if (strcmp (zenity_general_separator, "|") != 0) - if (results->mode != MODE_LIST && results->mode != MODE_FILE && results->mode != MODE_FORMS) - zenity_option_error (zenity_option_get_name (list_options, &zenity_general_separator), ERROR_SUPPORT); - - if (zenity_general_multiple) - if (results->mode != MODE_FILE && results->mode != MODE_LIST) - zenity_option_error (zenity_option_get_name (list_options, &zenity_general_multiple), ERROR_SUPPORT); - - if (zenity_general_editable) - if (results->mode != MODE_TEXTINFO && results->mode != MODE_LIST) - zenity_option_error (zenity_option_get_name (list_options, &zenity_general_editable), ERROR_SUPPORT); - - if (zenity_general_uri) - if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) - zenity_option_error (zenity_option_get_name (text_options, &zenity_general_uri), ERROR_SUPPORT); - - if (zenity_general_ok_button) - if(results->mode == MODE_FILE) - zenity_option_error (zenity_option_get_name (general_options, &zenity_general_ok_button), ERROR_SUPPORT); - - if (zenity_general_cancel_button) - if(results->mode == MODE_FILE || results->mode == MODE_ERROR || results->mode == MODE_WARNING || results->mode == MODE_INFO) - zenity_option_error (zenity_option_get_name (general_options, &zenity_general_cancel_button), ERROR_SUPPORT); - - if (zenity_general_dialog_no_wrap) - if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING && results->mode != MODE_TEXTINFO) - zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_no_wrap), ERROR_SUPPORT); - - if (zenity_general_dialog_ellipsize) - if (results->mode != MODE_INFO && results->mode != MODE_ERROR && results->mode != MODE_QUESTION && results->mode != MODE_WARNING) - zenity_option_error (zenity_option_get_name (text_options, &zenity_general_dialog_ellipsize), ERROR_SUPPORT); - - - return results; +zenity_option_parse (gint argc, gchar **argv) { + GError *error = NULL; + + zenity_option_init (); + + ctx = zenity_create_context (); + + g_option_context_parse (ctx, &argc, &argv, &error); + + /* Some option pointer a shared among more than one group and don't + have their post condition tested. This test is done here. */ + + if (zenity_general_dialog_text) + if (results->mode == MODE_ABOUT || results->mode == MODE_VERSION) + zenity_option_error (zenity_option_get_name (calendar_options, + &zenity_general_dialog_text), + ERROR_SUPPORT); + + if (strcmp (zenity_general_separator, "|") != 0) + if (results->mode != MODE_LIST && results->mode != MODE_FILE && + results->mode != MODE_FORMS) + zenity_option_error (zenity_option_get_name ( + list_options, &zenity_general_separator), + ERROR_SUPPORT); + + if (zenity_general_multiple) + if (results->mode != MODE_FILE && results->mode != MODE_LIST) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_general_multiple), + ERROR_SUPPORT); + + if (zenity_general_editable) + if (results->mode != MODE_TEXTINFO && results->mode != MODE_LIST) + zenity_option_error ( + zenity_option_get_name (list_options, &zenity_general_editable), + ERROR_SUPPORT); + + if (zenity_general_uri) + if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO) + zenity_option_error ( + zenity_option_get_name (text_options, &zenity_general_uri), + ERROR_SUPPORT); + + if (zenity_general_ok_button) + if (results->mode == MODE_FILE) + zenity_option_error (zenity_option_get_name (general_options, + &zenity_general_ok_button), + ERROR_SUPPORT); + + if (zenity_general_cancel_button) + if (results->mode == MODE_FILE || results->mode == MODE_ERROR || + results->mode == MODE_WARNING || results->mode == MODE_INFO) + zenity_option_error (zenity_option_get_name (general_options, + &zenity_general_cancel_button), + ERROR_SUPPORT); + + if (zenity_general_dialog_no_wrap) + if (results->mode != MODE_INFO && results->mode != MODE_ERROR && + results->mode != MODE_QUESTION && results->mode != MODE_WARNING && + results->mode != MODE_TEXTINFO) + zenity_option_error (zenity_option_get_name (text_options, + &zenity_general_dialog_no_wrap), + ERROR_SUPPORT); + + if (zenity_general_dialog_ellipsize) + if (results->mode != MODE_INFO && results->mode != MODE_ERROR && + results->mode != MODE_QUESTION && results->mode != MODE_WARNING) + zenity_option_error (zenity_option_get_name (text_options, + &zenity_general_dialog_ellipsize), + ERROR_SUPPORT); + + return results; } -- cgit