I love featuritis. Instead of fixing stuff so it actually works, I add
2003-01-06 Glynn Foster <glynn.foster@sun.com> * 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.
This commit is contained in:
parent
342d84b35f
commit
8924d5c401
@ -1,3 +1,10 @@
|
|||||||
|
2003-01-06 Glynn Foster <glynn.foster@sun.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2003-01-06 Glynn Foster <glynn.foster@sun.com>
|
2003-01-06 Glynn Foster <glynn.foster@sun.com>
|
||||||
|
|
||||||
* src/zenity.glade: Feeling stupid because I can't use
|
* src/zenity.glade: Feeling stupid because I can't use
|
||||||
|
50
src/main.c
50
src/main.c
@ -35,6 +35,7 @@ typedef enum {
|
|||||||
MODE_QUESTION,
|
MODE_QUESTION,
|
||||||
MODE_TEXTINFO,
|
MODE_TEXTINFO,
|
||||||
MODE_WARNING,
|
MODE_WARNING,
|
||||||
|
MODE_INFO,
|
||||||
MODE_LAST
|
MODE_LAST
|
||||||
} ZenityDialogMode;
|
} ZenityDialogMode;
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ enum {
|
|||||||
OPTION_CALENDAR = 1,
|
OPTION_CALENDAR = 1,
|
||||||
OPTION_ENTRY,
|
OPTION_ENTRY,
|
||||||
OPTION_ERROR,
|
OPTION_ERROR,
|
||||||
|
OPTION_INFO,
|
||||||
OPTION_FILE,
|
OPTION_FILE,
|
||||||
OPTION_LIST,
|
OPTION_LIST,
|
||||||
OPTION_PROGRESS,
|
OPTION_PROGRESS,
|
||||||
@ -71,6 +73,7 @@ enum {
|
|||||||
OPTION_INPUTTEXT,
|
OPTION_INPUTTEXT,
|
||||||
OPTION_HIDETEXT,
|
OPTION_HIDETEXT,
|
||||||
OPTION_ERRORTEXT,
|
OPTION_ERRORTEXT,
|
||||||
|
OPTION_INFOTEXT,
|
||||||
OPTION_FILENAME,
|
OPTION_FILENAME,
|
||||||
OPTION_COLUMN,
|
OPTION_COLUMN,
|
||||||
OPTION_CHECKLIST,
|
OPTION_CHECKLIST,
|
||||||
@ -128,6 +131,15 @@ struct poptOption options[] = {
|
|||||||
N_("Display error dialog"),
|
N_("Display error dialog"),
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"info",
|
||||||
|
'\0',
|
||||||
|
POPT_ARG_NONE,
|
||||||
|
NULL,
|
||||||
|
OPTION_INFO,
|
||||||
|
N_("Display info dialog"),
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"file-selection",
|
"file-selection",
|
||||||
'\0',
|
'\0',
|
||||||
@ -327,6 +339,28 @@ struct poptOption error_options[] = {
|
|||||||
POPT_TABLEEND
|
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[] = {
|
struct poptOption file_selection_options[] = {
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
@ -545,6 +579,15 @@ struct poptOption application_options[] = {
|
|||||||
N_("Text entry options"),
|
N_("Text entry options"),
|
||||||
NULL
|
NULL
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
NULL,
|
||||||
|
'\0',
|
||||||
|
POPT_ARG_INCLUDE_TABLE,
|
||||||
|
info_options,
|
||||||
|
0,
|
||||||
|
N_("Info options"),
|
||||||
|
NULL
|
||||||
|
},
|
||||||
{
|
{
|
||||||
NULL,
|
NULL,
|
||||||
'\0',
|
'\0',
|
||||||
@ -673,6 +716,7 @@ zenity_free_parsing_options (void) {
|
|||||||
case MODE_ERROR:
|
case MODE_ERROR:
|
||||||
case MODE_QUESTION:
|
case MODE_QUESTION:
|
||||||
case MODE_WARNING:
|
case MODE_WARNING:
|
||||||
|
case MODE_INFO:
|
||||||
g_free (results->msg_data->dialog_text);
|
g_free (results->msg_data->dialog_text);
|
||||||
break;
|
break;
|
||||||
case MODE_FILE:
|
case MODE_FILE:
|
||||||
@ -730,6 +774,7 @@ main (gint argc, gchar **argv) {
|
|||||||
case MODE_ERROR:
|
case MODE_ERROR:
|
||||||
case MODE_QUESTION:
|
case MODE_QUESTION:
|
||||||
case MODE_WARNING:
|
case MODE_WARNING:
|
||||||
|
case MODE_INFO:
|
||||||
zenity_msg (results->data, results->msg_data);
|
zenity_msg (results->data, results->msg_data);
|
||||||
break;
|
break;
|
||||||
case MODE_FILE:
|
case MODE_FILE:
|
||||||
@ -779,6 +824,10 @@ void zenity_parse_options_callback (poptContext ctx,
|
|||||||
results->mode = MODE_ERROR;
|
results->mode = MODE_ERROR;
|
||||||
results->msg_data->mode = ZENITY_MSG_ERROR;
|
results->msg_data->mode = ZENITY_MSG_ERROR;
|
||||||
break;
|
break;
|
||||||
|
case OPTION_INFO:
|
||||||
|
results->mode = MODE_INFO;
|
||||||
|
results->msg_data->mode = ZENITY_MSG_INFO;
|
||||||
|
break;
|
||||||
case OPTION_FILE:
|
case OPTION_FILE:
|
||||||
results->mode = MODE_FILE;
|
results->mode = MODE_FILE;
|
||||||
break;
|
break;
|
||||||
@ -821,6 +870,7 @@ void zenity_parse_options_callback (poptContext ctx,
|
|||||||
case MODE_ERROR:
|
case MODE_ERROR:
|
||||||
case MODE_QUESTION:
|
case MODE_QUESTION:
|
||||||
case MODE_WARNING:
|
case MODE_WARNING:
|
||||||
|
case MODE_INFO:
|
||||||
results->msg_data->dialog_text = g_strdup (arg);
|
results->msg_data->dialog_text = g_strdup (arg);
|
||||||
break;
|
break;
|
||||||
case MODE_PROGRESS:
|
case MODE_PROGRESS:
|
||||||
|
@ -52,6 +52,12 @@ int zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
dialog = glade_xml_get_widget (glade_dialog, "zenity_error_dialog");
|
dialog = glade_xml_get_widget (glade_dialog, "zenity_error_dialog");
|
||||||
text = glade_xml_get_widget (glade_dialog, "zenity_error_text");
|
text = glade_xml_get_widget (glade_dialog, "zenity_error_text");
|
||||||
break;
|
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:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
@ -81,6 +87,9 @@ int zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
|
|||||||
case ZENITY_MSG_ERROR:
|
case ZENITY_MSG_ERROR:
|
||||||
zenity_util_set_window_icon_from_stock (dialog, GTK_STOCK_DIALOG_ERROR);
|
zenity_util_set_window_icon_from_stock (dialog, GTK_STOCK_DIALOG_ERROR);
|
||||||
break;
|
break;
|
||||||
|
case ZENITY_MSG_INFO:
|
||||||
|
zenity_util_set_window_icon_from_stock (dialog, GTK_STOCK_DIALOG_INFO);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
111
src/zenity.glade
111
src/zenity.glade
@ -998,4 +998,115 @@
|
|||||||
</child>
|
</child>
|
||||||
</widget>
|
</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>
|
</glade-interface>
|
||||||
|
@ -38,7 +38,8 @@ typedef struct {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
ZENITY_MSG_WARNING,
|
ZENITY_MSG_WARNING,
|
||||||
ZENITY_MSG_QUESTION,
|
ZENITY_MSG_QUESTION,
|
||||||
ZENITY_MSG_ERROR
|
ZENITY_MSG_ERROR,
|
||||||
|
ZENITY_MSG_INFO
|
||||||
} MsgMode;
|
} MsgMode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user