summaryrefslogtreecommitdiff
path: root/gtk/gtkaction.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-02-28 04:48:18 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-02-28 04:48:18 +0000
commit617443f60723a9468fafa0155011064bc913d7e7 (patch)
treece81d2a16a2567d14113d7b43e90ab8455fe7184 /gtk/gtkaction.c
parent59786d81ee4283f192e64e17b0d8ee40cb4aa104 (diff)
downloadgdk-pixbuf-617443f60723a9468fafa0155011064bc913d7e7.tar.gz
Improve the handling of buttons as action proxys. (#165534, Milosz
2005-02-27 Matthias Clasen <mclasen@redhat.com> * gtk/gtkaction.c (connect_proxy): Improve the handling of buttons as action proxys. (#165534, Milosz Derezynski)
Diffstat (limited to 'gtk/gtkaction.c')
-rw-r--r--gtk/gtkaction.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index bb3c4242d..c33f915bf 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -739,6 +739,17 @@ gtk_action_sync_stock_id (GtkAction *action,
}
static void
+gtk_action_sync_button_stock_id (GtkAction *action,
+ GParamSpec *pspec,
+ GtkWidget *proxy)
+{
+ g_object_set (G_OBJECT (proxy),
+ "stock-id",
+ action->private_data->stock_id,
+ NULL);
+}
+
+static void
gtk_action_sync_tooltip (GtkAction *action,
GParamSpec *pspec,
GtkWidget *proxy)
@@ -931,16 +942,30 @@ connect_proxy (GtkAction *action,
else if (GTK_IS_BUTTON (proxy))
{
/* button specific synchronisers ... */
-
- /* synchronise the label */
- g_object_set (proxy,
- "label", action->private_data->short_label,
- "use_underline", TRUE,
- NULL);
- g_signal_connect_object (action, "notify::short-label",
- G_CALLBACK (gtk_action_sync_short_label),
- proxy, 0);
+ if (gtk_button_get_use_stock (GTK_BUTTON (proxy)))
+ {
+ /* synchronise stock-id */
+ g_object_set (proxy,
+ "stock-id", action->private_data->stock_id,
+ NULL);
+ g_signal_connect_object (action, "notify::stock-id",
+ G_CALLBACK (gtk_action_sync_button_stock_id),
+ proxy, 0);
+ }
+ else if (GTK_IS_LABEL(GTK_BIN(proxy)->child))
+ {
+ /* synchronise the label */
+ g_object_set (proxy,
+ "label", action->private_data->short_label,
+ "use_underline", TRUE,
+ NULL);
+ g_signal_connect_object (action, "notify::short-label",
+ G_CALLBACK (gtk_action_sync_short_label),
+ proxy, 0);
+
+ }
+ /* we leave the button alone if there is a custom child */
g_signal_connect_object (proxy, "clicked",
G_CALLBACK (gtk_action_activate), action,
G_CONNECT_SWAPPED);