Iterate on the proxies we hold when we change the sorting function and the

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
This commit is contained in:
Emmanuele Bassi 2007-10-04 22:52:13 +00:00 committed by Emmanuele Bassi
parent ff6a2c55a1
commit 43f5b189b7
2 changed files with 43 additions and 3 deletions

View File

@ -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> 2007-10-04 Matthias Clasen <mclasen@redhat.com>
* tests/testvolumebutton.c: Add a second volume button. * tests/testvolumebutton.c: Add a second volume button.

View File

@ -192,6 +192,7 @@ gtk_recent_action_set_sort_func (GtkRecentChooser *chooser,
{ {
GtkRecentAction *action = GTK_RECENT_ACTION (chooser); GtkRecentAction *action = GTK_RECENT_ACTION (chooser);
GtkRecentActionPrivate *priv = action->priv; GtkRecentActionPrivate *priv = action->priv;
GSList *l;
if (priv->data_destroy) if (priv->data_destroy)
{ {
@ -208,6 +209,15 @@ gtk_recent_action_set_sort_func (GtkRecentChooser *chooser,
priv->sort_data = sort_data; priv->sort_data = sort_data;
priv->data_destroy = data_destroy; 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 static void
@ -215,6 +225,7 @@ set_current_filter (GtkRecentAction *action,
GtkRecentFilter *filter) GtkRecentFilter *filter)
{ {
GtkRecentActionPrivate *priv = action->priv; GtkRecentActionPrivate *priv = action->priv;
GSList *l;
g_object_ref (action); g_object_ref (action);
@ -226,6 +237,13 @@ set_current_filter (GtkRecentAction *action,
if (priv->current_filter) if (priv->current_filter)
g_object_ref_sink (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_notify (G_OBJECT (action), "filter");
g_object_unref (action); g_object_unref (action);
@ -331,6 +349,7 @@ gtk_recent_action_connect_proxy (GtkAction *action,
"show-numbers", priv->show_numbers, "show-numbers", priv->show_numbers,
"limit", priv->limit, "limit", priv->limit,
"sort-type", priv->sort_type, "sort-type", priv->sort_type,
"filter", priv->current_filter,
NULL); NULL);
if (priv->sort_func) if (priv->sort_func)
@ -384,6 +403,7 @@ gtk_recent_action_create_menu (GtkAction *action)
"limit", priv->limit, "limit", priv->limit,
"sort-type", priv->sort_type, "sort-type", priv->sort_type,
"recent-manager", priv->manager, "recent-manager", priv->manager,
"filter", priv->current_filter,
NULL); NULL);
if (priv->sort_func) if (priv->sort_func)
@ -552,16 +572,21 @@ gtk_recent_action_set_property (GObject *gobject,
priv->sort_type = g_value_get_enum (value); priv->sort_type = g_value_get_enum (value);
break; break;
case GTK_RECENT_CHOOSER_PROP_FILTER: case GTK_RECENT_CHOOSER_PROP_FILTER:
/* this already iterates over the choosers list */
set_current_filter (action, g_value_get_object (value)); set_current_filter (action, g_value_get_object (value));
break; return;
case GTK_RECENT_CHOOSER_PROP_SELECT_MULTIPLE: case GTK_RECENT_CHOOSER_PROP_SELECT_MULTIPLE:
g_warning ("%s: Choosers of type `%s' do not support selecting multiple items.", g_warning ("%s: Choosers of type `%s' do not support selecting multiple items.",
G_STRFUNC, G_STRFUNC,
G_OBJECT_TYPE_NAME (gobject)); G_OBJECT_TYPE_NAME (gobject));
break; return;
case GTK_RECENT_CHOOSER_PROP_RECENT_MANAGER: 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)); set_recent_manager (action, g_value_get_object (value));
break; return;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
return; return;