From 8924d5c401829efc59380fda8823bedca5994bcb Mon Sep 17 00:00:00 2001 From: Glynn Foster Date: Mon, 6 Jan 2003 21:09:22 +0000 Subject: I love featuritis. Instead of fixing stuff so it actually works, I add 2003-01-06 Glynn Foster * src/main.c, src/msg.c, src/zenity.glade, src/zenity.h: I love featuritis. Instead of fixing stuff so it actually works, I add more stuff. Add support for info dialog. --- src/main.c | 50 +++++++++++++++++++++++++ src/msg.c | 9 +++++ src/zenity.glade | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/zenity.h | 3 +- 4 files changed, 172 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index a1faf681..334c20df 100644 --- a/src/main.c +++ b/src/main.c @@ -35,6 +35,7 @@ typedef enum { MODE_QUESTION, MODE_TEXTINFO, MODE_WARNING, + MODE_INFO, MODE_LAST } ZenityDialogMode; @@ -55,6 +56,7 @@ enum { OPTION_CALENDAR = 1, OPTION_ENTRY, OPTION_ERROR, + OPTION_INFO, OPTION_FILE, OPTION_LIST, OPTION_PROGRESS, @@ -71,6 +73,7 @@ enum { OPTION_INPUTTEXT, OPTION_HIDETEXT, OPTION_ERRORTEXT, + OPTION_INFOTEXT, OPTION_FILENAME, OPTION_COLUMN, OPTION_CHECKLIST, @@ -128,6 +131,15 @@ struct poptOption options[] = { N_("Display error dialog"), NULL }, + { + "info", + '\0', + POPT_ARG_NONE, + NULL, + OPTION_INFO, + N_("Display info dialog"), + NULL + }, { "file-selection", '\0', @@ -327,6 +339,28 @@ struct poptOption error_options[] = { POPT_TABLEEND }; +struct poptOption info_options[] = { + { + NULL, + '\0', + POPT_ARG_CALLBACK | POPT_CBFLAG_POST, + zenity_parse_options_callback, + 0, + NULL, + NULL + }, + { + "text", + '\0', + POPT_ARG_STRING, + NULL, + OPTION_INFOTEXT, + N_("Set the dialog text"), + NULL + }, + POPT_TABLEEND +}; + struct poptOption file_selection_options[] = { { NULL, @@ -545,6 +579,15 @@ struct poptOption application_options[] = { N_("Text entry options"), NULL }, + { + NULL, + '\0', + POPT_ARG_INCLUDE_TABLE, + info_options, + 0, + N_("Info options"), + NULL + }, { NULL, '\0', @@ -673,6 +716,7 @@ zenity_free_parsing_options (void) { case MODE_ERROR: case MODE_QUESTION: case MODE_WARNING: + case MODE_INFO: g_free (results->msg_data->dialog_text); break; case MODE_FILE: @@ -730,6 +774,7 @@ main (gint argc, gchar **argv) { case MODE_ERROR: case MODE_QUESTION: case MODE_WARNING: + case MODE_INFO: zenity_msg (results->data, results->msg_data); break; case MODE_FILE: @@ -779,6 +824,10 @@ void zenity_parse_options_callback (poptContext ctx, results->mode = MODE_ERROR; results->msg_data->mode = ZENITY_MSG_ERROR; break; + case OPTION_INFO: + results->mode = MODE_INFO; + results->msg_data->mode = ZENITY_MSG_INFO; + break; case OPTION_FILE: results->mode = MODE_FILE; break; @@ -821,6 +870,7 @@ void zenity_parse_options_callback (poptContext ctx, case MODE_ERROR: case MODE_QUESTION: case MODE_WARNING: + case MODE_INFO: results->msg_data->dialog_text = g_strdup (arg); break; case MODE_PROGRESS: diff --git a/src/msg.c b/src/msg.c index a8e5c2de..5b2cba96 100644 --- a/src/msg.c +++ b/src/msg.c @@ -52,6 +52,12 @@ int zenity_msg (ZenityData *data, ZenityMsgData *msg_data) dialog = glade_xml_get_widget (glade_dialog, "zenity_error_dialog"); text = glade_xml_get_widget (glade_dialog, "zenity_error_text"); break; + + case ZENITY_MSG_INFO: + glade_dialog = zenity_util_load_glade_file ("zenity_info_dialog"); + dialog = glade_xml_get_widget (glade_dialog, "zenity_info_dialog"); + text = glade_xml_get_widget (glade_dialog, "zenity_info_text"); + break; default: g_assert_not_reached (); @@ -81,6 +87,9 @@ int zenity_msg (ZenityData *data, ZenityMsgData *msg_data) case ZENITY_MSG_ERROR: zenity_util_set_window_icon_from_stock (dialog, GTK_STOCK_DIALOG_ERROR); break; + case ZENITY_MSG_INFO: + zenity_util_set_window_icon_from_stock (dialog, GTK_STOCK_DIALOG_INFO); + break; default: break; } diff --git a/src/zenity.glade b/src/zenity.glade index e4e1b1f6..bb9a5192 100644 --- a/src/zenity.glade +++ b/src/zenity.glade @@ -998,4 +998,115 @@ + + True + Information + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + False + False + True + + + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 0 + + + + True + False + 0 + + + + True + gtk-dialog-info + 6 + 0.5 + 0.5 + 0 + 0 + + + 0 + True + True + + + + + + True + You have done the right thing, hurrah. + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + diff --git a/src/zenity.h b/src/zenity.h index ea04b026..897857f5 100644 --- a/src/zenity.h +++ b/src/zenity.h @@ -38,7 +38,8 @@ typedef struct { typedef enum { ZENITY_MSG_WARNING, ZENITY_MSG_QUESTION, - ZENITY_MSG_ERROR + ZENITY_MSG_ERROR, + ZENITY_MSG_INFO } MsgMode; typedef struct { -- cgit