[patch] some threading fixes, and handle no default printers



Hi,

Attached is a patch to libgnomeprintui which adds some GDK_THREADS_ENTER
calls to callbacks eventually run from the libgnomecups idle handlers.  

More importantly for most applications, this also fixes the case where
there is no default printer (this part of the patch is from Matthias).

Ok to apply?

--- libgnomeprintui-2.7.1/libgnomeprintui/gpaui/gpa-printer-selector.c~	2004-07-09 11:10:37.000000000 -0400
+++ libgnomeprintui-2.7.1/libgnomeprintui/gpaui/gpa-printer-selector.c	2004-07-29 11:39:42.827538480 -0400
@@ -444,11 +444,15 @@
 {
 	GtkTreeIter iter;
 
+	GDK_THREADS_ENTER ();
+
 	g_return_if_fail (node_to_iter (ps->model, child, &iter) == FALSE);
 
 	gtk_list_store_append (GTK_LIST_STORE (ps->model), &iter);
 	gpa_printer_selector_sync_printer (GTK_LIST_STORE (ps->model), &iter,
 					   GPA_PRINTER (child));
+
+	GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -456,10 +460,14 @@
 					 GPAPrinterSelector *ps)
 {
 	GtkTreeIter iter;
+
+	GDK_THREADS_ENTER ();
 	
 	g_return_if_fail (node_to_iter (ps->model, child, &iter));
 	
 	gtk_list_store_remove (GTK_LIST_STORE (ps->model), &iter);
+
+	GDK_THREADS_LEAVE ();
 }
 
 static gboolean
@@ -494,8 +502,12 @@
 
 	if (ps->config != NULL)
 		default_printer = GPA_REFERENCE_REFERENCE (GPA_CONFIG (ps->config)->printer);
-
-	g_return_val_if_fail (node_to_iter (ps->model, default_printer, &iter), FALSE);
+	else
+		return TRUE;
+	
+	if (!node_to_iter (ps->model, default_printer, &iter))
+		return TRUE;
+	
 	gtk_tree_model_sort_convert_child_iter_to_iter (GTK_TREE_MODEL_SORT (ps->sortmodel),
 							&sort_iter, &iter);
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ps->treeview));

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]