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

Tomasz Wasilczyk twasilczyk at pidgin.im
Tue Sep 10 17:16:06 EDT 2013


Changeset: f5f3a9945a6d950d5c26b32b4f3dacb44476f4a1
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2013-09-10 23:15 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/f5f3a9945a6d

Description:

Request API refactoring: switch purple_request_folder to PurpleRequestCommonParameters

diffstat:

 finch/gntrequest.c  |   4 ++--
 libpurple/request.c |  14 +++++++-------
 libpurple/request.h |  19 +++++++------------
 pidgin/gtkrequest.c |   7 +++----
 4 files changed, 19 insertions(+), 25 deletions(-)

diffs (107 lines):

diff --git a/finch/gntrequest.c b/finch/gntrequest.c
--- a/finch/gntrequest.c
+++ b/finch/gntrequest.c
@@ -788,8 +788,8 @@ finch_request_file(const char *title, co
 
 static void *
 finch_request_folder(const char *title, const char *dirname, GCallback ok_cb,
-		GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv,
-		void *user_data)
+	GCallback cancel_cb, PurpleRequestCommonParameters *cpar,
+	void *user_data)
 {
 	FinchFileRequest *data;
 
diff --git a/libpurple/request.c b/libpurple/request.c
--- a/libpurple/request.c
+++ b/libpurple/request.c
@@ -1924,9 +1924,8 @@ purple_request_file(void *handle, const 
 
 void *
 purple_request_folder(void *handle, const char *title, const char *dirname,
-				  GCallback ok_cb, GCallback cancel_cb,
-				  PurpleAccount *account, const char *who, PurpleConversation *conv,
-				  void *user_data)
+	GCallback ok_cb, GCallback cancel_cb,
+	PurpleRequestCommonParameters *cpar, void *user_data)
 {
 	PurpleRequestUiOps *ops;
 
@@ -1938,14 +1937,15 @@ purple_request_folder(void *handle, cons
 		info            = g_new0(PurpleRequestInfo, 1);
 		info->type      = PURPLE_REQUEST_FOLDER;
 		info->handle    = handle;
-		info->ui_handle = ops->request_folder(title, dirname,
-											ok_cb, cancel_cb,
-											account, who, conv,
-											user_data);
+		info->ui_handle = ops->request_folder(title, dirname, ok_cb,
+			cancel_cb, cpar, user_data);
 		handles = g_list_append(handles, info);
+
+		purple_request_cpar_unref(cpar);
 		return info->ui_handle;
 	}
 
+	purple_request_cpar_unref(cpar);
 	return NULL;
 }
 
diff --git a/libpurple/request.h b/libpurple/request.h
--- a/libpurple/request.h
+++ b/libpurple/request.h
@@ -130,9 +130,8 @@ typedef struct
 
 	/** @see purple_request_folder(). */
 	void *(*request_folder)(const char *title, const char *dirname,
-	                        GCallback ok_cb, GCallback cancel_cb,
-	                        PurpleAccount *account, const char *who,
-	                        PurpleConversation *conv, void *user_data);
+		GCallback ok_cb, GCallback cancel_cb,
+		PurpleRequestCommonParameters *cpar, void *user_data);
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
@@ -1717,20 +1716,16 @@ purple_request_file(void *handle, const 
  * @param dirname     The default directory name (may be @c NULL)
  * @param ok_cb       The callback for the @c OK button.
  * @param cancel_cb   The callback for the @c Cancel button, which may be @c NULL.
- * @param account     The #PurpleAccount associated with this request, or @c
- *                    NULL if none is
- * @param who         The username of the buddy associated with this request,
- *                    or @c NULL if none is
- * @param conv        The #PurpleConversation associated with this request, or
- *                    @c NULL if none is
+ * @param cpar        The #PurpleRequestCommonParameters object, which gets
+ *                    unref'ed after this call.
  * @param user_data   The data to pass to the callback.
  *
  * @return A UI-specific handle.
  */
-void *purple_request_folder(void *handle, const char *title, const char *dirname,
+void *
+purple_request_folder(void *handle, const char *title, const char *dirname,
 	GCallback ok_cb, GCallback cancel_cb,
-	PurpleAccount *account, const char *who, PurpleConversation *conv,
-	void *user_data);
+	PurpleRequestCommonParameters *cpar, void *user_data);
 
 /**
  * Prompts the user for action over a certificate.
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1694,10 +1694,9 @@ pidgin_request_file(const char *title, c
 }
 
 static void *
-pidgin_request_folder(const char *title, const char *dirname,
-					  GCallback ok_cb, GCallback cancel_cb,
-					  PurpleAccount *account, const char *who, PurpleConversation *conv,
-					  void *user_data)
+pidgin_request_folder(const char *title, const char *dirname, GCallback ok_cb,
+	GCallback cancel_cb, PurpleRequestCommonParameters *cpar,
+	void *user_data)
 {
 	PidginRequestData *data;
 	GtkWidget *dirsel;



More information about the Commits mailing list