summaryrefslogtreecommitdiff
path: root/src/option.c
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2021-02-11 10:43:19 -0500
committerLogan Rathbone <poprocks@gmail.com>2021-02-11 10:43:19 -0500
commitacac6061539e6f6e0b74f9a7fcedc54553aad500 (patch)
treecfcccaa589cd4428de36a3b5ee86fb287f66838c /src/option.c
parentf17a8bfc875fada1a79e42f6f07119e91a6955f4 (diff)
downloadzenity-acac6061539e6f6e0b74f9a7fcedc54553aad500.tar.gz
forms,msg,notification,option: make build against gtk4
Diffstat (limited to 'src/option.c')
-rw-r--r--src/option.c1940
1 files changed, 1027 insertions, 913 deletions
diff --git a/src/option.c b/src/option.c
index fb65cd5..1b67fad 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1,3 +1,5 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* option.h
*
@@ -22,30 +24,30 @@
* Lucas Rocha <lucasr@im.ufba.br>
*/
-#include "config.h"
-
#include "option.h"
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <config.h>
+
/* General Options */
-static gchar *zenity_general_dialog_title;
-static gchar *zenity_general_window_icon;
+static char *zenity_general_dialog_title;
+static char *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 char *zenity_general_dialog_text;
+static char *zenity_general_dialog_icon;
+static char *zenity_general_separator;
static gboolean zenity_general_multiple;
static gboolean zenity_general_editable;
-static gchar *zenity_general_uri;
+static char *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 int zenity_general_timeout_delay;
+static char *zenity_general_ok_button;
+static char *zenity_general_cancel_button;
+static char **zenity_general_extra_buttons;
static gboolean zenity_general_modal;
static gboolean zenity_general_dialog_ellipsize;
@@ -54,11 +56,11 @@ 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 char *zenity_calendar_date_format;
/* Entry Dialog Options */
static gboolean zenity_entry_active;
-static gchar *zenity_entry_entry_text;
+static char *zenity_entry_entry_text;
static gboolean zenity_entry_hide_text;
/* Error Dialog Options */
@@ -71,15 +73,15 @@ static gboolean zenity_info_active;
static gboolean zenity_file_active;
static gboolean zenity_file_directory;
static gboolean zenity_file_save;
-static gchar **zenity_file_filter;
+static char **zenity_file_filter;
/* List Dialog Options */
static gboolean zenity_list_active;
-static gchar **zenity_list_columns;
+static char **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 char *zenity_list_print_column;
+static char *zenity_list_hide_column;
static gboolean zenity_list_hide_header;
static gboolean zenity_list_imagelist;
static gboolean zenity_list_mid_search;
@@ -88,7 +90,7 @@ 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 char **zenity_notification_hints;
#endif
/* Progress Dialog Options */
@@ -107,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 char *zenity_text_font;
+static char *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 char *zenity_text_url;
#endif
/* Warning Dialog Options */
@@ -122,16 +124,16 @@ 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 int zenity_scale_value;
+static int zenity_scale_min_value;
+static int zenity_scale_max_value;
+static int 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 char *zenity_colorsel_color;
static gboolean zenity_colorsel_show_palette;
/* Password Dialog Options */
@@ -141,244 +143,254 @@ 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 char *zenity_forms_date_format;
+static char **zenity_forms_list_values;
+static char **zenity_forms_column_values;
+static char **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},
- {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 gboolean zenity_forms_callback (const char *option_name,
+ const char *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},
+ {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 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 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 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 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 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"),
+ 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"),
+ NULL},
+ {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"),
+ 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"),
+ NULL},
+ {NULL}};
static GOptionEntry file_selection_options[] =
{{"file-selection",
@@ -435,255 +447,261 @@ static GOptionEntry file_selection_options[] =
},
{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 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}};
+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 text_options[] = {
- {"text-info",
+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"),
+ NULL},
+ {"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"),
+ NULL},
+ {"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,
@@ -753,212 +771,218 @@ static GOptionEntry text_options[] = {
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 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"),
+ 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"),
+ NULL},
+ {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 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",
+static GOptionEntry password_dialog_options[] =
+ {{"password",
'\0',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE,
@@ -974,8 +998,8 @@ static GOptionEntry password_dialog_options[] = {
NULL},
{NULL}};
-static GOptionEntry color_selection_options[] = {
- {"color-selection",
+static GOptionEntry color_selection_options[] =
+ {{"color-selection",
'\0',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE,
@@ -998,28 +1022,29 @@ static GOptionEntry color_selection_options[] = {
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 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;
static void
-zenity_option_init (void) {
-
+zenity_option_init (void)
+{
results = g_new0 (ZenityParsingOptions, 1);
/* Initialize the various dialog structures */
@@ -1042,7 +1067,8 @@ zenity_option_init (void) {
}
void
-zenity_option_free (void) {
+zenity_option_free (void)
+{
if (zenity_general_dialog_title)
g_free (zenity_general_dialog_title);
if (zenity_general_window_icon)
@@ -1070,8 +1096,6 @@ zenity_option_free (void) {
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);
@@ -1102,8 +1126,10 @@ zenity_option_free (void) {
}
static void
-zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) {
- if (is_active == TRUE) {
+zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode)
+{
+ if (is_active == TRUE)
+ {
if (results->mode == MODE_LAST)
results->mode = mode;
else
@@ -1111,21 +1137,22 @@ zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) {
}
}
-static gchar *
-zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) {
- int i;
-
- for (i = 1; entries[i].long_name != NULL; i++) {
+static char *
+zenity_option_get_name (GOptionEntry *entries, gpointer arg_data)
+{
+ for (int i = 1; entries[i].long_name != NULL; i++)
+ {
if (entries[i].arg_data == arg_data)
- return (gchar *) entries[i].long_name;
+ return (char *)entries[i].long_name;
}
return NULL;
}
/* Forms callback */
static gboolean
-zenity_forms_callback (const gchar *option_name, const gchar *value,
- gpointer data, GError **error) {
+zenity_forms_callback (const char *option_name, const char *value,
+ gpointer data, GError **error)
+{
ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1);
forms_value->option_value = g_strdup (value);
@@ -1150,7 +1177,8 @@ zenity_forms_callback (const gchar *option_name, const gchar *value,
/* Error callback */
static void
zenity_option_error_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_error (NULL, ERROR_SYNTAX);
}
@@ -1158,7 +1186,8 @@ zenity_option_error_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_general_dialog_title = NULL;
zenity_general_window_icon = NULL;
zenity_general_width = -1;
@@ -1181,7 +1210,8 @@ zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_calendar_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_calendar_active = FALSE;
zenity_calendar_date_format = NULL;
zenity_calendar_day = -1;
@@ -1193,7 +1223,8 @@ zenity_calendar_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_entry_active = FALSE;
zenity_entry_entry_text = NULL;
zenity_entry_hide_text = FALSE;
@@ -1203,7 +1234,8 @@ zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_error_active = FALSE;
return TRUE;
@@ -1211,7 +1243,8 @@ zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_info_active = FALSE;
return TRUE;
@@ -1219,7 +1252,8 @@ zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_file_active = FALSE;
zenity_file_directory = FALSE;
zenity_file_save = FALSE;
@@ -1230,7 +1264,8 @@ zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_list_active = FALSE;
zenity_list_columns = NULL;
zenity_list_checklist = FALSE;
@@ -1247,7 +1282,8 @@ zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group,
#ifdef HAVE_LIBNOTIFY
static gboolean
zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_notification_active = FALSE;
zenity_notification_listen = FALSE;
@@ -1257,7 +1293,8 @@ zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_progress_active = FALSE;
zenity_progress_percentage = 0;
zenity_progress_pulsate = FALSE;
@@ -1265,21 +1302,25 @@ zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group,
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) {
+ 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) {
+ gpointer data, GError **error)
+{
zenity_text_active = FALSE;
zenity_text_font = NULL;
zenity_text_checkbox = NULL;
@@ -1289,12 +1330,14 @@ zenity_text_pre_callback (GOptionContext *context, GOptionGroup *group,
zenity_text_no_interaction = FALSE;
zenity_text_url = NULL;
#endif
+
return TRUE;
}
static gboolean
zenity_warning_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_warning_active = FALSE;
return TRUE;
@@ -1302,7 +1345,8 @@ zenity_warning_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_scale_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_scale_active = FALSE;
zenity_scale_value = 0;
zenity_scale_min_value = 0;
@@ -1316,7 +1360,8 @@ zenity_scale_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_color_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_colorsel_active = FALSE;
zenity_colorsel_color = NULL;
zenity_colorsel_show_palette = FALSE;
@@ -1326,7 +1371,8 @@ zenity_color_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_password_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_password_active = FALSE;
zenity_password_show_username = FALSE;
@@ -1335,17 +1381,19 @@ zenity_password_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_forms_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ 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) {
+ gpointer data, GError **error)
+{
zenity_misc_about = FALSE;
zenity_misc_version = FALSE;
@@ -1357,7 +1405,8 @@ zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_general_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ 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;
@@ -1373,10 +1422,12 @@ zenity_general_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR);
- if (results->mode == MODE_CALENDAR) {
+ if (results->mode == MODE_CALENDAR)
+ {
struct tm *t;
time_t current_time;
@@ -1395,67 +1446,79 @@ zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group,
results->calendar_data->month = zenity_calendar_month;
results->calendar_data->year = zenity_calendar_year;
- if (zenity_calendar_date_format)
+ if (zenity_calendar_date_format) {
results->calendar_data->date_format = zenity_calendar_date_format;
- else
+ } 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),
+ }
+ }
+ 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),
+ 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),
+ if (zenity_calendar_year > -1) {
+ zenity_option_error (zenity_option_get_name (calendar_options,
+ &zenity_calendar_year),
ERROR_SUPPORT);
+ }
- if (zenity_calendar_date_format)
+ if (zenity_calendar_date_format) {
zenity_option_error (zenity_option_get_name (calendar_options,
- &zenity_calendar_date_format),
+ &zenity_calendar_date_format),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_entry_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_entry_active, MODE_ENTRY);
- if (results->mode == 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),
+ }
+ 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),
+ 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) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_error_active, MODE_ERROR);
- if (results->mode == 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;
@@ -1469,10 +1532,12 @@ zenity_error_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_info_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_info_active, MODE_INFO);
- if (results->mode == 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;
@@ -1486,50 +1551,61 @@ zenity_info_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_file_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_file_active, MODE_FILE);
- if (results->mode == 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->separator = zenity_general_separator;
results->file_data->filter = zenity_file_filter;
- } else {
- if (zenity_file_directory)
+ }
+ else
+ {
+ if (zenity_file_directory) {
zenity_option_error (zenity_option_get_name (file_selection_options,
- &zenity_file_directory),
+ &zenity_file_directory),
ERROR_SUPPORT);
+ }
- if (zenity_file_save)
- zenity_option_error (zenity_option_get_name (
- file_selection_options, &zenity_file_save),
+ if (zenity_file_save) {
+ zenity_option_error (zenity_option_get_name (file_selection_options,
+ &zenity_file_save),
ERROR_SUPPORT);
+ }
- if (zenity_file_filter)
+ if (zenity_file_filter) {
zenity_option_error (zenity_option_get_name (file_selection_options,
- &zenity_file_filter),
+ &zenity_file_filter),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
int i = 0;
- gchar *column;
+ char *column;
zenity_option_set_dialog_mode (zenity_list_active, MODE_LIST);
- if (results->mode == MODE_LIST) {
+ if (results->mode == MODE_LIST)
+ {
results->tree_data->dialog_text = zenity_general_dialog_text;
- if (zenity_list_columns) {
+ if (zenity_list_columns)
+ {
column = zenity_list_columns[0];
- while (column != NULL) {
+
+ while (column != NULL)
+ {
results->tree_data->columns =
g_slist_append (results->tree_data->columns, column);
column = zenity_list_columns[++i];
@@ -1546,7 +1622,9 @@ zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
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 {
+ }
+ else
+ {
if (zenity_list_columns)
zenity_option_error (
zenity_option_get_name (list_options, &zenity_list_columns),
@@ -1586,39 +1664,44 @@ zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
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);
+ gpointer data, GError **error)
+{
+ zenity_option_set_dialog_mode (zenity_notification_active,
+ MODE_NOTIFICATION);
- if (results->mode == 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)
+ }
+ else
+ {
+ if (zenity_notification_listen) {
zenity_option_error (zenity_option_get_name (notification_options,
- &zenity_notification_listen),
+ &zenity_notification_listen),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
#endif
static gboolean
zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS);
- if (results->mode == 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;
@@ -1626,46 +1709,56 @@ zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group,
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)
+ }
+ else
+ {
+ if (zenity_progress_pulsate) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_pulsate),
+ &zenity_progress_pulsate),
ERROR_SUPPORT);
+ }
- if (zenity_progress_percentage)
+ if (zenity_progress_percentage) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_percentage),
+ &zenity_progress_percentage),
ERROR_SUPPORT);
+ }
- if (zenity_progress_auto_close)
+ if (zenity_progress_auto_close) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_auto_close),
+ &zenity_progress_auto_close),
ERROR_SUPPORT);
+ }
- if (zenity_progress_auto_kill)
+ if (zenity_progress_auto_kill) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_auto_kill),
+ &zenity_progress_auto_kill),
ERROR_SUPPORT);
+ }
- if (zenity_progress_no_cancel)
+ if (zenity_progress_no_cancel) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_no_cancel),
+ &zenity_progress_no_cancel),
ERROR_SUPPORT);
+ }
- if (zenity_progress_time_remaining)
+ if (zenity_progress_time_remaining) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_time_remaining),
+ &zenity_progress_time_remaining),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_question_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION);
- if (results->mode == 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)
@@ -1677,20 +1770,24 @@ zenity_question_post_callback (GOptionContext *context, GOptionGroup *group,
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);
+ 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) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_text_active, MODE_TEXTINFO);
- if (results->mode == 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;
@@ -1702,16 +1799,20 @@ zenity_text_post_callback (GOptionContext *context, GOptionGroup *group,
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),
+ if (zenity_text_enable_html) {
+ zenity_option_error (zenity_option_get_name (text_options,
+ &zenity_text_enable_html),
ERROR_SUPPORT);
+ }
#endif
}
return TRUE;
@@ -1719,10 +1820,12 @@ zenity_text_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_warning_active, MODE_WARNING);
- if (results->mode == 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;
@@ -1736,10 +1839,12 @@ zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_scale_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_scale_active, MODE_SCALE);
- if (results->mode == 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;
@@ -1754,40 +1859,47 @@ zenity_scale_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_color_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_colorsel_active, MODE_COLOR);
- if (results->mode == 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);
}
+ 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;
+ gpointer data, GError **error)
+{
+ char *values;
int i = 0;
zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS);
- if (results->mode == 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) {
@@ -1824,7 +1936,9 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
else
results->forms_data->date_format =
g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
- } else {
+ }
+ else
+ {
if (zenity_forms_date_format)
zenity_option_error (zenity_option_get_name (forms_dialog_options,
&zenity_forms_date_format),
@@ -1833,10 +1947,6 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
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),
@@ -1856,24 +1966,26 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_password_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ 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);
+ 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) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_misc_about, MODE_ABOUT);
zenity_option_set_dialog_mode (zenity_misc_version, MODE_VERSION);
@@ -1881,7 +1993,8 @@ zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group,
}
static GOptionContext *
-zenity_create_context (void) {
+zenity_create_context (void)
+{
GOptionContext *tmp_ctx;
GOptionGroup *a_group;
@@ -1894,8 +2007,8 @@ zenity_create_context (void) {
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_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);
@@ -1907,8 +2020,8 @@ zenity_create_context (void) {
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_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);
@@ -1920,15 +2033,15 @@ zenity_create_context (void) {
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_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);
+ 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);
@@ -1937,8 +2050,8 @@ zenity_create_context (void) {
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);
+ 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);
@@ -2005,8 +2118,8 @@ zenity_create_context (void) {
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_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);
@@ -2018,15 +2131,15 @@ zenity_create_context (void) {
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_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);
+ 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);
@@ -2054,8 +2167,8 @@ zenity_create_context (void) {
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_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);
@@ -2067,8 +2180,8 @@ zenity_create_context (void) {
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_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);
@@ -2080,8 +2193,8 @@ zenity_create_context (void) {
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_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);
@@ -2093,17 +2206,12 @@ zenity_create_context (void) {
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_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);
@@ -2112,28 +2220,34 @@ zenity_create_context (void) {
}
void
-zenity_option_error (gchar *string, ZenityError error) {
- switch (error) {
+zenity_option_error (char *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) {
+zenity_option_parse (int argc, char **argv)
+{
GError *error = NULL;
zenity_option_init ();