/soc/2013/ankitkv/gobjectification: de6836a8b324: Removed unnece...
Ankit Vani
a at nevitus.org
Mon Sep 23 04:39:42 EDT 2013
Changeset: de6836a8b324140e209fc11eac67537121c8b340
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-23 13:50 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/de6836a8b324
Description:
Removed unnecessary globally defined plugin variable in example plugins
diffstat:
libpurple/plugins/helloworld.c | 9 +--------
libpurple/plugins/notify_example.c | 15 +++++----------
2 files changed, 6 insertions(+), 18 deletions(-)
diffs (94 lines):
diff --git a/libpurple/plugins/helloworld.c b/libpurple/plugins/helloworld.c
--- a/libpurple/plugins/helloworld.c
+++ b/libpurple/plugins/helloworld.c
@@ -47,18 +47,13 @@
#include <plugin.h>
#include <version.h>
-/* we're adding this here and assigning it in plugin_load because we need
- * a valid plugin handle for our call to purple_notify_message() in the
- * plugin_action_test_cb() callback function */
-PurplePlugin *helloworld_plugin = NULL;
-
/* This function is the callback for the plugin action we added. All we're
* doing here is displaying a message. When the user selects the plugin
* action, this function is called. */
static void
plugin_action_test_cb (PurplePluginAction * action)
{
- purple_notify_message (helloworld_plugin, PURPLE_NOTIFY_MSG_INFO,
+ purple_notify_message (action->plugin, PURPLE_NOTIFY_MSG_INFO,
"Plugin Actions Test", "This is a plugin actions test :)", NULL, NULL,
NULL, NULL);
}
@@ -95,8 +90,6 @@ plugin_load (PurplePlugin * plugin)
"This is the Hello World! plugin :)", NULL, NULL,
NULL, NULL);
- helloworld_plugin = plugin; /* assign this here so we have a valid handle later */
-
return TRUE;
}
diff --git a/libpurple/plugins/notify_example.c b/libpurple/plugins/notify_example.c
--- a/libpurple/plugins/notify_example.c
+++ b/libpurple/plugins/notify_example.c
@@ -50,35 +50,33 @@
#include <plugin.h>
#include <version.h>
-static PurplePlugin *notify_example = NULL;
-
/* The next four functions and the calls within them should cause dialog boxes to appear
* when you select the plugin action from the Tools->Notify Example menu */
static void
notify_error_cb(PurplePluginAction *action)
{
- purple_notify_error(notify_example, "Test Notification", "Test Notification",
+ purple_notify_error(action->plugin, "Test Notification", "Test Notification",
"This is a test error notification", NULL);
}
static void
notify_info_cb(PurplePluginAction *action)
{
- purple_notify_info(notify_example, "Test Notification", "Test Notification",
+ purple_notify_info(action->plugin, "Test Notification", "Test Notification",
"This is a test informative notification", NULL);
}
static void
notify_warn_cb(PurplePluginAction *action)
{
- purple_notify_warning(notify_example, "Test Notification", "Test Notification",
+ purple_notify_warning(action->plugin, "Test Notification", "Test Notification",
"This is a test warning notification", NULL);
}
static void
notify_format_cb(PurplePluginAction *action)
{
- purple_notify_formatted(notify_example, "Test Notification", "Test Notification",
+ purple_notify_formatted(action->plugin, "Test Notification", "Test Notification",
"Test Notification",
"<I>This is a test notification with formatted text.</I>", NULL, NULL);
}
@@ -87,7 +85,7 @@ static void
notify_uri_cb(PurplePluginAction *action)
{
/* This one should open your web browser of choice. */
- purple_notify_uri(notify_example, "https://www.pidgin.im/");
+ purple_notify_uri(action->plugin, "https://www.pidgin.im/");
}
static GList *
@@ -117,9 +115,6 @@ plugin_actions(PurplePlugin *plugin, gpo
static gboolean
plugin_load(PurplePlugin *plugin)
{
- /* we need a handle for all the notify calls */
- notify_example = plugin;
-
return TRUE;
}
More information about the Commits
mailing list