/soc/2013/ankitkv/gobjectification: 2e04586cf6e8: Refactored som...
Ankit Vani
a at nevitus.org
Tue Sep 17 08:57:26 EDT 2013
Changeset: 2e04586cf6e8f924fcad646529656d275edfc33a
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-17 18:27 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/2e04586cf6e8
Description:
Refactored some pidgin plugins to use the new plugin API
diffstat:
pidgin/plugins/extplacement.c | 103 ++++++++++++---------------------
pidgin/plugins/history.c | 67 +++++++++------------
pidgin/plugins/iconaway.c | 70 +++++++++-------------
pidgin/plugins/markerline.c | 109 +++++++++++++----------------------
pidgin/plugins/notify.c | 128 ++++++++++++++++-------------------------
pidgin/plugins/pidginrc.c | 107 +++++++++++++---------------------
6 files changed, 230 insertions(+), 354 deletions(-)
diffs (truncated from 729 to 300 lines):
diff --git a/pidgin/plugins/extplacement.c b/pidgin/plugins/extplacement.c
--- a/pidgin/plugins/extplacement.c
+++ b/pidgin/plugins/extplacement.c
@@ -75,23 +75,6 @@ conv_placement_by_number(PidginConversat
}
}
-static gboolean
-plugin_load(PurplePlugin *plugin)
-{
- pidgin_conv_placement_add_fnc("number", _("By conversation count"),
- &conv_placement_by_number);
- purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
- return TRUE;
-}
-
-static gboolean
-plugin_unload(PurplePlugin *plugin)
-{
- pidgin_conv_placement_remove_fnc("number");
- purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
- return TRUE;
-}
-
static PurplePluginPrefFrame *
get_plugin_pref_frame(PurplePlugin *plugin) {
PurplePluginPrefFrame *frame;
@@ -121,58 +104,50 @@ get_plugin_pref_frame(PurplePlugin *plug
return frame;
}
-static PurplePluginUiInfo prefs_info = {
- get_plugin_pref_frame,
- 0, /* page_num (Reserved) */
- NULL, /* frame (Reserved) */
+static PidginPluginInfo *
+plugin_query(GError **error)
+{
+ const gchar * const authors[] = {
+ "Stu Tomlinson <stu at nosnilmot.com>",
+ NULL
+ };
- /* padding */
- NULL,
- NULL,
- NULL,
- NULL
-};
+ return pidgin_plugin_info_new(
+ "id", "gtk-extplacement",
+ "name", N_("ExtPlacement"),
+ "version", DISPLAY_VERSION,
+ "category", N_("User interface"),
+ "summary", N_("Extra conversation placement options."),
+ "description", N_("Restrict the number of conversations per "
+ "windows, optionally separating IMs and "
+ "Chats"),
+ "authors", authors,
+ "website", PURPLE_WEBSITE,
+ "abi-version", PURPLE_ABI_VERSION,
+ "preferences-frame", get_plugin_pref_frame,
+ NULL
+ );
+}
-static PurplePluginInfo info =
-{
- PURPLE_PLUGIN_MAGIC,
- PURPLE_MAJOR_VERSION,
- PURPLE_MINOR_VERSION,
- PURPLE_PLUGIN_STANDARD, /**< type */
- PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
- 0, /**< flags */
- NULL, /**< dependencies */
- PURPLE_PRIORITY_DEFAULT, /**< priority */
- "gtk-extplacement", /**< id */
- N_("ExtPlacement"), /**< name */
- DISPLAY_VERSION, /**< version */
- N_("Extra conversation placement options."), /**< summary */
- /** description */
- N_("Restrict the number of conversations per windows,"
- " optionally separating IMs and Chats"),
- "Stu Tomlinson <stu at nosnilmot.com>", /**< author */
- PURPLE_WEBSITE, /**< homepage */
- plugin_load, /**< load */
- plugin_unload, /**< unload */
- NULL, /**< destroy */
- NULL, /**< ui_info */
- NULL, /**< extra_info */
- &prefs_info, /**< prefs_info */
- NULL, /**< actions */
-
- /* padding */
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
+static gboolean
+plugin_load(PurplePlugin *plugin, GError **error)
{
purple_prefs_add_none("/plugins/gtk/extplacement");
purple_prefs_add_int("/plugins/gtk/extplacement/placement_number", 4);
purple_prefs_add_bool("/plugins/gtk/extplacement/placement_number_separate", FALSE);
+
+ pidgin_conv_placement_add_fnc("number", _("By conversation count"),
+ &conv_placement_by_number);
+ purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
+ return TRUE;
}
-PURPLE_INIT_PLUGIN(extplacement, init_plugin, info)
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
+{
+ pidgin_conv_placement_remove_fnc("number");
+ purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
+ return TRUE;
+}
+
+PURPLE_PLUGIN_INIT(extplacement, plugin_query, plugin_load, plugin_unload);
diff --git a/pidgin/plugins/history.c b/pidgin/plugins/history.c
--- a/pidgin/plugins/history.c
+++ b/pidgin/plugins/history.c
@@ -190,8 +190,33 @@ static void history_prefs_cb(const char
history_prefs_check((PurplePlugin *)data);
}
+static PidginPluginInfo *
+plugin_query(GError **error)
+{
+ const gchar * const authors[] = {
+ "Sean Egan <seanegan at gmail.com>",
+ NULL
+ };
+
+ return pidgin_plugin_info_new(
+ "id", HISTORY_PLUGIN_ID,
+ "name", N_("History"),
+ "version", DISPLAY_VERSION,
+ "category", N_("User interface"),
+ "summary", N_("Shows recently logged conversations in new "
+ "conversations."),
+ "description", N_("When a new conversation is opened this plugin will "
+ "insert the last conversation into the current "
+ "conversation."),
+ "authors", authors,
+ "website", PURPLE_WEBSITE,
+ "abi-version", PURPLE_ABI_VERSION,
+ NULL
+ );
+}
+
static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
{
purple_signal_connect(purple_conversations_get_handle(),
"conversation-created",
@@ -208,42 +233,10 @@ plugin_load(PurplePlugin *plugin)
return TRUE;
}
-static PurplePluginInfo info =
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
{
- PURPLE_PLUGIN_MAGIC,
- PURPLE_MAJOR_VERSION,
- PURPLE_MINOR_VERSION,
- PURPLE_PLUGIN_STANDARD,
- PIDGIN_PLUGIN_TYPE,
- 0,
- NULL,
- PURPLE_PRIORITY_DEFAULT,
- HISTORY_PLUGIN_ID,
- N_("History"),
- DISPLAY_VERSION,
- N_("Shows recently logged conversations in new conversations."),
- N_("When a new conversation is opened this plugin will insert "
- "the last conversation into the current conversation."),
- "Sean Egan <seanegan at gmail.com>",
- PURPLE_WEBSITE,
- plugin_load,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-
- /* padding */
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
-{
+ return TRUE;
}
-PURPLE_INIT_PLUGIN(history, init_plugin, info)
+PURPLE_PLUGIN_INIT(history, plugin_query, plugin_load, plugin_unload);
diff --git a/pidgin/plugins/iconaway.c b/pidgin/plugins/iconaway.c
--- a/pidgin/plugins/iconaway.c
+++ b/pidgin/plugins/iconaway.c
@@ -58,8 +58,32 @@ iconify_windows(PurpleAccount *account,
* EXPORTED FUNCTIONS
*/
+static PidginPluginInfo *
+plugin_query(GError **error)
+{
+ const gchar * const authors[] = {
+ "Eric Warmenhoven <eric at warmenhoven.org>",
+ NULL
+ };
+
+ return pidgin_plugin_info_new(
+ "id", ICONAWAY_PLUGIN_ID,
+ "name", N_("Iconify on Away"),
+ "version", DISPLAY_VERSION,
+ "category", N_("User interface"),
+ "summary", N_("Iconifies the buddy list and your conversations "
+ "when you go away."),
+ "description", N_("Iconifies the buddy list and your conversations "
+ "when you go away."),
+ "authors", authors,
+ "website", PURPLE_WEBSITE,
+ "abi-version", PURPLE_ABI_VERSION,
+ NULL
+ );
+}
+
static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
{
purple_signal_connect(purple_accounts_get_handle(), "account-status-changed",
plugin, PURPLE_CALLBACK(iconify_windows), NULL);
@@ -67,46 +91,10 @@ plugin_load(PurplePlugin *plugin)
return TRUE;
}
-static PurplePluginInfo info =
+static gboolean
+plugin_unload(PurplePlugin *plugin, GError **error)
{
- PURPLE_PLUGIN_MAGIC,
- PURPLE_MAJOR_VERSION,
- PURPLE_MINOR_VERSION,
- PURPLE_PLUGIN_STANDARD, /**< type */
- PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
- 0, /**< flags */
- NULL, /**< dependencies */
- PURPLE_PRIORITY_DEFAULT, /**< priority */
-
- ICONAWAY_PLUGIN_ID, /**< id */
- N_("Iconify on Away"), /**< name */
- DISPLAY_VERSION, /**< version */
- /** summary */
- N_("Iconifies the buddy list and your conversations when you go away."),
- /** description */
- N_("Iconifies the buddy list and your conversations when you go away."),
- "Eric Warmenhoven <eric at warmenhoven.org>", /**< author */
- PURPLE_WEBSITE, /**< homepage */
-
- plugin_load, /**< load */
- NULL, /**< unload */
- NULL, /**< destroy */
-
- NULL, /**< ui_info */
- NULL, /**< extra_info */
- NULL,
- NULL,
-
- /* padding */
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
-{
+ return TRUE;
}
-PURPLE_INIT_PLUGIN(iconaway, init_plugin, info)
+PURPLE_PLUGIN_INIT(iconaway, plugin_query, plugin_load, plugin_unload);
diff --git a/pidgin/plugins/markerline.c b/pidgin/plugins/markerline.c
--- a/pidgin/plugins/markerline.c
More information about the Commits
mailing list