]> Pileus Git - ~andy/gtk/commitdiff
Iterate on the proxies we hold when we change the sorting function and the
authorEmmanuele Bassi <ebassi@gnome.org>
Thu, 4 Oct 2007 22:52:13 +0000 (22:52 +0000)
committerEmmanuele Bassi <ebassi@src.gnome.org>
Thu, 4 Oct 2007 22:52:13 +0000 (22:52 +0000)
2007-10-04  Emmanuele Bassi  <ebassi@gnome.org>

* gtk/gtkrecentaction.c:
(gtk_recent_action_set_sort_func), (set_current_filter): Iterate
on the proxies we hold when we change the sorting function and
the filter.

(gtk_recent_action_connect_proxy),
(gtk_recent_action_create_menu): Set the GtkRecentChooser:filter
property when we create/connect a proxy chooser. Thanks to
Jonh Wendell for pointing this bug out on gtk-list.

(gtk_recent_chooser_set_property): Bail out without iterating
over the proxies when there's no need to.

svn path=/trunk/; revision=18883

ChangeLog
gtk/gtkrecentaction.c

index 34e56e3be633d89453992212c852be4c195e3dee..29d89ae91f09222d88c9a6c665a441ba76903852 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-10-04  Emmanuele Bassi  <ebassi@gnome.org>
+
+       * gtk/gtkrecentaction.c:
+       (gtk_recent_action_set_sort_func), (set_current_filter): Iterate
+       on the proxies we hold when we change the sorting function and
+       the filter.
+
+       (gtk_recent_action_connect_proxy),
+       (gtk_recent_action_create_menu): Set the GtkRecentChooser:filter
+       property when we create/connect a proxy chooser. Thanks to
+       Jonh Wendell for pointing this bug out on gtk-list.
+
+       (gtk_recent_chooser_set_property): Bail out without iterating
+       over the proxies when there's no need to.
+
 2007-10-04  Matthias Clasen  <mclasen@redhat.com>
 
        * tests/testvolumebutton.c: Add a second volume button.
index 70c0e241501eedea77768e10712fc65d0636aa06..5beec74a477429e7ca3e7c9d37c1d25082f01239 100644 (file)
@@ -192,6 +192,7 @@ gtk_recent_action_set_sort_func (GtkRecentChooser  *chooser,
 {
   GtkRecentAction *action = GTK_RECENT_ACTION (chooser);
   GtkRecentActionPrivate *priv = action->priv;
+  GSList *l;
   
   if (priv->data_destroy)
     {
@@ -208,6 +209,15 @@ gtk_recent_action_set_sort_func (GtkRecentChooser  *chooser,
       priv->sort_data = sort_data;
       priv->data_destroy = data_destroy;
     }
+
+  for (l = priv->choosers; l; l = l->next)
+    {
+      GtkRecentChooser *chooser_menu = l->data;
+
+      gtk_recent_chooser_set_sort_func (chooser_menu, priv->sort_func,
+                                        priv->sort_data,
+                                        priv->data_destroy);
+    }
 }
 
 static void
@@ -215,6 +225,7 @@ set_current_filter (GtkRecentAction *action,
                     GtkRecentFilter *filter)
 {
   GtkRecentActionPrivate *priv = action->priv;
+  GSList *l;
 
   g_object_ref (action);
 
@@ -226,6 +237,13 @@ set_current_filter (GtkRecentAction *action,
   if (priv->current_filter)
     g_object_ref_sink (priv->current_filter);
 
+  for (l = priv->choosers; l; l = l->next)
+    {
+      GtkRecentChooser *chooser = l->data;
+
+      gtk_recent_chooser_set_filter (chooser, priv->current_filter);
+    }
+
   g_object_notify (G_OBJECT (action), "filter");
 
   g_object_unref (action);
@@ -331,6 +349,7 @@ gtk_recent_action_connect_proxy (GtkAction *action,
                     "show-numbers", priv->show_numbers,
                     "limit", priv->limit,
                     "sort-type", priv->sort_type,
+                    "filter", priv->current_filter,
                     NULL);
   
       if (priv->sort_func)
@@ -384,6 +403,7 @@ gtk_recent_action_create_menu (GtkAction *action)
                          "limit", priv->limit,
                          "sort-type", priv->sort_type,
                          "recent-manager", priv->manager,
+                         "filter", priv->current_filter,
                          NULL);
   
   if (priv->sort_func)
@@ -552,16 +572,21 @@ gtk_recent_action_set_property (GObject      *gobject,
       priv->sort_type = g_value_get_enum (value);
       break;
     case GTK_RECENT_CHOOSER_PROP_FILTER:
+      /* this already iterates over the choosers list */
       set_current_filter (action, g_value_get_object (value));
-      break;
+      return;
     case GTK_RECENT_CHOOSER_PROP_SELECT_MULTIPLE:
       g_warning ("%s: Choosers of type `%s' do not support selecting multiple items.",
                  G_STRFUNC,
                  G_OBJECT_TYPE_NAME (gobject));
-      break;
+      return;
     case GTK_RECENT_CHOOSER_PROP_RECENT_MANAGER:
+      /* this is a construct-only property; we set the recent-manager
+       * of the choosers with this value when we create them, so there's
+       * no need to iterate later.
+       */
       set_recent_manager (action, g_value_get_object (value));
-      break;
+      return;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
       return;