libpurple/action.h

changeset 39480
5e089a52b01b
parent 39479
4da996236e9b
child 39481
4db28449567d
--- 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 @@
 #include <glib.h>
 #include <glib-object.h>
 
+
+#define PURPLE_TYPE_PROTOCOL_ACTION  (purple_protocol_action_get_type())
+
+typedef struct _PurpleProtocolAction PurpleProtocolAction;
+
+typedef void (*PurpleProtocolActionCallback)(PurpleProtocolAction *action);
+
 /**
  * PurpleMenuAction:
  *
@@ -34,8 +41,27 @@
  */
 typedef struct _PurpleMenuAction PurpleMenuAction;
 
+#include "connection.h"
+
+/**
+ * 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 {
+	char *label;
+	PurpleProtocolActionCallback callback;
+	PurpleConnection *connection;
+	gpointer user_data;
+};
+
 G_BEGIN_DECLS
 
+/******************************************************************************
+ * Menu Action API
+ *****************************************************************************/
+
 /**
  * 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);
 
+/******************************************************************************
+ * 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
+ *            action.
+ *
+ * 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);
+
+
 G_END_DECLS
 
-#endif /* PURPLE_ACTION */
\ No newline at end of file
+#endif /* PURPLE_ACTION */

mercurial