[gtk+] Deprecate and ignore gtk-menu-images setting



commit e8147d15f74e62047c84eb95e393449722198d89
Author: William Jon McCann <william jon mccann gmail com>
Date:   Wed Jun 26 10:36:56 2013 -0400

    Deprecate and ignore gtk-menu-images setting
    
    GtkImageMenuItem images can still be enabled selectively by the app author
    using the always-show-image property on the item.

 gdk/wayland/gdkscreen-wayland.c |    1 -
 gdk/win32/gdkproperty-win32.c   |    1 -
 gdk/x11/gdksettings.c           |    1 -
 gtk/gtkaction.c                 |   12 ++---
 gtk/gtkimagemenuitem.c          |   98 +++------------------------------------
 gtk/gtksettings.c               |   11 ++++-
 6 files changed, 21 insertions(+), 103 deletions(-)
---
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 041200d..490d145 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -481,7 +481,6 @@ static TranslationEntry translations[] = {
   { "org.gnome.desktop.interface", "cursor-blink", "gtk-cursor-blink", G_TYPE_BOOLEAN,  { .b = TRUE } },
   { "org.gnome.desktop.interface", "cursor-blink-time", "gtk-cursor-blink-time", G_TYPE_INT, { .i = 1200 } },
   { "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 
3600 } },
-  { "org.gnome.desktop.interface", "menus-have-icons", "gtk-menu-images", G_TYPE_BOOLEAN, { .b = FALSE } },
   { "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
   { "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE 
} },
   { "org.gnome.desktop.interface", "automatic-mnemonics", "gtk-auto-mnemonics", G_TYPE_BOOLEAN, { .b = TRUE 
} },
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index eccd74a..e73db69 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -318,7 +318,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
   "Gtk/IMStatusStyle\0"       "gtk-im-status-style\0"
   "Gtk/Modules\0"             "gtk-modules\0"
   "Gtk/FileChooserBackend\0"  "gtk-file-chooser-backend\0"
-  "Gtk/MenuImages\0"          "gtk-menu-images\0"
   "Gtk/MenuBarAccel\0"        "gtk-menu-bar-accel\0"
   "Gtk/CursorBlinkTimeout\0"  "gtk-cursor-blink-timeout\0"
   "Gtk/CursorThemeName\0"     "gtk-cursor-theme-name\0"
diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c
index 46f496b..511ef39 100644
--- a/gdk/x11/gdksettings.c
+++ b/gdk/x11/gdksettings.c
@@ -43,7 +43,6 @@ static const struct {
   {"Gtk/IMStatusStyle",       "gtk-im-status-style"},
   {"Gtk/Modules",             "gtk-modules"},
   {"Gtk/FileChooserBackend",  "gtk-file-chooser-backend"},
-  {"Gtk/MenuImages",          "gtk-menu-images"},
   {"Gtk/MenuBarAccel",        "gtk-menu-bar-accel"},
   {"Gtk/CursorThemeName",     "gtk-cursor-theme-name"},
   {"Gtk/CursorThemeSize",     "gtk-cursor-theme-size"},
diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c
index 06138cb..71413bc 100644
--- a/gtk/gtkaction.c
+++ b/gtk/gtkaction.c
@@ -398,8 +398,7 @@ gtk_action_class_init (GtkActionClass *klass)
   /**
    * GtkAction:always-show-image:
    *
-   * If %TRUE, the action's menu item proxies will ignore the #GtkSettings:gtk-menu-images 
-   * setting and always show their image, if available.
+   * If %TRUE, the action's menu item proxies will always show their image, if available.
    *
    * Use this property if the menu item would be useless or hard to use
    * without their image. 
@@ -1203,8 +1202,8 @@ gtk_action_get_is_important (GtkAction *action)
  * @action: a #GtkAction
  * @always_show: %TRUE if menuitem proxies should always show their image
  *
- * Sets whether @action<!-- -->'s menu item proxies will ignore the
- * #GtkSettings:gtk-menu-images setting and always show their image, if available.
+ * Sets whether @action<!-- -->'s menu item proxies will always show
+ * their image, if available.
  *
  * Use this if the menu item would be useless or hard to use
  * without their image.
@@ -1235,9 +1234,8 @@ gtk_action_set_always_show_image (GtkAction *action,
  * gtk_action_get_always_show_image:
  * @action: a #GtkAction
  *
- * Returns whether @action<!-- -->'s menu item proxies will ignore the
- * #GtkSettings:gtk-menu-images setting and always show their image,
- * if available.
+ * Returns whether @action<!-- -->'s menu item proxies will always
+ * show their image, if available.
  *
  * Returns: %TRUE if the menu item proxies will always show their image
  *
diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c
index bce335f..8b5d048 100644
--- a/gtk/gtkimagemenuitem.c
+++ b/gtk/gtkimagemenuitem.c
@@ -107,8 +107,6 @@ static void gtk_image_menu_item_get_property         (GObject         *object,
                                                       guint            prop_id,
                                                       GValue          *value,
                                                       GParamSpec      *pspec);
-static void gtk_image_menu_item_screen_changed       (GtkWidget        *widget,
-                                                      GdkScreen        *previous_screen);
 
 static void gtk_image_menu_item_recalculate          (GtkImageMenuItem *image_menu_item);
 
@@ -134,7 +132,6 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
   GtkContainerClass *container_class = (GtkContainerClass*) klass;
 
   widget_class->destroy = gtk_image_menu_item_destroy;
-  widget_class->screen_changed = gtk_image_menu_item_screen_changed;
   widget_class->get_preferred_width = gtk_image_menu_item_get_preferred_width;
   widget_class->get_preferred_height = gtk_image_menu_item_get_preferred_height;
   widget_class->get_preferred_height_for_width = gtk_image_menu_item_get_preferred_height_for_width;
@@ -180,10 +177,9 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
   /**
    * GtkImageMenuItem:always-show-image:
    *
-   * If %TRUE, the menu item will ignore the #GtkSettings:gtk-menu-images
-   * setting and always show the image, if available.
+   * If %TRUE, the menu item will always show the image, if available.
    *
-   * Use this property if the menuitem would be useless or hard to use
+   * Use this property only if the menuitem would be useless or hard to use
    * without the image.
    *
    * Since: 2.16
@@ -301,21 +297,6 @@ gtk_image_menu_item_get_property (GObject         *object,
     }
 }
 
-static gboolean
-show_image (GtkImageMenuItem *image_menu_item)
-{
-  GtkImageMenuItemPrivate *priv = image_menu_item->priv;
-  GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (image_menu_item));
-  gboolean show;
-
-  if (priv->always_show_image)
-    show = TRUE;
-  else
-    g_object_get (settings, "gtk-menu-images", &show, NULL);
-
-  return show;
-}
-
 static void
 gtk_image_menu_item_map (GtkWidget *widget)
 {
@@ -326,7 +307,7 @@ gtk_image_menu_item_map (GtkWidget *widget)
 
   if (priv->image)
     g_object_set (priv->image,
-                  "visible", show_image (image_menu_item),
+                  "visible", priv->always_show_image,
                   NULL);
 }
 
@@ -925,8 +906,7 @@ gtk_image_menu_item_get_use_stock (GtkImageMenuItem *image_menu_item)
  * @image_menu_item: a #GtkImageMenuItem
  * @always_show: %TRUE if the menuitem should always show the image
  *
- * If %TRUE, the menu item will ignore the #GtkSettings:gtk-menu-images
- * setting and always show the image, if available.
+ * If %TRUE, the menu item will always show the image, if available.
  *
  * Use this property if the menuitem would be useless or hard to use
  * without the image.
@@ -949,7 +929,7 @@ gtk_image_menu_item_set_always_show_image (GtkImageMenuItem *image_menu_item,
 
       if (priv->image)
         {
-          if (show_image (image_menu_item))
+          if (priv->always_show_image)
             gtk_widget_show (priv->image);
           else
             gtk_widget_hide (priv->image);
@@ -963,8 +943,7 @@ gtk_image_menu_item_set_always_show_image (GtkImageMenuItem *image_menu_item,
  * gtk_image_menu_item_get_always_show_image:
  * @image_menu_item: a #GtkImageMenuItem
  *
- * Returns whether the menu item will ignore the #GtkSettings:gtk-menu-images
- * setting and always show the image, if available.
+ * Returns whether the menu item will always show the image, if available.
  *
  * Returns: %TRUE if the menu item will always show the image
  *
@@ -1059,7 +1038,7 @@ gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,
 
   gtk_widget_set_parent (image, GTK_WIDGET (image_menu_item));
   g_object_set (image,
-                "visible", show_image (image_menu_item),
+                "visible", priv->always_show_image,
                 "no-show-all", TRUE,
                 NULL);
 
@@ -1110,66 +1089,3 @@ gtk_image_menu_item_remove (GtkContainer *container,
       GTK_CONTAINER_CLASS (gtk_image_menu_item_parent_class)->remove (container, child);
     }
 }
-
-static void
-show_image_change_notify (GtkImageMenuItem *image_menu_item)
-{
-  GtkImageMenuItemPrivate *priv = image_menu_item->priv;
-
-  if (priv->image)
-    {
-      if (show_image (image_menu_item))
-        gtk_widget_show (priv->image);
-      else
-        gtk_widget_hide (priv->image);
-    }
-}
-
-static void
-traverse_container (GtkWidget *widget,
-                    gpointer   data)
-{
-  if (GTK_IS_IMAGE_MENU_ITEM (widget))
-    show_image_change_notify (GTK_IMAGE_MENU_ITEM (widget));
-  else if (GTK_IS_CONTAINER (widget))
-    gtk_container_forall (GTK_CONTAINER (widget), traverse_container, NULL);
-}
-
-static void
-gtk_image_menu_item_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_image_menu_item_screen_changed (GtkWidget *widget,
-                                    GdkScreen *previous_screen)
-{
-  GtkSettings *settings;
-  gulong show_image_connection;
-
-  if (!gtk_widget_has_screen (widget))
-    return;
-
-  settings = gtk_widget_get_settings (widget);
-
-  show_image_connection =
-    g_signal_handler_find (settings, G_SIGNAL_MATCH_FUNC, 0, 0,
-                           NULL, gtk_image_menu_item_setting_changed, NULL);
-
-  if (show_image_connection)
-    return;
-
-  g_signal_connect (settings, "notify::gtk-menu-images",
-                    G_CALLBACK (gtk_image_menu_item_setting_changed), NULL);
-
-  show_image_change_notify (GTK_IMAGE_MENU_ITEM (widget));
-}
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 4cf2aca..c40c88b 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -88,7 +88,7 @@
  *   /&ast; make sure the type is realized &ast;/
  *   g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM));
  *
- *   g_object_set (gtk_settings_get_default (), "gtk-menu-images", FALSE, NULL);
+ *   g_object_set (gtk_settings_get_default (), "gtk-enable-animations", FALSE, NULL);
  * </programlisting></informalexample>
  *
  * There is one GtkSettings instance per screen. It can be obtained with
@@ -1276,11 +1276,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                              NULL);
   g_assert (result == PROP_ENTRY_PASSWORD_HINT_TIMEOUT);
 
+  /**
+   * GtkSettings::gtk-menu-images:
+   *
+   * Whether images should be shown in menu items
+   *
+   * Deprecated: 3.10: This setting is ignored
+   */
   result = settings_install_property_parser (class,
                                              g_param_spec_boolean ("gtk-menu-images",
                                                                    P_("Show menu images"),
                                                                    P_("Whether images should be shown in 
menus"),
-                                                                   TRUE,
+                                                                   FALSE,
                                                                    GTK_PARAM_READWRITE),
                                              NULL);
   g_assert (result == PROP_MENU_IMAGES);


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