Mercurial > pidgin
annotate src/plugins.c @ 3387:c434f13dfa9b
[gaim-migrate @ 3406]
Even though we don't compile libicq anymore, it does have to be in
DIST_SUBDIRS, so that a make dist or make distcheck won't die on us.
We should probably remove it from configure.in (the line with
src/protocols/icqMakefile in AC_OUTPUT()). Then we can remove it from here.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 08 Aug 2002 17:42:08 +0000 |
parents | 3cd2fbddf95a |
children | 7a3f16a375a5 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 * ---------------- | |
21 * The Plug-in plug | |
22 * | |
23 * Plugin support is currently being maintained by Mike Saraf | |
24 * msaraf@dwc.edu | |
25 * | |
90 | 26 * Well, I didn't see any work done on it for a while, so I'm going to try |
27 * my hand at it. - Eric warmenhoven@yahoo.com | |
28 * | |
1745 | 29 * Mike is my roomate. I can assure you that he's lazy :-P -- Rob rob@marko.net |
30 * | |
1 | 31 */ |
32 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
33 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
34 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
35 #endif |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
176
diff
changeset
|
36 |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
37 #ifdef GAIM_PLUGINS |
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
38 |
1 | 39 #include <string.h> |
40 #include <sys/time.h> | |
41 | |
42 #include <sys/types.h> | |
43 #include <sys/stat.h> | |
44 | |
45 #include <unistd.h> | |
46 #include <stdio.h> | |
47 #include <stdlib.h> | |
48 #include <gtk/gtk.h> | |
49 #include "gaim.h" | |
50 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
51 #include "pixmaps/gnome_add.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
52 #include "pixmaps/gnome_remove.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
53 #include "pixmaps/gnome_preferences.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
54 #include "pixmaps/refresh.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
55 #include "pixmaps/cancel.xpm" |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
56 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
57 #define PATHSIZE 1024 /* XXX: stolen from dialogs.c */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
58 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
59 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
60 /* ------------------ Local Variables ------------------------ */ |
1 | 61 |
90 | 62 static GtkWidget *plugin_dialog = NULL; |
63 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
64 static GtkWidget *pluglist = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
65 static GtkWidget *plugtext = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
66 static GtkWidget *plugwindow = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
67 static GtkWidget *plugentry = NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
68 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
69 static GtkTooltips *tooltips = NULL; |
1 | 70 |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
71 static GtkWidget *config = NULL; |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
72 static guint confighandle = 0; |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
73 static GtkWidget *reload = NULL; |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
74 static GtkWidget *unload = NULL; |
2405
6e637ad18494
[gaim-migrate @ 2418]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2393
diff
changeset
|
75 extern char *last_dir; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
76 |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
77 /* --------------- Function Declarations --------------------- */ |
1 | 78 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
79 void show_plugins(GtkWidget *, gpointer); |
94
9f6ce50ffb78
[gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
92
diff
changeset
|
80 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
81 /* UI button callbacks */ |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
82 static void unload_plugin_cb(GtkWidget *, gpointer); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
83 static void plugin_reload_cb(GtkWidget *, gpointer); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
84 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
85 static const gchar *plugin_makelistname(GModule *); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
86 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
87 static void destroy_plugins(GtkWidget *, gpointer); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
88 static void load_file(GtkWidget *, gpointer); |
90 | 89 static void load_which_plugin(GtkWidget *, gpointer); |
2494
2c1950c5544a
[gaim-migrate @ 2507]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2405
diff
changeset
|
90 void update_show_plugins(); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
91 static void hide_plugins(GtkWidget *, gpointer); |
3374 | 92 static void clear_plugin_display(); |
93 #if GTK_CHECK_VERSION(1,3,0) | |
94 static struct gaim_plugin *get_selected_plugin(GtkWidget *); | |
95 static void select_plugin(GtkWidget *w, struct gaim_plugin *p); | |
96 static void list_clicked(GtkWidget *, gpointer); | |
97 #else | |
98 static void list_clicked(GtkWidget *, struct gaim_plugin *); | |
99 #endif | |
90 | 100 |
1 | 101 /* ------------------ Code Below ---------------------------- */ |
102 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
103 static void destroy_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
104 { |
90 | 105 if (plugin_dialog) |
106 gtk_widget_destroy(plugin_dialog); | |
107 plugin_dialog = NULL; | |
108 } | |
109 | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
110 static void load_file(GtkWidget *w, gpointer data) |
1 | 111 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
112 gchar *buf; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
113 |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
114 if (plugin_dialog) { |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
115 gtk_widget_show(plugin_dialog); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
116 gdk_window_raise(plugin_dialog->window); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
117 return; |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
118 } |
90 | 119 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
120 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List")); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
121 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
122 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugin_dialog)); |
90 | 123 |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
124 if (!last_dir) |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
125 buf = g_strdup(LIBDIR); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
126 else |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
127 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL); |
1 | 128 |
90 | 129 gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
130 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so"); |
90 | 131 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
132 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); |
90 | 133 |
134 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button), | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
135 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
136 |
90 | 137 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button), |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
138 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL); |
90 | 139 |
140 g_free(buf); | |
626
d86cc11faab8
[gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
141 gtk_widget_show(plugin_dialog); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
142 gdk_window_raise(plugin_dialog->window); |
90 | 143 } |
1 | 144 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
145 static void load_which_plugin(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
146 { |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
147 char *file; |
3374 | 148 struct gaim_plugin *p; |
149 | |
150 file = (char *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(plugin_dialog)); | |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
151 if (file_is_dir(file, plugin_dialog)) { |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
152 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
153 } |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
154 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
155 if (file) |
3374 | 156 p = load_plugin(file); |
157 else | |
158 p = NULL; | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
159 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
160 if (plugin_dialog) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
161 gtk_widget_destroy(plugin_dialog); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
162 plugin_dialog = NULL; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
163 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
164 update_show_plugins(); |
3374 | 165 /* Select newly loaded plugin */ |
166 if(p == NULL) | |
167 return; | |
168 #if GTK_CHECK_VERSION(1,3,0) | |
169 select_plugin(pluglist, p); | |
170 #else | |
171 gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, p)); | |
172 #endif | |
90 | 173 } |
1 | 174 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
175 void show_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
176 { |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
177 /* most of this code was shamelessly stolen from Glade */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
178 GtkWidget *mainvbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
179 GtkWidget *tophbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
180 GtkWidget *bothbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
181 GtkWidget *hbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
182 GtkWidget *vbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
183 GtkWidget *frame; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
184 GtkWidget *scrolledwindow; |
90 | 185 GtkWidget *label; |
186 GtkWidget *add; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
187 GtkWidget *close; |
3374 | 188 #if GTK_CHECK_VERSION(1,3,0) |
189 /* stuff needed for GtkTreeView *pluglist */ | |
190 GtkListStore *store; | |
191 GtkCellRenderer *renderer; | |
192 GtkTreeViewColumn *column; | |
193 GtkTreeSelection *selection; | |
194 /* needed for GtkTextView *plugtext */ | |
195 GtkTextBuffer *buffer; | |
196 #endif | |
197 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
198 if (plugwindow) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
199 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
200 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2494
diff
changeset
|
201 GAIM_DIALOG(plugwindow); |
905 | 202 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim"); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
203 gtk_widget_realize(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
204 aol_icon(plugwindow->window); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
205 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins")); |
3374 | 206 #if !GTK_CHECK_VERSION(1,3,0) |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
207 gtk_widget_set_usize(plugwindow, 515, 300); |
3374 | 208 #endif |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
209 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
90 | 210 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
211 mainvbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
212 gtk_container_add(GTK_CONTAINER(plugwindow), mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
213 gtk_widget_show(mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
214 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
215 /* Build the top */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
216 tophbox = gtk_hbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
217 gtk_box_pack_start(GTK_BOX(mainvbox), tophbox, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
218 gtk_widget_show(tophbox); |
90 | 219 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
220 /* Left side: frame with list of plugin file names */ |
3025 | 221 frame = gtk_frame_new(_("Loaded Plugins")); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
222 gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0); |
3374 | 223 #if !GTK_CHECK_VERSION(1,3,0) |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
224 gtk_widget_set_usize(frame, 140, -1); |
3374 | 225 #endif |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
226 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
227 gtk_frame_set_label_align(GTK_FRAME(frame), 0.05, 0.5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
228 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
229 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
230 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
231 gtk_container_add(GTK_CONTAINER(frame), scrolledwindow); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
232 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
233 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
234 gtk_widget_show(scrolledwindow); |
3374 | 235 #if GTK_CHECK_VERSION(1,3,0) |
236 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), | |
237 GTK_SHADOW_IN); | |
90 | 238 |
3374 | 239 /* Create & show plugin list */ |
240 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); | |
241 pluglist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); | |
242 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pluglist), FALSE); | |
243 renderer = gtk_cell_renderer_text_new(); | |
244 column = gtk_tree_view_column_new_with_attributes("text", | |
245 renderer, "text", 0, NULL); | |
246 gtk_tree_view_append_column(GTK_TREE_VIEW(pluglist), column); | |
247 gtk_container_add(GTK_CONTAINER(scrolledwindow), pluglist); | |
248 | |
249 g_object_unref(G_OBJECT(store)); | |
250 | |
251 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pluglist)); | |
252 g_signal_connect(G_OBJECT(selection), "changed", | |
253 G_CALLBACK(list_clicked), | |
254 NULL); | |
255 #else | |
90 | 256 pluglist = gtk_list_new(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
257 gtk_list_set_selection_mode(GTK_LIST(pluglist), GTK_SELECTION_BROWSE); |
3374 | 258 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), |
259 pluglist); | |
260 #endif /* GTK_CHECK_VERSION */ | |
261 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
262 gtk_widget_show(pluglist); |
90 | 263 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
264 /* Right side: frame with description and the filepath of plugin */ |
3374 | 265 frame = gtk_frame_new(_("Selected Plugin")); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
266 gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
267 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
268 gtk_frame_set_label_align(GTK_FRAME(frame), 0.05, 0.5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
269 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
270 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
271 vbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
272 gtk_container_add(GTK_CONTAINER(frame), vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
273 gtk_widget_show(vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
274 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
275 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
276 gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
277 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
278 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
279 gtk_widget_show(scrolledwindow); |
3374 | 280 #if GTK_CHECK_VERSION(1,3,0) |
281 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow), | |
282 GTK_SHADOW_IN); | |
283 | |
284 /* Create & show the plugin description widget */ | |
285 plugtext = gtk_text_view_new(); | |
286 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(plugtext), GTK_WRAP_WORD); | |
287 gtk_text_view_set_editable(GTK_TEXT_VIEW(plugtext), FALSE); | |
288 gtk_container_add(GTK_CONTAINER(scrolledwindow), plugtext); | |
289 gtk_widget_set_size_request(GTK_WIDGET(plugtext), -1, 200); | |
290 | |
291 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext)); | |
292 gtk_text_buffer_create_tag(buffer, "bold", "weight", | |
293 PANGO_WEIGHT_BOLD, NULL); | |
294 #else | |
90 | 295 plugtext = gtk_text_new(NULL, NULL); |
3374 | 296 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), |
297 plugtext); | |
90 | 298 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE); |
299 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE); | |
3374 | 300 #endif |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
301 gtk_widget_show(plugtext); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
302 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
303 hbox = gtk_hbox_new(FALSE, 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
304 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
305 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
306 gtk_widget_show(hbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
307 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
308 label = gtk_label_new(_("Filepath:")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
309 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
310 gtk_widget_show(label); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
311 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
312 plugentry = gtk_entry_new(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
313 gtk_box_pack_start(GTK_BOX(hbox), plugentry, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
314 gtk_entry_set_editable(GTK_ENTRY(plugentry), FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
315 gtk_widget_show(plugentry); |
90 | 316 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
317 /* Build the bottom button bar */ |
3374 | 318 bothbox = gtk_hbox_new(TRUE, 3); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
319 gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
320 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
321 gtk_widget_show(bothbox); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
322 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
323 if (!tooltips) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
324 tooltips = gtk_tooltips_new(); |
90 | 325 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
326 add = picture_button(plugwindow, _("Load"), gnome_add_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
327 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL); |
3374 | 328 gtk_box_pack_start_defaults(GTK_BOX(bothbox), add); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
329 gtk_tooltips_set_tip(tooltips, add, _("Load a plugin from a file"), ""); |
90 | 330 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
331 config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
332 gtk_widget_set_sensitive(config, FALSE); |
3374 | 333 gtk_box_pack_start_defaults(GTK_BOX(bothbox), config); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
334 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), ""); |
90 | 335 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
336 reload = picture_button(plugwindow, _("Reload"), refresh_xpm); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
337 gtk_widget_set_sensitive(reload, FALSE); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
338 gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL); |
3374 | 339 gtk_box_pack_start_defaults(GTK_BOX(bothbox), reload); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
340 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), ""); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
341 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
342 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm); |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
343 gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin_cb), pluglist); |
3374 | 344 gtk_box_pack_start_defaults(GTK_BOX(bothbox), unload); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
345 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), ""); |
90 | 346 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
347 close = picture_button(plugwindow, _("Close"), cancel_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
348 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
3374 | 349 gtk_box_pack_start_defaults(GTK_BOX(bothbox), close); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
350 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), ""); |
90 | 351 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
352 update_show_plugins(); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
353 gtk_widget_show(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
354 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
355 |
2494
2c1950c5544a
[gaim-migrate @ 2507]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2405
diff
changeset
|
356 void update_show_plugins() |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
357 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
358 GList *plugs = plugins; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
359 struct gaim_plugin *p; |
3374 | 360 #if GTK_CHECK_VERSION(1,3,0) |
361 int pnum = 0; | |
362 GtkListStore *store; | |
363 GtkTreeIter iter; | |
364 #else | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
365 GtkWidget *label; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
366 GtkWidget *list_item; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
367 GtkWidget *hbox; |
3374 | 368 #endif |
369 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
370 if (plugwindow == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
371 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
372 |
3374 | 373 #if GTK_CHECK_VERSION(1,3,0) |
374 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pluglist))); | |
375 gtk_list_store_clear(store); | |
376 #else | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
377 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1); |
3374 | 378 #endif |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
379 while (plugs) { |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
380 p = (struct gaim_plugin *)plugs->data; |
3374 | 381 #if GTK_CHECK_VERSION(1,3,0) |
382 gtk_list_store_append(store, &iter); | |
383 gtk_list_store_set(store, &iter, 0, plugin_makelistname(p->handle), -1); | |
384 gtk_list_store_set(store, &iter, 1, pnum++, -1); | |
385 #else | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
386 label = gtk_label_new(plugin_makelistname(p->handle)); |
3374 | 387 hbox = gtk_hbox_new(FALSE, 0); /* for left justification */ |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
388 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
389 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
390 list_item = gtk_list_item_new(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
391 gtk_container_add(GTK_CONTAINER(list_item), hbox); |
3374 | 392 gtk_signal_connect(GTK_OBJECT(list_item), "select", |
393 GTK_SIGNAL_FUNC(list_clicked), p); | |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
394 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
3374 | 395 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
396 gtk_widget_show(hbox); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
397 gtk_widget_show(label); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
398 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
399 gtk_widget_show(list_item); |
3374 | 400 #endif |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
401 plugs = g_list_next(plugs); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
402 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
403 |
3374 | 404 clear_plugin_display(); |
1 | 405 } |
406 | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
407 static void unload_plugin_cb(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
408 { |
3374 | 409 struct gaim_plugin *p; |
410 #if GTK_CHECK_VERSION(1,3,0) | |
411 p = get_selected_plugin(pluglist); | |
412 if(p == NULL) | |
413 return; | |
414 #else | |
90 | 415 GList *i; |
3374 | 416 |
90 | 417 i = GTK_LIST(pluglist)->selection; |
418 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
419 if (i == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
420 return; |
90 | 421 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
422 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
3374 | 423 #endif |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
424 unload_plugin(p); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
425 update_show_plugins(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
426 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
427 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
428 static void plugin_reload_cb(GtkWidget *w, gpointer data) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
429 { |
3374 | 430 struct gaim_plugin *p; |
431 #if GTK_CHECK_VERSION(1,3,0) | |
432 p = get_selected_plugin(pluglist); | |
433 if(p == NULL) | |
434 return; | |
435 p = reload_plugin(p); | |
436 #else | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
437 GList *i; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
438 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
439 i = GTK_LIST(pluglist)->selection; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
440 if (i == NULL) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
441 return; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
442 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
443 /* Just pass off plugin to the actual function */ |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
444 p = reload_plugin(gtk_object_get_user_data(GTK_OBJECT(i->data))); |
3374 | 445 #endif |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
446 update_show_plugins(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
447 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
448 /* Try and reselect the plugin in list */ |
2280
13d5d7e829c9
[gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2274
diff
changeset
|
449 if (!pluglist) |
13d5d7e829c9
[gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2274
diff
changeset
|
450 return; |
3374 | 451 #if GTK_CHECK_VERSION(1,3,0) |
452 select_plugin(pluglist, p); | |
453 #else | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
454 gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, p)); |
3374 | 455 #endif |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
456 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
457 |
3374 | 458 |
459 #if GTK_CHECK_VERSION(1,3,0) | |
460 static void list_clicked(GtkWidget *w, gpointer data) | |
461 #else | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
462 static void list_clicked(GtkWidget *w, struct gaim_plugin *p) |
3374 | 463 #endif |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
464 { |
3374 | 465 void (*gaim_plugin_config)(); |
466 #if GTK_CHECK_VERSION(1,3,0) | |
467 struct gaim_plugin *p; | |
468 GtkTextBuffer *buffer; | |
469 GtkTextIter iter; | |
470 #else | |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
471 gchar *temp; |
90 | 472 guint text_len; |
3374 | 473 #endif |
474 | |
475 if (confighandle != 0) { | |
476 gtk_signal_disconnect(GTK_OBJECT(config), confighandle); | |
477 confighandle = 0; | |
478 } | |
479 | |
480 #if GTK_CHECK_VERSION(1,3,0) | |
481 p = get_selected_plugin(pluglist); | |
482 if(p == NULL) { /* No selected plugin */ | |
483 clear_plugin_display(); | |
484 return; | |
485 } | |
90 | 486 |
3374 | 487 /* Set text and filepath widgets */ |
488 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext)); | |
489 gtk_text_buffer_set_text(buffer, "", -1); | |
490 gtk_text_buffer_get_start_iter(buffer, &iter); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
491 |
3374 | 492 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, "Name:", -1, |
493 "bold", NULL); | |
494 gtk_text_buffer_insert(buffer, &iter, " ", -1); | |
495 gtk_text_buffer_insert(buffer, &iter, (p->name != NULL) ? p->name : "", -1); | |
496 gtk_text_buffer_insert(buffer, &iter, "\n\n", -1); | |
497 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, "Description:", -1, | |
498 "bold", NULL); | |
499 gtk_text_buffer_insert(buffer, &iter, "\n", -1); | |
500 gtk_text_buffer_insert(buffer, &iter, | |
501 (p->description != NULL) ? p->description : "", -1); | |
502 | |
503 gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle)); | |
504 #else | |
90 | 505 text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
506 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
507 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
508 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
509 temp = g_strdup_printf("Name: %s\n\nDescription:\n%s", |
3374 | 510 (p->name != NULL) ? p->name : "", |
511 (p->description != NULL) ? p->description : ""); | |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
512 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1); |
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
513 g_free(temp); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
514 gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle)); |
3374 | 515 #endif |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
516 /* Find out if this plug-in has a configuration function */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
517 if (g_module_symbol(p->handle, "gaim_plugin_config", (gpointer *)&gaim_plugin_config)) { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
518 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
519 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
520 gtk_widget_set_sensitive(config, TRUE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
521 } else { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
522 confighandle = 0; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
523 gtk_widget_set_sensitive(config, FALSE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
524 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
525 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
526 gtk_widget_set_sensitive(reload, TRUE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
527 gtk_widget_set_sensitive(unload, TRUE); |
90 | 528 } |
529 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
530 static void hide_plugins(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
531 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
532 if (plugwindow) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
533 gtk_widget_destroy(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
534 plugwindow = NULL; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
535 config = NULL; |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
536 confighandle = 0; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
537 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
538 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
539 static const gchar *plugin_makelistname(GModule *module) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
540 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
541 static gchar filename[PATHSIZE]; |
3374 | 542 gchar *filepath = (char *)g_module_name(module); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
543 char *cp; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
544 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
545 if (filepath == NULL || strlen(filepath) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
546 return NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
547 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
548 if ((cp = strrchr(filepath, '/')) == NULL || *++cp == '\0') |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
549 cp = filepath; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
550 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
551 strncpy(filename, cp, sizeof(filename)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
552 filename[sizeof(filename) - 1] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
553 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
554 /* Try to pretty name by removing any trailing ".so" */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
555 if (strlen(filename) > 3 && |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
556 strncmp(filename + strlen(filename) - 3, ".so", 3) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
557 filename[strlen(filename) - 3] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
558 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
559 return filename; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
560 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
561 |
3374 | 562 #if GTK_CHECK_VERSION(1,3,0) |
563 static struct gaim_plugin *get_selected_plugin(GtkWidget *w) { | |
564 /* Given the pluglist widget, this will return a pointer to the plugin | |
565 * currently selected in the list, and NULL if none is selected. */ | |
566 gint index; | |
567 GList *plugs = plugins; | |
568 GtkTreeSelection *sel; | |
569 GtkTreeIter iter; | |
570 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(w)); | |
571 | |
572 /* Get list index of selected plugin */ | |
573 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w)); | |
574 if(!gtk_tree_selection_get_selected(sel, &model, &iter)) | |
575 return NULL; | |
576 gtk_tree_model_get(model, &iter, 1, &index, -1); | |
577 | |
578 /* Get plugin entry from index */ | |
579 plugs = g_list_nth(plugins, index); | |
580 if(plugs == NULL) | |
581 return NULL; | |
582 else | |
583 return (struct gaim_plugin *)plugs->data; | |
584 } | |
585 | |
586 static void select_plugin(GtkWidget *w, struct gaim_plugin *p) { | |
587 /* Given the pluglist widget and a plugin, this will try to select | |
588 * entry in the list which corresponds with the plugin. */ | |
589 GtkTreeSelection *sel; | |
590 GtkTreeIter iter; | |
591 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(w)); | |
592 gchar temp[10]; | |
593 | |
594 if(g_list_index(plugins, p) == -1) | |
595 return; | |
596 | |
597 snprintf(temp, 10, "%d", g_list_index(plugins, p)); | |
598 gtk_tree_model_get_iter_from_string(model, | |
599 &iter, temp); | |
600 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w)); | |
601 gtk_tree_selection_select_iter(sel, &iter); | |
602 } | |
603 #endif /* GTK_CHECK_VERSION */ | |
604 | |
605 static void clear_plugin_display() { | |
606 #if GTK_CHECK_VERSION(1,3,0) | |
607 GtkTreeSelection *selection; | |
608 GtkTextBuffer *buffer; | |
609 | |
610 /* Clear the plugin display if nothing's selected */ | |
611 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pluglist)); | |
612 if(gtk_tree_selection_get_selected(selection, NULL, NULL) == FALSE) { | |
613 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext)); | |
614 gtk_text_buffer_set_text(buffer, "", -1); | |
615 gtk_entry_set_text(GTK_ENTRY(plugentry), ""); | |
616 | |
617 gtk_widget_set_sensitive(config, FALSE); | |
618 gtk_widget_set_sensitive(reload, FALSE); | |
619 gtk_widget_set_sensitive(unload, FALSE); | |
620 } | |
621 #else | |
622 /* Clear the display if nothing's selected */ | |
623 if (GTK_LIST(pluglist)->selection == NULL) { | |
624 guint text_len = gtk_text_get_length(GTK_TEXT(plugtext)); | |
625 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
626 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
627 gtk_entry_set_text(GTK_ENTRY(plugentry), ""); | |
628 | |
629 gtk_widget_set_sensitive(config, FALSE); | |
630 gtk_widget_set_sensitive(reload, FALSE); | |
631 gtk_widget_set_sensitive(unload, FALSE); | |
632 } | |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
633 #endif |
3374 | 634 } |
635 | |
636 #endif |