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

Jorge Villase?or <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: fd7447005dea3d762ae717d0e252333aa94b3150
Author:	 Jorge Villase?or <[email protected]>
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.

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.