[Xfce4-commits] r24025 - xarchiver/branches/xarchiver-psybsd/src

Stephan Arts stephan at xfce.org
Fri Dec 1 15:10:44 CET 2006


Author: stephan
Date: 2006-12-01 14:10:44 +0000 (Fri, 01 Dec 2006)
New Revision: 24025

Modified:
   xarchiver/branches/xarchiver-psybsd/src/archive_store.c
   xarchiver/branches/xarchiver-psybsd/src/archive_store.h
   xarchiver/branches/xarchiver-psybsd/src/main.c
Log:
Added threading to archive-store (and broke it)


Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-12-01 13:33:04 UTC (rev 24024)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.c	2006-12-01 14:10:44 UTC (rev 24025)
@@ -46,6 +46,11 @@
 static void
 sq_archive_store_finalize(GObject *object);
 
+static gpointer
+sq_archive_store_sort_thread_func(SQArchiveStore *store);
+static gpointer
+sq_archive_store_sort_order_thread_func(SQArchiveStore *store);
+
 /* properties */
 enum {
 	SQ_ARCHIVE_STORE_SHOW_ICONS = 1, 
@@ -749,7 +754,8 @@
 	store->sort_column = sort_col_id;
 	store->sort_order = order;
 
-	sq_archive_store_sort(store);
+	/* sq_archive_store_sort(store); */
+	g_thread_create((GThreadFunc)sq_archive_store_sort_order_thread_func, store, FALSE, NULL);
 
 	gtk_tree_sortable_sort_column_changed(sortable);
 }
@@ -957,6 +963,7 @@
 void
 sq_archive_store_connect_treeview(SQArchiveStore *store, GtkTreeView *treeview)
 {
+	store->treeview = treeview;
 	g_signal_connect(G_OBJECT(treeview), "row-activated", G_CALLBACK(cb_sq_archive_store_row_activated), store);
 }
 
@@ -1103,10 +1110,6 @@
 		sq_archive_store_append_history(store, current_entry);
 	}
 
-	sq_archive_store_sort(store);
-
-	sq_archive_store_refresh(store);
-	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
 }
 
 void
@@ -1131,10 +1134,9 @@
 	current_entry = g_slist_copy(current_entry->next);
 	sq_archive_store_append_history(store, current_entry);
 
-	sq_archive_store_sort(store);
+	/* sq_archive_store_sort(store); */
+	g_thread_create((GThreadFunc)sq_archive_store_sort_thread_func, store, FALSE, NULL);
 
-	sq_archive_store_refresh(store);
-	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
 }
 
 void
@@ -1388,11 +1390,9 @@
 
 	sq_archive_store_append_history(store, stack);
 
-	sq_archive_store_sort(store);
+	/* sq_archive_store_sort(store); */
+	g_thread_create((GThreadFunc)sq_archive_store_sort_thread_func, store, FALSE, NULL);
 
-	sq_archive_store_refresh(store);
-
-	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
 	return TRUE;
 }
 
@@ -1524,10 +1524,9 @@
 	if(sq_archive_store_has_history(store))
 		store->navigation.present = store->navigation.present->prev;
 
-	sq_archive_store_sort(store);
+	/* sq_archive_store_sort(store); */
+	g_thread_create((GThreadFunc)sq_archive_store_sort_thread_func, store, FALSE, NULL);
 
-	sq_archive_store_refresh(store);
-
 	sq_archive_store_check_trailing(store);
 
 	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
@@ -1551,10 +1550,9 @@
 	if(sq_archive_store_has_future(store))
 		store->navigation.present = store->navigation.present->next;
 
-	sq_archive_store_sort(store);
+	/* sq_archive_store_sort(store); */
+	g_thread_create((GThreadFunc)sq_archive_store_sort_thread_func, store, FALSE, NULL);
 
-	sq_archive_store_refresh(store);
-
 	sq_archive_store_check_trailing(store);
 
 	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
@@ -1709,3 +1707,35 @@
 	if(store->archive)
 		g_object_unref(store->archive);
 }
+
+static gpointer
+sq_archive_store_sort_thread_func(SQArchiveStore *store)
+{
+	sq_archive_store_sort(store);
+
+	gdk_threads_enter();
+
+	sq_archive_store_refresh(store);
+	g_signal_emit(store, sq_archive_store_signals[SQ_ARCHIVE_STORE_SIGNAL_PWD_CHANGED], 0,NULL);
+
+	gdk_threads_leave();
+	return NULL;
+}
+
+static gpointer
+sq_archive_store_sort_order_thread_func(SQArchiveStore *store)
+{
+	sq_archive_store_sort(store);
+
+	gdk_threads_enter();
+	if(store->treeview)
+		gtk_tree_view_set_model(store->treeview, NULL);
+	sq_archive_store_refresh(store);
+	if(store->treeview)
+		gtk_tree_view_set_model(store->treeview, (GtkTreeModel *)store);
+
+	/* TODO: should do stuff i think */
+
+	gdk_threads_leave();
+	return NULL;
+}

Modified: xarchiver/branches/xarchiver-psybsd/src/archive_store.h
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/archive_store.h	2006-12-01 13:33:04 UTC (rev 24024)
+++ xarchiver/branches/xarchiver-psybsd/src/archive_store.h	2006-12-01 14:10:44 UTC (rev 24025)
@@ -51,6 +51,7 @@
 	LSQEntry **sort_list;
 	guint list_size;
 	GtkIconTheme *icon_theme;
+	GtkTreeView *treeview;
 	struct {
 		guint _show_icons : 1;
 		guint _show_up_dir : 1;

Modified: xarchiver/branches/xarchiver-psybsd/src/main.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/src/main.c	2006-12-01 13:33:04 UTC (rev 24024)
+++ xarchiver/branches/xarchiver-psybsd/src/main.c	2006-12-01 14:10:44 UTC (rev 24025)
@@ -112,10 +112,9 @@
  	textdomain (GETTEXT_PACKAGE);
 	#endif
 
-#ifdef G_THREADS_ENABLED
 	g_thread_init(NULL);
   gdk_threads_init();
-#endif /* G_THREADS_ENABLED */
+	gdk_threads_enter();
 
 	if(!gtk_init_with_args(&argc, &argv, _("[archive name]"), entries, PACKAGE, &cli_error))
 	{
@@ -181,7 +180,6 @@
 
 
 	g_object_unref(sq_app);
-	gdk_threads_enter();
 	gtk_main();
 	gdk_threads_leave();
 	lsq_destroy();



More information about the Xfce4-commits mailing list