summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/msg.c9
-rw-r--r--src/option.c41
-rw-r--r--src/zenity.h1
-rw-r--r--src/zenity.ui8
4 files changed, 55 insertions, 4 deletions
diff --git a/src/msg.c b/src/msg.c
index 505f961c..229f0cec 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -58,12 +58,14 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
GtkWidget *dialog;
GtkWidget *ok_button;
GObject *text;
+ GObject *image;
switch (msg_data->mode) {
case ZENITY_MSG_WARNING:
builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_dialog"));
text = gtk_builder_get_object (builder, "zenity_warning_text");
+ image = gtk_builder_get_object (builder, "zenity_warning_image");
ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_warning_ok_button"));
break;
@@ -71,6 +73,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_question_dialog"));
text = gtk_builder_get_object (builder, "zenity_question_text");
+ image = gtk_builder_get_object (builder, "zenity_question_image");
ok_button = NULL;
break;
@@ -78,6 +81,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_dialog"));
text = gtk_builder_get_object (builder, "zenity_error_text");
+ image = gtk_builder_get_object (builder, "zenity_error_image");
ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_error_ok_button"));
break;
@@ -85,6 +89,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_dialog"));
text = gtk_builder_get_object (builder, "zenity_info_text");
+ image = gtk_builder_get_object (builder, "zenity_info_image");
ok_button = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_info_ok_button"));
break;
@@ -92,6 +97,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
builder = NULL;
dialog = NULL;
text = NULL;
+ image = NULL;
ok_button = NULL;
g_assert_not_reached ();
break;
@@ -152,6 +158,9 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
else
gtk_label_set_markup (GTK_LABEL (text), g_strcompress (msg_data->dialog_text));
}
+
+ if (msg_data->dialog_icon)
+ gtk_image_set_from_icon_name (GTK_IMAGE (image), msg_data->dialog_icon, GTK_ICON_SIZE_DIALOG);
if (msg_data->no_wrap)
gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);
diff --git a/src/option.c b/src/option.c
index ba4691d0..13275d1c 100644
--- a/src/option.c
+++ b/src/option.c
@@ -35,6 +35,7 @@ static gchar *zenity_general_window_icon;
static int zenity_general_width;
static int zenity_general_height;
static gchar *zenity_general_dialog_text;
+static gchar *zenity_general_dialog_icon;
static gchar *zenity_general_separator;
static gboolean zenity_general_multiple;
static gboolean zenity_general_editable;
@@ -348,6 +349,15 @@ static GOptionEntry error_options[] = {
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,
@@ -389,6 +399,15 @@ static GOptionEntry info_options[] = {
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,
@@ -732,6 +751,15 @@ static GOptionEntry question_options[] = {
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,
@@ -844,6 +872,15 @@ static GOptionEntry warning_options[] = {
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,
@@ -1627,6 +1664,7 @@ zenity_error_post_callback (GOptionContext *context,
if (results->mode == MODE_ERROR) {
results->msg_data->dialog_text = zenity_general_dialog_text;
+ results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_ERROR;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
@@ -1645,6 +1683,7 @@ zenity_info_post_callback (GOptionContext *context,
if (results->mode == MODE_INFO) {
results->msg_data->dialog_text = zenity_general_dialog_text;
+ results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_INFO;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
@@ -1819,6 +1858,7 @@ zenity_question_post_callback (GOptionContext *context,
zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION);
if (results->mode == MODE_QUESTION) {
results->msg_data->dialog_text = zenity_general_dialog_text;
+ results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_QUESTION;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
@@ -1863,6 +1903,7 @@ zenity_warning_post_callback (GOptionContext *context,
if (results->mode == MODE_WARNING) {
results->msg_data->dialog_text = zenity_general_dialog_text;
+ results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_WARNING;
results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
results->msg_data->no_markup = zenity_general_dialog_no_markup;
diff --git a/src/zenity.h b/src/zenity.h
index 2eec3aa6..4c941290 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -61,6 +61,7 @@ typedef enum {
typedef struct {
gchar *dialog_text;
+ gchar *dialog_icon;
MsgMode mode;
gboolean no_wrap;
gboolean no_markup;
diff --git a/src/zenity.ui b/src/zenity.ui
index d656ad40..ee89093a 100644
--- a/src/zenity.ui
+++ b/src/zenity.ui
@@ -299,7 +299,7 @@
<property name="border_width">5</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="image3">
+ <object class="GtkImage" id="zenity_error_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0</property>
@@ -500,7 +500,7 @@
<property name="border_width">5</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="image4">
+ <object class="GtkImage" id="zenity_info_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="yalign">0</property>
@@ -677,7 +677,7 @@
<property name="border_width">5</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="image1">
+ <object class="GtkImage" id="zenity_question_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
@@ -1101,7 +1101,7 @@
<property name="border_width">5</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="image2">
+ <object class="GtkImage" id="zenity_warning_image">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
bgstack15