[gtk+/places-sidebar] Cancel and disconnect from the bookmarks monitor when done
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar] Cancel and disconnect from the bookmarks monitor when done
- Date: Mon, 3 Oct 2011 19:48:39 +0000 (UTC)
commit f780e4e72c447ac12666a991672f42b76816ef56
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Sep 30 09:43:59 2011 -0500
Cancel and disconnect from the bookmarks monitor when done
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkbookmarksmanager.c | 11 ++++++++---
gtk/gtkbookmarksmanager.h | 1 +
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkbookmarksmanager.c b/gtk/gtkbookmarksmanager.c
index b998c4a..a5d9331 100644
--- a/gtk/gtkbookmarksmanager.c
+++ b/gtk/gtkbookmarksmanager.c
@@ -200,8 +200,8 @@ _gtk_bookmarks_manager_new (GtkBookmarksChangedFunc changed_func, gpointer chang
g_error_free (error);
}
else
- g_signal_connect (manager->bookmarks_monitor, "changed",
- G_CALLBACK (bookmarks_file_changed), manager);
+ manager->bookmarks_monitor_changed_id = g_signal_connect (manager->bookmarks_monitor, "changed",
+ G_CALLBACK (bookmarks_file_changed), manager);
g_object_unref (bookmarks_file);
@@ -214,7 +214,12 @@ _gtk_bookmarks_manager_free (GtkBookmarksManager *manager)
g_return_if_fail (manager != NULL);
if (manager->bookmarks_monitor)
- g_object_unref (manager->bookmarks_monitor);
+ {
+ g_file_monitor_cancel (manager->bookmarks_monitor);
+ g_signal_handler_disconnect (manager->bookmarks_monitor, manager->bookmarks_monitor_changed_id);
+ manager->bookmarks_monitor_changed_id = 0;
+ g_object_unref (manager->bookmarks_monitor);
+ }
if (manager->bookmarks)
{
diff --git a/gtk/gtkbookmarksmanager.h b/gtk/gtkbookmarksmanager.h
index ee98d87..a991c04 100644
--- a/gtk/gtkbookmarksmanager.h
+++ b/gtk/gtkbookmarksmanager.h
@@ -35,6 +35,7 @@ typedef struct
GSList *bookmarks;
GFileMonitor *bookmarks_monitor;
+ gulong bookmarks_monitor_changed_id;
gpointer changed_func_data;
GtkBookmarksChangedFunc changed_func;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]