/soc/2013/ankitkv/gobjectification: 8fba0d44840d: Added PidginPl...
Ankit Vani
a at nevitus.org
Thu Aug 1 08:56:27 EDT 2013
Changeset: 8fba0d44840d775524610828c26863360ab9f840
Author: Ankit Vani <a at nevitus.org>
Date: 2013-08-01 18:26 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/8fba0d44840d
Description:
Added PidginPluginInfo, inheriting PurplePluginInfo to hold UI information
diffstat:
pidgin/gtkplugin.c | 32 ++++++++++++++++++++++++++++++++
pidgin/gtkplugin.h | 49 ++++++++++++++++++++++++++++++++-----------------
2 files changed, 64 insertions(+), 17 deletions(-)
diffs (129 lines):
diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c
--- a/pidgin/gtkplugin.c
+++ b/pidgin/gtkplugin.c
@@ -37,8 +37,15 @@
#include "gtk3compat.h"
+#define PIDGIN_PLUGIN_INFO_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_PLUGIN_INFO, PidginPluginInfoPrivate))
+
#define PIDGIN_RESPONSE_CONFIGURE 98121
+typedef struct
+{
+} PidginPluginInfoPrivate;
+
static void plugin_toggled_stage_two(PurplePlugin *plug, GtkTreeModel *model,
GtkTreeIter *iter, gboolean unload);
@@ -56,6 +63,31 @@ static GtkLabel *plugin_filename = NULL;
static GtkWidget *pref_button = NULL;
static GHashTable *plugin_pref_dialogs = NULL;
+/* Class initializer function */
+static void pidgin_plugin_info_class_init(PidginPluginInfoClass *klass)
+{
+ g_type_class_add_private(klass, sizeof(PidginPluginInfoPrivate));
+}
+
+GType
+pidgin_plugin_info_get_type(void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY(type == 0)) {
+ static const GTypeInfo info = {
+ .class_size = sizeof(PidginPluginInfoClass),
+ .class_init = (GClassInitFunc)pidgin_plugin_info_class_init,
+ .instance_size = sizeof(PidginPluginInfo),
+ };
+
+ type = g_type_register_static(PURPLE_TYPE_PLUGIN_INFO,
+ "PidginPluginInfo", &info, 0);
+ }
+
+ return type;
+}
+
GtkWidget *
pidgin_plugin_get_config_frame(PurplePlugin *plugin)
{
diff --git a/pidgin/gtkplugin.h b/pidgin/gtkplugin.h
--- a/pidgin/gtkplugin.h
+++ b/pidgin/gtkplugin.h
@@ -29,34 +29,49 @@
#include "pidgin.h"
#include "plugins.h"
-typedef struct _PidginPluginUiInfo PidginPluginUiInfo;
+#define PIDGIN_TYPE_PLUGIN_INFO (pidgin_plugin_info_get_type())
+#define PIDGIN_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_PLUGIN_INFO, PidginPluginInfo))
+#define PIDGIN_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PIDGIN_TYPE_PLUGIN_INFO, PidginPluginInfoClass))
+#define PIDGIN_IS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PIDGIN_TYPE_PLUGIN_INFO))
+#define PIDGIN_IS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_PLUGIN_INFO))
+#define PIDGIN_PLUGIN_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_PLUGIN_INFO, PidginPluginInfoClass))
+
+/** @copydoc _PidginPluginInfo */
+typedef struct _PidginPluginInfo PidginPluginInfo;
+/** @copydoc _PidginPluginInfoClass */
+typedef struct _PidginPluginInfoClass PidginPluginInfoClass;
+
+typedef GtkWidget *(*PidginPluginConfigFrame)(GPluginPlugin *);
/**
- * A GTK+ UI structure for plugins.
+ * Extends #PurplePluginInfo to hold UI information for pidgin.
*/
-struct _PidginPluginUiInfo
-{
- GtkWidget *(*get_config_frame)(PurplePlugin *plugin);
+struct _PidginPluginInfo {
+ /*< private >*/
+ PurplePluginInfo parent;
+};
- int page_num; /**< Reserved */
+/**
+ * PidginPluginInfoClass:
+ *
+ * The base class for all #PidginPluginInfo's.
+ */
+struct _PidginPluginInfoClass {
+ /*< private >*/
+ PurplePluginInfoClass parent_class;
- /* padding */
void (*_pidgin_reserved1)(void);
void (*_pidgin_reserved2)(void);
void (*_pidgin_reserved3)(void);
void (*_pidgin_reserved4)(void);
};
-#define PIDGIN_PLUGIN_TYPE PIDGIN_UI
+G_BEGIN_DECLS
-#define PIDGIN_IS_PIDGIN_PLUGIN(plugin) \
- ((plugin)->info != NULL && (plugin)->info->ui_info != NULL && \
- !strcmp((plugin)->info->ui_requirement, PIDGIN_PLUGIN_TYPE))
-
-#define PIDGIN_PLUGIN_UI_INFO(plugin) \
- ((PidginPluginUiInfo *)(plugin)->info->ui_info)
-
-G_BEGIN_DECLS
+/**
+ * Returns the GType for the PidginPluginInfo object.
+ */
+GType pidgin_plugin_info_get_type(void);
/**
* Returns the configuration frame widget for a GTK+ plugin, if one
@@ -67,7 +82,7 @@ G_BEGIN_DECLS
* @return The frame, if the plugin is a GTK+ plugin and provides a
* configuration frame.
*/
-GtkWidget *pidgin_plugin_get_config_frame(PurplePlugin *plugin);
+GtkWidget *pidgin_plugin_get_config_frame(GPluginPlugin *plugin);
/**
* Saves all loaded plugins.
More information about the Commits
mailing list