Use the right object when disconnecting from the GtkRecentManager::changed

2006-12-31  Emmanuele Bassi  <ebassi@gnome.org>

	* gtk/gtkrecentchoosermenu.c (set_recent_manager): Use the
	right object when disconnecting from the GtkRecentManager::changed
	signal; save us a few indirections using a variable.

svn path=/trunk/; revision=16999
This commit is contained in:
Emmanuele Bassi 2006-12-31 16:54:56 +00:00 committed by Emmanuele Bassi
parent ccd897d2fc
commit 2e372626d7
2 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2006-12-31 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkrecentchoosermenu.c (set_recent_manager): Use the
right object when disconnecting from the GtkRecentManager::changed
signal; save us a few indirections using a variable.
2006-12-31 Emmanuele Bassi <ebassi@gnome.org> 2006-12-31 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkrecentchoosermenu.c: Move the signal and idle * gtk/gtkrecentchoosermenu.c: Move the signal and idle

View File

@ -264,7 +264,9 @@ gtk_recent_chooser_menu_dispose (GObject *object)
if (priv->manager_changed_id) if (priv->manager_changed_id)
{ {
g_signal_handler_disconnect (priv->manager, priv->manager_changed_id); if (priv->manager)
g_signal_handler_disconnect (priv->manager, priv->manager_changed_id);
priv->manager_changed_id = 0; priv->manager_changed_id = 0;
} }
@ -1157,21 +1159,25 @@ static void
set_recent_manager (GtkRecentChooserMenu *menu, set_recent_manager (GtkRecentChooserMenu *menu,
GtkRecentManager *manager) GtkRecentManager *manager)
{ {
if (menu->priv->manager) GtkRecentChooserMenuPrivate *priv = menu->priv;
if (priv->manager)
{ {
g_signal_handler_disconnect (menu, menu->priv->manager_changed_id); if (priv->manager_changed_id)
menu->priv->manager = NULL; g_signal_handler_disconnect (priv->manager, priv->manager_changed_id);
priv->manager = NULL;
} }
if (manager) if (manager)
menu->priv->manager = manager; priv->manager = manager;
else else
menu->priv->manager = gtk_recent_manager_get_default (); priv->manager = gtk_recent_manager_get_default ();
if (menu->priv->manager) if (priv->manager)
menu->priv->manager_changed_id = g_signal_connect (menu->priv->manager, "changed", priv->manager_changed_id = g_signal_connect (priv->manager, "changed",
G_CALLBACK (manager_changed_cb), G_CALLBACK (manager_changed_cb),
menu); menu);
/* (re)populate the menu */ /* (re)populate the menu */
gtk_recent_chooser_menu_populate (menu); gtk_recent_chooser_menu_populate (menu);
} }