Move the ProtocolActionInterface to action.[ch]
--- a/libpurple/action.c Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/action.c Thu Feb 01 23:21:30 2018 -0600
@@ -124,3 +124,42 @@
+/****************************************************************************** + *****************************************************************************/ +purple_protocol_action_new(const gchar* label, PurpleProtocolActionCallback callback) { + PurpleProtocolAction *action; + g_return_val_if_fail(label != NULL, NULL); + g_return_val_if_fail(callback != NULL, NULL); + action = g_new0(PurpleProtocolAction, 1); + action->label = g_strdup(label); + action->callback = callback; +purple_protocol_action_free(PurpleProtocolAction *action) { + g_return_if_fail(action != NULL); +static PurpleProtocolAction * +purple_protocol_action_copy(PurpleProtocolAction *action) { + g_return_val_if_fail(action != NULL, NULL); + return purple_protocol_action_new(action->label, action->callback); + purple_protocol_action, + purple_protocol_action_copy, + purple_protocol_action_free --- a/libpurple/action.h Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/action.h Thu Feb 01 23:21:30 2018 -0600
@@ -25,6 +25,13 @@
+#define PURPLE_TYPE_PROTOCOL_ACTION (purple_protocol_action_get_type()) +typedef struct _PurpleProtocolAction PurpleProtocolAction; +typedef void (*PurpleProtocolActionCallback)(PurpleProtocolAction *action); @@ -34,8 +41,27 @@
typedef struct _PurpleMenuAction PurpleMenuAction;
+ * PurpleProtocolAction: + * Represents an action that the protocol can perform. This shows up in the + * Accounts menu, under a submenu with the name of the account. +struct _PurpleProtocolAction { + PurpleProtocolActionCallback callback; + PurpleConnection *connection; +/****************************************************************************** + *****************************************************************************/ * purple_menu_action_new:
* @label: The text label to display for this action.
@@ -154,6 +180,37 @@
const gchar *purple_menu_action_get_stock_icon(PurpleMenuAction *act);
+/****************************************************************************** + *****************************************************************************/ + * purple_protocol_action_get_type: + * Returns: The #GType for the #PurpleProtocolAction boxed structure. +GType purple_protocol_action_get_type(void); + * purple_protocol_action_new: + * @label: The description of the action to show to the user. + * @callback: (scope call): The callback to call when the user selects this + * Allocates and returns a new PurpleProtocolAction. Use this to add actions in + * a list in the get_actions function of the protocol. +PurpleProtocolAction *purple_protocol_action_new(const gchar *label, PurpleProtocolActionCallback callback); + * purple_protocol_action_free: + * @action: The PurpleProtocolAction to free. + * Frees a PurpleProtocolAction +void purple_protocol_action_free(PurpleProtocolAction *action); -#endif /* PURPLE_ACTION */
\ No newline at end of file
+#endif /* PURPLE_ACTION */ --- a/libpurple/protocols.c Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/protocols.c Thu Feb 01 23:21:30 2018 -0600
@@ -538,61 +538,6 @@
return purple_protocol_client_iface_get_max_message_size(protocol, NULL);
-/**************************************************************************/
-/* Protocol Action API */
-/**************************************************************************/
-purple_protocol_action_new(const char* label,
- PurpleProtocolActionCallback callback)
- PurpleProtocolAction *action;
- g_return_val_if_fail(label != NULL && callback != NULL, NULL);
- action = g_new0(PurpleProtocolAction, 1);
- action->label = g_strdup(label);
- action->callback = callback;
-purple_protocol_action_free(PurpleProtocolAction *action)
- g_return_if_fail(action != NULL);
-/**************************************************************************
- * GBoxed code for PurpleProtocolAction
- **************************************************************************/
-static PurpleProtocolAction *
-purple_protocol_action_copy(PurpleProtocolAction *action)
- g_return_val_if_fail(action != NULL, NULL);
- return purple_protocol_action_new(action->label, action->callback);
-purple_protocol_action_get_type(void)
- type = g_boxed_type_register_static("PurpleProtocolAction",
- (GBoxedCopyFunc)purple_protocol_action_copy,
- (GBoxedFreeFunc)purple_protocol_action_free);
/**************************************************************************
**************************************************************************/
--- a/libpurple/protocols.h Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/protocols.h Thu Feb 01 23:21:30 2018 -0600
@@ -31,11 +31,6 @@
#define PURPLE_PROTOCOLS_DOMAIN (g_quark_from_static_string("protocols"))
-#define PURPLE_TYPE_PROTOCOL_ACTION (purple_protocol_action_get_type())
-typedef struct _PurpleProtocolAction PurpleProtocolAction;
-typedef void (*PurpleProtocolActionCallback)(PurpleProtocolAction *action);
/**************************************************************************/
/* Basic Protocol Information */
/**************************************************************************/
@@ -128,19 +123,6 @@
- * PurpleProtocolAction:
- * Represents an action that the protocol can perform. This shows up in the
- * Accounts menu, under a submenu with the name of the account.
-struct _PurpleProtocolAction {
- PurpleProtocolActionCallback callback;
- PurpleConnection *connection;
/**************************************************************************/
@@ -148,37 +130,6 @@
/**************************************************************************/
/**************************************************************************/
-/* Protocol Action API */
-/**************************************************************************/
- * purple_protocol_action_get_type:
- * Returns: The #GType for the #PurpleProtocolAction boxed structure.
-GType purple_protocol_action_get_type(void);
- * purple_protocol_action_new:
- * @label: The description of the action to show to the user.
- * @callback: (scope call): The callback to call when the user selects this
- * Allocates and returns a new PurpleProtocolAction. Use this to add actions in
- * a list in the get_actions function of the protocol.
-PurpleProtocolAction *purple_protocol_action_new(const char* label,
- PurpleProtocolActionCallback callback);
- * purple_protocol_action_free:
- * @action: The PurpleProtocolAction to free.
- * Frees a PurpleProtocolAction
-void purple_protocol_action_free(PurpleProtocolAction *action);
-/**************************************************************************/
/* Protocol Chat Entry API */
/**************************************************************************/
--- a/libpurple/protocols/gg/gg.c Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/protocols/gg/gg.c Thu Feb 01 23:21:30 2018 -0600
@@ -28,6 +28,7 @@
--- a/libpurple/protocols/irc/irc.c Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/protocols/irc/irc.c Thu Feb 01 23:21:30 2018 -0600
@@ -26,6 +26,7 @@
#include "conversation.h"
--- a/libpurple/protocols/jabber/buddy.h Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/protocols/jabber/buddy.h Thu Feb 01 23:21:30 2018 -0600
@@ -26,6 +26,8 @@
typedef struct _JabberBuddy JabberBuddy;
--- a/libpurple/protocols/zephyr/zephyr.c Thu Feb 01 22:33:16 2018 -0600
+++ b/libpurple/protocols/zephyr/zephyr.c Thu Feb 01 23:21:30 2018 -0600
@@ -29,6 +29,7 @@
#include "libpurple/internal.h"