[Xfce4-commits] r24252 - in squeeze/trunk: libsqueeze src

Stephan Arts stephan at xfce.org
Wed Jan 3 09:01:52 CET 2007


Author: stephan
Date: 2007-01-03 08:01:52 +0000 (Wed, 03 Jan 2007)
New Revision: 24252

Modified:
   squeeze/trunk/libsqueeze/libsqueeze.c
   squeeze/trunk/src/application.c
   squeeze/trunk/src/archive_store.c
   squeeze/trunk/src/notebook.c
Log:
fixed dispose of notebook

Modified: squeeze/trunk/libsqueeze/libsqueeze.c
===================================================================
--- squeeze/trunk/libsqueeze/libsqueeze.c	2007-01-03 01:23:49 UTC (rev 24251)
+++ squeeze/trunk/libsqueeze/libsqueeze.c	2007-01-03 08:01:52 UTC (rev 24252)
@@ -56,6 +56,7 @@
 	g_slist_foreach(lsq_opened_archive_list,  (GFunc)g_object_unref, NULL);
 
 	g_object_unref(lsq_mime_database);
+	thunar_vfs_path_unref(lsq_relative_base_path);
 }
 
 /*

Modified: squeeze/trunk/src/application.c
===================================================================
--- squeeze/trunk/src/application.c	2007-01-03 01:23:49 UTC (rev 24251)
+++ squeeze/trunk/src/application.c	2007-01-03 08:01:52 UTC (rev 24252)
@@ -146,8 +146,8 @@
 	switch(archive->status)
 	{
 		case LSQ_ARCHIVESTATUS_IDLE:
+		case LSQ_ARCHIVESTATUS_ERROR:
 			lsq_close_archive(archive);
-		case LSQ_ARCHIVESTATUS_ERROR:
 		case LSQ_ARCHIVESTATUS_USERBREAK:
 			g_object_unref(app);
 			break;
@@ -243,7 +243,7 @@
 			return 1;
 		}
 	}
-	g_signal_connect(G_OBJECT(lp_archive), "lsq_status_changed", G_CALLBACK(cb_sq_application_archive_status_changed), NULL);
+	g_signal_connect(G_OBJECT(lp_archive), "lsq_status_changed", G_CALLBACK(cb_sq_application_archive_status_changed), app);
 	lp_support = lsq_get_support_for_mime(lp_archive->mime_info);
 	lsq_archive_support_add(lp_support, lp_archive, files);
 	g_object_ref(app);

Modified: squeeze/trunk/src/archive_store.c
===================================================================
--- squeeze/trunk/src/archive_store.c	2007-01-03 01:23:49 UTC (rev 24251)
+++ squeeze/trunk/src/archive_store.c	2007-01-03 08:01:52 UTC (rev 24252)
@@ -1702,9 +1702,6 @@
 static void
 sq_archive_store_finalize(GObject *object)
 {
-#ifdef DEBUG
-	g_debug("%s", __FUNCTION__);
-#endif
 	SQArchiveStore *store = SQ_ARCHIVE_STORE(object);
 	if(store->archive)
 		g_object_unref(store->archive);

Modified: squeeze/trunk/src/notebook.c
===================================================================
--- squeeze/trunk/src/notebook.c	2007-01-03 01:23:49 UTC (rev 24251)
+++ squeeze/trunk/src/notebook.c	2007-01-03 08:01:52 UTC (rev 24252)
@@ -34,7 +34,7 @@
 static void
 sq_notebook_init(SQNotebook *archive);
 static void
-sq_notebook_finalize(GObject *object);
+sq_notebook_dispose(GObject *object);
 
 static void
 sq_notebook_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
@@ -75,6 +75,8 @@
 
 static gint sq_notebook_signals[SQ_NOTEBOOK_SIGNAL_COUNT];
 
+static GObjectClass *parent_class;
+
 GType
 sq_notebook_get_type ()
 {
@@ -107,9 +109,11 @@
 	GObjectClass *object_class = G_OBJECT_CLASS (notebook_class);
 	GParamSpec *pspec = NULL;
 
+	parent_class = gtk_type_class (GTK_TYPE_NOTEBOOK);
+
 	object_class->set_property = sq_notebook_set_property;
 	object_class->get_property = sq_notebook_get_property;
-	object_class->finalize     = sq_notebook_finalize;
+	object_class->dispose      = sq_notebook_dispose;
 
 	sq_notebook_signals[SQ_NOTEBOOK_SIGNAL_ARCHIVE_REMOVED] = g_signal_new("archive-removed",
 			G_TYPE_FROM_CLASS(notebook_class),
@@ -174,9 +178,30 @@
 }
 
 static void
-sq_notebook_finalize(GObject *object)
+sq_notebook_dispose(GObject *object)
 {
 	/* TODO: unref archive_stores */
+	GtkWidget *child = NULL;
+	GtkNotebook *notebook = GTK_NOTEBOOK(object);
+	gint n = gtk_notebook_get_n_pages(notebook);
+	gint i = 0;
+	for(i = 0; i < n; i++)
+	{
+		child = gtk_notebook_get_nth_page(notebook, i);
+		GtkWidget *treeview = gtk_bin_get_child(GTK_BIN(child));
+		GtkTreeModel *archive_store = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
+
+		LSQArchive *archive = sq_archive_store_get_archive(SQ_ARCHIVE_STORE(archive_store));
+
+		if(archive)
+			g_signal_handlers_disconnect_by_func(archive, cb_notebook_archive_refreshed, treeview);
+		if(SQ_NOTEBOOK(notebook)->navigation_bar)
+			sq_navigation_bar_set_store(((SQNotebook *)notebook)->navigation_bar, NULL);
+		g_object_unref(archive_store);
+
+		lsq_close_archive(archive);
+	}
+	parent_class->dispose(object);
 }
 
 GtkWidget *
@@ -425,8 +450,8 @@
 	g_object_ref(archive_store);
 	gtk_tree_view_set_model(treeview, NULL);
 	sq_archive_store_set_archive(SQ_ARCHIVE_STORE(archive_store), archive);
+	gtk_tree_view_set_model(treeview, archive_store);
 	g_object_unref(archive_store);
-	gtk_tree_view_set_model(treeview, archive_store);
 }
 
 static void



More information about the Xfce4-commits mailing list