Mercurial > pidgin
annotate finch/gntplugin.c @ 21498:040b4f646f35
Don't update the error in the buddy list if it hasn't changed.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Wed, 14 Nov 2007 12:40:48 +0000 |
parents | 5321f283365e |
children | 665e04562de0 |
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 |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19681
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19681
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19681
diff
changeset
|
6 /* finch |
15817 | 7 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 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 | |
19681
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 |
15817 | 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> | |
21276
5321f283365e
Pressing 'insert' in the plugins window triggers the 'Install Plugin..' button.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
32 #include <gntutils.h> |
15817 | 33 |
18210
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18099
diff
changeset
|
34 #include "finch.h" |
b8572b937c09
#include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents:
18099
diff
changeset
|
35 |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
36 #include "debug.h" |
15817 | 37 #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
|
38 #include "request.h" |
15817 | 39 |
40 #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
|
41 #include "gntrequest.h" |
15817 | 42 |
43 static struct | |
44 { | |
45 GntWidget *tree; | |
46 GntWidget *window; | |
47 GntWidget *aboot; | |
48 GntWidget *conf; | |
49 } plugins; | |
50 | |
51 static GHashTable *confwins; | |
52 | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
53 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
|
54 |
15817 | 55 static void |
15822 | 56 decide_conf_button(PurplePlugin *plugin) |
15817 | 57 { |
15822 | 58 if (purple_plugin_is_loaded(plugin) && |
59 ((PURPLE_IS_GNT_PLUGIN(plugin) && | |
60 FINCH_PLUGIN_UI_INFO(plugin) != NULL) || | |
15817 | 61 (plugin->info->prefs_info && |
62 plugin->info->prefs_info->get_plugin_pref_frame))) | |
63 gnt_widget_set_visible(plugins.conf, TRUE); | |
64 else | |
65 gnt_widget_set_visible(plugins.conf, FALSE); | |
66 | |
67 gnt_box_readjust(GNT_BOX(plugins.window)); | |
68 gnt_widget_draw(plugins.window); | |
69 } | |
70 | |
71 static void | |
15822 | 72 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null) |
15817 | 73 { |
74 if (gnt_tree_get_choice(GNT_TREE(tree), plugin)) | |
75 { | |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
76 if (!purple_plugin_load(plugin)) { |
17137
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16941
diff
changeset
|
77 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
|
78 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
|
79 } |
15817 | 80 } |
81 else | |
82 { | |
83 GntWidget *win; | |
84 | |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
85 if (!purple_plugin_unload(plugin)) { |
17137
a924c94ce5da
Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents:
16941
diff
changeset
|
86 purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"), NULL); |
21202
e34e56eeb2da
Use purple_plugin_disable() to get the right behavior with plugins that
Richard Laager <rlaager@wiktel.com>
parents:
20716
diff
changeset
|
87 purple_plugin_disable(plugin); |
16254
c3052de39110
If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents:
16194
diff
changeset
|
88 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
|
89 } |
15817 | 90 |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
91 if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL) |
15817 | 92 { |
93 gnt_widget_destroy(win); | |
94 } | |
95 } | |
96 decide_conf_button(plugin); | |
97 finch_plugins_save_loaded(); | |
98 } | |
99 | |
100 /* Xerox */ | |
101 void | |
102 finch_plugins_save_loaded(void) | |
103 { | |
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
|
104 purple_plugins_save_loaded("/finch/plugins/loaded"); |
15817 | 105 } |
106 | |
107 static void | |
108 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null) | |
109 { | |
15822 | 110 PurplePlugin *plugin = current; |
15817 | 111 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
|
112 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
|
113 |
18099
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17137
diff
changeset
|
114 if (!plugin) |
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17137
diff
changeset
|
115 return; |
7be04c20bf22
Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
17137
diff
changeset
|
116 |
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
|
117 /* 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
|
118 * 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
|
119 * 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
|
120 * 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
|
121 * 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 } |
15817 | 129 |
130 /* XXX: Use formatting and stuff */ | |
131 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot)); | |
132 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
|
133 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
|
134 SAFE(_(plugin->info->author)), SAFE(_(plugin->info->homepage)), SAFE(plugin->path)); |
15817 | 135 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot), |
136 text, GNT_TEXT_FLAG_NORMAL); | |
137 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0); | |
138 g_free(text); | |
139 decide_conf_button(plugin); | |
140 } | |
141 | |
142 static void | |
143 reset_plugin_window(GntWidget *window, gpointer null) | |
144 { | |
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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 |
15817 | 150 plugins.window = NULL; |
151 plugins.tree = NULL; | |
152 plugins.aboot = NULL; | |
153 } | |
154 | |
155 static int | |
15822 | 156 plugin_compare(PurplePlugin *p1, PurplePlugin *p2) |
15817 | 157 { |
158 char *s1 = g_utf8_strup(p1->info->name, -1); | |
159 char *s2 = g_utf8_strup(p2->info->name, -1); | |
160 int ret = g_utf8_collate(s1, s2); | |
161 g_free(s1); | |
162 g_free(s2); | |
163 return ret; | |
164 } | |
165 | |
166 static void | |
167 confwin_init() | |
168 { | |
169 confwins = g_hash_table_new(g_direct_hash, g_direct_equal); | |
170 } | |
171 | |
172 static void | |
173 remove_confwin(GntWidget *window, gpointer plugin) | |
174 { | |
175 g_hash_table_remove(confwins, plugin); | |
176 } | |
177 | |
178 static void | |
179 configure_plugin_cb(GntWidget *button, gpointer null) | |
180 { | |
15822 | 181 PurplePlugin *plugin; |
15817 | 182 FinchPluginFrame callback; |
183 | |
184 g_return_if_fail(plugins.tree != NULL); | |
185 | |
186 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree)); | |
15822 | 187 if (!purple_plugin_is_loaded(plugin)) |
15817 | 188 { |
15822 | 189 purple_notify_error(plugin, _("Error"), |
15817 | 190 _("Plugin need to be loaded before you can configure it."), NULL); |
191 return; | |
192 } | |
193 | |
194 if (confwins && g_hash_table_lookup(confwins, plugin)) | |
195 return; | |
196 | |
15822 | 197 if (PURPLE_IS_GNT_PLUGIN(plugin) && |
198 (callback = FINCH_PLUGIN_UI_INFO(plugin)) != NULL) | |
15817 | 199 { |
200 GntWidget *window = gnt_vbox_new(FALSE); | |
201 GntWidget *box, *button; | |
202 | |
203 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
204 gnt_box_set_title(GNT_BOX(window), plugin->info->name); | |
205 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
206 | |
207 box = callback(); | |
208 gnt_box_add_widget(GNT_BOX(window), box); | |
209 | |
210 box = gnt_hbox_new(FALSE); | |
211 gnt_box_add_widget(GNT_BOX(window), box); | |
212 | |
213 button = gnt_button_new(_("Close")); | |
214 gnt_box_add_widget(GNT_BOX(box), button); | |
215 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
216 G_CALLBACK(gnt_widget_destroy), window); | |
217 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin); | |
218 | |
219 gnt_widget_show(window); | |
220 | |
221 if (confwins == NULL) | |
222 confwin_init(); | |
223 g_hash_table_insert(confwins, plugin, window); | |
224 } | |
225 else if (plugin->info->prefs_info && | |
226 plugin->info->prefs_info->get_plugin_pref_frame) | |
227 { | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
228 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
|
229 if (confwins == NULL) |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
230 confwin_init(); |
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
231 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
|
232 g_hash_table_insert(confwins, plugin, win); |
15817 | 233 return; |
234 } | |
235 else | |
236 { | |
15822 | 237 purple_notify_info(plugin, _("Error"), |
15817 | 238 _("No configuration options for this plugin."), NULL); |
239 return; | |
240 } | |
241 } | |
242 | |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
243 static void |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
244 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
|
245 { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
246 /* 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
|
247 * 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
|
248 * 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
|
249 * 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
|
250 * 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
|
251 */ |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
252 char *path; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
253 PurplePlugin *plugin; |
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 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
|
256 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
257 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
|
258 if (!plugin) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
259 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
|
260 _("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
|
261 _("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
|
262 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
263 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
264 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
|
265 purple_plugin_load(plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
266 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
|
267 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
|
268 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
269 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
270 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
271 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
|
272 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
|
273 char *content = NULL; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
274 gsize length = 0; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
275 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
276 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
|
277 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
|
278 g_free(path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
279 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
|
280 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
|
281 purple_plugin_destroy(plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
282 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
|
283 if (!plugin) { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
284 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
|
285 filename, path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
286 g_unlink(path); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
287 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
|
288 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
289 } else { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
290 } |
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(content); |
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 g_free(path); |
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 purple_plugin_load(plugin); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
297 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
298 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
|
299 GList *cur; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
300 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
|
301 cur = cur->next) |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
302 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
|
303 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
304 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
305 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
306 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
|
307 (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
|
308 plugin->error) |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
309 return; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
310 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 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
|
315 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
|
316 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
317 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
318 static void |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
319 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
|
320 { |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
321 static int handle; |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
322 |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
323 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
|
324 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
|
325 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
|
326 NULL, NULL, NULL, &handle); |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
327 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
|
328 } |
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
329 |
15817 | 330 void finch_plugins_show_all() |
331 { | |
332 GntWidget *window, *tree, *box, *aboot, *button; | |
333 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
|
334 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
|
335 |
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
|
336 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
|
337 gnt_window_present(plugins.window); |
15817 | 338 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
|
339 } |
15817 | 340 |
15822 | 341 purple_plugins_probe(G_MODULE_SUFFIX); |
15817 | 342 |
343 plugins.window = window = gnt_vbox_new(FALSE); | |
344 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
345 gnt_box_set_title(GNT_BOX(window), _("Plugins")); | |
346 gnt_box_set_pad(GNT_BOX(window), 0); | |
347 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
348 | |
349 gnt_box_add_widget(GNT_BOX(window), | |
350 gnt_label_new(_("You can (un)load plugins from the following list."))); | |
351 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
352 | |
353 box = gnt_hbox_new(FALSE); | |
354 gnt_box_add_widget(GNT_BOX(window), box); | |
355 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new()); | |
356 | |
357 gnt_box_set_pad(GNT_BOX(box), 0); | |
358 plugins.tree = tree = gnt_tree_new(); | |
359 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare); | |
360 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); | |
361 gnt_box_add_widget(GNT_BOX(box), tree); | |
362 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new()); | |
363 | |
364 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
|
365 gnt_text_view_set_flag(GNT_TEXT_VIEW(aboot), GNT_TEXT_VIEW_TOP_ALIGN); |
15817 | 366 gnt_widget_set_size(aboot, 40, 20); |
367 gnt_box_add_widget(GNT_BOX(box), aboot); | |
368 | |
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
|
369 seen = purple_prefs_get_path_list("/finch/plugins/seen"); |
15822 | 370 for (iter = purple_plugins_get_all(); iter; iter = iter->next) |
15817 | 371 { |
15822 | 372 PurplePlugin *plug = iter->data; |
15817 | 373 |
18242
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
374 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
|
375 GList *cur; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
376 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
|
377 cur = cur->next) |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
378 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
|
379 continue; |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
380 } |
2500e968be58
Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
381 |
15822 | 382 if (plug->info->type != PURPLE_PLUGIN_STANDARD || |
383 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) || | |
15817 | 384 plug->error) |
385 continue; | |
386 | |
387 gnt_tree_add_choice(GNT_TREE(tree), plug, | |
388 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL); | |
15822 | 389 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
|
390 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
|
391 gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD); |
15817 | 392 } |
393 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30); | |
394 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL); | |
395 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
|
396 g_object_set_data(G_OBJECT(tree), "seen-list", seen); |
15817 | 397 |
398 box = gnt_hbox_new(FALSE); | |
399 gnt_box_add_widget(GNT_BOX(window), box); | |
400 | |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
401 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
|
402 gnt_box_add_widget(GNT_BOX(box), button); |
21276
5321f283365e
Pressing 'insert' in the plugins window triggers the 'Install Plugin..' button.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21244
diff
changeset
|
403 gnt_util_set_trigger_widget(GNT_WIDGET(tree), GNT_KEY_INS, button); |
20716
227e397d8e80
Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20713
diff
changeset
|
404 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
|
405 |
15817 | 406 button = gnt_button_new(_("Close")); |
407 gnt_box_add_widget(GNT_BOX(box), button); | |
408 g_signal_connect_swapped(G_OBJECT(button), "activate", | |
409 G_CALLBACK(gnt_widget_destroy), window); | |
410 | |
411 plugins.conf = button = gnt_button_new(_("Configure Plugin")); | |
412 gnt_box_add_widget(GNT_BOX(box), button); | |
413 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL); | |
414 | |
415 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL); | |
416 | |
417 gnt_widget_show(window); | |
418 | |
419 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree))); | |
420 } | |
421 | |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18210
diff
changeset
|
422 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
|
423 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
|
424 { |
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 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
|
426 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
|
427 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
|
428 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
|
429 |
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 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
|
431 |
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 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 |
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 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
|
441 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
|
442 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
|
443 } 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
|
444 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
|
445 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
|
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 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
|
448 } |
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 |
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 = 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
|
451 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
|
452 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
|
453 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
|
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_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
|
456 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
|
457 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
|
458 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
|
459 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
|
460 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
|
461 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
|
462 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
|
463 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
|
464 } |
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 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
|
466 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
|
467 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
|
468 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
|
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 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
|
471 } |
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
|
472 } |
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
|
473 |
20598
285bb637a2b7
Updated hinting to be less invasive
Gabriel Schulhof <nix@go-nix.ca>
parents:
20597
diff
changeset
|
474 return purple_request_fields_with_hint(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
|
475 _("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
|
476 NULL, NULL, NULL, |
21244
a20ef7180680
Re-namespace the #defines to all be PURPLE_REQUEST_UI_HINT_*. I see no
Richard Laager <rlaager@wiktel.com>
parents:
21235
diff
changeset
|
477 PURPLE_REQUEST_UI_HINT_PLUGINMGR, 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
|
478 } |
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
|
479 |