Mercurial > pidgin
annotate finch/gntplugin.c @ 17869:6842cc73b1b7
Implemented XEP-0172: User Nickname, fixed some potential crashers in the other PEP callbacks.
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Mon, 18 Jun 2007 14:45:17 +0000 |
parents | a924c94ce5da |
children | 7be04c20bf22 |
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 | |
32 #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
|
33 #include "request.h" |
15817 | 34 |
15822 | 35 #include "finch.h" |
15817 | 36 #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
|
37 #include "gntrequest.h" |
15817 | 38 |
39 static struct | |
40 { | |
41 GntWidget *tree; | |
42 GntWidget *window; | |
43 GntWidget *aboot; | |
44 GntWidget *conf; | |
45 } plugins; | |
46 | |
47 static GHashTable *confwins; | |
48 | |
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
|
49 static void 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
|
50 |
15817 | 51 static void |
15822 | 52 decide_conf_button(PurplePlugin *plugin) |
15817 | 53 { |
15822 | 54 if (purple_plugin_is_loaded(plugin) && |
55 ((PURPLE_IS_GNT_PLUGIN(plugin) && | |
56 FINCH_PLUGIN_UI_INFO(plugin) != NULL) || | |
15817 | 57 (plugin->info->prefs_info && |
58 plugin->info->prefs_info->get_plugin_pref_frame))) | |
59 gnt_widget_set_visible(plugins.conf, TRUE); | |
60 else | |
61 gnt_widget_set_visible(plugins.conf, FALSE); | |
62 | |
63 gnt_box_readjust(GNT_BOX(plugins.window)); | |
64 gnt_widget_draw(plugins.window); | |
65 } | |
66 | |
67 static void | |
15822 | 68 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null) |
15817 | 69 { |
70 if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) | |
71 { | |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
72 if (!purple_plugin_load(plugin)) { |
17137
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16941
diff
changeset
|
73 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
|
74 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
|
75 } |
15817 | 76 } |
77 else | |
78 { | |
79 GntWidget *win; | |
80 | |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
81 if (!purple_plugin_unload(plugin)) { |
17137
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16941
diff
changeset
|
82 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
|
83 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
|
84 } |
15817 | 85 |
86 if ((win = g_hash_table_lookup(confwins, plugin)) != NULL) | |
87 { | |
88 gnt_widget_destroy(win); | |
89 } | |
90 } | |
91 decide_conf_button(plugin); | |
92 finch_plugins_save_loaded(); | |
93 } | |
94 | |
95 /* Xerox */ | |
96 void | |
97 finch_plugins_save_loaded(void) | |
98 { | |
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
|
99 purple_plugins_save_loaded("/finch/plugins/loaded"); |
15817 | 100 } |
101 | |
102 static void | |
103 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) | |
104 { | |
15822 | 105 PurplePlugin *plugin = current; |
15817 | 106 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
|
107 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
|
108 |
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 /* 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
|
110 * 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
|
111 * 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
|
112 * 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
|
113 * 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 } |
15817 | 121 |
122 /* XXX: Use formatting and stuff */ | |
123 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); | |
124 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), | |
125 SAFE(plugin->info->name), SAFE(plugin->info->version), SAFE(plugin->info->description), | |
126 SAFE(plugin->info->author), SAFE(plugin->info->homepage), SAFE(plugin->path)); | |
127 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), | |
128 text, GNT_TEXT_FLAG_NORMAL); | |
129 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); | |
130 g_free(text); | |
131 decide_conf_button(plugin); | |
132 } | |
133 | |
134 static void | |
135 reset_plugin_window(GntWidget *window, gpointer null) | |
136 { | |
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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 |
15817 | 142 plugins.window = NULL; |
143 plugins.tree = NULL; | |
144 plugins.aboot = NULL; | |
145 } | |
146 | |
147 static int | |
15822 | 148 plugin_compare(PurplePlugin *p1, PurplePlugin *p2) |
15817 | 149 { |
150 char *s1 = g_utf8_strup(p1->info->name, -1); | |
151 char *s2 = g_utf8_strup(p2->info->name, -1); | |
152 int ret = g_utf8_collate(s1, s2); | |
153 g_free(s1); | |
154 g_free(s2); | |
155 return ret; | |
156 } | |
157 | |
158 static void | |
159 confwin_init() | |
160 { | |
161 confwins = g_hash_table_new(g_direct_hash, g_direct_equal); | |
162 } | |
163 | |
164 static void | |
165 remove_confwin(GntWidget *window, gpointer plugin) | |
166 { | |
167 g_hash_table_remove(confwins, plugin); | |
168 } | |
169 | |
170 static void | |
171 configure_plugin_cb(GntWidget *button, gpointer null) | |
172 { | |
15822 | 173 PurplePlugin *plugin; |
15817 | 174 FinchPluginFrame callback; |
175 | |
176 g_return_if_fail(plugins.tree != NULL); | |
177 | |
178 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree)); | |
15822 | 179 if (!purple_plugin_is_loaded(plugin)) |
15817 | 180 { |
15822 | 181 purple_notify_error(plugin, _("Error"), |
15817 | 182 _("Plugin need to be loaded before you can configure it."), NULL); |
183 return; | |
184 } | |
185 | |
186 if (confwins && g_hash_table_lookup(confwins, plugin)) | |
187 return; | |
188 | |
15822 | 189 if (PURPLE_IS_GNT_PLUGIN(plugin) && |
190 (callback = FINCH_PLUGIN_UI_INFO(plugin)) != NULL) | |
15817 | 191 { |
192 GntWidget *window = gnt_vbox_new(FALSE); | |
193 GntWidget *box, *button; | |
194 | |
195 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
196 gnt_box_set_title(GNT_BOX(window), plugin->info->name); | |
197 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
198 | |
199 box = callback(); | |
200 gnt_box_add_widget(GNT_BOX(window), box); | |
201 | |
202 box = gnt_hbox_new(FALSE); | |
203 gnt_box_add_widget(GNT_BOX(window), box); | |
204 | |
205 button = gnt_button_new(_("Close")); | |
206 gnt_box_add_widget(GNT_BOX(box), button); | |
207 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
208 G_CALLBACK(gnt_widget_destroy), window); | |
209 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin); | |
210 | |
211 gnt_widget_show(window); | |
212 | |
213 if (confwins == NULL) | |
214 confwin_init(); | |
215 g_hash_table_insert(confwins, plugin, window); | |
216 } | |
217 else if (plugin->info->prefs_info && | |
218 plugin->info->prefs_info->get_plugin_pref_frame) | |
219 { | |
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
|
220 process_pref_frame(plugin->info->prefs_info->get_plugin_pref_frame(plugin)); |
15817 | 221 return; |
222 } | |
223 else | |
224 { | |
15822 | 225 purple_notify_info(plugin, _("Error"), |
15817 | 226 _("No configuration options for this plugin."), NULL); |
227 return; | |
228 } | |
229 } | |
230 | |
231 void finch_plugins_show_all() | |
232 { | |
233 GntWidget *window, *tree, *box, *aboot, *button; | |
234 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
|
235 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
|
236 |
15817 | 237 if (plugins.window) |
238 return; | |
239 | |
15822 | 240 purple_plugins_probe(G_MODULE_SUFFIX); |
15817 | 241 |
242 plugins.window = window = gnt_vbox_new(FALSE); | |
243 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
244 gnt_box_set_title(GNT_BOX(window), _("Plugins")); | |
245 gnt_box_set_pad(GNT_BOX(window), 0); | |
246 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
247 | |
248 gnt_box_add_widget(GNT_BOX(window), | |
249 gnt_label_new(_("You can (un)load plugins from the following list."))); | |
250 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
251 | |
252 box = gnt_hbox_new(FALSE); | |
253 gnt_box_add_widget(GNT_BOX(window), box); | |
254 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
255 | |
256 gnt_box_set_pad(GNT_BOX(box), 0); | |
257 plugins.tree = tree = gnt_tree_new(); | |
258 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare); | |
259 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); | |
260 gnt_box_add_widget(GNT_BOX(box), tree); | |
261 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); | |
262 | |
263 plugins.aboot = aboot = gnt_text_view_new(); | |
264 gnt_widget_set_size(aboot, 40, 20); | |
265 gnt_box_add_widget(GNT_BOX(box), aboot); | |
266 | |
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
|
267 seen = purple_prefs_get_path_list("/finch/plugins/seen"); |
15822 | 268 for (iter = purple_plugins_get_all(); iter; iter = iter->next) |
15817 | 269 { |
15822 | 270 PurplePlugin *plug = iter->data; |
15817 | 271 |
15822 | 272 if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
273 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) || | |
15817 | 274 plug->error) |
275 continue; | |
276 | |
277 gnt_tree_add_choice(GNT_TREE(tree), plug, | |
278 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); | |
15822 | 279 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
|
280 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
|
281 gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD); |
15817 | 282 } |
283 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); | |
284 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); | |
285 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
|
286 g_object_set_data(G_OBJECT(tree), "seen-list", seen); |
15817 | 287 |
288 box = gnt_hbox_new(FALSE); | |
289 gnt_box_add_widget(GNT_BOX(window), box); | |
290 | |
291 button = gnt_button_new(_("Close")); | |
292 gnt_box_add_widget(GNT_BOX(box), button); | |
293 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
294 G_CALLBACK(gnt_widget_destroy), window); | |
295 | |
296 plugins.conf = button = gnt_button_new(_("Configure Plugin")); | |
297 gnt_box_add_widget(GNT_BOX(box), button); | |
298 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL); | |
299 | |
300 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); | |
301 | |
302 gnt_widget_show(window); | |
303 | |
304 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree))); | |
305 } | |
306 | |
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
|
307 static void |
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
|
308 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
|
309 { |
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
|
310 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
|
311 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
|
312 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
|
313 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
|
314 |
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
|
315 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
|
316 |
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
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 |
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 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
|
326 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
|
327 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
|
328 } 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
|
329 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
|
330 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
|
331 } |
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 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
|
333 } |
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 |
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 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
|
336 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
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 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
|
343 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
|
344 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
|
345 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
|
346 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
|
347 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
|
348 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
|
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 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
|
351 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
|
352 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
|
353 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
|
354 } |
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 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
|
356 } |
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 } |
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 |
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 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
|
360 _("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
|
361 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
|
362 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
|
363 } |
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 |