pidgin: ba17a795: Make the custom smiley edit windows sing...

qulogic at pidgin.im qulogic at pidgin.im
Mon Jul 6 01:30:50 EDT 2009


-----------------------------------------------------------------
Revision: ba17a7951e25b8a66b8405cb25015f5843597118
Ancestor: f9d2a098156b3fd9141160bb50c8299383c9d831
Author: qulogic at pidgin.im
Date: 2009-07-04T22:15:59
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ba17a7951e25b8a66b8405cb25015f5843597118

Modified files:
        pidgin/gtksmiley.c

ChangeLog: 

Make the custom smiley edit windows single-instance. That is, if you click
Modify multiple times, you won't have multiple dialogs.

-------------- next part --------------
============================================================
--- pidgin/gtksmiley.c	35d4a4fa5909bb119153b4c1126964c2df9c5484
+++ pidgin/gtksmiley.c	73151e6c72938612cdc59d472aedb9daf6dcc6a7
@@ -74,6 +74,7 @@ pidgin_smiley_destroy(PidginSmiley *smil
 static void
 pidgin_smiley_destroy(PidginSmiley *smiley)
 {
+	g_object_set_data(G_OBJECT(smiley->smiley), "edit-dialog", NULL);
 	gtk_widget_destroy(smiley->parent);
 	g_free(smiley->filename);
 	if (smiley->custom_pixbuf)
@@ -402,6 +403,7 @@ pidgin_smiley_edit(GtkWidget *widget, Pu
 			smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
 			NULL);
 	s->parent = window;
+	g_object_set_data(G_OBJECT(smiley), "edit-dialog", window);
 
 	gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER);
 
@@ -650,8 +652,12 @@ smiley_edit_iter(SmileyManager *dialog, 
 smiley_edit_iter(SmileyManager *dialog, GtkTreeIter *iter)
 {
 	PurpleSmiley *smiley = NULL;
+	GtkWidget *window = NULL;
 	gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), iter, SMILEY, &smiley, -1);
-	pidgin_smiley_edit(gtk_widget_get_toplevel(GTK_WIDGET(dialog->treeview)), smiley);
+	if ((window = g_object_get_data(G_OBJECT(smiley), "edit-dialog")) != NULL)
+		gtk_window_present(GTK_WINDOW(window));
+	else
+		pidgin_smiley_edit(gtk_widget_get_toplevel(GTK_WIDGET(dialog->treeview)), smiley);
 	g_object_unref(G_OBJECT(smiley));
 }
 


More information about the Commits mailing list