annotate console/gntplugin.c @ 14813:dd000ac4d148

[gaim-migrate @ 17579] Blink icon preference committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Wed, 25 Oct 2006 07:19:20 +0000
parents 81650a27f253
children 3d87d9b7491c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14558
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
1 /**
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
2 * @file gntplugin.c GNT Plugins API
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
3 * @ingroup gntui
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
4 *
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
5 * gaim
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
6 *
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
9 * source distribution.
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
10 *
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
11 * This program is free software; you can redistribute it and/or modify
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
12 * it under the terms of the GNU General Public License as published by
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
14 * (at your option) any later version.
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
15 *
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
16 * This program is distributed in the hope that it will be useful,
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
19 * GNU General Public License for more details.
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
20 *
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
21 * You should have received a copy of the GNU General Public License
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
22 * along with this program; if not, write to the Free Software
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
81650a27f253 [gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14148
diff changeset
24 */
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
25 #include <gnt.h>
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
26 #include <gntbox.h>
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
27 #include <gntbutton.h>
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
28 #include <gntlabel.h>
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
29 #include <gntline.h>
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
30 #include <gnttree.h>
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
31
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
32 #include "notify.h"
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
33
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
34 #include "gntgaim.h"
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
35 #include "gntplugin.h"
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
36
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
37 static struct
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
38 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39 GntWidget *tree;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
40 GntWidget *window;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
41 GntWidget *aboot;
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
42 GntWidget *conf;
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
43 } plugins;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
44
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
45 static GHashTable *confwins;
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
46
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
47 static void
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
48 decide_conf_button(GaimPlugin *plugin)
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
49 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
50 if (gaim_plugin_is_loaded(plugin) &&
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
51 ((GAIM_IS_GNT_PLUGIN(plugin) &&
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
52 GAIM_GNT_PLUGIN_UI_INFO(plugin) != NULL) ||
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
53 (plugin->info->prefs_info &&
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
54 plugin->info->prefs_info->get_plugin_pref_frame)))
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
55 gnt_widget_set_visible(plugins.conf, TRUE);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
56 else
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
57 gnt_widget_set_visible(plugins.conf, FALSE);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
58
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
59 gnt_box_readjust(GNT_BOX(plugins.window));
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
60 gnt_widget_draw(plugins.window);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
61 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
62
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
63 static void
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
64 plugin_toggled_cb(GntWidget *tree, GaimPlugin *plugin, gpointer null)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
65 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
66 if (gnt_tree_get_choice(GNT_TREE(tree), plugin))
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
67 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
68 if(!gaim_plugin_load(plugin))
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
69 gaim_notify_error(NULL, "ERROR", "loading plugin failed", NULL);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
70 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71 else
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
72 {
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
73 GntWidget *win;
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
74
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
75 if (!gaim_plugin_unload(plugin))
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
76 gaim_notify_error(NULL, "ERROR", "unloading plugin failed", NULL);
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
77
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
78 if ((win = g_hash_table_lookup(confwins, plugin)) != NULL)
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
79 {
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
80 gnt_widget_destroy(win);
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
81 }
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
82 }
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
83 decide_conf_button(plugin);
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
84 gg_plugins_save_loaded();
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
85 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
86
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
87 /* Xerox */
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
88 void
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
89 gg_plugins_save_loaded(void)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
90 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
91 GList *pl;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
92 GList *files = NULL;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
93 GaimPlugin *p;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
94
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
95 for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
96 p = pl->data;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
97
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98 if (p->info->type != GAIM_PLUGIN_PROTOCOL &&
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
99 p->info->type != GAIM_PLUGIN_LOADER) {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
100
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
101 files = g_list_append(files, p->path);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
102 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
103 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
104
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 gaim_prefs_set_string_list("/gaim/gnt/plugins/loaded", files);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
106 g_list_free(files);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
107 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
108
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
109 static void
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
110 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
111 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
112 GaimPlugin *plugin = current;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
113 char *text;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
114
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
115 /* XXX: Use formatting and stuff */
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
116 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot));
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
117 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"),
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
118 plugin->info->name, plugin->info->version, plugin->info->description,
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
119 plugin->info->author, plugin->info->homepage, plugin->path);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
120 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot),
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
121 text, GNT_TEXT_FLAG_NORMAL);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
122 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0);
14105
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
123 g_free(text);
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
124 decide_conf_button(plugin);
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
125 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
126
14024
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
127 static void
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
128 reset_plugin_window(GntWidget *window, gpointer null)
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
129 {
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
130 plugins.window = NULL;
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
131 plugins.tree = NULL;
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
132 plugins.aboot = NULL;
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
133 }
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
134
14105
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
135 static int
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
136 plugin_compare(GaimPlugin *p1, GaimPlugin *p2)
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
137 {
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
138 char *s1 = g_utf8_strup(p1->info->name, -1);
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
139 char *s2 = g_utf8_strup(p2->info->name, -1);
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
140 int ret = g_utf8_collate(s1, s2);
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
141 g_free(s1);
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
142 g_free(s2);
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
143 return ret;
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
144 }
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
145
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
146 static void
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
147 confwin_init()
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
148 {
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
149 confwins = g_hash_table_new(g_direct_hash, g_direct_equal);
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
150 }
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
151
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
152 static void
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
153 remove_confwin(GntWidget *window, gpointer plugin)
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
154 {
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
155 g_hash_table_remove(confwins, plugin);
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
156 }
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
157
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
158 static void
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
159 configure_plugin_cb(GntWidget *button, gpointer null)
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
160 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
161 GaimPlugin *plugin;
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
162 GGPluginFrame callback;
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
163
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
164 g_return_if_fail(plugins.tree != NULL);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
165
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
166 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree));
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
167 if (!gaim_plugin_is_loaded(plugin))
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
168 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
169 gaim_notify_error(plugin, _("Error"),
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
170 _("Plugin need to be loaded before you can configure it."), NULL);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
171 return;
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
172 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
173
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
174 if (confwins && g_hash_table_lookup(confwins, plugin))
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
175 return;
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
176
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
177 if (GAIM_IS_GNT_PLUGIN(plugin) &&
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
178 (callback = GAIM_GNT_PLUGIN_UI_INFO(plugin)) != NULL)
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
179 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
180 GntWidget *window = gnt_vbox_new(FALSE);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
181 GntWidget *box, *button;
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
182
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
183 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
184 gnt_box_set_title(GNT_BOX(window), plugin->info->name);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
185 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
186
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
187 box = callback();
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
188 gnt_box_add_widget(GNT_BOX(window), box);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
189
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
190 box = gnt_hbox_new(FALSE);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
191 gnt_box_add_widget(GNT_BOX(window), box);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
192
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
193 button = gnt_button_new(_("Close"));
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
194 gnt_box_add_widget(GNT_BOX(box), button);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
195 g_signal_connect_swapped(G_OBJECT(button), "activate",
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
196 G_CALLBACK(gnt_widget_destroy), window);
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
197 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin);
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
198
14148
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
199 gnt_widget_show(window);
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
200
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
201 if (confwins == NULL)
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
202 confwin_init();
5b9daf111b42 [gaim-migrate @ 16793]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14139
diff changeset
203 g_hash_table_insert(confwins, plugin, window);
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
204 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
205 else if (plugin->info->prefs_info &&
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
206 plugin->info->prefs_info->get_plugin_pref_frame)
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
207 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
208 gaim_notify_info(plugin, _("..."),
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
209 _("Still need to do something about this."), NULL);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
210 return;
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
211 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
212 else
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
213 {
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
214 gaim_notify_info(plugin, _("Error"),
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
215 _("No configuration options for this plugin."), NULL);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
216 return;
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
217 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
218 }
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
219
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
220 void gg_plugins_show_all()
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
221 {
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
222 GntWidget *window, *tree, *box, *aboot, *button;
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
223 GList *iter;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
224 if (plugins.window)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
225 return;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
226
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
227 gaim_plugins_probe(G_MODULE_SUFFIX);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
228
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
229 plugins.window = window = gnt_vbox_new(FALSE);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
230 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
231 gnt_box_set_title(GNT_BOX(window), _("Plugins"));
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
232 gnt_box_set_pad(GNT_BOX(window), 0);
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
233 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
234
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
235 gnt_box_add_widget(GNT_BOX(window),
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
236 gnt_label_new(_("You can (un)load plugins from the following list.")));
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
237 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new());
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
238
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
239 box = gnt_hbox_new(FALSE);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
240 gnt_box_add_widget(GNT_BOX(window), box);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
241 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new());
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
242
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
243 gnt_box_set_pad(GNT_BOX(box), 0);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
244 plugins.tree = tree = gnt_tree_new();
14105
eaf7f35635bc [gaim-migrate @ 16739]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14059
diff changeset
245 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare);
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
246 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
247 gnt_box_add_widget(GNT_BOX(box), tree);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
248 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new());
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
249
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
250 plugins.aboot = aboot = gnt_text_view_new();
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
251 gnt_widget_set_size(aboot, 40, 20);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
252 gnt_box_add_widget(GNT_BOX(box), aboot);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
253
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
254 for (iter = gaim_plugins_get_all(); iter; iter = iter->next)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
255 {
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
256 GaimPlugin *plug = iter->data;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
257
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
258 if (plug->info->type != GAIM_PLUGIN_STANDARD ||
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
259 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE) ||
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
260 plug->error)
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
261 continue;
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
262
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
263 gnt_tree_add_choice(GNT_TREE(tree), plug,
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
264 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
265 gnt_tree_set_choice(GNT_TREE(tree), plug, gaim_plugin_is_loaded(plug));
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
266 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
267 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
268 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL);
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
269 g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL);
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
270
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
271 box = gnt_hbox_new(FALSE);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
272 gnt_box_add_widget(GNT_BOX(window), box);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
273
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
274 button = gnt_button_new(_("Close"));
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
275 gnt_box_add_widget(GNT_BOX(box), button);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
276 g_signal_connect_swapped(G_OBJECT(button), "activate",
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
277 G_CALLBACK(gnt_widget_destroy), window);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
278
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
279 plugins.conf = button = gnt_button_new(_("Configure Plugin"));
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
280 gnt_box_add_widget(GNT_BOX(box), button);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
281 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL);
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
282
14024
7109e6397a31 [gaim-migrate @ 16622]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14010
diff changeset
283 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL);
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
284
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
285 gnt_widget_show(window);
14139
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
286
44ec6c7cbc76 [gaim-migrate @ 16781]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 14105
diff changeset
287 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree)));
14010
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
288 }
7573bd40a190 [gaim-migrate @ 16602]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
289