[gtk+/wip/baedert/box: 26/67] button: Stop checking for GtkSettings:gtk-button-images setting



commit f742b474ae20b4d0bfb699478ffe096487b5dbbc
Author: Timm Bäder <mail baedert org>
Date:   Wed Oct 12 22:04:15 2016 +0200

    button: Stop checking for GtkSettings:gtk-button-images setting

 gtk/gtkbutton.c |   70 ++----------------------------------------------------
 1 files changed, 3 insertions(+), 67 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index dbe7d82..2a0eef1 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -908,26 +908,6 @@ gtk_button_new (void)
   return g_object_new (GTK_TYPE_BUTTON, NULL);
 }
 
-static gboolean
-show_image (GtkButton *button)
-{
-  GtkButtonPrivate *priv = button->priv;
-  gboolean show;
-
-  if (priv->label_text && !priv->always_show_image)
-    {
-      GtkSettings *settings;
-
-      settings = gtk_widget_get_settings (GTK_WIDGET (button));        
-      g_object_get (settings, "gtk-button-images", &show, NULL);
-    }
-  else
-    show = TRUE;
-
-  return show;
-}
-
-
 static void
 gtk_button_construct_child (GtkButton *button)
 {
@@ -969,7 +949,7 @@ gtk_button_construct_child (GtkButton *button)
     {
       priv->image = image;
       g_object_set (priv->image,
-                   "visible", show_image (button),
+                   "visible", TRUE,
                    "no-show-all", TRUE,
                    NULL);
 
@@ -1731,45 +1711,16 @@ show_image_change_notify (GtkButton *button)
 
   if (priv->image) 
     {
-      if (show_image (button))
-       gtk_widget_show (priv->image);
-      else
-       gtk_widget_hide (priv->image);
+      gtk_widget_show (priv->image);
     }
 }
 
 static void
-traverse_container (GtkWidget *widget,
-                   gpointer   data)
-{
-  if (GTK_IS_BUTTON (widget))
-    show_image_change_notify (GTK_BUTTON (widget));
-  else if (GTK_IS_CONTAINER (widget))
-    gtk_container_forall (GTK_CONTAINER (widget), traverse_container, NULL);
-}
-
-static void
-gtk_button_setting_changed (GtkSettings *settings)
-{
-  GList *list, *l;
-
-  list = gtk_window_list_toplevels ();
-
-  for (l = list; l; l = l->next)
-    gtk_container_forall (GTK_CONTAINER (l->data), 
-                         traverse_container, NULL);
-
-  g_list_free (list);
-}
-
-static void
 gtk_button_screen_changed (GtkWidget *widget,
                           GdkScreen *previous_screen)
 {
   GtkButton *button;
   GtkButtonPrivate *priv;
-  GtkSettings *settings;
-  gulong show_image_connection;
 
   if (!gtk_widget_has_screen (widget))
     return;
@@ -1785,18 +1736,6 @@ gtk_button_screen_changed (GtkWidget *widget,
       gtk_button_update_state (button);
     }
 
-  settings = gtk_widget_get_settings (widget);
-
-  show_image_connection = 
-    g_signal_handler_find (settings, G_SIGNAL_MATCH_FUNC, 0, 0,
-                           NULL, gtk_button_setting_changed, NULL);
-  
-  if (show_image_connection)
-    return;
-
-  g_signal_connect (settings, "notify::gtk-button-images",
-                    G_CALLBACK (gtk_button_setting_changed), NULL);
-
   show_image_change_notify (button);
 }
 
@@ -1962,10 +1901,7 @@ gtk_button_set_always_show_image (GtkButton *button,
 
       if (priv->image)
         {
-          if (show_image (button))
-            gtk_widget_show (priv->image);
-          else
-            gtk_widget_hide (priv->image);
+          gtk_widget_show (priv->image);
         }
 
       g_object_notify_by_pspec (G_OBJECT (button), props[PROP_ALWAYS_SHOW_IMAGE]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]