summaryrefslogtreecommitdiff
path: root/gtk/gtkaction.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2008-06-13 01:26:46 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2008-06-13 01:26:46 +0000
commit3fb401be617e3323b6a44c650872aac87ef20553 (patch)
tree4f254717aaaeff148beffc8508dd2c21fcf6eb93 /gtk/gtkaction.c
parent128a478b9bca9a3455eb6af153a227b26dcfb84f (diff)
downloadgtk+-3fb401be617e3323b6a44c650872aac87ef20553.tar.gz
Set the image of a button proxy to the "icon-name" property.
* gtk/gtkaction.c (connect_proxy): Set the image of a button proxy to the "icon-name" property. (gtk_action_set_short_label): If the "image" property is set on the button proxy, also tries to set the "label" property on the GtkButton. svn path=/trunk/; revision=20363
Diffstat (limited to 'gtk/gtkaction.c')
-rw-r--r--gtk/gtkaction.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index f7d3a7ad34..08047f105f 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -817,7 +817,12 @@ connect_proxy (GtkAction *action,
}
else
{
- if (GTK_BIN (proxy)->child == NULL ||
+ GtkWidget *image;
+
+ image = gtk_button_get_image (GTK_BUTTON (proxy));
+
+ if (GTK_IS_IMAGE (image) ||
+ GTK_BIN (proxy)->child == NULL ||
GTK_IS_LABEL (GTK_BIN (proxy)->child))
{
/* synchronise the label */
@@ -826,6 +831,12 @@ connect_proxy (GtkAction *action,
"use-underline", TRUE,
NULL);
}
+
+ if (GTK_IS_IMAGE (image) &&
+ (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY ||
+ gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_ICON_NAME))
+ gtk_image_set_from_icon_name (GTK_IMAGE (image),
+ action->private_data->icon_name, GTK_ICON_SIZE_MENU);
}
/* we leave the button alone if there is a custom child */
g_signal_connect_object (proxy, "clicked",
@@ -1379,9 +1390,13 @@ gtk_action_set_short_label (GtkAction *action,
else if (GTK_IS_BUTTON (proxy) &&
!gtk_button_get_use_stock (GTK_BUTTON (proxy)))
{
+ GtkImage *image;
child = GTK_BIN (proxy)->child;
+
+ image = gtk_button_get_image (GTK_BUTTON (proxy));
- if (child == NULL || GTK_IS_LABEL (child))
+ if (GTK_IS_IMAGE (image) ||
+ child == NULL || GTK_IS_LABEL (child))
gtk_button_set_label (GTK_BUTTON (proxy),
action->private_data->short_label);
}