Mercurial > pidgin
comparison src/plugin.c @ 8986:8cf32769ba1b
[gaim-migrate @ 9761]
" This patch adds a Plugin Actions menu item after the
Account Actions menu. The Plugin Actions menu is
populated from the added 'actions' slot in
GaimPluginInfo. As a demonstration, the Idle Maker
plugin has been converted to no longer require GTK code
and the Preferences interface just to perform its
actions. Instead, it uses a Plugin Action to spawn a
Fields Request.
There's also a minor fix for consistency in the menu
building for buddy actions. The pre-existing method for
instructing a menu list to display a separator was to
insert a NULL rather than a proto_buddy_menu into the
GList of actions. The code for the buddy menus was
instead checking for a proto_buddy_menu with a '-'
label. This has been fixed, and it now correctly uses
NULL to indicate a separator."
"Date: 2004-05-16 02:25
Sender: taliesein
Logged In: YES
user_id=77326
I need to add a callback to this patch to watch for
loading/unloading of plugins (to determine when to rebuild
the menu). Since the appropriate way to handle Plugin
Actions is still mildly up for debate, I'm holding of on
correcting the patch until I know for sure whether I should
fix this patch, or scrap it and write a new one using a
different method."
"Date: 2004-05-18 12:26
Sender: taliesein
Logged In: YES
user_id=77326
I've completed changes to this patch to also add plugin load
and unload signals (it looks like plugin.c actually had
pre-signal callbacks in place, but they were never used or
converted to signals)
This patch now will correctly update the Plugin Action menu
as plugins load and unload."
I'm not entirely sure i like the ui of a plugins actions menu, but i think
that having some way for plugins to add actions on an account is a good
thing, and i'm not sure that every viable action fits under the accounts
actions menu. we may want to merge the two (the existing accounts actions
and this plugins actions), but both times it came up in #gaim no one seemed
to want to comment, and on one commented to the gaim-devel post either.
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Thu, 20 May 2004 05:11:44 +0000 |
| parents | 184b8c3b6d09 |
| children | 294ae6548d4e |
comparison
equal
deleted
inserted
replaced
| 8985:8abc99ed5d93 | 8986:8cf32769ba1b |
|---|---|
| 71 static void (*load_cb)(GaimPlugin *, void *) = NULL; | 71 static void (*load_cb)(GaimPlugin *, void *) = NULL; |
| 72 static void *load_cb_data = NULL; | 72 static void *load_cb_data = NULL; |
| 73 static void (*unload_cb)(GaimPlugin *, void *) = NULL; | 73 static void (*unload_cb)(GaimPlugin *, void *) = NULL; |
| 74 static void *unload_cb_data = NULL; | 74 static void *unload_cb_data = NULL; |
| 75 | 75 |
| 76 | |
| 77 void * | |
| 78 gaim_plugins_get_handle(void) | |
| 79 { | |
| 80 static int handle; | |
| 81 return &handle; | |
| 82 } | |
| 83 | |
| 84 | |
| 76 #ifdef GAIM_PLUGINS | 85 #ifdef GAIM_PLUGINS |
| 77 static int | 86 static int |
| 78 is_so_file(const char *filename, const char *ext) | 87 is_so_file(const char *filename, const char *ext) |
| 79 { | 88 { |
| 80 int len, extlen; | 89 int len, extlen; |
| 353 | 362 |
| 354 /* TODO */ | 363 /* TODO */ |
| 355 if (load_cb != NULL) | 364 if (load_cb != NULL) |
| 356 load_cb(plugin, load_cb_data); | 365 load_cb(plugin, load_cb_data); |
| 357 | 366 |
| 367 gaim_signal_emit(gaim_plugins_get_handle(), "plugin-unload", plugin); | |
| 368 | |
| 358 return TRUE; | 369 return TRUE; |
| 359 | 370 |
| 360 #else | 371 #else |
| 361 return TRUE; | 372 return TRUE; |
| 362 #endif /* !GAIM_PLUGINS */ | 373 #endif /* !GAIM_PLUGINS */ |
| 423 gaim_plugin_ipc_unregister_all(plugin); | 434 gaim_plugin_ipc_unregister_all(plugin); |
| 424 | 435 |
| 425 /* TODO */ | 436 /* TODO */ |
| 426 if (unload_cb != NULL) | 437 if (unload_cb != NULL) |
| 427 unload_cb(plugin, unload_cb_data); | 438 unload_cb(plugin, unload_cb_data); |
| 439 | |
| 440 /* I suppose this is the right place to call this... */ | |
| 441 gaim_signal_emit(gaim_plugins_get_handle(), "plugin-unload", plugin); | |
| 428 | 442 |
| 429 return TRUE; | 443 return TRUE; |
| 430 #else | 444 #else |
| 431 return TRUE; | 445 return TRUE; |
| 432 #endif /* GAIM_PLUGINS */ | 446 #endif /* GAIM_PLUGINS */ |
| 834 const gchar *file; | 848 const gchar *file; |
| 835 gchar *path; | 849 gchar *path; |
| 836 GaimPlugin *plugin; | 850 GaimPlugin *plugin; |
| 837 size_t i; | 851 size_t i; |
| 838 | 852 |
| 853 void *handle; | |
| 854 | |
| 839 if (!g_module_supported()) | 855 if (!g_module_supported()) |
| 840 return; | 856 return; |
| 857 | |
| 858 handle = gaim_plugins_get_handle(); | |
| 859 | |
| 860 gaim_debug_info("plugins", "registering plugin-load signal\n"); | |
| 861 gaim_signal_register(handle, "plugin-load", gaim_marshal_VOID__POINTER, NULL, | |
| 862 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_PLUGIN)); | |
| 863 | |
| 864 gaim_debug_info("plugins", "registering plugin-unload signal\n"); | |
| 865 gaim_signal_register(handle, "plugin-unload", gaim_marshal_VOID__POINTER, NULL, | |
| 866 1, gaim_value_new(GAIM_TYPE_SUBTYPE, GAIM_SUBTYPE_PLUGIN)); | |
| 867 | |
| 841 | 868 |
| 842 for (i = 0; i < search_path_count; i++) { | 869 for (i = 0; i < search_path_count; i++) { |
| 843 if (search_paths[i] == NULL) | 870 if (search_paths[i] == NULL) |
| 844 continue; | 871 continue; |
| 845 | 872 |
