Mercurial > pidgin
comparison libpurple/plugins/notify_example.c @ 20003:26f562916f98
Comment tweaks to be closer to the version handed out via the wiki as well as
removing an unused variable I neglected to remove previously (eliminates an
unused variable warning, obviously).
| author | John Bailey <rekkanoryo@rekkanoryo.org> |
|---|---|
| date | Fri, 14 Sep 2007 02:41:20 +0000 |
| parents | 2c69ceca8067 |
| children | 3a5f152e7ed0 |
comparison
equal
deleted
inserted
replaced
| 20002:6583988a57ae | 20003:26f562916f98 |
|---|---|
| 40 #include <plugin.h> | 40 #include <plugin.h> |
| 41 #include <version.h> | 41 #include <version.h> |
| 42 | 42 |
| 43 static PurplePlugin *notify_example = NULL; | 43 static PurplePlugin *notify_example = NULL; |
| 44 | 44 |
| 45 /* The next four functions and the calls within them should cause dialog boxes to appear | |
| 46 * when you select the plugin action from the Tools->Notify Example menu */ | |
| 45 static void | 47 static void |
| 46 notify_error_cb(PurplePluginAction *action) | 48 notify_error_cb(PurplePluginAction *action) |
| 47 { | 49 { |
| 48 purple_notify_error(notify_example, "Test Notification", "Test Notification", | 50 purple_notify_error(notify_example, "Test Notification", "Test Notification", |
| 49 "This is a test error notification"); | 51 "This is a test error notification"); |
| 72 } | 74 } |
| 73 | 75 |
| 74 static void | 76 static void |
| 75 notify_uri_cb(PurplePluginAction *action) | 77 notify_uri_cb(PurplePluginAction *action) |
| 76 { | 78 { |
| 79 /* This one should open your web browser of choice. */ | |
| 77 purple_notify_uri(notify_example, "http://www.pidgin.im/"); | 80 purple_notify_uri(notify_example, "http://www.pidgin.im/"); |
| 78 } | 81 } |
| 79 | 82 |
| 80 static GList * | 83 static GList * |
| 81 plugin_actions(PurplePlugin *plugin, gpointer context) | 84 plugin_actions(PurplePlugin *plugin, gpointer context) |
| 82 { | 85 { |
| 83 GList *actions = NULL; | 86 GList *actions = NULL; |
| 84 PurplePluginAction *action = NULL; | |
| 85 | 87 |
| 88 /* Here we take advantage of return values to avoid the need for a temp variable */ | |
| 86 actions = g_list_prepend(actions, | 89 actions = g_list_prepend(actions, |
| 87 purple_plugin_action_new("Show Error Notification", notify_error_cb)); | 90 purple_plugin_action_new("Show Error Notification", notify_error_cb)); |
| 88 | 91 |
| 89 actions = g_list_prepend(actions, | 92 actions = g_list_prepend(actions, |
| 90 purple_plugin_action_new("Show Info Notification", notify_info_cb)); | 93 purple_plugin_action_new("Show Info Notification", notify_info_cb)); |
| 102 } | 105 } |
| 103 | 106 |
| 104 static gboolean | 107 static gboolean |
| 105 plugin_load(PurplePlugin *plugin) | 108 plugin_load(PurplePlugin *plugin) |
| 106 { | 109 { |
| 110 /* we need a handle for all the notify calls */ | |
| 107 notify_example = plugin; | 111 notify_example = plugin; |
| 108 | 112 |
| 109 return TRUE; | 113 return TRUE; |
| 110 } | 114 } |
| 111 | 115 |
