/soc/2013/ankitkv/gobjectification: c78437610c6d: Refactored uni...
Ankit Vani
a at nevitus.org
Wed Jan 1 00:42:48 EST 2014
Changeset: c78437610c6dce465fb8ca6c24404c0d5eb1a529
Author: Ankit Vani <a at nevitus.org>
Date: 2014-01-01 11:11 +0530
Branch: soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/c78437610c6d
Description:
Refactored unity plugin to use the new plugin API
diffstat:
pidgin/plugins/unity.c | 96 +++++++++++++++++--------------------------------
1 files changed, 33 insertions(+), 63 deletions(-)
diffs (125 lines):
diff --git a/pidgin/plugins/unity.c b/pidgin/plugins/unity.c
--- a/pidgin/plugins/unity.c
+++ b/pidgin/plugins/unity.c
@@ -502,8 +502,32 @@ get_config_frame(PurplePlugin *plugin)
return ret;
}
+static PidginPluginInfo *
+plugin_query(GError **error)
+{
+ const gchar * const authors[] = {
+ "Ankit Vani <a at nevitus.org>",
+ NULL
+ };
+
+ return pidgin_plugin_info_new(
+ "id", UNITY_PLUGIN_ID,
+ "name", N_("Unity Integration"),
+ "version", DISPLAY_VERSION,
+ "category", N_("Notification"),
+ "summary", N_("Provides integration with Unity."),
+ "description", N_("Provides integration with Unity's "
+ "messaging menu and launcher."),
+ "authors", authors,
+ "website", PURPLE_WEBSITE,
+ "abi-version", PURPLE_ABI_VERSION,
+ "gtk-config-frame-cb", get_config_frame,
+ NULL
+ );
+}
+
static gboolean
-plugin_load(PurplePlugin *plugin)
+plugin_load(PurplePlugin *plugin, GError **error)
{
GList *convs = purple_conversations_get_all();
PurpleSavedStatus *saved_status;
@@ -511,6 +535,12 @@ plugin_load(PurplePlugin *plugin)
void *gtk_conv_handle = pidgin_conversations_get_handle();
void *savedstat_handle = purple_savedstatuses_get_handle();
+ purple_prefs_add_none("/plugins/gtk");
+ purple_prefs_add_none("/plugins/gtk/unity");
+ purple_prefs_add_int("/plugins/gtk/unity/launcher_count", LAUNCHER_COUNT_SOURCES);
+ purple_prefs_add_int("/plugins/gtk/unity/messaging_menu_text", MESSAGING_MENU_COUNT);
+ purple_prefs_add_bool("/plugins/gtk/unity/alert_chat_nick", TRUE);
+
alert_chat_nick = purple_prefs_get_bool("/plugins/gtk/unity/alert_chat_nick");
mmapp = messaging_menu_app_new("pidgin.desktop");
@@ -556,7 +586,7 @@ plugin_load(PurplePlugin *plugin)
}
static gboolean
-plugin_unload(PurplePlugin *plugin)
+plugin_unload(PurplePlugin *plugin, GError **error)
{
GList *convs = purple_conversations_get_all();
while (convs) {
@@ -574,64 +604,4 @@ plugin_unload(PurplePlugin *plugin)
return TRUE;
}
-static PidginPluginUiInfo ui_info =
-{
- get_config_frame,
-
- /* padding */
- NULL,
- NULL,
- NULL,
- 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 */
-
- UNITY_PLUGIN_ID, /**< id */
- N_("Unity Integration"), /**< name */
- DISPLAY_VERSION, /**< version */
- /** summary */
- N_("Provides integration with Unity."),
- /** description */
- N_("Provides integration with Unity's messaging "
- "menu and launcher."),
- /**< author */
- "Ankit Vani <a at nevitus.org>",
- PURPLE_WEBSITE, /**< homepage */
-
- plugin_load, /**< load */
- plugin_unload, /**< unload */
- NULL, /**< destroy */
-
- &ui_info, /**< ui_info */
- NULL, /**< extra_info */
- NULL,
- NULL,
-
- /* padding */
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-static void
-init_plugin(PurplePlugin *plugin)
-{
- purple_prefs_add_none("/plugins/gtk");
- purple_prefs_add_none("/plugins/gtk/unity");
- purple_prefs_add_int("/plugins/gtk/unity/launcher_count", LAUNCHER_COUNT_SOURCES);
- purple_prefs_add_int("/plugins/gtk/unity/messaging_menu_text", MESSAGING_MENU_COUNT);
- purple_prefs_add_bool("/plugins/gtk/unity/alert_chat_nick", TRUE);
-}
-
-PURPLE_INIT_PLUGIN(unity, init_plugin, info)
+PURPLE_PLUGIN_INIT(unity, plugin_query, plugin_load, plugin_unload);
More information about the Commits
mailing list