Mercurial > pidgin.yaz
annotate finch/gntplugin.c @ 21088:fc80a99f6f40
propagate from branch 'im.pidgin.pidgin' (head ef97aa9259d77504bb07c2dff5ec0750d498e847)
to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience' (head 0e5385979f58d6ee74f668bb9b5dfd1ae3b6043f)
author | Gabriel Schulhof <nix@go-nix.ca> |
---|---|
date | Wed, 10 Oct 2007 23:19:58 +0000 |
parents | 8c9aad9479c0 |
children | cab348e39751 b9680933c2c6 |
rev | line source |
---|---|
15818 | 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:
15871
diff
changeset
|
3 * @ingroup finch |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
6 /* finch |
15818 | 7 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15818 | 9 * to list here. Please refer to the COPYRIGHT file distributed with this |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18345
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15818 | 25 */ |
26 #include <gnt.h> | |
27 #include <gntbox.h> | |
28 #include <gntbutton.h> | |
29 #include <gntlabel.h> | |
30 #include <gntline.h> | |
31 #include <gnttree.h> | |
32 | |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18099
diff
changeset
|
33 #include "finch.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18099
diff
changeset
|
34 |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
35 #include "debug.h" |
15818 | 36 #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
|
37 #include "request.h" |
15818 | 38 |
39 #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
|
40 #include "gntrequest.h" |
15818 | 41 |
42 static struct | |
43 { | |
44 GntWidget *tree; | |
45 GntWidget *window; | |
46 GntWidget *aboot; | |
47 GntWidget *conf; | |
48 } plugins; | |
49 | |
50 static GHashTable *confwins; | |
51 | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
52 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
|
53 |
15818 | 54 static void |
15823 | 55 decide_conf_button(PurplePlugin *plugin) |
15818 | 56 { |
15823 | 57 if (purple_plugin_is_loaded(plugin) && |
58 ((PURPLE_IS_GNT_PLUGIN(plugin) && | |
59 FINCH_PLUGIN_UI_INFO(plugin) != NULL) || | |
15818 | 60 (plugin->info->prefs_info && |
61 plugin->info->prefs_info->get_plugin_pref_frame))) | |
62 gnt_widget_set_visible(plugins.conf, TRUE); | |
63 else | |
64 gnt_widget_set_visible(plugins.conf, FALSE); | |
65 | |
66 gnt_box_readjust(GNT_BOX(plugins.window)); | |
67 gnt_widget_draw(plugins.window); | |
68 } | |
69 | |
70 static void | |
15823 | 71 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null) |
15818 | 72 { |
73 if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) | |
74 { | |
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 if (!purple_plugin_load(plugin)) { |
17160
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16952
diff
changeset
|
76 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
|
77 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
|
78 } |
15818 | 79 } |
80 else | |
81 { | |
82 GntWidget *win; | |
83 | |
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 if (!purple_plugin_unload(plugin)) { |
17160
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16952
diff
changeset
|
85 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
|
86 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
|
87 } |
15818 | 88 |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
89 if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL) |
15818 | 90 { |
91 gnt_widget_destroy(win); | |
92 } | |
93 } | |
94 decide_conf_button(plugin); | |
95 finch_plugins_save_loaded(); | |
96 } | |
97 | |
98 /* Xerox */ | |
99 void | |
100 finch_plugins_save_loaded(void) | |
101 { | |
16427
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
|
102 purple_plugins_save_loaded("/finch/plugins/loaded"); |
15818 | 103 } |
104 | |
105 static void | |
106 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) | |
107 { | |
15823 | 108 PurplePlugin *plugin = current; |
15818 | 109 char *text; |
16952
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:
16442
diff
changeset
|
110 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:
16442
diff
changeset
|
111 |
18099
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17160
diff
changeset
|
112 if (!plugin) |
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17160
diff
changeset
|
113 return; |
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17160
diff
changeset
|
114 |
16952
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:
16442
diff
changeset
|
115 /* 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:
16442
diff
changeset
|
116 * 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:
16442
diff
changeset
|
117 * 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:
16442
diff
changeset
|
118 * 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:
16442
diff
changeset
|
119 * 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:
16442
diff
changeset
|
120 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:
16442
diff
changeset
|
121 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:
16442
diff
changeset
|
122 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:
16442
diff
changeset
|
123 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:
16442
diff
changeset
|
124 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:
16442
diff
changeset
|
125 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:
16442
diff
changeset
|
126 } |
15818 | 127 |
128 /* XXX: Use formatting and stuff */ | |
129 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); | |
130 text = g_strdup_printf(_("Name: %s\nVersion: %s\nDescription: %s\nAuthor: %s\nWebsite: %s\nFilename: %s\n"), | |
20713
8ed95ae6441b
Translate plugin information, and top-align them.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
131 SAFE(_(plugin->info->name)), SAFE(_(plugin->info->version)), SAFE(_(plugin->info->description)), |
8ed95ae6441b
Translate plugin information, and top-align them.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
132 SAFE(_(plugin->info->author)), SAFE(_(plugin->info->homepage)), SAFE(plugin->path)); |
15818 | 133 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), |
134 text, GNT_TEXT_FLAG_NORMAL); | |
135 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); | |
136 g_free(text); | |
137 decide_conf_button(plugin); | |
138 } | |
139 | |
140 static void | |
141 reset_plugin_window(GntWidget *window, gpointer null) | |
142 { | |
16952
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:
16442
diff
changeset
|
143 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:
16442
diff
changeset
|
144 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:
16442
diff
changeset
|
145 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:
16442
diff
changeset
|
146 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:
16442
diff
changeset
|
147 |
15818 | 148 plugins.window = NULL; |
149 plugins.tree = NULL; | |
150 plugins.aboot = NULL; | |
151 } | |
152 | |
153 static int | |
15823 | 154 plugin_compare(PurplePlugin *p1, PurplePlugin *p2) |
15818 | 155 { |
156 char *s1 = g_utf8_strup(p1->info->name, -1); | |
157 char *s2 = g_utf8_strup(p2->info->name, -1); | |
158 int ret = g_utf8_collate(s1, s2); | |
159 g_free(s1); | |
160 g_free(s2); | |
161 return ret; | |
162 } | |
163 | |
164 static void | |
165 confwin_init() | |
166 { | |
167 confwins = g_hash_table_new(g_direct_hash, g_direct_equal); | |
168 } | |
169 | |
170 static void | |
171 remove_confwin(GntWidget *window, gpointer plugin) | |
172 { | |
173 g_hash_table_remove(confwins, plugin); | |
174 } | |
175 | |
176 static void | |
177 configure_plugin_cb(GntWidget *button, gpointer null) | |
178 { | |
15823 | 179 PurplePlugin *plugin; |
15818 | 180 FinchPluginFrame callback; |
181 | |
182 g_return_if_fail(plugins.tree != NULL); | |
183 | |
184 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree)); | |
15823 | 185 if (!purple_plugin_is_loaded(plugin)) |
15818 | 186 { |
15823 | 187 purple_notify_error(plugin, _("Error"), |
15818 | 188 _("Plugin need to be loaded before you can configure it."), NULL); |
189 return; | |
190 } | |
191 | |
192 if (confwins && g_hash_table_lookup(confwins, plugin)) | |
193 return; | |
194 | |
15823 | 195 if (PURPLE_IS_GNT_PLUGIN(plugin) && |
196 (callback = FINCH_PLUGIN_UI_INFO(plugin)) != NULL) | |
15818 | 197 { |
198 GntWidget *window = gnt_vbox_new(FALSE); | |
199 GntWidget *box, *button; | |
200 | |
201 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
202 gnt_box_set_title(GNT_BOX(window), plugin->info->name); | |
203 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
204 | |
205 box = callback(); | |
206 gnt_box_add_widget(GNT_BOX(window), box); | |
207 | |
208 box = gnt_hbox_new(FALSE); | |
209 gnt_box_add_widget(GNT_BOX(window), box); | |
210 | |
211 button = gnt_button_new(_("Close")); | |
212 gnt_box_add_widget(GNT_BOX(box), button); | |
213 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
214 G_CALLBACK(gnt_widget_destroy), window); | |
215 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin); | |
216 | |
217 gnt_widget_show(window); | |
218 | |
219 if (confwins == NULL) | |
220 confwin_init(); | |
221 g_hash_table_insert(confwins, plugin, window); | |
222 } | |
223 else if (plugin->info->prefs_info && | |
224 plugin->info->prefs_info->get_plugin_pref_frame) | |
225 { | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
226 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
|
227 if (confwins == NULL) |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
228 confwin_init(); |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
229 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
|
230 g_hash_table_insert(confwins, plugin, win); |
15818 | 231 return; |
232 } | |
233 else | |
234 { | |
15823 | 235 purple_notify_info(plugin, _("Error"), |
15818 | 236 _("No configuration options for this plugin."), NULL); |
237 return; | |
238 } | |
239 } | |
240 | |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
241 static void |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
242 install_selected_file_cb(gpointer handle, const char *filename) |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
243 { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
244 /* Try to init the selected file. |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
245 * If it succeeds, try to make a copy of the file in $USERDIR/plugins/. |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
246 * If the copy succeeds, unload and destroy the plugin in the original |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
247 * location and init+load the new one. |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
248 * Select the plugin in the plugin list. |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
249 */ |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
250 char *path; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
251 PurplePlugin *plugin; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
252 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
253 g_return_if_fail(plugins.window); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
254 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
255 plugin = purple_plugin_probe(filename); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
256 if (!plugin) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
257 purple_notify_error(handle, _("Error loading plugin"), |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
258 _("The selected file is not a valid plugin."), |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
259 _("Please open the debug window and try again to see the exact error message.")); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
260 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
261 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
262 if (g_list_find(gnt_tree_get_rows(GNT_TREE(plugins.tree)), plugin)) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
263 purple_plugin_load(plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
264 gnt_tree_set_choice(GNT_TREE(plugins.tree), plugin, purple_plugin_is_loaded(plugin)); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
265 gnt_tree_set_selected(GNT_TREE(plugins.tree), plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
266 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
267 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
268 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
269 path = g_build_filename(purple_user_dir(), "plugins", NULL); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
270 if (purple_build_dir(path, S_IRUSR | S_IWUSR | S_IXUSR) == 0) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
271 char *content = NULL; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
272 gsize length = 0; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
273 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
274 if (g_file_get_contents(filename, &content, &length, NULL)) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
275 char *file = g_path_get_basename(filename); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
276 g_free(path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
277 path = g_build_filename(purple_user_dir(), "plugins", file, NULL); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
278 if (purple_util_write_data_to_file_absolute(path, content, length)) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
279 purple_plugin_destroy(plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
280 plugin = purple_plugin_probe(path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
281 if (!plugin) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
282 purple_debug_warning("gntplugin", "This is really strange. %s can be loaded, but %s can't!\n", |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
283 filename, path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
284 g_unlink(path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
285 plugin = purple_plugin_probe(filename); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
286 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
287 } else { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
288 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
289 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
290 g_free(content); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
291 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
292 g_free(path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
293 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
294 purple_plugin_load(plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
295 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
296 if (plugin->info->type == PURPLE_PLUGIN_LOADER) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
297 GList *cur; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
298 for (cur = PURPLE_PLUGIN_LOADER_INFO(plugin)->exts; cur != NULL; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
299 cur = cur->next) |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
300 purple_plugins_probe(cur->data); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
301 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
302 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
303 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
304 if (plugin->info->type != PURPLE_PLUGIN_STANDARD || |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
305 (plugin->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) || |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
306 plugin->error) |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
307 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
308 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
309 gnt_tree_add_choice(GNT_TREE(plugins.tree), plugin, |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
310 gnt_tree_create_row(GNT_TREE(plugins.tree), plugin->info->name), NULL, NULL); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
311 gnt_tree_set_choice(GNT_TREE(plugins.tree), plugin, purple_plugin_is_loaded(plugin)); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
312 gnt_tree_set_row_flags(GNT_TREE(plugins.tree), plugin, GNT_TEXT_FLAG_BOLD); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
313 gnt_tree_set_selected(GNT_TREE(plugins.tree), plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
314 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
315 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
316 static void |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
317 install_plugin_cb(GntWidget *w, gpointer null) |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
318 { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
319 static int handle; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
320 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
321 purple_request_close_with_handle(&handle); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
322 purple_request_file(&handle, _("Select plugin to install"), NULL, |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
323 FALSE, G_CALLBACK(install_selected_file_cb), NULL, |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
324 NULL, NULL, NULL, &handle); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
325 g_signal_connect_swapped(G_OBJECT(w), "destroy", G_CALLBACK(purple_request_close_with_handle), &handle); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
326 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
327 |
15818 | 328 void finch_plugins_show_all() |
329 { | |
330 GntWidget *window, *tree, *box, *aboot, *button; | |
331 GList *iter; | |
16952
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:
16442
diff
changeset
|
332 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:
16442
diff
changeset
|
333 |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18242
diff
changeset
|
334 if (plugins.window) { |
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18242
diff
changeset
|
335 gnt_window_present(plugins.window); |
15818 | 336 return; |
18345
2d4df5ef0090
If the action-windows are already there, then bring them to front when
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18242
diff
changeset
|
337 } |
15818 | 338 |
15823 | 339 purple_plugins_probe(G_MODULE_SUFFIX); |
15818 | 340 |
341 plugins.window = window = gnt_vbox_new(FALSE); | |
342 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
343 gnt_box_set_title(GNT_BOX(window), _("Plugins")); | |
344 gnt_box_set_pad(GNT_BOX(window), 0); | |
345 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
346 | |
347 gnt_box_add_widget(GNT_BOX(window), | |
348 gnt_label_new(_("You can (un)load plugins from the following list."))); | |
349 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
350 | |
351 box = gnt_hbox_new(FALSE); | |
352 gnt_box_add_widget(GNT_BOX(window), box); | |
353 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
354 | |
355 gnt_box_set_pad(GNT_BOX(box), 0); | |
356 plugins.tree = tree = gnt_tree_new(); | |
357 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare); | |
358 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); | |
359 gnt_box_add_widget(GNT_BOX(box), tree); | |
360 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); | |
361 | |
362 plugins.aboot = aboot = gnt_text_view_new(); | |
20713
8ed95ae6441b
Translate plugin information, and top-align them.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
363 gnt_text_view_set_flag(GNT_TEXT_VIEW(aboot), GNT_TEXT_VIEW_TOP_ALIGN); |
15818 | 364 gnt_widget_set_size(aboot, 40, 20); |
365 gnt_box_add_widget(GNT_BOX(box), aboot); | |
366 | |
16952
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:
16442
diff
changeset
|
367 seen = purple_prefs_get_path_list("/finch/plugins/seen"); |
15823 | 368 for (iter = purple_plugins_get_all(); iter; iter = iter->next) |
15818 | 369 { |
15823 | 370 PurplePlugin *plug = iter->data; |
15818 | 371 |
18242
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
372 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
|
373 GList *cur; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
374 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
|
375 cur = cur->next) |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
376 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
|
377 continue; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
378 } |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
379 |
15823 | 380 if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
381 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) || | |
15818 | 382 plug->error) |
383 continue; | |
384 | |
385 gnt_tree_add_choice(GNT_TREE(tree), plug, | |
386 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); | |
15823 | 387 gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug)); |
16952
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:
16442
diff
changeset
|
388 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:
16442
diff
changeset
|
389 gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD); |
15818 | 390 } |
391 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); | |
392 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); | |
393 g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL); | |
16952
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:
16442
diff
changeset
|
394 g_object_set_data(G_OBJECT(tree), "seen-list", seen); |
15818 | 395 |
396 box = gnt_hbox_new(FALSE); | |
397 gnt_box_add_widget(GNT_BOX(window), box); | |
398 | |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
399 button = gnt_button_new(_("Install Plugin...")); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
400 gnt_box_add_widget(GNT_BOX(box), button); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
401 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(install_plugin_cb), NULL); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
402 |
15818 | 403 button = gnt_button_new(_("Close")); |
404 gnt_box_add_widget(GNT_BOX(box), button); | |
405 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
406 G_CALLBACK(gnt_widget_destroy), window); | |
407 | |
408 plugins.conf = button = gnt_button_new(_("Configure Plugin")); | |
409 gnt_box_add_widget(GNT_BOX(box), button); | |
410 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL); | |
411 | |
412 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); | |
413 | |
414 gnt_widget_show(window); | |
415 | |
416 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree))); | |
417 } | |
418 | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
419 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
|
420 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
|
421 { |
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
|
422 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
|
423 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
|
424 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
|
425 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
|
426 |
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
|
427 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
|
428 |
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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 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
|
436 |
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
|
437 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
|
438 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
|
439 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
|
440 } 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
|
441 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
|
442 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
|
443 } |
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
|
444 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
|
445 } |
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
|
446 |
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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 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
|
461 } |
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
|
462 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
|
463 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
|
464 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
|
465 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
|
466 } |
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
|
467 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
|
468 } |
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
|
469 } |
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
|
470 |
21086
8c9aad9479c0
Removed request stuff - now on pidgin-request-ui-hint
Gabriel Schulhof <nix@go-nix.ca>
parents:
21069
diff
changeset
|
471 return purple_request_fields(NULL, _("Preferences"), NULL, NULL, fields, |
16442
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:
16427
diff
changeset
|
472 _("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:
16427
diff
changeset
|
473 NULL, NULL, NULL, |
21086
8c9aad9479c0
Removed request stuff - now on pidgin-request-ui-hint
Gabriel Schulhof <nix@go-nix.ca>
parents:
21069
diff
changeset
|
474 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
|
475 } |
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
|
476 |