Mercurial > pidgin
annotate finch/gntplugin.c @ 18330:a6fa0249d7f7
merge of '27846e24a6f7b260a1e3c53e16e35180aa5a240c'
and '64f522ee98f90529cdffd4be7cc7db4bc8930102'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 27 Jun 2007 22:20:28 +0000 |
parents | 2500e968be58 |
children | 2d4df5ef0090 |
rev | line source |
---|---|
15817 | 1 /** |
2 * @file gntplugin.c GNT Plugins API | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
15870
diff
changeset
|
3 * @ingroup finch |
15817 | 4 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
5 * finch |
15817 | 6 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
7 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | |
10 * | |
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 */ | |
25 #include <gnt.h> | |
26 #include <gntbox.h> | |
27 #include <gntbutton.h> | |
28 #include <gntlabel.h> | |
29 #include <gntline.h> | |
30 #include <gnttree.h> | |
31 | |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18099
diff
changeset
|
32 #include "finch.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18099
diff
changeset
|
33 |
15817 | 34 #include "notify.h" |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
35 #include "request.h" |
15817 | 36 |
37 #include "gntplugin.h" | |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
38 #include "gntrequest.h" |
15817 | 39 |
40 static struct | |
41 { | |
42 GntWidget *tree; | |
43 GntWidget *window; | |
44 GntWidget *aboot; | |
45 GntWidget *conf; | |
46 } plugins; | |
47 | |
48 static GHashTable *confwins; | |
49 | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
50 static GntWidget *process_pref_frame(PurplePluginPrefFrame *frame); |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
51 |
15817 | 52 static void |
15822 | 53 decide_conf_button(PurplePlugin *plugin) |
15817 | 54 { |
15822 | 55 if (purple_plugin_is_loaded(plugin) && |
56 ((PURPLE_IS_GNT_PLUGIN(plugin) && | |
57 FINCH_PLUGIN_UI_INFO(plugin) != NULL) || | |
15817 | 58 (plugin->info->prefs_info && |
59 plugin->info->prefs_info->get_plugin_pref_frame))) | |
60 gnt_widget_set_visible(plugins.conf, TRUE); | |
61 else | |
62 gnt_widget_set_visible(plugins.conf, FALSE); | |
63 | |
64 gnt_box_readjust(GNT_BOX(plugins.window)); | |
65 gnt_widget_draw(plugins.window); | |
66 } | |
67 | |
68 static void | |
15822 | 69 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null) |
15817 | 70 { |
71 if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) | |
72 { | |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
73 if (!purple_plugin_load(plugin)) { |
17137
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16941
diff
changeset
|
74 purple_notify_error(NULL, _("ERROR"), _("loading plugin failed"), NULL); |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
75 gnt_tree_set_choice(GNT_TREE(tree), plugin, FALSE); |
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
76 } |
15817 | 77 } |
78 else | |
79 { | |
80 GntWidget *win; | |
81 | |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
82 if (!purple_plugin_unload(plugin)) { |
17137
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16941
diff
changeset
|
83 purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"), NULL); |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
84 gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE); |
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
85 } |
15817 | 86 |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
87 if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL) |
15817 | 88 { |
89 gnt_widget_destroy(win); | |
90 } | |
91 } | |
92 decide_conf_button(plugin); | |
93 finch_plugins_save_loaded(); | |
94 } | |
95 | |
96 /* Xerox */ | |
97 void | |
98 finch_plugins_save_loaded(void) | |
99 { | |
16424
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16310
diff
changeset
|
100 purple_plugins_save_loaded("/finch/plugins/loaded"); |
15817 | 101 } |
102 | |
103 static void | |
104 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) | |
105 { | |
15822 | 106 PurplePlugin *plugin = current; |
15817 | 107 char *text; |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
108 GList *list = NULL, *iter = NULL; |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
109 |
18099
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17137
diff
changeset
|
110 if (!plugin) |
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17137
diff
changeset
|
111 return; |
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17137
diff
changeset
|
112 |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
113 /* If the selected plugin was unseen before, mark it as seen. But save the list |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
114 * only when the plugin list is closed. So if the user enables a plugin, and it |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
115 * crashes, it won't get marked as seen so the user can fix the bug and still |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
116 * quickly find the plugin in the list. |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
117 * I probably mean 'plugin developers' by 'users' here. */ |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
118 list = g_object_get_data(G_OBJECT(widget), "seen-list"); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
119 if (list) |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
120 iter = g_list_find_custom(list, plugin->path, (GCompareFunc)strcmp); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
121 if (!iter) { |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
122 list = g_list_prepend(list, g_strdup(plugin->path)); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
123 g_object_set_data(G_OBJECT(widget), "seen-list", list); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
124 } |
15817 | 125 |
126 /* XXX: Use formatting and stuff */ | |
127 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); | |
128 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), | |
129 SAFE(plugin->info->name), SAFE(plugin->info->version), SAFE(plugin->info->description), | |
130 SAFE(plugin->info->author), SAFE(plugin->info->homepage), SAFE(plugin->path)); | |
131 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), | |
132 text, GNT_TEXT_FLAG_NORMAL); | |
133 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); | |
134 g_free(text); | |
135 decide_conf_button(plugin); | |
136 } | |
137 | |
138 static void | |
139 reset_plugin_window(GntWidget *window, gpointer null) | |
140 { | |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
141 GList *list = g_object_get_data(G_OBJECT(plugins.tree), "seen-list"); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
142 purple_prefs_set_path_list("/finch/plugins/seen", list); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
143 g_list_foreach(list, (GFunc)g_free, NULL); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
144 g_list_free(list); |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
145 |
15817 | 146 plugins.window = NULL; |
147 plugins.tree = NULL; | |
148 plugins.aboot = NULL; | |
149 } | |
150 | |
151 static int | |
15822 | 152 plugin_compare(PurplePlugin *p1, PurplePlugin *p2) |
15817 | 153 { |
154 char *s1 = g_utf8_strup(p1->info->name, -1); | |
155 char *s2 = g_utf8_strup(p2->info->name, -1); | |
156 int ret = g_utf8_collate(s1, s2); | |
157 g_free(s1); | |
158 g_free(s2); | |
159 return ret; | |
160 } | |
161 | |
162 static void | |
163 confwin_init() | |
164 { | |
165 confwins = g_hash_table_new(g_direct_hash, g_direct_equal); | |
166 } | |
167 | |
168 static void | |
169 remove_confwin(GntWidget *window, gpointer plugin) | |
170 { | |
171 g_hash_table_remove(confwins, plugin); | |
172 } | |
173 | |
174 static void | |
175 configure_plugin_cb(GntWidget *button, gpointer null) | |
176 { | |
15822 | 177 PurplePlugin *plugin; |
15817 | 178 FinchPluginFrame callback; |
179 | |
180 g_return_if_fail(plugins.tree != NULL); | |
181 | |
182 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree)); | |
15822 | 183 if (!purple_plugin_is_loaded(plugin)) |
15817 | 184 { |
15822 | 185 purple_notify_error(plugin, _("Error"), |
15817 | 186 _("Plugin need to be loaded before you can configure it."), NULL); |
187 return; | |
188 } | |
189 | |
190 if (confwins && g_hash_table_lookup(confwins, plugin)) | |
191 return; | |
192 | |
15822 | 193 if (PURPLE_IS_GNT_PLUGIN(plugin) && |
194 (callback = FINCH_PLUGIN_UI_INFO(plugin)) != NULL) | |
15817 | 195 { |
196 GntWidget *window = gnt_vbox_new(FALSE); | |
197 GntWidget *box, *button; | |
198 | |
199 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
200 gnt_box_set_title(GNT_BOX(window), plugin->info->name); | |
201 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
202 | |
203 box = callback(); | |
204 gnt_box_add_widget(GNT_BOX(window), box); | |
205 | |
206 box = gnt_hbox_new(FALSE); | |
207 gnt_box_add_widget(GNT_BOX(window), box); | |
208 | |
209 button = gnt_button_new(_("Close")); | |
210 gnt_box_add_widget(GNT_BOX(box), button); | |
211 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
212 G_CALLBACK(gnt_widget_destroy), window); | |
213 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin); | |
214 | |
215 gnt_widget_show(window); | |
216 | |
217 if (confwins == NULL) | |
218 confwin_init(); | |
219 g_hash_table_insert(confwins, plugin, window); | |
220 } | |
221 else if (plugin->info->prefs_info && | |
222 plugin->info->prefs_info->get_plugin_pref_frame) | |
223 { | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
224 GntWidget *win = process_pref_frame(plugin->info->prefs_info->get_plugin_pref_frame(plugin)); |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
225 if (confwins == NULL) |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
226 confwin_init(); |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
227 g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(remove_confwin), plugin); |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
228 g_hash_table_insert(confwins, plugin, win); |
15817 | 229 return; |
230 } | |
231 else | |
232 { | |
15822 | 233 purple_notify_info(plugin, _("Error"), |
15817 | 234 _("No configuration options for this plugin."), NULL); |
235 return; | |
236 } | |
237 } | |
238 | |
239 void finch_plugins_show_all() | |
240 { | |
241 GntWidget *window, *tree, *box, *aboot, *button; | |
242 GList *iter; | |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
243 GList *seen; |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
244 |
15817 | 245 if (plugins.window) |
246 return; | |
247 | |
15822 | 248 purple_plugins_probe(G_MODULE_SUFFIX); |
15817 | 249 |
250 plugins.window = window = gnt_vbox_new(FALSE); | |
251 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
252 gnt_box_set_title(GNT_BOX(window), _("Plugins")); | |
253 gnt_box_set_pad(GNT_BOX(window), 0); | |
254 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
255 | |
256 gnt_box_add_widget(GNT_BOX(window), | |
257 gnt_label_new(_("You can (un)load plugins from the following list."))); | |
258 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
259 | |
260 box = gnt_hbox_new(FALSE); | |
261 gnt_box_add_widget(GNT_BOX(window), box); | |
262 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
263 | |
264 gnt_box_set_pad(GNT_BOX(box), 0); | |
265 plugins.tree = tree = gnt_tree_new(); | |
266 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare); | |
267 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); | |
268 gnt_box_add_widget(GNT_BOX(box), tree); | |
269 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); | |
270 | |
271 plugins.aboot = aboot = gnt_text_view_new(); | |
272 gnt_widget_set_size(aboot, 40, 20); | |
273 gnt_box_add_widget(GNT_BOX(box), aboot); | |
274 | |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
275 seen = purple_prefs_get_path_list("/finch/plugins/seen"); |
15822 | 276 for (iter = purple_plugins_get_all(); iter; iter = iter->next) |
15817 | 277 { |
15822 | 278 PurplePlugin *plug = iter->data; |
15817 | 279 |
18242
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
280 if (plug->info->type == PURPLE_PLUGIN_LOADER) { |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
281 GList *cur; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
282 for (cur = PURPLE_PLUGIN_LOADER_INFO(plug)->exts; cur != NULL; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
283 cur = cur->next) |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
284 purple_plugins_probe(cur->data); |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
285 continue; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
286 } |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
287 |
15822 | 288 if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
289 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) || | |
15817 | 290 plug->error) |
291 continue; | |
292 | |
293 gnt_tree_add_choice(GNT_TREE(tree), plug, | |
294 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); | |
15822 | 295 gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug)); |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
296 if (!g_list_find_custom(seen, plug->path, (GCompareFunc)strcmp)) |
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
297 gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD); |
15817 | 298 } |
299 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); | |
300 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); | |
301 g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); | |
16941
beb960114f7d
I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
302 g_object_set_data(G_OBJECT(tree), "seen-list", seen); |
15817 | 303 |
304 box = gnt_hbox_new(FALSE); | |
305 gnt_box_add_widget(GNT_BOX(window), box); | |
306 | |
307 button = gnt_button_new(_("Close")); | |
308 gnt_box_add_widget(GNT_BOX(box), button); | |
309 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
310 G_CALLBACK(gnt_widget_destroy), window); | |
311 | |
312 plugins.conf = button = gnt_button_new(_("Configure Plugin")); | |
313 gnt_box_add_widget(GNT_BOX(box), button); | |
314 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL); | |
315 | |
316 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); | |
317 | |
318 gnt_widget_show(window); | |
319 | |
320 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree))); | |
321 } | |
322 | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
323 static GntWidget* |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
324 process_pref_frame(PurplePluginPrefFrame *frame) |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
325 { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
326 PurpleRequestField *field; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
327 PurpleRequestFields *fields; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
328 PurpleRequestFieldGroup *group = NULL; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
329 GList *prefs; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
330 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
331 fields = purple_request_fields_new(); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
332 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
333 for (prefs = purple_plugin_pref_frame_get_prefs(frame); prefs; prefs = prefs->next) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
334 PurplePluginPref *pref = prefs->data; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
335 const char *name = purple_plugin_pref_get_name(pref); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
336 const char *label = purple_plugin_pref_get_label(pref); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
337 if(name == NULL) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
338 if(label == NULL) |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
339 continue; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
340 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
341 if(purple_plugin_pref_get_type(pref) == PURPLE_PLUGIN_PREF_INFO) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
342 field = purple_request_field_label_new("*", purple_plugin_pref_get_label(pref)); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
343 purple_request_field_group_add_field(group, field); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
344 } else { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
345 group = purple_request_field_group_new(label); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
346 purple_request_fields_add_group(fields, group); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
347 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
348 continue; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
349 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
350 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
351 field = NULL; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
352 switch(purple_prefs_get_type(name)) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
353 case PURPLE_PREF_BOOLEAN: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
354 field = purple_request_field_bool_new(name, label, purple_prefs_get_bool(name)); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
355 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
356 case PURPLE_PREF_INT: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
357 field = purple_request_field_int_new(name, label, purple_prefs_get_int(name)); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
358 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
359 case PURPLE_PREF_STRING: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
360 field = purple_request_field_string_new(name, label, purple_prefs_get_string(name), |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
361 purple_plugin_pref_get_format_type(pref) & PURPLE_STRING_FORMAT_TYPE_MULTILINE); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
362 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
363 default: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
364 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
365 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
366 if (field) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
367 if (group == NULL) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
368 group = purple_request_field_group_new(_("Preferences")); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
369 purple_request_fields_add_group(fields, group); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
370 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
371 purple_request_field_group_add_field(group, field); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
372 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
373 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
374 |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
375 return purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields, |
16439
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
376 _("Save"), G_CALLBACK(finch_request_save_in_prefs), _("Cancel"), NULL, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
377 NULL, NULL, NULL, |
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16424
diff
changeset
|
378 NULL); |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
379 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16254
diff
changeset
|
380 |