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

Colin Walters <[email protected]> Tue, 03 Aug 2004 13:37:41 -0400
Newsgroups gmane.comp.gnome.print
Message-ID <[email protected]>
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?

_______________________________________________
gnome-print-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-print-list
libgnomeprintui-2.7.1-fixes.patch (text/x-patch, 1.4 KB)
--- 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));
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQBBD81lOIkJWWp2WGURAvqiAJ9nYB8Yg9t/YK3rrxmAhbaBZv4tJgCfQk5I
L+gSOTCksHjmDwO+Hgm785w=
=aYiO
-----END PGP SIGNATURE-----