annotate finch/gntplugin.c @ 32810:d288f5215a9a

Add purple_contact_get_contact_size().
author andrew.victor@mxit.com
date Mon, 31 Oct 2011 20:35:39 +0000
parents a8cc50c2279f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
29152
259bbfb423d4 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents: 27663
diff changeset
26 #include <internal.h>
259bbfb423d4 Fix all the remaining files for which internal.h doesn't end up being the first include.
Paul Aurich <paul@darkrain42.org>
parents: 27663
diff changeset
27
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include <gnt.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include <gntbox.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include <gntbutton.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include <gntlabel.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include <gntline.h>
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #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
34 #include <gntutils.h>
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
18210
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 18099
diff changeset
36 #include "finch.h"
b8572b937c09 #include reorganizations to allow compiling with glib < 2.8 using the
Stu Tomlinson <stu@nosnilmot.com>
parents: 18099
diff changeset
37
20716
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
38 #include "debug.h"
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #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
40 #include "request.h"
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 #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
43 #include "gntrequest.h"
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 static struct
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 GntWidget *tree;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 GntWidget *window;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 GntWidget *aboot;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 GntWidget *conf;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 } plugins;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 static GHashTable *confwins;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54
18222
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
55 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
56
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 static void
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
58 free_stringlist(GList *list)
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
59 {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
60 g_list_foreach(list, (GFunc)g_free, NULL);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
61 g_list_free(list);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
62 }
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
63
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
64 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
65 decide_conf_button(PurplePlugin *plugin)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 {
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29852
diff changeset
67 if (purple_plugin_is_loaded(plugin) &&
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
68 ((PURPLE_IS_GNT_PLUGIN(plugin) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
69 FINCH_PLUGIN_UI_INFO(plugin) != NULL) ||
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 (plugin->info->prefs_info &&
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 plugin->info->prefs_info->get_plugin_pref_frame)))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 gnt_widget_set_visible(plugins.conf, TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 gnt_widget_set_visible(plugins.conf, FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 gnt_box_readjust(GNT_BOX(plugins.window));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 gnt_widget_draw(plugins.window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
81 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 if (gnt_tree_get_choice(GNT_TREE(tree), plugin))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
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_load(plugin)) {
17160
a924c94ce5da Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents: 16952
diff changeset
86 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
87 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
88 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 GntWidget *win;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93
16254
c3052de39110 If a plugin failed to load/unload, don't pretend that it worked
Richard Nelson <wabz@pidgin.im>
parents: 16194
diff changeset
94 if (!purple_plugin_unload(plugin)) {
17160
a924c94ce5da Mark strings for translation
Richard Nelson <wabz@pidgin.im>
parents: 16952
diff changeset
95 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
96 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
97 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
98 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99
18222
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
100 if (confwins && (win = g_hash_table_lookup(confwins, plugin)) != NULL)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 gnt_widget_destroy(win);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 decide_conf_button(plugin);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 finch_plugins_save_loaded();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 /* Xerox */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 finch_plugins_save_loaded(void)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 {
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
113 purple_plugins_save_loaded("/finch/plugins/loaded");
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 selection_changed(GntWidget *widget, gpointer old, gpointer current, gpointer null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
119 PurplePlugin *plugin = current;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 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
121 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
122
18099
7be04c20bf22 Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17160
diff changeset
123 if (!plugin)
7be04c20bf22 Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17160
diff changeset
124 return;
7be04c20bf22 Let's not crash if there's no plugin.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 17160
diff changeset
125
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
126 /* 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
127 * 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
128 * 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
129 * 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
130 * 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
131 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
132 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
133 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
134 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
135 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
136 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
137 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 /* XXX: Use formatting and stuff */
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 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
142 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
143 SAFE(_(plugin->info->author)), SAFE(_(plugin->info->homepage)), SAFE(plugin->path));
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(plugins.aboot),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 text, GNT_TEXT_FLAG_NORMAL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 gnt_text_view_scroll(GNT_TEXT_VIEW(plugins.aboot), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 g_free(text);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 decide_conf_button(plugin);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 reset_plugin_window(GntWidget *window, gpointer null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 {
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
154 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
155 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
156 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
157 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
158
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 plugins.window = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 plugins.tree = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 plugins.aboot = NULL;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 static int
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
165 plugin_compare(PurplePlugin *p1, PurplePlugin *p2)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 char *s1 = g_utf8_strup(p1->info->name, -1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 char *s2 = g_utf8_strup(p2->info->name, -1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 int ret = g_utf8_collate(s1, s2);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 g_free(s1);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 g_free(s2);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 return ret;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 static void
22007
c38d72677c8a Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents: 21809
diff changeset
176 confwin_init(void)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 confwins = g_hash_table_new(g_direct_hash, g_direct_equal);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 remove_confwin(GntWidget *window, gpointer plugin)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 g_hash_table_remove(confwins, plugin);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 static void
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 configure_plugin_cb(GntWidget *button, gpointer null)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
190 PurplePlugin *plugin;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 FinchPluginFrame callback;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 g_return_if_fail(plugins.tree != NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 plugin = gnt_tree_get_selection_data(GNT_TREE(plugins.tree));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
196 if (!purple_plugin_is_loaded(plugin))
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
198 purple_notify_error(plugin, _("Error"),
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 _("Plugin need to be loaded before you can configure it."), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 if (confwins && g_hash_table_lookup(confwins, plugin))
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
206 if (PURPLE_IS_GNT_PLUGIN(plugin) &&
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
207 (callback = FINCH_PLUGIN_UI_INFO(plugin)) != NULL)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 GntWidget *window = gnt_vbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 GntWidget *box, *button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 gnt_box_set_title(GNT_BOX(window), plugin->info->name);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 box = callback();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 gnt_box_add_widget(GNT_BOX(window), box);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 box = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 gnt_box_add_widget(GNT_BOX(window), box);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 button = gnt_button_new(_("Close"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 gnt_box_add_widget(GNT_BOX(box), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 g_signal_connect_swapped(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 G_CALLBACK(gnt_widget_destroy), window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(remove_confwin), plugin);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 gnt_widget_show(window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 if (confwins == NULL)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 confwin_init();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 g_hash_table_insert(confwins, plugin, window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 else if (plugin->info->prefs_info &&
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 plugin->info->prefs_info->get_plugin_pref_frame)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 {
18222
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
237 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
238 if (confwins == NULL)
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
239 confwin_init();
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
240 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
241 g_hash_table_insert(confwins, plugin, win);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 else
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
246 purple_notify_info(plugin, _("Error"),
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 _("No configuration options for this plugin."), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 return;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251
20716
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
252 static void
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
253 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
254 {
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
255 /* 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
256 * 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
257 * 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
258 * 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
259 * 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
260 */
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
261 char *path;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
262 PurplePlugin *plugin;
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 g_return_if_fail(plugins.window);
31534
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 29852
diff changeset
265
20716
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
266 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
267 if (!plugin) {
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
268 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
269 _("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
270 _("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
271 return;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
272 }
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
273 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
274 purple_plugin_load(plugin);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
275 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
276 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
277 return;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
278 }
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
279
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
280 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
281 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
282 char *content = NULL;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
283 gsize length = 0;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
284
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
285 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
286 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
287 g_free(path);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
288 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
289 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
290 purple_plugin_destroy(plugin);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
291 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
292 if (!plugin) {
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
293 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
294 filename, path);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
295 g_unlink(path);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
296 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
297 }
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
298 } else {
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
299 }
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
300 }
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
301 g_free(content);
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 g_free(path);
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 purple_plugin_load(plugin);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
306
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
307 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
308 GList *cur;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
309 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
310 cur = cur->next)
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
311 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
312 return;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
313 }
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 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
316 (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
317 plugin->error)
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
318 return;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
319
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
320 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
321 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
322 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
323 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
324 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
325 }
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 static void
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
328 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
329 {
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
330 static int handle;
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
331
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
332 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
333 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
334 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
335 NULL, NULL, NULL, &handle);
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
336 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
337 }
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
338
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 void finch_plugins_show_all()
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 {
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 GntWidget *window, *tree, *box, *aboot, *button;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 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
343 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
344
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
345 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
346 gnt_window_present(plugins.window);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 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
348 }
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
350 purple_plugins_probe(G_MODULE_SUFFIX);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 plugins.window = window = gnt_vbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 gnt_box_set_toplevel(GNT_BOX(window), TRUE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 gnt_box_set_title(GNT_BOX(window), _("Plugins"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 gnt_box_set_pad(GNT_BOX(window), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
357
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
358 gnt_box_add_widget(GNT_BOX(window),
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 gnt_label_new(_("You can (un)load plugins from the following list.")));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new());
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 box = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 gnt_box_add_widget(GNT_BOX(window), box);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 gnt_box_add_widget(GNT_BOX(window), gnt_hline_new());
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 gnt_box_set_pad(GNT_BOX(box), 0);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 plugins.tree = tree = gnt_tree_new();
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)plugin_compare);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 gnt_box_add_widget(GNT_BOX(box), tree);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 gnt_box_add_widget(GNT_BOX(box), gnt_vline_new());
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 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
374 gnt_text_view_set_flag(GNT_TEXT_VIEW(aboot), GNT_TEXT_VIEW_TOP_ALIGN);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 gnt_widget_set_size(aboot, 40, 20);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 gnt_box_add_widget(GNT_BOX(box), aboot);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
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
378 seen = purple_prefs_get_path_list("/finch/plugins/seen");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
379 for (iter = purple_plugins_get_all(); iter; iter = iter->next)
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
381 PurplePlugin *plug = iter->data;
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382
18242
2500e968be58 Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
383 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
384 GList *cur;
2500e968be58 Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
385 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
386 cur = cur->next)
2500e968be58 Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
387 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
388 continue;
2500e968be58 Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
389 }
2500e968be58 Load new non-native plugins when the plugins window opens.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18222
diff changeset
390
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
391 if (plug->info->type != PURPLE_PLUGIN_STANDARD ||
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
392 (plug->info->flags & PURPLE_PLUGIN_FLAG_INVISIBLE) ||
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 plug->error)
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 continue;
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 gnt_tree_add_choice(GNT_TREE(tree), plug,
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15818
diff changeset
398 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
399 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
400 gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 gnt_tree_set_col_width(GNT_TREE(tree), 0, 30);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 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
405 g_object_set_data(G_OBJECT(tree), "seen-list", seen);
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 box = gnt_hbox_new(FALSE);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 gnt_box_add_widget(GNT_BOX(window), box);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409
20716
227e397d8e80 Add a 'Install plugin...' button in the plugins dialog.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 20713
diff changeset
410 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
411 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
412 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
413 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
414
15818
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415 button = gnt_button_new(_("Close"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 gnt_box_add_widget(GNT_BOX(box), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 g_signal_connect_swapped(G_OBJECT(button), "activate",
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 G_CALLBACK(gnt_widget_destroy), window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 plugins.conf = button = gnt_button_new(_("Configure Plugin"));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 gnt_box_add_widget(GNT_BOX(box), button);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(configure_plugin_cb), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(reset_plugin_window), NULL);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 gnt_widget_show(window);
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 decide_conf_button(gnt_tree_get_selection_data(GNT_TREE(tree)));
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 }
0e3a8505ebbe renamed gaim-text to finch
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
18222
ef65d43190e5 Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18210
diff changeset
431 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
432 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
433 {
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 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
435 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
436 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
437 GList *prefs;
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
438 GList *stringlist = NULL;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
439 GntWidget *ret = NULL;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
440
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
441 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
442
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 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
444 PurplePluginPref *pref = prefs->data;
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
445 PurplePrefType type;
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
446 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
447 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
448 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
449 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
450 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
451
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 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
453 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
454 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
455 } 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
456 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
457 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
458 }
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 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
460 }
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 field = NULL;
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
463 type = purple_prefs_get_type(name);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
464 if(purple_plugin_pref_get_type(pref) == PURPLE_PLUGIN_PREF_CHOICE) {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
465 GList *list = purple_plugin_pref_get_choices(pref);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
466 gpointer current_value = NULL;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
467
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
468 switch(type) {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
469 case PURPLE_PREF_BOOLEAN:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
470 current_value = g_strdup_printf("%d", (int)purple_prefs_get_bool(name));
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
471 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
472 case PURPLE_PREF_INT:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
473 current_value = g_strdup_printf("%d", (int)purple_prefs_get_int(name));
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
474 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
475 case PURPLE_PREF_STRING:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
476 current_value = g_strdup(purple_prefs_get_string(name));
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
477 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
478 default:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
479 continue;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
480 }
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
481
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
482 field = purple_request_field_list_new(name, label);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
483 purple_request_field_list_set_multi_select(field, FALSE);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
484 while (list && list->next) {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
485 const char *label = list->data;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
486 char *value = NULL;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
487 switch(type) {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
488 case PURPLE_PREF_BOOLEAN:
26281
b23211876f47 Fix Finch warnings when building on 64-bit
Paul Aurich <paul@darkrain42.org>
parents: 22007
diff changeset
489 value = g_strdup_printf("%d", GPOINTER_TO_INT(list->next->data));
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
490 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
491 case PURPLE_PREF_INT:
26281
b23211876f47 Fix Finch warnings when building on 64-bit
Paul Aurich <paul@darkrain42.org>
parents: 22007
diff changeset
492 value = g_strdup_printf("%d", GPOINTER_TO_INT(list->next->data));
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
493 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
494 case PURPLE_PREF_STRING:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
495 value = g_strdup(list->next->data);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
496 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
497 default:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
498 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
499 }
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
500 stringlist = g_list_prepend(stringlist, value);
29822
cc1e35fa774d Deprecate purple_request_field_list_add()
Richard Laager <rlaager@wiktel.com>
parents: 22007
diff changeset
501 purple_request_field_list_add_icon(field, label, NULL, value);
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
502 if (strcmp(value, current_value) == 0)
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
503 purple_request_field_list_add_selected(field, label);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
504 list = list->next->next;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
505 }
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
506 g_free(current_value);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
507 } else {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
508 switch(type) {
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
509 case PURPLE_PREF_BOOLEAN:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
510 field = purple_request_field_bool_new(name, label, purple_prefs_get_bool(name));
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
511 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
512 case PURPLE_PREF_INT:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
513 field = purple_request_field_int_new(name, label, purple_prefs_get_int(name));
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
514 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
515 case PURPLE_PREF_STRING:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
516 field = purple_request_field_string_new(name, label, purple_prefs_get_string(name),
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
517 purple_plugin_pref_get_format_type(pref) & PURPLE_STRING_FORMAT_TYPE_MULTILINE);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
518 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
519 default:
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
520 break;
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
521 }
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
522 }
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
523
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
524 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
525 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
526 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
527 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
528 }
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
529 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
530 }
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
531 }
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
532
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
533 ret = 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
534 _("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
535 NULL, NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
536 NULL);
21809
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
537 g_signal_connect_swapped(G_OBJECT(ret), "destroy", G_CALLBACK(free_stringlist), stringlist);
0a5dcdbdc89a Create a 'list' request-field for a 'choice' plugin pref.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21560
diff changeset
538 return ret;
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
539 }
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
540