]> Pileus Git - ~andy/gtk/commitdiff
Improve the handling of buttons as action proxys. (#165534, Milosz
authorMatthias Clasen <mclasen@redhat.com>
Mon, 28 Feb 2005 04:43:22 +0000 (04:43 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 28 Feb 2005 04:43:22 +0000 (04:43 +0000)
2005-02-27  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkaction.c (connect_proxy): Improve the handling
of buttons as action proxys.  (#165534, Milosz Derezynski)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkaction.c

index f35e58f00a7e7a83679bff084227bc4cf3f709aa..68447d84518c70f05dcb65b629e983c8678ea151 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2005-02-27  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkaction.c (connect_proxy): Improve the handling
+       of buttons as action proxys.  (#165534, Milosz Derezynski)
+
        * gtk/gtklabel.c (gtk_label_size_request): Fix a typo.
        (#168646, Vincent Untz)
 
index f35e58f00a7e7a83679bff084227bc4cf3f709aa..68447d84518c70f05dcb65b629e983c8678ea151 100644 (file)
@@ -1,5 +1,8 @@
 2005-02-27  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkaction.c (connect_proxy): Improve the handling
+       of buttons as action proxys.  (#165534, Milosz Derezynski)
+
        * gtk/gtklabel.c (gtk_label_size_request): Fix a typo.
        (#168646, Vincent Untz)
 
index f35e58f00a7e7a83679bff084227bc4cf3f709aa..68447d84518c70f05dcb65b629e983c8678ea151 100644 (file)
@@ -1,5 +1,8 @@
 2005-02-27  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/gtkaction.c (connect_proxy): Improve the handling
+       of buttons as action proxys.  (#165534, Milosz Derezynski)
+
        * gtk/gtklabel.c (gtk_label_size_request): Fix a typo.
        (#168646, Vincent Untz)
 
index bb3c4242d3928bd055af1c662b5d41df5fdbf931..c33f915bf5cdeff762c44caee95ac460a092cf32 100644 (file)
@@ -738,6 +738,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, 
@@ -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);