summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c50
-rw-r--r--src/msg.c9
-rw-r--r--src/zenity.glade111
-rw-r--r--src/zenity.h3
4 files changed, 172 insertions, 1 deletions
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,
@@ -129,6 +132,15 @@ struct poptOption options[] = {
NULL
},
{
+ "info",
+ '\0',
+ POPT_ARG_NONE,
+ NULL,
+ OPTION_INFO,
+ N_("Display info dialog"),
+ NULL
+ },
+ {
"file-selection",
'\0',
POPT_ARG_NONE,
@@ -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,
@@ -549,6 +583,15 @@ struct poptOption application_options[] = {
NULL,
'\0',
POPT_ARG_INCLUDE_TABLE,
+ info_options,
+ 0,
+ N_("Info options"),
+ NULL
+ },
+ {
+ NULL,
+ '\0',
+ POPT_ARG_INCLUDE_TABLE,
error_options,
0,
N_("Error options"),
@@ -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 @@
</child>
</widget>
+<widget class="GtkDialog" id="zenity_info_dialog">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Information</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+ <signal name="response" handler="zenity_msg_dialog_response" last_modification_time="Sat, 28 Dec 2002 15:05:31 GMT"/>
+ <signal name="destroy" handler="gtk_main_quit" last_modification_time="Sat, 28 Dec 2002 15:05:42 GMT"/>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area7">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="zenity_info_ok_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-5</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox8">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-info</property>
+ <property name="icon_size">6</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="zenity_info_text">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">You have done the right thing, hurrah.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
</glade-interface>
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 {
bgstack15