From: <sa...@us...> - 2006-08-16 17:10:41
|
Revision: 16793 Author: sadrul Date: 2006-08-16 10:10:36 -0700 (Wed, 16 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16793&view=rev Log Message: ----------- Handle the plugin-pref windows better. Modified Paths: -------------- trunk/console/gntplugin.c Modified: trunk/console/gntplugin.c =================================================================== --- trunk/console/gntplugin.c 2006-08-16 16:56:59 UTC (rev 16792) +++ trunk/console/gntplugin.c 2006-08-16 17:10:36 UTC (rev 16793) @@ -18,6 +18,8 @@ GntWidget *conf; } plugins; +static GHashTable *confwins; + static void decide_conf_button(GaimPlugin *plugin) { @@ -44,8 +46,15 @@ } else { + GntWidget *win; + if (!gaim_plugin_unload(plugin)) gaim_notify_error(NULL, "ERROR", "unloading plugin failed", NULL); + + if ((win = g_hash_table_lookup(confwins, plugin)) != NULL) + { + gnt_widget_destroy(win); + } } decide_conf_button(plugin); gg_plugins_save_loaded(); @@ -111,6 +120,18 @@ } static void +confwin_init() +{ + confwins = g_hash_table_new(g_direct_hash, g_direct_equal); +} + +static void +remove_confwin(GntWidget *window, gpointer plugin) +{ + g_hash_table_remove(confwins, plugin); +} + +static void configure_plugin_cb(GntWidget *button, gpointer null) { GaimPlugin *plugin; @@ -126,6 +147,9 @@ return; } + if (confwins && g_hash_table_lookup(confwins, plugin)) + return; + if (GAIM_IS_GNT_PLUGIN(plugin) && (callback = GAIM_GNT_PLUGIN_UI_INFO(plugin)) != NULL) { @@ -146,8 +170,13 @@ gnt_box_add_widget(GNT_BOX(box), button); g_signal_connect_swapped(G_OBJECT(button), "activate", G_CALLBACK(gnt_widget_destroy), window); + g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin); - gnt_widget_show(window); /* XXX: This window needs to be closed when the plugin is unloaded */ + gnt_widget_show(window); + + if (confwins == NULL) + confwin_init(); + g_hash_table_insert(confwins, plugin, window); } else if (plugin->info->prefs_info && plugin->info->prefs_info->get_plugin_pref_frame) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |