/dev/tomkiewicz/new-smileys: 301fdb5e342e: Cleanup pidgin_smiley...

Tomasz Wasilczyk twasilczyk at pidgin.im
Wed Apr 2 12:40:31 EDT 2014


Changeset: 301fdb5e342eaa9dd55a7964b2704dc366b2a440
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-04-02 18:40 +0200
Branch:	 default
URL: https://hg.pidgin.im/dev/tomkiewicz/new-smileys/rev/301fdb5e342e

Description:

Cleanup pidgin_smiley_edit calls

diffstat:

 pidgin/gtksmiley-manager.c |  19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diffs (72 lines):

diff --git a/pidgin/gtksmiley-manager.c b/pidgin/gtksmiley-manager.c
--- a/pidgin/gtksmiley-manager.c
+++ b/pidgin/gtksmiley-manager.c
@@ -298,9 +298,8 @@ smiley_shortcut_changed(GtkEditable *sho
 	edit_dialog_update_buttons(edit_dialog);
 }
 
-/* TODO: maybe replace "GtkWindow *parent" with "SmileyManager *manager"? */
 static void
-pidgin_smiley_edit(GtkWindow *parent, PurpleSmiley *smiley)
+pidgin_smiley_edit(SmileyManager *manager, PurpleSmiley *smiley)
 {
 	SmileyEditDialog *edit_dialog;
 	GtkWidget *vbox, *hbox;
@@ -318,7 +317,7 @@ pidgin_smiley_edit(GtkWindow *parent, Pu
 
 	edit_dialog->window = GTK_DIALOG(gtk_dialog_new_with_buttons(
 		smiley ? _("Edit Smiley") : _("Add Smiley"),
-		parent, GTK_DIALOG_DESTROY_WITH_PARENT,
+		GTK_WINDOW(manager->window), GTK_DIALOG_DESTROY_WITH_PARENT,
 		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 		smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT,
 		NULL));
@@ -552,7 +551,7 @@ smiley_got_url(PurpleHttpConnection *htt
 	if (!image)
 		return;
 
-	ps = pidgin_smiley_edit(GTK_WIDGET(dialog->window), NULL);
+	ps = pidgin_smiley_edit(manager, NULL);
 	pidgin_smiley_editor_set_image(ps, image);
 	pidgin_smiley_editor_set_data(ps, g_memdup(smileydata, len), len);
 }
@@ -583,7 +582,7 @@ smiley_dnd_recv(GtkWidget *widget, GdkDr
 							"g_filename_from_uri error"));
 				return;
 			}
-			ps = pidgin_smiley_edit(GTK_WIDGET(dialog->window), NULL);
+			ps = pidgin_smiley_edit(manager, NULL);
 			image_choosen(tmp, ps);
 			if (gtk_image_get_pixbuf(GTK_IMAGE(ps->smiley_image)) == NULL)
 				gtk_dialog_response(GTK_DIALOG(ps->parent), GTK_RESPONSE_CANCEL);
@@ -638,7 +637,7 @@ smiley_list_activated(GtkTreeView *tree,
 		SMILEY_LIST_MODEL_PURPLESMILEY, &smiley, -1);
 	g_return_if_fail(PURPLE_IS_SMILEY(smiley));
 
-	pidgin_smiley_edit(GTK_WINDOW(manager->window), smiley);
+	pidgin_smiley_edit(manager, smiley);
 }
 
 static void
@@ -789,7 +788,7 @@ smiley_manager_select_cb(GtkWidget *widg
 
 	switch (resp) {
 		case GTK_RESPONSE_YES:
-			pidgin_smiley_edit(GTK_WINDOW(manager->window), NULL);
+			pidgin_smiley_edit(manager, NULL);
 			break;
 #if 0
 		case GTK_RESPONSE_NO:
@@ -804,10 +803,8 @@ smiley_manager_select_cb(GtkWidget *widg
 			smiley_manager = NULL;
 			break;
 		case PIDGIN_RESPONSE_MODIFY:
-			for (it = selected_smileys; it; it = g_list_next(it)) {
-				pidgin_smiley_edit(GTK_WINDOW(manager->window),
-					it->data);
-			}
+			for (it = selected_smileys; it; it = g_list_next(it))
+				pidgin_smiley_edit(manager, it->data);
 			break;
 		default:
 			g_warn_if_reached();



More information about the Commits mailing list