Mercurial > pidgin.yaz
annotate src/gtkplugin.c @ 12974:7080dfef2077
[gaim-migrate @ 15327]
He wrote the original man page, and designed one of the older prefs pages,
or something.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 21 Jan 2006 01:48:52 +0000 |
parents | 3cc18baeaca3 |
children | 71fbe885c50b |
rev | line source |
---|---|
5205 | 1 /** |
6927
ee51189dfe76
[gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents:
5982
diff
changeset
|
2 * @file gtkplugin.c GTK+ Plugins support |
ee51189dfe76
[gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents:
5982
diff
changeset
|
3 * @ingroup gtkui |
5205 | 4 * |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6927
ee51189dfe76
[gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents:
5982
diff
changeset
|
10 * |
5205 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
11740 | 25 #include "internal.h" |
9791 | 26 #include "gtkgaim.h" |
5205 | 27 #include "gtkplugin.h" |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
28 #include "gtkpluginpref.h" |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
29 #include "debug.h" |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
30 #include "prefs.h" |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
31 #include "request.h" |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
32 |
5205 | 33 #include <string.h> |
34 | |
12246 | 35 #define GAIM_RESPONSE_CONFIGURE 98121 |
36 | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
37 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
38 GtkTreeIter *iter, gboolean unload); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
39 |
12343 | 40 static GtkWidget *expander = NULL; |
11740 | 41 static GtkWidget *plugin_dialog = NULL; |
42 static GtkWidget *plugin_details = NULL; | |
43 static GtkWidget *pref_button = NULL; | |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
44 static GHashTable *plugin_pref_dialogs = NULL; |
11747
b8bf638cc4aa
[gaim-migrate @ 14038]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11744
diff
changeset
|
45 |
5205 | 46 GtkWidget * |
47 gaim_gtk_plugin_get_config_frame(GaimPlugin *plugin) | |
48 { | |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
49 GtkWidget *config = NULL; |
5205 | 50 |
51 g_return_val_if_fail(plugin != NULL, NULL); | |
52 | |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
53 if (GAIM_IS_GTK_PLUGIN(plugin) && plugin->info->ui_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
54 && GAIM_GTK_PLUGIN_UI_INFO(plugin)->get_config_frame) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
55 { |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
56 GaimGtkPluginUiInfo *ui_info; |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
57 |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
58 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plugin); |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
59 |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
60 config = ui_info->get_config_frame(plugin); |
5205 | 61 |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
62 if (plugin->info->prefs_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
63 && plugin->info->prefs_info->get_plugin_pref_frame) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
64 { |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
65 gaim_debug_warning("gtkplugin", |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
66 "Plugin %s contains both, ui_info and " |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
67 "prefs_info preferences; prefs_info will be " |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
68 "ignored.", plugin->info->name); |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
69 } |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
70 } |
5205 | 71 |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
72 if (config == NULL && plugin->info->prefs_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
73 && plugin->info->prefs_info->get_plugin_pref_frame) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
74 { |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
75 GaimPluginPrefFrame *frame; |
5205 | 76 |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
77 frame = plugin->info->prefs_info->get_plugin_pref_frame(plugin); |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
78 |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
79 config = gaim_gtk_plugin_pref_create_frame(frame); |
12870
a9cd674078b1
[gaim-migrate @ 15222]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12705
diff
changeset
|
80 |
12889
bba0faa37f3a
[gaim-migrate @ 15242]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12870
diff
changeset
|
81 /* XXX According to bug #1407047 this broke saving pluging preferences, I'll look at fixing it correctly later. |
12870
a9cd674078b1
[gaim-migrate @ 15222]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12705
diff
changeset
|
82 gaim_plugin_pref_frame_destroy(frame); |
12889
bba0faa37f3a
[gaim-migrate @ 15242]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12870
diff
changeset
|
83 */ |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
84 } |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
85 |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
86 return config; |
5205 | 87 } |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
88 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
89 void |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
90 gaim_gtk_plugins_save(void) |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
91 { |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
92 GList *pl; |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
93 GList *files = NULL; |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
94 GaimPlugin *p; |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
95 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
96 for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) { |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
97 p = pl->data; |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
98 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
99 if (p->info->type != GAIM_PLUGIN_PROTOCOL && |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
100 p->info->type != GAIM_PLUGIN_LOADER) { |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
101 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
102 files = g_list_append(files, p->path); |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
103 } |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
104 } |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
105 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
106 gaim_prefs_set_string_list("/gaim/gtk/plugins/loaded", files); |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
107 g_list_free(files); |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
108 } |
11740 | 109 |
110 static void | |
111 update_plugin_list(void *data) | |
112 { | |
113 GtkListStore *ls = GTK_LIST_STORE(data); | |
114 GtkTreeIter iter; | |
115 GList *probes; | |
116 GaimPlugin *plug; | |
117 | |
118 gtk_list_store_clear(ls); | |
12066 | 119 gaim_plugins_probe(G_MODULE_SUFFIX); |
11740 | 120 |
121 for (probes = gaim_plugins_get_all(); | |
122 probes != NULL; | |
123 probes = probes->next) | |
124 { | |
12702
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
125 char *name; |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
126 char *version; |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
127 char *summary; |
11740 | 128 char *desc; |
129 plug = probes->data; | |
130 | |
131 if (plug->info->type != GAIM_PLUGIN_STANDARD || | |
132 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) | |
133 { | |
134 continue; | |
135 } | |
136 | |
137 gtk_list_store_append (ls, &iter); | |
12702
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
138 |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
139 name = g_markup_escape_text(plug->info->name ? _(plug->info->name) : g_basename(plug->path), -1); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
140 version = g_markup_escape_text(plug->info->version, -1); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
141 summary = g_markup_escape_text(_(plug->info->summary), -1); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
142 |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
143 desc = g_strdup_printf("<b>%s</b> %s\n%s", name, |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
144 version, |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
145 summary); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
146 g_free(name); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
147 g_free(version); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
148 g_free(summary); |
ba7834d6e2c9
[gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents:
12695
diff
changeset
|
149 |
11740 | 150 gtk_list_store_set(ls, &iter, |
151 0, gaim_plugin_is_loaded(plug), | |
152 1, desc, | |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
153 2, plug, |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
154 3, gaim_plugin_is_unloadable(plug), |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
155 -1); |
11740 | 156 g_free(desc); |
157 } | |
158 } | |
159 | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
160 static void plugin_loading_common(GaimPlugin *plugin, GtkTreeView *view, gboolean loaded) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
161 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
162 GtkTreeIter iter; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
163 GtkTreeModel *model = gtk_tree_view_get_model(view); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
164 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
165 if (gtk_tree_model_get_iter_first(model, &iter)) { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
166 do { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
167 GaimPlugin *plug; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
168 GtkTreeSelection *sel; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
169 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
170 gtk_tree_model_get(model, &iter, 2, &plug, -1); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
171 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
172 if (plug != plugin) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
173 continue; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
174 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
175 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, loaded, -1); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
176 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
177 /* If the loaded/unloaded plugin is the selected row, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
178 * update the pref_button. */ |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
179 sel = gtk_tree_view_get_selection(view); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
180 if (gtk_tree_selection_get_selected(sel, &model, &iter)) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
181 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
182 gtk_tree_model_get(model, &iter, 2, &plug, -1); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
183 if (plug == plugin) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
184 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
185 gtk_widget_set_sensitive(pref_button, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
186 loaded |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
187 && ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
188 && GAIM_GTK_PLUGIN_UI_INFO(plug)->get_config_frame) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
189 || (plug->info->prefs_info |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
190 && plug->info->prefs_info->get_plugin_pref_frame))); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
191 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
192 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
193 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
194 break; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
195 } while (gtk_tree_model_iter_next(model, &iter)); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
196 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
197 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
198 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
199 static void plugin_load_cb(GaimPlugin *plugin, gpointer data) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
200 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
201 GtkTreeView *view = (GtkTreeView *)data; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
202 plugin_loading_common(plugin, view, TRUE); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
203 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
204 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
205 static void plugin_unload_cb(GaimPlugin *plugin, gpointer data) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
206 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
207 GtkTreeView *view = (GtkTreeView *)data; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
208 plugin_loading_common(plugin, view, FALSE); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
209 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
210 |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
211 static void pref_dialog_response_cb(GtkWidget *d, int response, GaimPlugin *plug) |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
212 { |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
213 switch (response) { |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
214 case GTK_RESPONSE_CLOSE: |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
215 case GTK_RESPONSE_DELETE_EVENT: |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
216 g_hash_table_remove(plugin_pref_dialogs, plug); |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
217 if (g_hash_table_size(plugin_pref_dialogs) == 0) { |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
218 g_hash_table_destroy(plugin_pref_dialogs); |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
219 plugin_pref_dialogs = NULL; |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
220 } |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
221 gtk_widget_destroy(d); |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
222 break; |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
223 } |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
224 } |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
225 |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
226 static void plugin_unload_confirm_cb(gpointer *data) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
227 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
228 GaimPlugin *plugin = (GaimPlugin *)data[0]; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
229 GtkTreeModel *model = (GtkTreeModel *)data[1]; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
230 GtkTreeIter *iter = (GtkTreeIter *)data[2]; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
231 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
232 plugin_toggled_stage_two(plugin, model, iter, TRUE); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
233 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
234 g_free(data); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
235 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
236 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
237 static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
11740 | 238 { |
239 GtkTreeModel *model = (GtkTreeModel *)data; | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
240 GtkTreeIter *iter = g_new(GtkTreeIter, 1); |
11740 | 241 GtkTreePath *path = gtk_tree_path_new_from_string(pth); |
242 GaimPlugin *plug; | |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
243 GtkWidget *dialog = NULL; |
11740 | 244 |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
245 gtk_tree_model_get_iter(model, iter, path); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
246 gtk_tree_path_free(path); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
247 gtk_tree_model_get(model, iter, 2, &plug, -1); |
11740 | 248 |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
249 /* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */ |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
250 if (gaim_plugin_is_unloadable(plug)) |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
251 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
252 g_free(iter); |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
253 return; |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
254 } |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
255 |
11740 | 256 if (!gaim_plugin_is_loaded(plug)) |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
257 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
258 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
259 gdk_window_set_cursor(plugin_dialog->window, wait); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
260 gdk_cursor_unref(wait); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
261 |
11740 | 262 gaim_plugin_load(plug); |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
263 plugin_toggled_stage_two(plug, model, iter, FALSE); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
264 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
265 gdk_window_set_cursor(plugin_dialog->window, NULL); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
266 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
267 else |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
268 { |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
269 if (plugin_pref_dialogs != NULL && |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
270 (dialog = g_hash_table_lookup(plugin_pref_dialogs, plug))) |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
271 pref_dialog_response_cb(dialog, GTK_RESPONSE_DELETE_EVENT, plug); |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
272 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
273 if (plug->dependent_plugins != NULL) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
274 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
275 GString *tmp = g_string_new(_("The following plugins will be unloaded.")); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
276 GList *l; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
277 gpointer *cb_data; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
278 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
279 for (l = plug->dependent_plugins ; l != NULL ; l = l->next) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
280 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
281 const char *dep_name = (const char *)l->data; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
282 GaimPlugin *dep_plugin = gaim_plugins_find_with_id(dep_name); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
283 g_return_if_fail(dep_plugin != NULL); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
284 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
285 g_string_append_printf(tmp, "\n\t%s\n", _(dep_plugin->info->name)); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
286 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
287 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
288 cb_data = g_new(gpointer, 3); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
289 cb_data[0] = plug; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
290 cb_data[1] = model; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
291 cb_data[2] = iter; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
292 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
293 gaim_request_action(plugin_dialog, NULL, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
294 _("Multiple plugins will be unloaded."), |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
295 tmp->str, 0, cb_data, 2, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
296 _("Unload Plugins"), G_CALLBACK(plugin_unload_confirm_cb), |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
297 _("Cancel"), NULL); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
298 g_string_free(tmp, TRUE); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
299 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
300 else |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
301 plugin_toggled_stage_two(plug, model, iter, TRUE); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
302 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
303 } |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
304 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
305 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, gboolean unload) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
306 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
307 gchar *name = NULL; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
308 gchar *description = NULL; |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
309 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
310 if (unload) |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
311 { |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
312 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
313 gdk_window_set_cursor(plugin_dialog->window, wait); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
314 gdk_cursor_unref(wait); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
315 |
11740 | 316 gaim_plugin_unload(plug); |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
317 |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
318 gdk_window_set_cursor(plugin_dialog->window, NULL); |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
319 } |
11740 | 320 |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
321 gtk_widget_set_sensitive(pref_button, |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
322 gaim_plugin_is_loaded(plug) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
323 && ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
324 && GAIM_GTK_PLUGIN_UI_INFO(plug)->get_config_frame) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
325 || (plug->info->prefs_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
326 && plug->info->prefs_info->get_plugin_pref_frame))); |
11740 | 327 |
328 name = g_markup_escape_text(_(plug->info->name), -1); | |
329 description = g_markup_escape_text(_(plug->info->description), -1); | |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
330 |
11740 | 331 if (plug->error != NULL) { |
332 gchar *error = g_markup_escape_text(plug->error, -1); | |
333 gchar *desc; | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
334 gchar *text = g_strdup_printf( |
11740 | 335 "<span size=\"larger\">%s %s</span>\n\n" |
336 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
337 "%s", | |
338 name, plug->info->version, error, description); | |
339 desc = g_strdup_printf("<b>%s</b> %s\n<span weight=\"bold\" color=\"red\"%s</span>", | |
340 plug->info->name, plug->info->version, error); | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
341 gtk_list_store_set(GTK_LIST_STORE (model), iter, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
342 1, desc, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
343 -1); |
11740 | 344 g_free(desc); |
345 g_free(error); | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
346 gtk_label_set_markup(GTK_LABEL(plugin_details), text); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
347 g_free(text); |
11740 | 348 } |
349 g_free(name); | |
350 g_free(description); | |
351 | |
352 | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
353 gtk_list_store_set(GTK_LIST_STORE (model), iter, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
354 0, gaim_plugin_is_loaded(plug), |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
355 -1); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
356 g_free(iter); |
11740 | 357 |
358 gaim_gtk_plugins_save(); | |
359 } | |
360 | |
11877 | 361 static gboolean ensure_plugin_visible(void *data) |
362 { | |
363 GtkTreeSelection *sel = GTK_TREE_SELECTION(data); | |
12246 | 364 GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel); |
11877 | 365 GtkTreeModel *model = gtk_tree_view_get_model(tv); |
366 GtkTreePath *path; | |
367 GtkTreeIter iter; | |
368 if (!gtk_tree_selection_get_selected (sel, &model, &iter)) | |
369 return FALSE; | |
370 path = gtk_tree_model_get_path(model, &iter); | |
371 gtk_tree_view_scroll_to_cell(gtk_tree_selection_get_tree_view(sel), path, NULL, FALSE, 0, 0); | |
372 gtk_tree_path_free(path); | |
373 return FALSE; | |
374 } | |
375 | |
11740 | 376 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) |
377 { | |
11741 | 378 gchar *buf, *pname, *pdesc, *pauth, *pweb; |
11740 | 379 GtkTreeIter iter; |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12343
diff
changeset
|
380 GValue val; |
11740 | 381 GaimPlugin *plug; |
382 | |
11833 | 383 if (!gtk_tree_selection_get_selected (sel, &model, &iter)) |
384 { | |
385 /* Clear the old plugin details */ | |
386 gtk_label_set_markup(GTK_LABEL(plugin_details), ""); | |
387 gtk_widget_set_sensitive(pref_button, FALSE); | |
12343 | 388 |
389 /* Collapse and disable the expander widget */ | |
390 gtk_expander_set_expanded(GTK_EXPANDER(expander), FALSE); | |
391 gtk_widget_set_sensitive(expander, FALSE); | |
392 | |
11740 | 393 return; |
11833 | 394 } |
395 | |
12343 | 396 gtk_widget_set_sensitive(expander, TRUE); |
397 | |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12343
diff
changeset
|
398 val.g_type = 0; |
11740 | 399 gtk_tree_model_get_value (model, &iter, 2, &val); |
400 plug = g_value_get_pointer(&val); | |
401 | |
402 pname = g_markup_escape_text(_(plug->info->name), -1); | |
403 pdesc = (plug->info->description) ? | |
404 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
405 pauth = (plug->info->author) ? | |
406 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
407 pweb = (plug->info->homepage) ? | |
408 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
409 buf = g_strdup_printf( | |
11771
08b1dd8aa11c
[gaim-migrate @ 14062]
Richard Laager <rlaager@wiktel.com>
parents:
11770
diff
changeset
|
410 _("%s%s" |
11740 | 411 "<span weight=\"bold\">Written by:</span>\t%s\n" |
12705
31b860fcf1aa
[gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents:
12702
diff
changeset
|
412 "<span weight=\"bold\">Website:</span>\t\t%s\n" |
31b860fcf1aa
[gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents:
12702
diff
changeset
|
413 "<span weight=\"bold\">Filename:</span>\t\t%s"), |
11771
08b1dd8aa11c
[gaim-migrate @ 14062]
Richard Laager <rlaager@wiktel.com>
parents:
11770
diff
changeset
|
414 pdesc ? pdesc : "", pdesc ? "\n\n" : "", |
11740 | 415 pauth ? pauth : "", pweb ? pweb : "", plug->path); |
416 | |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
417 if (plug->error != NULL) |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
418 { |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
419 char *tmp = g_strdup_printf( |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
420 _("%s\n" |
12705
31b860fcf1aa
[gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents:
12702
diff
changeset
|
421 "<span foreground=\"#ff0000\" weight=\"bold\">" |
31b860fcf1aa
[gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents:
12702
diff
changeset
|
422 "Error: %s\n" |
31b860fcf1aa
[gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents:
12702
diff
changeset
|
423 "Check the plugin website for an update." |
31b860fcf1aa
[gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents:
12702
diff
changeset
|
424 "</span>"), |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
425 buf, plug->error); |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
426 g_free(buf); |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
427 buf = tmp; |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
428 } |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
429 |
11817
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
430 gtk_widget_set_sensitive(pref_button, |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
431 gaim_plugin_is_loaded(plug) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
432 && ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
433 && GAIM_GTK_PLUGIN_UI_INFO(plug)->get_config_frame) |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
434 || (plug->info->prefs_info |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
435 && plug->info->prefs_info->get_plugin_pref_frame))); |
1bb0efbd4394
[gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11813
diff
changeset
|
436 |
11740 | 437 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); |
11877 | 438 |
439 /* Make sure the selected plugin is still visible */ | |
440 g_idle_add(ensure_plugin_visible, sel); | |
441 | |
442 | |
11740 | 443 g_value_unset(&val); |
444 g_free(buf); | |
445 g_free(pname); | |
446 g_free(pdesc); | |
447 g_free(pauth); | |
448 g_free(pweb); | |
449 } | |
450 | |
11741 | 451 static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel) |
11740 | 452 { |
453 GaimPlugin *plug; | |
454 GtkWidget *dialog, *box; | |
455 GtkTreeModel *model; | |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12343
diff
changeset
|
456 GValue val; |
11740 | 457 GtkTreeIter iter; |
458 | |
459 switch (response) { | |
460 case GTK_RESPONSE_CLOSE: | |
461 case GTK_RESPONSE_DELETE_EVENT: | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
462 gaim_request_close_with_handle(plugin_dialog); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
463 gaim_signals_disconnect_by_handle(plugin_dialog); |
11740 | 464 gtk_widget_destroy(d); |
11888 | 465 if (plugin_pref_dialogs != NULL) { |
466 g_hash_table_destroy(plugin_pref_dialogs); | |
467 plugin_pref_dialogs = NULL; | |
468 } | |
11740 | 469 plugin_dialog = NULL; |
470 break; | |
12246 | 471 case GAIM_RESPONSE_CONFIGURE: |
11740 | 472 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
473 return; | |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12343
diff
changeset
|
474 val.g_type = 0; |
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12343
diff
changeset
|
475 gtk_tree_model_get_value(model, &iter, 2, &val); |
11740 | 476 plug = g_value_get_pointer(&val); |
477 if (plug == NULL) | |
478 break; | |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
479 if (plugin_pref_dialogs != NULL && |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
480 g_hash_table_lookup(plugin_pref_dialogs, plug)) |
11770 | 481 break; |
11740 | 482 box = gaim_gtk_plugin_get_config_frame(plug); |
483 if (box == NULL) | |
484 break; | |
485 | |
11741 | 486 dialog = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, GTK_WINDOW(d), |
11744 | 487 GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, |
11740 | 488 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, |
489 NULL); | |
11781
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
490 if (plugin_pref_dialogs == NULL) |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
491 plugin_pref_dialogs = g_hash_table_new(NULL, NULL); |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
492 |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
493 g_hash_table_insert(plugin_pref_dialogs, plug, dialog); |
10317f1a2de2
[gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11777
diff
changeset
|
494 |
11770 | 495 g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug); |
11740 | 496 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box); |
11747
b8bf638cc4aa
[gaim-migrate @ 14038]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11744
diff
changeset
|
497 gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); |
12290 | 498 gtk_window_set_title(GTK_WINDOW(dialog), _(gaim_plugin_get_name(plug))); |
11740 | 499 gtk_widget_show_all(dialog); |
11770 | 500 g_value_unset(&val); |
11740 | 501 break; |
502 } | |
503 } | |
504 | |
12162
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
505 static void |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
506 show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer null) |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
507 { |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
508 GtkTreeSelection *sel; |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
509 GtkTreeIter iter; |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
510 GaimPlugin *plugin; |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
511 GtkTreeModel *model; |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
512 |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
513 sel = gtk_tree_view_get_selection(view); |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
514 |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
515 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
516 return; |
12246 | 517 |
12162
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
518 gtk_tree_model_get(model, &iter, 2, &plugin, -1); |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
519 |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
520 if (!gaim_plugin_is_loaded(plugin)) |
12174
c7652a910308
[gaim-migrate @ 14476]
Richard Laager <rlaager@wiktel.com>
parents:
12162
diff
changeset
|
521 return; |
c7652a910308
[gaim-migrate @ 14476]
Richard Laager <rlaager@wiktel.com>
parents:
12162
diff
changeset
|
522 |
12162
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
523 /* Now show the pref-dialog for the plugin */ |
12246 | 524 plugin_dialog_response_cb(NULL, GAIM_RESPONSE_CONFIGURE, sel); |
12162
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
525 } |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
526 |
11740 | 527 void gaim_gtk_plugin_dialog_show() |
528 { | |
11741 | 529 GtkWidget *sw; |
11740 | 530 GtkWidget *event_view; |
531 GtkListStore *ls; | |
532 GtkCellRenderer *rend, *rendt; | |
533 GtkTreeViewColumn *col; | |
534 GtkTreeSelection *sel; | |
535 | |
536 if (plugin_dialog != NULL) { | |
537 gtk_window_present(GTK_WINDOW(plugin_dialog)); | |
538 return; | |
539 } | |
540 | |
541 plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"), | |
542 NULL, | |
543 GTK_DIALOG_NO_SEPARATOR, | |
544 NULL); | |
12246 | 545 pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), |
12276
b3652193d359
[gaim-migrate @ 14580]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12246
diff
changeset
|
546 _("Configure Pl_ugin"), GAIM_RESPONSE_CONFIGURE); |
12246 | 547 gtk_dialog_add_button(GTK_DIALOG(plugin_dialog), |
548 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); | |
11813
1f7f4f850db5
[gaim-migrate @ 14104]
Gary Kramlich <grim@reaperworld.com>
parents:
11794
diff
changeset
|
549 gtk_widget_set_sensitive(pref_button, FALSE); |
11747
b8bf638cc4aa
[gaim-migrate @ 14038]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11744
diff
changeset
|
550 gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins"); |
11740 | 551 |
552 sw = gtk_scrolled_window_new(NULL,NULL); | |
553 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); | |
554 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
555 | |
556 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), sw, TRUE, TRUE, 0); | |
557 | |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
558 ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN); |
11740 | 559 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
560 1, GTK_SORT_ASCENDING); | |
561 | |
562 update_plugin_list(ls); | |
11813
1f7f4f850db5
[gaim-migrate @ 14104]
Gary Kramlich <grim@reaperworld.com>
parents:
11794
diff
changeset
|
563 |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
564 event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls)); |
11740 | 565 |
12162
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
566 g_signal_connect(G_OBJECT(event_view), "row-activated", |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
567 G_CALLBACK(show_plugin_prefs_cb), event_view); |
5e24b8e49522
[gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents:
12066
diff
changeset
|
568 |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
569 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load", plugin_dialog, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
570 GAIM_CALLBACK(plugin_load_cb), event_view); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
571 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload", plugin_dialog, |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
572 GAIM_CALLBACK(plugin_unload_cb), event_view); |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
573 |
11740 | 574 rend = gtk_cell_renderer_toggle_new(); |
575 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
576 | |
577 col = gtk_tree_view_column_new_with_attributes (_("Enabled"), | |
578 rend, | |
579 "active", 0, | |
580 NULL); | |
581 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
11794
f5105a2b8bf6
[gaim-migrate @ 14085]
Gary Kramlich <grim@reaperworld.com>
parents:
11783
diff
changeset
|
582 gtk_tree_view_column_set_sort_column_id(col, 0); |
12927
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
583 g_signal_connect(G_OBJECT(rend), "toggled", |
3cc18baeaca3
[gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents:
12889
diff
changeset
|
584 G_CALLBACK(plugin_toggled), ls); |
12246 | 585 |
11740 | 586 rendt = gtk_cell_renderer_text_new(); |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
587 g_object_set(rendt, |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
588 "foreground", "#c0c0c0", |
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
589 NULL); |
11740 | 590 col = gtk_tree_view_column_new_with_attributes (_("Name"), |
591 rendt, | |
592 "markup", 1, | |
12695
0bc110c7ab91
[gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
593 "foreground-set", 3, |
11740 | 594 NULL); |
595 #if GTK_CHECK_VERSION(2,6,0) | |
596 gtk_tree_view_column_set_expand (col, TRUE); | |
597 g_object_set(rendt, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | |
598 #endif | |
599 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
11794
f5105a2b8bf6
[gaim-migrate @ 14085]
Gary Kramlich <grim@reaperworld.com>
parents:
11783
diff
changeset
|
600 gtk_tree_view_column_set_sort_column_id(col, 1); |
11740 | 601 g_object_unref(G_OBJECT(ls)); |
602 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
12246 | 603 |
11740 | 604 expander = gtk_expander_new(_("<b>Plugin Details</b>")); |
605 gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE); | |
606 plugin_details = gtk_label_new(NULL); | |
607 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); | |
608 gtk_container_add(GTK_CONTAINER(expander), plugin_details); | |
12343 | 609 gtk_widget_set_sensitive(expander, FALSE); |
11740 | 610 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), expander, FALSE, FALSE, 0); |
611 | |
612 g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL); | |
613 g_signal_connect(G_OBJECT(plugin_dialog), "response", G_CALLBACK(plugin_dialog_response_cb), sel); | |
614 gtk_window_set_default_size(GTK_WINDOW(plugin_dialog), 430, 430); | |
615 gtk_widget_show_all(plugin_dialog); | |
616 } |