pidgin: 756598e4: A small bit of hide-a-struct

markdoliner at pidgin.im markdoliner at pidgin.im
Tue Aug 30 02:40:22 EDT 2011


----------------------------------------------------------------------
Revision: 756598e4c0c17510d74152d8f495204deb003620
Parent:   907d6d9ff02d6a4ac1342133d6e040ee794c7d6d
Author:   markdoliner at pidgin.im
Date:     08/30/11 02:37:09
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/756598e4c0c17510d74152d8f495204deb003620

Changelog: 

A small bit of hide-a-struct

Changes against parent 907d6d9ff02d6a4ac1342133d6e040ee794c7d6d

  patched  libpurple/request.c
  patched  libpurple/request.h

-------------- next part --------------
============================================================
--- libpurple/request.c	1bbf1c436ed3cd37d44e7e57bc0b25bc292576f2
+++ libpurple/request.c	1a08e90926d962a6384a88aa7f8e94bd67f44ee5
@@ -126,9 +126,28 @@ struct _PurpleRequestField
 
 	void *ui_data;
 	char *tooltip;
+};
 
+struct _PurpleRequestFields
+{
+	GList *groups;
+
+	GHashTable *fields;
+
+	GList *required_fields;
+
+	void *ui_data;
 };
 
+struct _PurpleRequestFieldGroup
+{
+	PurpleRequestFields *fields_list;
+
+	char *title;
+
+	GList *fields;
+};
+
 PurpleRequestFields *
 purple_request_fields_new(void)
 {
@@ -357,6 +376,20 @@ purple_request_fields_get_account(const 
 	return purple_request_field_account_get_value(field);
 }
 
+gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields)
+{
+	g_return_val_if_fail(fields != NULL, NULL);
+
+	return fields->ui_data;
+}
+
+void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer ui_data)
+{
+	g_return_if_fail(fields != NULL);
+
+	fields->ui_data = ui_data;
+}
+
 PurpleRequestFieldGroup *
 purple_request_field_group_new(const char *title)
 {
@@ -423,6 +456,14 @@ purple_request_field_group_get_fields(co
 	return group->fields;
 }
 
+PurpleRequestFields *
+purple_request_field_group_get_fields_list(const PurpleRequestFieldGroup *group)
+{
+	g_return_val_if_fail(group != NULL, NULL);
+
+	return group->fields_list;
+}
+
 PurpleRequestField *
 purple_request_field_new(const char *id, const char *text,
 					   PurpleRequestFieldType type)
============================================================
--- libpurple/request.h	d9b1562006b44b4b448d3b4cdde618e35e1ef2ab
+++ libpurple/request.h	b32e33550372256ffe548650d1eb7b8995975156
@@ -33,6 +33,16 @@ typedef struct _PurpleRequestField Purpl
 /** @copydoc _PurpleRequestField */
 typedef struct _PurpleRequestField PurpleRequestField;
 
+/**
+ * Multiple fields request data.
+ */
+typedef struct _PurpleRequestFields PurpleRequestFields;
+
+/**
+ * A group of fields with a title.
+ */
+typedef struct _PurpleRequestFieldGroup PurpleRequestFieldGroup;
+
 #include "account.h"
 
 #define PURPLE_DEFAULT_ACTION_NONE	-1
@@ -69,34 +79,6 @@ typedef enum
 } PurpleRequestFieldType;
 
 /**
- * Multiple fields request data.
- */
-typedef struct
-{
-	GList *groups;
-
-	GHashTable *fields;
-
-	GList *required_fields;
-
-	void *ui_data;
-
-} PurpleRequestFields;
-
-/**
- * A group of fields with a title.
- */
-typedef struct
-{
-	PurpleRequestFields *fields_list;
-
-	char *title;
-
-	GList *fields;
-
-} PurpleRequestFieldGroup;
-
-/**
  * Request UI operations.
  */
 typedef struct
@@ -322,6 +304,25 @@ PurpleAccount *purple_request_fields_get
 PurpleAccount *purple_request_fields_get_account(const PurpleRequestFields *fields,
 											 const char *id);
 
+/**
+ * Returns the UI data associated with this object.
+ *
+ * @param fields The fields list.
+ *
+ * @return The UI data associated with this object.  This is a
+ *         convenience field provided to the UIs--it is not
+ *         used by the libuprple core.
+ */
+gpointer purple_request_fields_get_ui_data(const PurpleRequestFields *fields);
+
+/**
+ * Set the UI data associated with this object.
+ *
+ * @param fields The fields list.
+ * @param ui_data A pointer to associate with this object.
+ */
+void purple_request_fields_set_ui_data(PurpleRequestFields *fields, gpointer data);
+
 /*@}*/
 
 /**************************************************************************/
@@ -374,6 +375,16 @@ GList *purple_request_field_group_get_fi
 GList *purple_request_field_group_get_fields(
 		const PurpleRequestFieldGroup *group);
 
+/**
+ * Returns a list of all fields in a group.
+ *
+ * @param group The group.
+ *
+ * @constreturn The list of fields in the group.
+ */
+PurpleRequestFields *purple_request_field_group_get_fields_list(
+		const PurpleRequestFieldGroup *group);
+
 /*@}*/
 
 /**************************************************************************/


More information about the Commits mailing list