/pidgin/main: 876483829700: Request API refactoring: switch purp...

Tomasz Wasilczyk twasilczyk at pidgin.im
Tue Sep 10 16:32:51 EDT 2013


Changeset: 876483829700789584c9162cd0fe005d8b15958d
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2013-09-10 22:32 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/876483829700

Description:

Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters

diffstat:

 finch/gntblist.c                             |  20 +++++----------
 finch/gntplugin.c                            |   3 +-
 finch/gntprefs.c                             |   5 +--
 finch/gntrequest.c                           |   2 +-
 finch/plugins/gnthistory.c                   |   2 +-
 libpurple/account.c                          |  27 ++++++---------------
 libpurple/conversation.c                     |   2 +-
 libpurple/plugins/idle.c                     |   9 ++----
 libpurple/plugins/keyrings/internalkeyring.c |   2 +-
 libpurple/plugins/perl/common/Request.xs     |   2 +-
 libpurple/protocols/gg/account.c             |   4 +-
 libpurple/protocols/gg/gg.c                  |   2 +-
 libpurple/protocols/gg/pubdir-prpl.c         |   4 +-
 libpurple/protocols/gg/status.c              |   2 +-
 libpurple/protocols/jabber/buddy.c           |   4 +-
 libpurple/protocols/jabber/jabber.c          |  19 +++++++--------
 libpurple/protocols/jabber/si.c              |   2 +-
 libpurple/protocols/jabber/xdata.c           |   2 +-
 libpurple/protocols/msn/msn.c                |   9 ++----
 libpurple/protocols/mxit/actions.c           |   4 +-
 libpurple/protocols/mxit/login.c             |   9 +++++-
 libpurple/protocols/mxit/splashscreen.c      |   4 +-
 libpurple/protocols/oscar/oscar.c            |   2 +-
 libpurple/protocols/sametime/sametime.c      |   6 ++--
 libpurple/protocols/silc/buddy.c             |   2 +-
 libpurple/protocols/silc/chat.c              |   6 ++--
 libpurple/protocols/silc/silc.c              |   4 +-
 libpurple/protocols/yahoo/libymsg.c          |   3 +-
 libpurple/protocols/yahoo/yahoo_aliases.c    |   4 +-
 libpurple/request.c                          |  34 +++++++++++++++------------
 libpurple/request.h                          |  17 +++++--------
 pidgin/gtkblist.c                            |   6 +---
 pidgin/gtkdialogs.c                          |   9 ++----
 pidgin/gtkimhtmltoolbar.c                    |   2 +-
 pidgin/gtkrequest.c                          |  11 ++++----
 pidgin/gtkwebviewtoolbar.c                   |  12 +++------
 36 files changed, 113 insertions(+), 144 deletions(-)

diffs (truncated from 865 to 300 lines):

diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -699,7 +699,7 @@ finch_request_add_buddy(PurpleAccount *a
 			fields,
 			_("Add"), G_CALLBACK(add_buddy_cb),
 			_("Cancel"), NULL,
-			account, NULL, NULL,
+			purple_request_cpar_from_account(account),
 			NULL);
 }
 
@@ -805,8 +805,7 @@ finch_request_add_chat(PurpleAccount *ac
 	purple_request_fields(NULL, _("Add Chat"), NULL,
 			_("You can edit more information from the context menu later."),
 			fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL,
-			NULL, NULL, NULL,
-			NULL);
+			NULL, NULL);
 }
 
 static void
@@ -1167,8 +1166,7 @@ chat_components_edit(PurpleBlistNode *se
 
 	purple_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."),
 			fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL,
-			NULL, NULL, NULL,
-			chat);
+			NULL, chat);
 }
 
 static void
@@ -2715,8 +2713,7 @@ block_select(GntMenuItem *item, gpointer
 						fields,
 						_("OK"), G_CALLBACK(block_select_cb),
 						_("Cancel"), NULL,
-						NULL, NULL, NULL,
-						NULL);
+						NULL, NULL);
 }
 
 /* send_im_select* -- Xerox */
@@ -2766,8 +2763,7 @@ send_im_select(GntMenuItem *item, gpoint
 						fields,
 						_("OK"), G_CALLBACK(send_im_select_cb),
 						_("Cancel"), NULL,
-						NULL, NULL, NULL,
-						NULL);
+						NULL, NULL);
 }
 
 static void
@@ -2840,8 +2836,7 @@ join_chat_select(GntMenuItem *item, gpoi
 						fields,
 						_("Join"), G_CALLBACK(join_chat_select_cb),
 						_("Cancel"), NULL,
-						NULL, NULL, NULL,
-						NULL);
+						NULL, NULL);
 }
 
 static void
@@ -2902,8 +2897,7 @@ view_log_cb(GntMenuItem *item, gpointer 
 						fields,
 						_("OK"), G_CALLBACK(view_log_select_cb),
 						_("Cancel"), NULL,
-						NULL, NULL, NULL,
-						NULL);
+						NULL, NULL);
 }
 
 static void
diff --git a/finch/gntplugin.c b/finch/gntplugin.c
--- a/finch/gntplugin.c
+++ b/finch/gntplugin.c
@@ -532,8 +532,7 @@ process_pref_frame(PurplePluginPrefFrame
 
 	ret = purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
 			_("Save"), G_CALLBACK(finch_request_save_in_prefs), _("Cancel"), NULL,
-			NULL, NULL, NULL,
-			NULL);
+			NULL, NULL);
 	g_signal_connect_swapped(G_OBJECT(ret), "destroy", G_CALLBACK(free_stringlist), stringlist);
 	return ret;
 }
diff --git a/finch/gntprefs.c b/finch/gntprefs.c
--- a/finch/gntprefs.c
+++ b/finch/gntprefs.c
@@ -268,8 +268,7 @@ void finch_prefs_show_all()
 	pref_request.showing = TRUE;
 	pref_request.window = purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields,
 			_("Save"), G_CALLBACK(save_cb), _("Cancel"), free_strings,
-			NULL, NULL, NULL,
-			NULL);
+			NULL, NULL);
 }
 
 static void
@@ -307,5 +306,5 @@ void finch_prefs_show_keyring(void)
 		_("Keyring settings"), NULL, NULL, fields,
 		_("Save"), G_CALLBACK(finch_prefs_keyring_save),
 		_("Cancel"), G_CALLBACK(finch_prefs_keyring_cancel),
-		NULL, NULL, NULL, NULL);
+		NULL, NULL);
 }
diff --git a/finch/gntrequest.c b/finch/gntrequest.c
--- a/finch/gntrequest.c
+++ b/finch/gntrequest.c
@@ -593,7 +593,7 @@ finch_request_fields(const char *title, 
 		const char *secondary, PurpleRequestFields *allfields,
 		const char *ok, GCallback ok_cb,
 		const char *cancel, GCallback cancel_cb,
-		PurpleAccount *account, const char *who, PurpleConversation *conv,
+		PurpleRequestCommonParameters *cpar,
 		void *userdata)
 {
 	GntWidget *window, *box;
diff --git a/finch/plugins/gnthistory.c b/finch/plugins/gnthistory.c
--- a/finch/plugins/gnthistory.c
+++ b/finch/plugins/gnthistory.c
@@ -180,7 +180,7 @@ history_prefs_check(PurplePlugin *plugin
 				      fields,
 				      _("OK"), G_CALLBACK(finch_request_save_in_prefs),
 				      _("Cancel"), NULL,
-				      NULL, NULL, NULL, plugin);
+				      NULL, plugin);
 	}
 }
 
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -1265,15 +1265,9 @@ purple_account_request_password(PurpleAc
 	field = purple_request_field_bool_new("remember", _("Save password"), FALSE);
 	purple_request_field_group_add_field(group, field);
 
-	purple_request_fields(account,
-                        NULL,
-                        primary,
-                        NULL,
-                        fields,
-                        _("OK"), ok_cb,
-                        _("Cancel"), cancel_cb,
-						account, NULL, NULL,
-                        user_data);
+	purple_request_fields(account, NULL, primary, NULL, fields, _("OK"),
+		ok_cb, _("Cancel"), cancel_cb,
+		purple_request_cpar_from_account(account), user_data);
 	g_free(primary);
 }
 
@@ -1641,16 +1635,11 @@ purple_account_request_change_password(P
 
 	/* I'm sticking this somewhere in the code: bologna */
 
-	purple_request_fields(purple_account_get_connection(account),
-						NULL,
-						primary,
-						_("Please enter your current password and your "
-						  "new password."),
-						fields,
-						_("OK"), G_CALLBACK(change_password_cb),
-						_("Cancel"), NULL,
-						account, NULL, NULL,
-						account);
+	purple_request_fields(purple_account_get_connection(account), NULL,
+		primary, _("Please enter your current password and your new "
+		"password."), fields, _("OK"), G_CALLBACK(change_password_cb),
+		_("Cancel"), NULL, purple_request_cpar_from_account(account),
+		account);
 }
 
 static void
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -2252,7 +2252,7 @@ void purple_conv_chat_invite_user(Purple
 			fields,
 			_("Invite"), G_CALLBACK(invite_user_to_chat),
 			_("Cancel"), NULL,
-			account, user, conv,
+			purple_request_cpar_from_conversation(conv),
 			conv);
 }
 
diff --git a/libpurple/plugins/idle.c b/libpurple/plugins/idle.c
--- a/libpurple/plugins/idle.c
+++ b/libpurple/plugins/idle.c
@@ -164,8 +164,7 @@ idle_action(PurplePluginAction *action)
 			request,
 			_("_Set"), G_CALLBACK(idle_action_ok),
 			_("_Cancel"), NULL,
-			NULL, NULL, NULL,
-			NULL);
+			NULL, NULL);
 }
 
 static void
@@ -198,8 +197,7 @@ unidle_action(PurplePluginAction *action
 			request,
 			_("_Unset"), G_CALLBACK(unidle_action_ok),
 			_("_Cancel"), NULL,
-			NULL, NULL, NULL,
-			NULL);
+			NULL, NULL);
 }
 
 static void
@@ -224,8 +222,7 @@ idle_all_action(PurplePluginAction *acti
 			request,
 			_("_Set"), G_CALLBACK(idle_all_action_ok),
 			_("_Cancel"), NULL,
-			NULL, NULL, NULL,
-			NULL);
+			NULL, NULL);
 }
 
 static void
diff --git a/libpurple/plugins/keyrings/internalkeyring.c b/libpurple/plugins/keyrings/internalkeyring.c
--- a/libpurple/plugins/keyrings/internalkeyring.c
+++ b/libpurple/plugins/keyrings/internalkeyring.c
@@ -608,7 +608,7 @@ intkeyring_unlock(const gchar *message)
 		primary_msg, secondary_msg, fields,
 		_("OK"), G_CALLBACK(intkeyring_unlock_ok),
 		_("Cancel"), G_CALLBACK(intkeyring_unlock_cancel),
-		NULL, NULL, NULL, NULL);
+		NULL, NULL);
 }
 
 static void
diff --git a/libpurple/plugins/perl/common/Request.xs b/libpurple/plugins/perl/common/Request.xs
--- a/libpurple/plugins/perl/common/Request.xs
+++ b/libpurple/plugins/perl/common/Request.xs
@@ -193,7 +193,7 @@ CODE:
 	gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb);
 	g_free(basename);
 
-	RETVAL = purple_request_fields(handle, title, primary, secondary, fields, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr);
+	RETVAL = purple_request_fields(handle, title, primary, secondary, fields, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, gpr);
 OUTPUT:
 	RETVAL
 
diff --git a/libpurple/protocols/gg/account.c b/libpurple/protocols/gg/account.c
--- a/libpurple/protocols/gg/account.c
+++ b/libpurple/protocols/gg/account.c
@@ -262,7 +262,7 @@ static void ggp_account_register_dialog(
 		_("Please, fill in the following fields"), fields,
 		_("OK"), G_CALLBACK(ggp_account_register_dialog_ok),
 		_("Cancel"), G_CALLBACK(ggp_account_register_dialog_cancel),
-		purple_connection_get_account(gc), NULL, NULL, register_data);
+		purple_request_cpar_from_connection(gc), register_data);
 }
 
 static void ggp_account_register_dialog_cancel(
@@ -520,7 +520,7 @@ static void ggp_account_chpass_dialog(Pu
 		fields,
 		_("OK"), G_CALLBACK(ggp_account_chpass_dialog_ok),
 		_("Cancel"), G_CALLBACK(ggp_account_chpass_dialog_cancel),
-		account, NULL, NULL, chpass_data);
+		purple_request_cpar_from_connection(gc), chpass_data);
 	
 	g_free(primary);
 }
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -229,7 +229,7 @@ static void ggp_bmenu_add_to_chat(Purple
 			fields,
 			_("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok),
 			_("Cancel"), NULL,
-			purple_connection_get_account(gc), NULL, NULL,
+			purple_request_cpar_from_connection(gc),
 			buddy);
 	g_free(msg);
 }
diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c
--- a/libpurple/protocols/gg/pubdir-prpl.c
+++ b/libpurple/protocols/gg/pubdir-prpl.c
@@ -547,7 +547,7 @@ void ggp_pubdir_search(PurpleConnection 
 		_("Please, enter your search criteria below"), fields,
 		_("OK"), G_CALLBACK(ggp_pubdir_search_request),
 		_("Cancel"), NULL,
-		purple_connection_get_account(gc), NULL, NULL, gc);
+		purple_request_cpar_from_connection(gc), gc);
 }
 
 static void ggp_pubdir_search_request(PurpleConnection *gc,
@@ -874,7 +874,7 @@ static void ggp_pubdir_set_info_dialog(P
 		NULL, fields,
 		_("OK"), G_CALLBACK(ggp_pubdir_set_info_request),
 		_("Cancel"), NULL,
-		purple_connection_get_account(gc), NULL, NULL, gc);
+		purple_request_cpar_from_connection(gc), gc);
 	
 }
 
diff --git a/libpurple/protocols/gg/status.c b/libpurple/protocols/gg/status.c
--- a/libpurple/protocols/gg/status.c
+++ b/libpurple/protocols/gg/status.c
@@ -359,7 +359,7 @@ void ggp_status_broadcasting_dialog(Purp



More information about the Commits mailing list