[gtk+/wip/baedert/box: 21/30] recentchooser: Stop implementing GtkActivatable



commit 24505c0381ee621c5dbd4caf59b5ab47bec16619
Author: Timm Bäder <mail baedert org>
Date:   Sun Oct 16 18:32:10 2016 +0200

    recentchooser: Stop implementing GtkActivatable

 gtk/gtkrecentchooser.c        |  157 -----------------------------------------
 gtk/gtkrecentchoosermenu.c    |   73 +-------------------
 gtk/gtkrecentchooserprivate.h |   13 ----
 3 files changed, 1 insertions(+), 242 deletions(-)
---
diff --git a/gtk/gtkrecentchooser.c b/gtk/gtkrecentchooser.c
index e976db7..738a0d3 100644
--- a/gtk/gtkrecentchooser.c
+++ b/gtk/gtkrecentchooser.c
@@ -23,7 +23,6 @@
 #include "gtkrecentchooserprivate.h"
 #include "gtkrecentmanager.h"
 #include "deprecated/gtkrecentaction.h"
-#include "deprecated/gtkactivatable.h"
 #include "gtkintl.h"
 #include "gtktypebuiltins.h"
 #include "gtkprivate.h"
@@ -54,14 +53,6 @@ enum
   LAST_SIGNAL
 };
 
-static gboolean recent_chooser_has_show_numbers       (GtkRecentChooser *chooser);
-
-static GQuark      quark_gtk_related_action               = 0;
-static GQuark      quark_gtk_use_action_appearance        = 0;
-static const gchar gtk_related_action_key[]               = "gtk-related-action";
-static const gchar gtk_use_action_appearance_key[]        = "gtk-use-action-appearance";
-
-
 static guint chooser_signals[LAST_SIGNAL] = { 0, };
 
 
@@ -74,9 +65,6 @@ gtk_recent_chooser_default_init (GtkRecentChooserInterface *iface)
 {
   GType iface_type = G_TYPE_FROM_INTERFACE (iface);
 
-  quark_gtk_related_action        = g_quark_from_static_string (gtk_related_action_key);
-  quark_gtk_use_action_appearance = g_quark_from_static_string (gtk_use_action_appearance_key);
-  
   /**
    * GtkRecentChooser::selection-changed:
    * @chooser: the object which received the signal
@@ -589,25 +577,6 @@ gtk_recent_chooser_get_show_tips (GtkRecentChooser *chooser)
   return show_tips;
 }
 
-static gboolean
-recent_chooser_has_show_numbers (GtkRecentChooser *chooser)
-{
-  GParamSpec *pspec;
-  
-  /* This is the result of a minor screw up: the "show-numbers" property
-   * was removed from the GtkRecentChooser interface, but the accessors
-   * remained in the interface API; now we need to check whether the
-   * implementation of the RecentChooser interface has a "show-numbers"
-   * boolean property installed before accessing it, and avoid an
-   * assertion failure using a more graceful warning.  This should really
-   * go away as soon as we can break API and remove these accessors.
-   */
-  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (chooser),
-                                       "show-numbers");
-
-  return (pspec && pspec->value_type == G_TYPE_BOOLEAN);
-}
-
 /**
  * gtk_recent_chooser_set_sort_type:
  * @chooser: a #GtkRecentChooser
@@ -1029,129 +998,3 @@ _gtk_recent_chooser_selection_changed (GtkRecentChooser *chooser)
 
   g_signal_emit (chooser, chooser_signals[SELECTION_CHANGED], 0);
 }
-
-void
-_gtk_recent_chooser_update (GtkActivatable *activatable,
-                           GtkAction      *action,
-                           const gchar    *property_name)
-{
-  GtkRecentChooser *recent_chooser;
-  GtkRecentChooser *action_chooser;
-  GtkRecentAction  *recent_action;
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  recent_chooser = GTK_RECENT_CHOOSER (activatable);
-  action_chooser = GTK_RECENT_CHOOSER (action);
-  recent_action  = GTK_RECENT_ACTION (action);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  if (strcmp (property_name, "show-numbers") == 0 && recent_chooser_has_show_numbers (recent_chooser))
-    {
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      g_object_set (recent_chooser, "show-numbers",
-                    gtk_recent_action_get_show_numbers (recent_action), NULL);
-      G_GNUC_END_IGNORE_DEPRECATIONS;
-    }
-  else if (strcmp (property_name, "show-private") == 0)
-    gtk_recent_chooser_set_show_private (recent_chooser, gtk_recent_chooser_get_show_private 
(action_chooser));
-  else if (strcmp (property_name, "show-not-found") == 0)
-    gtk_recent_chooser_set_show_not_found (recent_chooser, gtk_recent_chooser_get_show_not_found 
(action_chooser));
-  else if (strcmp (property_name, "show-tips") == 0)
-    gtk_recent_chooser_set_show_tips (recent_chooser, gtk_recent_chooser_get_show_tips (action_chooser));
-  else if (strcmp (property_name, "show-icons") == 0)
-    gtk_recent_chooser_set_show_icons (recent_chooser, gtk_recent_chooser_get_show_icons (action_chooser));
-  else if (strcmp (property_name, "limit") == 0)
-    gtk_recent_chooser_set_limit (recent_chooser, gtk_recent_chooser_get_limit (action_chooser));
-  else if (strcmp (property_name, "local-only") == 0)
-    gtk_recent_chooser_set_local_only (recent_chooser, gtk_recent_chooser_get_local_only (action_chooser));
-  else if (strcmp (property_name, "sort-type") == 0)
-    gtk_recent_chooser_set_sort_type (recent_chooser, gtk_recent_chooser_get_sort_type (action_chooser));
-  else if (strcmp (property_name, "filter") == 0)
-    gtk_recent_chooser_set_filter (recent_chooser, gtk_recent_chooser_get_filter (action_chooser));
-}
-
-void
-_gtk_recent_chooser_sync_action_properties (GtkActivatable *activatable,
-                                           GtkAction      *action)
-{
-  GtkRecentChooser *recent_chooser;
-  GtkRecentChooser *action_chooser;
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  recent_chooser = GTK_RECENT_CHOOSER (activatable);
-  action_chooser = GTK_RECENT_CHOOSER (action);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  if (!action)
-    return;
-
-  if (recent_chooser_has_show_numbers (recent_chooser))
-    {
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      g_object_set (recent_chooser, "show-numbers", 
-                    gtk_recent_action_get_show_numbers (GTK_RECENT_ACTION (action)),
-                    NULL);
-      G_GNUC_END_IGNORE_DEPRECATIONS;
-    }
-  gtk_recent_chooser_set_show_private (recent_chooser, gtk_recent_chooser_get_show_private (action_chooser));
-  gtk_recent_chooser_set_show_not_found (recent_chooser, gtk_recent_chooser_get_show_not_found 
(action_chooser));
-  gtk_recent_chooser_set_show_tips (recent_chooser, gtk_recent_chooser_get_show_tips (action_chooser));
-  gtk_recent_chooser_set_show_icons (recent_chooser, gtk_recent_chooser_get_show_icons (action_chooser));
-  gtk_recent_chooser_set_limit (recent_chooser, gtk_recent_chooser_get_limit (action_chooser));
-  gtk_recent_chooser_set_local_only (recent_chooser, gtk_recent_chooser_get_local_only (action_chooser));
-  gtk_recent_chooser_set_sort_type (recent_chooser, gtk_recent_chooser_get_sort_type (action_chooser));
-  gtk_recent_chooser_set_filter (recent_chooser, gtk_recent_chooser_get_filter (action_chooser));
-}
-
-void
-_gtk_recent_chooser_set_related_action (GtkRecentChooser *recent_chooser,
-                                       GtkAction        *action)
-{
-  GtkAction *prev_action;
-
-  prev_action = g_object_get_qdata (G_OBJECT (recent_chooser), quark_gtk_related_action);
-
-  if (prev_action == action)
-    return;
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-  gtk_activatable_do_set_related_action (GTK_ACTIVATABLE (recent_chooser), action);
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-  g_object_set_qdata (G_OBJECT (recent_chooser), quark_gtk_related_action, action);
-}
-
-GtkAction *
-_gtk_recent_chooser_get_related_action (GtkRecentChooser *recent_chooser)
-{
-  return g_object_get_qdata (G_OBJECT (recent_chooser), quark_gtk_related_action);
-}
-
-/* The default for use-action-appearance is TRUE, so we try to set the
- * qdata backwards for this case.
- */
-void
-_gtk_recent_chooser_set_use_action_appearance (GtkRecentChooser *recent_chooser, 
-                                              gboolean          use_appearance)
-{
-  GtkAction *action;
-  gboolean   use_action_appearance;
-
-  action                = g_object_get_qdata (G_OBJECT (recent_chooser), quark_gtk_related_action);
-  use_action_appearance = !GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (recent_chooser), 
quark_gtk_use_action_appearance));
-
-  if (use_action_appearance != use_appearance)
-    {
-
-      g_object_set_qdata (G_OBJECT (recent_chooser), quark_gtk_use_action_appearance, GINT_TO_POINTER 
(!use_appearance));
- 
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      gtk_activatable_sync_action_properties (GTK_ACTIVATABLE (recent_chooser), action);
-      G_GNUC_END_IGNORE_DEPRECATIONS;
-    }
-}
-
-gboolean
-_gtk_recent_chooser_get_use_action_appearance (GtkRecentChooser *recent_chooser)
-{
-  return !GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (recent_chooser), quark_gtk_use_action_appearance));
-}
diff --git a/gtk/gtkrecentchoosermenu.c b/gtk/gtkrecentchoosermenu.c
index 8921cd7..5a5b1a6 100644
--- a/gtk/gtkrecentchoosermenu.c
+++ b/gtk/gtkrecentchoosermenu.c
@@ -38,7 +38,6 @@
 #include "gtklabel.h"
 #include "gtkbox.h"
 #include "gtktooltip.h"
-#include "deprecated/gtkactivatable.h"
 #include "gtktypebuiltins.h"
 #include "gtkprivate.h"
 
@@ -107,10 +106,6 @@ struct _GtkRecentChooserMenuPrivate
 enum {
   PROP_0,
   PROP_SHOW_NUMBERS,
-
-  /* activatable properties */
-  PROP_ACTIVATABLE_RELATED_ACTION,
-  PROP_ACTIVATABLE_USE_ACTION_APPEARANCE
 };
 
 
@@ -170,23 +165,12 @@ static void     item_activate_cb   (GtkWidget        *widget,
 static void     manager_changed_cb (GtkRecentManager *manager,
                                    gpointer          user_data);
 
-static void gtk_recent_chooser_activatable_iface_init (GtkActivatableIface  *iface);
-static void gtk_recent_chooser_update                 (GtkActivatable       *activatable,
-                                                      GtkAction            *action,
-                                                      const gchar          *property_name);
-static void gtk_recent_chooser_sync_action_properties (GtkActivatable       *activatable,
-                                                      GtkAction            *action);
-
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
 G_DEFINE_TYPE_WITH_CODE (GtkRecentChooserMenu,
                         gtk_recent_chooser_menu,
                         GTK_TYPE_MENU,
                          G_ADD_PRIVATE (GtkRecentChooserMenu)
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_RECENT_CHOOSER,
-                                               gtk_recent_chooser_iface_init)
-                        G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
-                                               gtk_recent_chooser_activatable_iface_init))
-G_GNUC_END_IGNORE_DEPRECATIONS;
+                                               gtk_recent_chooser_iface_init))
 
 static void
 gtk_recent_chooser_iface_init (GtkRecentChooserIface *iface)
@@ -206,13 +190,6 @@ gtk_recent_chooser_iface_init (GtkRecentChooserIface *iface)
 }
 
 static void
-gtk_recent_chooser_activatable_iface_init (GtkActivatableIface *iface)
-{
-  iface->update = gtk_recent_chooser_update;
-  iface->sync_action_properties = gtk_recent_chooser_sync_action_properties;
-}
-
-static void
 gtk_recent_chooser_menu_class_init (GtkRecentChooserMenuClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@@ -240,10 +217,6 @@ gtk_recent_chooser_menu_class_init (GtkRecentChooserMenuClass *klass)
                                                         P_("Whether the items should be displayed with a 
number"),
                                                         FALSE,
                                                         GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-  
-
-  g_object_class_override_property (gobject_class, PROP_ACTIVATABLE_RELATED_ACTION, "related-action");
-  g_object_class_override_property (gobject_class, PROP_ACTIVATABLE_USE_ACTION_APPEARANCE, 
"use-action-appearance");
 }
 
 static void
@@ -428,12 +401,6 @@ gtk_recent_chooser_menu_set_property (GObject      *object,
     case GTK_RECENT_CHOOSER_PROP_FILTER:
       gtk_recent_chooser_menu_set_current_filter (menu, g_value_get_object (value));
       break;
-    case PROP_ACTIVATABLE_RELATED_ACTION:
-      _gtk_recent_chooser_set_related_action (GTK_RECENT_CHOOSER (menu), g_value_get_object (value));
-      break;
-    case PROP_ACTIVATABLE_USE_ACTION_APPEARANCE: 
-      _gtk_recent_chooser_set_use_action_appearance (GTK_RECENT_CHOOSER (menu), g_value_get_boolean (value));
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -481,12 +448,6 @@ gtk_recent_chooser_menu_get_property (GObject    *object,
     case GTK_RECENT_CHOOSER_PROP_FILTER:
       g_value_set_object (value, priv->current_filter);
       break;
-    case PROP_ACTIVATABLE_RELATED_ACTION:
-      g_value_set_object (value, _gtk_recent_chooser_get_related_action (GTK_RECENT_CHOOSER (menu)));
-      break;
-    case PROP_ACTIVATABLE_USE_ACTION_APPEARANCE: 
-      g_value_set_boolean (value, _gtk_recent_chooser_get_use_action_appearance (GTK_RECENT_CHOOSER (menu)));
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1187,38 +1148,6 @@ gtk_recent_chooser_menu_set_show_tips (GtkRecentChooserMenu *menu,
   g_object_notify (G_OBJECT (menu), "show-tips");
 }
 
-static void
-gtk_recent_chooser_update (GtkActivatable *activatable,
-                          GtkAction      *action,
-                          const gchar    *property_name)
-{
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-  if (strcmp (property_name, "sensitive") == 0)
-    gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
-
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  _gtk_recent_chooser_update (activatable, action, property_name);
-}
-
-static void
-gtk_recent_chooser_sync_action_properties (GtkActivatable *activatable,
-                                          GtkAction      *action)
-{
-  if (!action)
-    return;
-
-  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-
-  gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
-
-  G_GNUC_END_IGNORE_DEPRECATIONS;
-
-  _gtk_recent_chooser_sync_action_properties (activatable, action);
-}
-
-
 /*
  * Public API
  */
diff --git a/gtk/gtkrecentchooserprivate.h b/gtk/gtkrecentchooserprivate.h
index 8e1be08..1338854 100644
--- a/gtk/gtkrecentchooserprivate.h
+++ b/gtk/gtkrecentchooserprivate.h
@@ -23,7 +23,6 @@
 
 #include "gtkrecentmanager.h"
 #include "gtkrecentchooser.h"
-#include "deprecated/gtkactivatable.h"
 
 G_BEGIN_DECLS
 
@@ -36,18 +35,6 @@ GList *           _gtk_recent_chooser_get_items              (GtkRecentChooser
 void              _gtk_recent_chooser_item_activated         (GtkRecentChooser  *chooser);
 void              _gtk_recent_chooser_selection_changed      (GtkRecentChooser  *chooser);
 
-void              _gtk_recent_chooser_update                 (GtkActivatable       *activatable,
-                                                             GtkAction            *action,
-                                                             const gchar          *property_name);
-void              _gtk_recent_chooser_sync_action_properties (GtkActivatable       *activatable,
-                                                             GtkAction            *action);
-void              _gtk_recent_chooser_set_related_action     (GtkRecentChooser     *recent_chooser, 
-                                                             GtkAction            *action);
-GtkAction        *_gtk_recent_chooser_get_related_action     (GtkRecentChooser     *recent_chooser);
-void              _gtk_recent_chooser_set_use_action_appearance (GtkRecentChooser  *recent_chooser, 
-                                                                gboolean           use_appearance);
-gboolean          _gtk_recent_chooser_get_use_action_appearance (GtkRecentChooser  *recent_chooser);
-
 G_END_DECLS
 
 #endif /* ! __GTK_RECENT_CHOOSER_PRIVATE_H__ */


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