annotate src/gtkplugin.c @ 13899:79f29d8dcd7a

[gaim-migrate @ 16384] Workaround for silc toolkit "bug" that prevents empty unix account real names from connecting. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 01 Jul 2006 15:20:58 +0000
parents 3ac2d64a74a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
6927
ee51189dfe76 [gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents: 5982
diff changeset
2 * @file gtkplugin.c GTK+ Plugins support
ee51189dfe76 [gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents: 5982
diff changeset
3 * @ingroup gtkui
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6927
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6927
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 6927
diff changeset
9 * source distribution.
6927
ee51189dfe76 [gaim-migrate @ 7474]
Christian Hammond <chipx86@chipx86.com>
parents: 5982
diff changeset
10 *
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
25 #include "internal.h"
9791
4a15962c344a [gaim-migrate @ 10659]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
26 #include "gtkgaim.h"
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "gtkplugin.h"
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
28 #include "gtkpluginpref.h"
13435
5f6d2b22c18e [gaim-migrate @ 15810]
Richard Laager <rlaager@wiktel.com>
parents: 13434
diff changeset
29 #include "gtkutils.h"
5981
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
30 #include "debug.h"
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
31 #include "prefs.h"
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
32 #include "request.h"
5981
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
33
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 #include <string.h>
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
36 #define GAIM_RESPONSE_CONFIGURE 98121
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
37
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
38 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
39 GtkTreeIter *iter, gboolean unload);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
40
12343
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
41 static GtkWidget *expander = NULL;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
42 static GtkWidget *plugin_dialog = NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
43 static GtkWidget *plugin_details = NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
44 static GtkWidget *pref_button = NULL;
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
45 static GHashTable *plugin_pref_dialogs = NULL;
11747
b8bf638cc4aa [gaim-migrate @ 14038]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11744
diff changeset
46
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 GtkWidget *
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 gaim_gtk_plugin_get_config_frame(GaimPlugin *plugin)
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 {
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
50 GtkWidget *config = NULL;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 g_return_val_if_fail(plugin != NULL, NULL);
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
54 if (GAIM_IS_GTK_PLUGIN(plugin) && plugin->info->ui_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
55 && GAIM_GTK_PLUGIN_UI_INFO(plugin)->get_config_frame)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
56 {
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
57 GaimGtkPluginUiInfo *ui_info;
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
58
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
59 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plugin);
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
60
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
61 config = ui_info->get_config_frame(plugin);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
63 if (plugin->info->prefs_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
64 && plugin->info->prefs_info->get_plugin_pref_frame)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
65 {
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
66 gaim_debug_warning("gtkplugin",
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
67 "Plugin %s contains both, ui_info and "
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
68 "prefs_info preferences; prefs_info will be "
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
69 "ignored.", plugin->info->name);
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
70 }
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
71 }
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
73 if (config == NULL && plugin->info->prefs_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
74 && plugin->info->prefs_info->get_plugin_pref_frame)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
75 {
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
76 GaimPluginPrefFrame *frame;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
78 frame = plugin->info->prefs_info->get_plugin_pref_frame(plugin);
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
79
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
80 config = gaim_gtk_plugin_pref_create_frame(frame);
12870
a9cd674078b1 [gaim-migrate @ 15222]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12705
diff changeset
81
12889
bba0faa37f3a [gaim-migrate @ 15242]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12870
diff changeset
82 /* XXX According to bug #1407047 this broke saving pluging preferences, I'll look at fixing it correctly later.
12870
a9cd674078b1 [gaim-migrate @ 15222]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12705
diff changeset
83 gaim_plugin_pref_frame_destroy(frame);
12889
bba0faa37f3a [gaim-migrate @ 15242]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12870
diff changeset
84 */
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
85 }
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
86
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
87 return config;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 }
5981
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
89
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
90 void
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
91 gaim_gtk_plugins_save(void)
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
92 {
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
93 GList *pl;
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
94 GList *files = NULL;
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
95 GaimPlugin *p;
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
96
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
97 for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) {
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
98 p = pl->data;
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
99
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
100 if (p->info->type != GAIM_PLUGIN_PROTOCOL &&
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
101 p->info->type != GAIM_PLUGIN_LOADER) {
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
102
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
103 files = g_list_append(files, p->path);
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
104 }
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
105 }
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
106
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
107 gaim_prefs_set_string_list("/gaim/gtk/plugins/loaded", files);
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
108 g_list_free(files);
81564bb4db68 [gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
109 }
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
110
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
111 static void
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
112 update_plugin_list(void *data)
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
113 {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
114 GtkListStore *ls = GTK_LIST_STORE(data);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
115 GtkTreeIter iter;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
116 GList *probes;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
117 GaimPlugin *plug;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
118
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
119 gtk_list_store_clear(ls);
12066
ee8312c764b1 [gaim-migrate @ 14361]
Mark Doliner <mark@kingant.net>
parents: 11888
diff changeset
120 gaim_plugins_probe(G_MODULE_SUFFIX);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
121
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
122 for (probes = gaim_plugins_get_all();
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
123 probes != NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
124 probes = probes->next)
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
125 {
12702
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
126 char *name;
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
127 char *version;
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
128 char *summary;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
129 char *desc;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
130 plug = probes->data;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
131
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
132 if (plug->info->type != GAIM_PLUGIN_STANDARD ||
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
133 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE))
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
134 {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
135 continue;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
136 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
137
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
138 gtk_list_store_append (ls, &iter);
12702
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
139
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
140 name = g_markup_escape_text(plug->info->name ? _(plug->info->name) : g_basename(plug->path), -1);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
141 version = g_markup_escape_text(plug->info->version, -1);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
142 summary = g_markup_escape_text(_(plug->info->summary), -1);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
143
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
144 desc = g_strdup_printf("<b>%s</b> %s\n%s", name,
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
145 version,
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
146 summary);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
147 g_free(name);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
148 g_free(version);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
149 g_free(summary);
ba7834d6e2c9 [gaim-migrate @ 15045]
Richard Laager <rlaager@wiktel.com>
parents: 12695
diff changeset
150
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
151 gtk_list_store_set(ls, &iter,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
152 0, gaim_plugin_is_loaded(plug),
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
153 1, desc,
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
154 2, plug,
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
155 3, gaim_plugin_is_unloadable(plug),
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
156 -1);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
157 g_free(desc);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
158 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
159 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
160
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
161 static void plugin_loading_common(GaimPlugin *plugin, GtkTreeView *view, gboolean loaded)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
162 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
163 GtkTreeIter iter;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
164 GtkTreeModel *model = gtk_tree_view_get_model(view);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
165
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
166 if (gtk_tree_model_get_iter_first(model, &iter)) {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
167 do {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
168 GaimPlugin *plug;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
169 GtkTreeSelection *sel;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
170
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
171 gtk_tree_model_get(model, &iter, 2, &plug, -1);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
172
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
173 if (plug != plugin)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
174 continue;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
175
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
176 gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0, loaded, -1);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
177
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
178 /* If the loaded/unloaded plugin is the selected row,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
179 * update the pref_button. */
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
180 sel = gtk_tree_view_get_selection(view);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
181 if (gtk_tree_selection_get_selected(sel, &model, &iter))
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
182 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
183 gtk_tree_model_get(model, &iter, 2, &plug, -1);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
184 if (plug == plugin)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
185 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
186 gtk_widget_set_sensitive(pref_button,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
187 loaded
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
188 && ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
189 && GAIM_GTK_PLUGIN_UI_INFO(plug)->get_config_frame)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
190 || (plug->info->prefs_info
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
191 && plug->info->prefs_info->get_plugin_pref_frame)));
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
192 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
193 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
194
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
195 break;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
196 } while (gtk_tree_model_iter_next(model, &iter));
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
197 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
198 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
199
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
200 static void plugin_load_cb(GaimPlugin *plugin, gpointer data)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
201 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
202 GtkTreeView *view = (GtkTreeView *)data;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
203 plugin_loading_common(plugin, view, TRUE);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
204 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
205
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
206 static void plugin_unload_cb(GaimPlugin *plugin, gpointer data)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
207 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
208 GtkTreeView *view = (GtkTreeView *)data;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
209 plugin_loading_common(plugin, view, FALSE);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
210 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
211
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
212 static void pref_dialog_response_cb(GtkWidget *d, int response, GaimPlugin *plug)
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
213 {
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
214 switch (response) {
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
215 case GTK_RESPONSE_CLOSE:
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
216 case GTK_RESPONSE_DELETE_EVENT:
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
217 g_hash_table_remove(plugin_pref_dialogs, plug);
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
218 if (g_hash_table_size(plugin_pref_dialogs) == 0) {
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
219 g_hash_table_destroy(plugin_pref_dialogs);
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
220 plugin_pref_dialogs = NULL;
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
221 }
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
222 gtk_widget_destroy(d);
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
223 break;
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
224 }
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
225 }
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
226
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
227 static void plugin_unload_confirm_cb(gpointer *data)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
228 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
229 GaimPlugin *plugin = (GaimPlugin *)data[0];
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
230 GtkTreeModel *model = (GtkTreeModel *)data[1];
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
231 GtkTreeIter *iter = (GtkTreeIter *)data[2];
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
232
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
233 plugin_toggled_stage_two(plugin, model, iter, TRUE);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
234
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
235 g_free(data);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
236 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
237
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
238 static void plugin_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data)
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
239 {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
240 GtkTreeModel *model = (GtkTreeModel *)data;
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
241 GtkTreeIter *iter = g_new(GtkTreeIter, 1);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
242 GtkTreePath *path = gtk_tree_path_new_from_string(pth);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
243 GaimPlugin *plug;
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
244 GtkWidget *dialog = NULL;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
245
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
246 gtk_tree_model_get_iter(model, iter, path);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
247 gtk_tree_path_free(path);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
248 gtk_tree_model_get(model, iter, 2, &plug, -1);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
249
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
250 /* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
251 if (gaim_plugin_is_unloadable(plug))
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
252 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
253 g_free(iter);
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
254 return;
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
255 }
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
256
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
257 if (!gaim_plugin_is_loaded(plug))
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
258 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13377
diff changeset
259 gaim_gtk_set_cursor(plugin_dialog, GDK_WATCH);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
260
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
261 gaim_plugin_load(plug);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
262 plugin_toggled_stage_two(plug, model, iter, FALSE);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
263
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13377
diff changeset
264 gaim_gtk_clear_cursor(plugin_dialog);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
265 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
266 else
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
267 {
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
268 if (plugin_pref_dialogs != NULL &&
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
269 (dialog = g_hash_table_lookup(plugin_pref_dialogs, plug)))
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
270 pref_dialog_response_cb(dialog, GTK_RESPONSE_DELETE_EVENT, plug);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
271
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
272 if (plug->dependent_plugins != NULL)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
273 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
274 GString *tmp = g_string_new(_("The following plugins will be unloaded."));
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
275 GList *l;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
276 gpointer *cb_data;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
277
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
278 for (l = plug->dependent_plugins ; l != NULL ; l = l->next)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
279 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
280 const char *dep_name = (const char *)l->data;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
281 GaimPlugin *dep_plugin = gaim_plugins_find_with_id(dep_name);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
282 g_return_if_fail(dep_plugin != NULL);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
283
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
284 g_string_append_printf(tmp, "\n\t%s\n", _(dep_plugin->info->name));
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
285 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
286
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
287 cb_data = g_new(gpointer, 3);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
288 cb_data[0] = plug;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
289 cb_data[1] = model;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
290 cb_data[2] = iter;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
291
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
292 gaim_request_action(plugin_dialog, NULL,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
293 _("Multiple plugins will be unloaded."),
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
294 tmp->str, 0, cb_data, 2,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
295 _("Unload Plugins"), G_CALLBACK(plugin_unload_confirm_cb),
13377
71fbe885c50b [gaim-migrate @ 15750]
Richard Laager <rlaager@wiktel.com>
parents: 12927
diff changeset
296 _("Cancel"), g_free);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
297 g_string_free(tmp, TRUE);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
298 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
299 else
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
300 plugin_toggled_stage_two(plug, model, iter, TRUE);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
301 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
302 }
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
303
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
304 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model, GtkTreeIter *iter, gboolean unload)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
305 {
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
306 gchar *name = NULL;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
307 gchar *description = NULL;
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
308
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
309 if (unload)
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
310 {
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13377
diff changeset
311 gaim_gtk_set_cursor(plugin_dialog, GDK_WATCH);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
312
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
313 gaim_plugin_unload(plug);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
314
13434
ffd724befbf8 [gaim-migrate @ 15809]
Richard Laager <rlaager@wiktel.com>
parents: 13377
diff changeset
315 gaim_gtk_clear_cursor(plugin_dialog);
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
316 }
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
317
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
318 gtk_widget_set_sensitive(pref_button,
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
319 gaim_plugin_is_loaded(plug)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
320 && ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
321 && GAIM_GTK_PLUGIN_UI_INFO(plug)->get_config_frame)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
322 || (plug->info->prefs_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
323 && plug->info->prefs_info->get_plugin_pref_frame)));
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
324
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
325 name = g_markup_escape_text(_(plug->info->name), -1);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
326 description = g_markup_escape_text(_(plug->info->description), -1);
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
327
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
328 if (plug->error != NULL) {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
329 gchar *error = g_markup_escape_text(plug->error, -1);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
330 gchar *desc;
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
331 gchar *text = g_strdup_printf(
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
332 "<span size=\"larger\">%s %s</span>\n\n"
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
333 "<span weight=\"bold\" color=\"red\">%s</span>\n\n"
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
334 "%s",
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
335 name, plug->info->version, error, description);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
336 desc = g_strdup_printf("<b>%s</b> %s\n<span weight=\"bold\" color=\"red\"%s</span>",
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
337 plug->info->name, plug->info->version, error);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
338 gtk_list_store_set(GTK_LIST_STORE (model), iter,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
339 1, desc,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
340 -1);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
341 g_free(desc);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
342 g_free(error);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
343 gtk_label_set_markup(GTK_LABEL(plugin_details), text);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
344 g_free(text);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
345 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
346 g_free(name);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
347 g_free(description);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
348
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
349
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
350 gtk_list_store_set(GTK_LIST_STORE (model), iter,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
351 0, gaim_plugin_is_loaded(plug),
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
352 -1);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
353 g_free(iter);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
354
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
355 gaim_gtk_plugins_save();
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
356 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
357
11877
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
358 static gboolean ensure_plugin_visible(void *data)
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
359 {
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
360 GtkTreeSelection *sel = GTK_TREE_SELECTION(data);
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
361 GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel);
11877
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
362 GtkTreeModel *model = gtk_tree_view_get_model(tv);
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
363 GtkTreePath *path;
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
364 GtkTreeIter iter;
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
365 if (!gtk_tree_selection_get_selected (sel, &model, &iter))
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
366 return FALSE;
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
367 path = gtk_tree_model_get_path(model, &iter);
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
368 gtk_tree_view_scroll_to_cell(gtk_tree_selection_get_tree_view(sel), path, NULL, FALSE, 0, 0);
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
369 gtk_tree_path_free(path);
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
370 return FALSE;
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
371 }
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
372
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
373 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model)
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
374 {
11741
8034f752feae [gaim-migrate @ 14032]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
375 gchar *buf, *pname, *pdesc, *pauth, *pweb;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
376 GtkTreeIter iter;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12343
diff changeset
377 GValue val;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
378 GaimPlugin *plug;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
379
11833
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
380 if (!gtk_tree_selection_get_selected (sel, &model, &iter))
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
381 {
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
382 /* Clear the old plugin details */
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
383 gtk_label_set_markup(GTK_LABEL(plugin_details), "");
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
384 gtk_widget_set_sensitive(pref_button, FALSE);
12343
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
385
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
386 /* Collapse and disable the expander widget */
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
387 gtk_expander_set_expanded(GTK_EXPANDER(expander), FALSE);
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
388 gtk_widget_set_sensitive(expander, FALSE);
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
389
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
390 return;
11833
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
391 }
9d3ab7919ee0 [gaim-migrate @ 14124]
Mark Doliner <mark@kingant.net>
parents: 11817
diff changeset
392
12343
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
393 gtk_widget_set_sensitive(expander, TRUE);
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
394
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12343
diff changeset
395 val.g_type = 0;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
396 gtk_tree_model_get_value (model, &iter, 2, &val);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
397 plug = g_value_get_pointer(&val);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
398
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
399 pname = g_markup_escape_text(_(plug->info->name), -1);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
400 pdesc = (plug->info->description) ?
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
401 g_markup_escape_text(_(plug->info->description), -1) : NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
402 pauth = (plug->info->author) ?
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
403 g_markup_escape_text(_(plug->info->author), -1) : NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
404 pweb = (plug->info->homepage) ?
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
405 g_markup_escape_text(_(plug->info->homepage), -1) : NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
406 buf = g_strdup_printf(
11771
08b1dd8aa11c [gaim-migrate @ 14062]
Richard Laager <rlaager@wiktel.com>
parents: 11770
diff changeset
407 _("%s%s"
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
408 "<span weight=\"bold\">Written by:</span>\t%s\n"
12705
31b860fcf1aa [gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents: 12702
diff changeset
409 "<span weight=\"bold\">Website:</span>\t\t%s\n"
31b860fcf1aa [gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents: 12702
diff changeset
410 "<span weight=\"bold\">Filename:</span>\t\t%s"),
11771
08b1dd8aa11c [gaim-migrate @ 14062]
Richard Laager <rlaager@wiktel.com>
parents: 11770
diff changeset
411 pdesc ? pdesc : "", pdesc ? "\n\n" : "",
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
412 pauth ? pauth : "", pweb ? pweb : "", plug->path);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
413
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
414 if (plug->error != NULL)
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
415 {
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
416 char *tmp = g_strdup_printf(
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
417 _("%s\n"
12705
31b860fcf1aa [gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents: 12702
diff changeset
418 "<span foreground=\"#ff0000\" weight=\"bold\">"
31b860fcf1aa [gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents: 12702
diff changeset
419 "Error: %s\n"
31b860fcf1aa [gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents: 12702
diff changeset
420 "Check the plugin website for an update."
31b860fcf1aa [gaim-migrate @ 15048]
Richard Laager <rlaager@wiktel.com>
parents: 12702
diff changeset
421 "</span>"),
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
422 buf, plug->error);
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
423 g_free(buf);
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
424 buf = tmp;
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
425 }
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
426
11817
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
427 gtk_widget_set_sensitive(pref_button,
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
428 gaim_plugin_is_loaded(plug)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
429 && ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
430 && GAIM_GTK_PLUGIN_UI_INFO(plug)->get_config_frame)
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
431 || (plug->info->prefs_info
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
432 && plug->info->prefs_info->get_plugin_pref_frame)));
1bb0efbd4394 [gaim-migrate @ 14108]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11813
diff changeset
433
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
434 gtk_label_set_markup(GTK_LABEL(plugin_details), buf);
11877
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
435
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
436 /* Make sure the selected plugin is still visible */
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
437 g_idle_add(ensure_plugin_visible, sel);
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
438
f1f7c83d7b6c [gaim-migrate @ 14168]
Sean Egan <seanegan@gmail.com>
parents: 11843
diff changeset
439
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
440 g_value_unset(&val);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
441 g_free(buf);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
442 g_free(pname);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
443 g_free(pdesc);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
444 g_free(pauth);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
445 g_free(pweb);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
446 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
447
11741
8034f752feae [gaim-migrate @ 14032]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
448 static void plugin_dialog_response_cb(GtkWidget *d, int response, GtkTreeSelection *sel)
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
449 {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
450 GaimPlugin *plug;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
451 GtkWidget *dialog, *box;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
452 GtkTreeModel *model;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12343
diff changeset
453 GValue val;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
454 GtkTreeIter iter;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
455
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
456 switch (response) {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
457 case GTK_RESPONSE_CLOSE:
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
458 case GTK_RESPONSE_DELETE_EVENT:
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
459 gaim_request_close_with_handle(plugin_dialog);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
460 gaim_signals_disconnect_by_handle(plugin_dialog);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
461 gtk_widget_destroy(d);
11888
7d2d926704aa [gaim-migrate @ 14179]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11886
diff changeset
462 if (plugin_pref_dialogs != NULL) {
7d2d926704aa [gaim-migrate @ 14179]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11886
diff changeset
463 g_hash_table_destroy(plugin_pref_dialogs);
7d2d926704aa [gaim-migrate @ 14179]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11886
diff changeset
464 plugin_pref_dialogs = NULL;
7d2d926704aa [gaim-migrate @ 14179]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11886
diff changeset
465 }
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
466 plugin_dialog = NULL;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
467 break;
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
468 case GAIM_RESPONSE_CONFIGURE:
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
469 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
470 return;
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12343
diff changeset
471 val.g_type = 0;
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12343
diff changeset
472 gtk_tree_model_get_value(model, &iter, 2, &val);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
473 plug = g_value_get_pointer(&val);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
474 if (plug == NULL)
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
475 break;
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
476 if (plugin_pref_dialogs != NULL &&
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
477 g_hash_table_lookup(plugin_pref_dialogs, plug))
11770
d353f31d17a9 [gaim-migrate @ 14061]
Sean Egan <seanegan@gmail.com>
parents: 11751
diff changeset
478 break;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
479 box = gaim_gtk_plugin_get_config_frame(plug);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
480 if (box == NULL)
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
481 break;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
482
11741
8034f752feae [gaim-migrate @ 14032]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
483 dialog = gtk_dialog_new_with_buttons(GAIM_ALERT_TITLE, GTK_WINDOW(d),
11744
628dd7aa6509 [gaim-migrate @ 14035]
Sean Egan <seanegan@gmail.com>
parents: 11743
diff changeset
484 GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
485 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
486 NULL);
11781
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
487 if (plugin_pref_dialogs == NULL)
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
488 plugin_pref_dialogs = g_hash_table_new(NULL, NULL);
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
489
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
490 g_hash_table_insert(plugin_pref_dialogs, plug, dialog);
10317f1a2de2 [gaim-migrate @ 14072]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11777
diff changeset
491
11770
d353f31d17a9 [gaim-migrate @ 14061]
Sean Egan <seanegan@gmail.com>
parents: 11751
diff changeset
492 g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(pref_dialog_response_cb), plug);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
493 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), box);
11747
b8bf638cc4aa [gaim-migrate @ 14038]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11744
diff changeset
494 gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config");
12290
f17958be25ab [gaim-migrate @ 14594]
Mark Doliner <mark@kingant.net>
parents: 12276
diff changeset
495 gtk_window_set_title(GTK_WINDOW(dialog), _(gaim_plugin_get_name(plug)));
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
496 gtk_widget_show_all(dialog);
11770
d353f31d17a9 [gaim-migrate @ 14061]
Sean Egan <seanegan@gmail.com>
parents: 11751
diff changeset
497 g_value_unset(&val);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
498 break;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
499 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
500 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
501
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
502 static void
13716
963703ee5f91 [gaim-migrate @ 16125]
Richard Laager <rlaager@wiktel.com>
parents: 13435
diff changeset
503 show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, GtkWidget *dialog)
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
504 {
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
505 GtkTreeSelection *sel;
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
506 GtkTreeIter iter;
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
507 GaimPlugin *plugin;
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
508 GtkTreeModel *model;
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
509
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
510 sel = gtk_tree_view_get_selection(view);
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
511
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
512 if (!gtk_tree_selection_get_selected(sel, &model, &iter))
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
513 return;
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
514
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
515 gtk_tree_model_get(model, &iter, 2, &plugin, -1);
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
516
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
517 if (!gaim_plugin_is_loaded(plugin))
12174
c7652a910308 [gaim-migrate @ 14476]
Richard Laager <rlaager@wiktel.com>
parents: 12162
diff changeset
518 return;
c7652a910308 [gaim-migrate @ 14476]
Richard Laager <rlaager@wiktel.com>
parents: 12162
diff changeset
519
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
520 /* Now show the pref-dialog for the plugin */
13716
963703ee5f91 [gaim-migrate @ 16125]
Richard Laager <rlaager@wiktel.com>
parents: 13435
diff changeset
521 plugin_dialog_response_cb(dialog, GAIM_RESPONSE_CONFIGURE, sel);
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
522 }
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
523
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
524 void gaim_gtk_plugin_dialog_show()
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
525 {
11741
8034f752feae [gaim-migrate @ 14032]
Sean Egan <seanegan@gmail.com>
parents: 11740
diff changeset
526 GtkWidget *sw;
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
527 GtkWidget *event_view;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
528 GtkListStore *ls;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
529 GtkCellRenderer *rend, *rendt;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
530 GtkTreeViewColumn *col;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
531 GtkTreeSelection *sel;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
532
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
533 if (plugin_dialog != NULL) {
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
534 gtk_window_present(GTK_WINDOW(plugin_dialog));
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
535 return;
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
536 }
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
537
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
538 plugin_dialog = gtk_dialog_new_with_buttons(_("Plugins"),
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
539 NULL,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
540 GTK_DIALOG_NO_SEPARATOR,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
541 NULL);
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
542 pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
12276
b3652193d359 [gaim-migrate @ 14580]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12246
diff changeset
543 _("Configure Pl_ugin"), GAIM_RESPONSE_CONFIGURE);
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
544 gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
545 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
11813
1f7f4f850db5 [gaim-migrate @ 14104]
Gary Kramlich <grim@reaperworld.com>
parents: 11794
diff changeset
546 gtk_widget_set_sensitive(pref_button, FALSE);
11747
b8bf638cc4aa [gaim-migrate @ 14038]
Etan Reisner <pidgin@unreliablesource.net>
parents: 11744
diff changeset
547 gtk_window_set_role(GTK_WINDOW(plugin_dialog), "plugins");
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
548
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
549 sw = gtk_scrolled_window_new(NULL,NULL);
13773
3ac2d64a74a0 [gaim-migrate @ 16185]
Richard Laager <rlaager@wiktel.com>
parents: 13716
diff changeset
550 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
551 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
552
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
553 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), sw, TRUE, TRUE, 0);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
554
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
555 ls = gtk_list_store_new(4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
556 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls),
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
557 1, GTK_SORT_ASCENDING);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
558
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
559 update_plugin_list(ls);
11813
1f7f4f850db5 [gaim-migrate @ 14104]
Gary Kramlich <grim@reaperworld.com>
parents: 11794
diff changeset
560
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
561 event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(ls));
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
562
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
563 g_signal_connect(G_OBJECT(event_view), "row-activated",
13716
963703ee5f91 [gaim-migrate @ 16125]
Richard Laager <rlaager@wiktel.com>
parents: 13435
diff changeset
564 G_CALLBACK(show_plugin_prefs_cb), plugin_dialog);
12162
5e24b8e49522 [gaim-migrate @ 14463]
Richard Laager <rlaager@wiktel.com>
parents: 12066
diff changeset
565
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
566 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-load", plugin_dialog,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
567 GAIM_CALLBACK(plugin_load_cb), event_view);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
568 gaim_signal_connect(gaim_plugins_get_handle(), "plugin-unload", plugin_dialog,
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
569 GAIM_CALLBACK(plugin_unload_cb), event_view);
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
570
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
571 rend = gtk_cell_renderer_toggle_new();
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
572 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view));
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
573
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
574 col = gtk_tree_view_column_new_with_attributes (_("Enabled"),
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
575 rend,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
576 "active", 0,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
577 NULL);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
578 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
11794
f5105a2b8bf6 [gaim-migrate @ 14085]
Gary Kramlich <grim@reaperworld.com>
parents: 11783
diff changeset
579 gtk_tree_view_column_set_sort_column_id(col, 0);
12927
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
580 g_signal_connect(G_OBJECT(rend), "toggled",
3cc18baeaca3 [gaim-migrate @ 15280]
Richard Laager <rlaager@wiktel.com>
parents: 12889
diff changeset
581 G_CALLBACK(plugin_toggled), ls);
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
582
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
583 rendt = gtk_cell_renderer_text_new();
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
584 g_object_set(rendt,
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
585 "foreground", "#c0c0c0",
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
586 NULL);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
587 col = gtk_tree_view_column_new_with_attributes (_("Name"),
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
588 rendt,
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
589 "markup", 1,
12695
0bc110c7ab91 [gaim-migrate @ 15038]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
590 "foreground-set", 3,
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
591 NULL);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
592 #if GTK_CHECK_VERSION(2,6,0)
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
593 gtk_tree_view_column_set_expand (col, TRUE);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
594 g_object_set(rendt, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
595 #endif
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
596 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
11794
f5105a2b8bf6 [gaim-migrate @ 14085]
Gary Kramlich <grim@reaperworld.com>
parents: 11783
diff changeset
597 gtk_tree_view_column_set_sort_column_id(col, 1);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
598 g_object_unref(G_OBJECT(ls));
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
599 gtk_container_add(GTK_CONTAINER(sw), event_view);
12246
b7a51e68d0b8 [gaim-migrate @ 14548]
Mark Doliner <mark@kingant.net>
parents: 12240
diff changeset
600
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
601 expander = gtk_expander_new(_("<b>Plugin Details</b>"));
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
602 gtk_expander_set_use_markup(GTK_EXPANDER(expander), TRUE);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
603 plugin_details = gtk_label_new(NULL);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
604 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
605 gtk_container_add(GTK_CONTAINER(expander), plugin_details);
12343
a02f877637a6 [gaim-migrate @ 14647]
Mark Doliner <mark@kingant.net>
parents: 12290
diff changeset
606 gtk_widget_set_sensitive(expander, FALSE);
11740
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
607 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), expander, FALSE, FALSE, 0);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
608
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
609 g_signal_connect (G_OBJECT (sel), "changed", G_CALLBACK (prefs_plugin_sel), NULL);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
610 g_signal_connect(G_OBJECT(plugin_dialog), "response", G_CALLBACK(plugin_dialog_response_cb), sel);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
611 gtk_window_set_default_size(GTK_WINDOW(plugin_dialog), 430, 430);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
612 gtk_widget_show_all(plugin_dialog);
7e0ad3b6882a [gaim-migrate @ 14031]
Sean Egan <seanegan@gmail.com>
parents: 9791
diff changeset
613 }