/pidgin/main: fd7447005dea: Convert PurpleNotifySearchButton to ...

Jorge Villase?or salinasv at pidgin.im
Tue Dec 15 02:30:12 EST 2015


Changeset: fd7447005dea3d762ae717d0e252333aa94b3150
Author:	 Jorge Villase?or <salinasv at pidgin.im>
Date:	 2015-12-10 22:53 -0800
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/fd7447005dea

Description:

Convert PurpleNotifySearchButton to a GBoxed type

diffstat:

 libpurple/notify.c |  27 +++++++++++++++++++++++++++
 libpurple/notify.h |  15 +++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)

diffs (85 lines):

diff --git a/libpurple/notify.c b/libpurple/notify.c
--- a/libpurple/notify.c
+++ b/libpurple/notify.c
@@ -860,6 +860,33 @@ purple_notify_ui_ops_get_type(void)
 	return type;
 }
 
+static PurpleNotifySearchButton *
+purple_notify_search_button_copy(PurpleNotifySearchButton *button)
+{
+	PurpleNotifySearchButton *button_new;
+
+	g_return_val_if_fail(button != NULL, NULL);
+
+	button_new = g_new(PurpleNotifySearchButton, 1);
+	*button_new = *button;
+
+	return button_new;
+}
+
+GType
+purple_notify_search_button_get_type(void)
+{
+	static GType type = 0;
+
+	if (type == 0) {
+		type = g_boxed_type_register_static("PurpleNotifySearchButton",
+				(GBoxedCopyFunc)purple_notify_search_button_copy,
+				(GBoxedFreeFunc)g_free);
+	}
+
+	return type;
+}
+
 void
 purple_notify_set_ui_ops(PurpleNotifyUiOps *ops)
 {
diff --git a/libpurple/notify.h b/libpurple/notify.h
--- a/libpurple/notify.h
+++ b/libpurple/notify.h
@@ -38,6 +38,9 @@ typedef struct _PurpleNotifyUserInfoEntr
 #define  PURPLE_TYPE_NOTIFY_USER_INFO  (purple_notify_user_info_get_type())
 typedef struct _PurpleNotifyUserInfo		PurpleNotifyUserInfo;
 
+#define PURPLE_TYPE_NOTIFY_SEARCH_BUTTON  (purple_notify_search_button_get_type())
+typedef struct _PurpleNotifySearchButton	PurpleNotifySearchButton;
+
 /**
  * PurpleNotifySearchColumn:
  *
@@ -166,17 +169,18 @@ typedef void (*PurpleNotifySearchResults
 
 /**
  * PurpleNotifySearchButton:
+ * @type:     The type of search button that will be used.
  * @callback: Function to be called when clicked.
  * @label:    only for PURPLE_NOTIFY_BUTTON_LABELED
  *
  * Definition of a button.
  */
-typedef struct
+struct _PurpleNotifySearchButton
 {
 	PurpleNotifySearchButtonType type;
 	PurpleNotifySearchResultsCallback callback;
 	char *label;
-} PurpleNotifySearchButton;
+};
 
 
 /**
@@ -489,6 +493,13 @@ void *purple_notify_userinfo(PurpleConne
 						   gpointer user_data);
 
 /**
+ * purple_notify_search_button_get_type:
+ *
+ * Returns: The #GType for #PurpleNotifiySearchButton boxed structure.
+ */
+GType purple_notify_search_button_get_type(void);
+
+/**
  * purple_notify_user_info_get_type:
  *
  * Returns: The #GType for the #PurpleNotifyUserInfo boxed structure.



More information about the Commits mailing list