Mercurial > pidgin
annotate src/plugins.c @ 3078:2e324d44dd65
[gaim-migrate @ 3092]
i dont know
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Mon, 18 Mar 2002 03:43:57 +0000 |
parents | 0486d3d00d0e |
children | 3cd2fbddf95a |
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); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
90 static void list_clicked(GtkWidget *, struct gaim_plugin *); |
2494
2c1950c5544a
[gaim-migrate @ 2507]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2405
diff
changeset
|
91 void update_show_plugins(); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
92 static void hide_plugins(GtkWidget *, gpointer); |
90 | 93 |
1 | 94 /* ------------------ Code Below ---------------------------- */ |
95 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
96 static void destroy_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
97 { |
90 | 98 if (plugin_dialog) |
99 gtk_widget_destroy(plugin_dialog); | |
100 plugin_dialog = NULL; | |
101 } | |
102 | |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
103 static void load_file(GtkWidget *w, gpointer data) |
1 | 104 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
105 gchar *buf; |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
106 |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
107 if (plugin_dialog) { |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
108 gtk_widget_show(plugin_dialog); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
109 gdk_window_raise(plugin_dialog->window); |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
110 return; |
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
111 } |
90 | 112 |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
113 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List")); |
138
e8ea1e2fdf0c
[gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
134
diff
changeset
|
114 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
115 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugin_dialog)); |
90 | 116 |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
117 if (!last_dir) |
1163
8f70ecf3e884
[gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1145
diff
changeset
|
118 buf = g_strdup(LIBDIR); |
153
8ed64c704fb0
[gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
142
diff
changeset
|
119 else |
1025
84a5d80e52f1
[gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1000
diff
changeset
|
120 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL); |
1 | 121 |
90 | 122 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
|
123 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so"); |
90 | 124 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
125 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); |
90 | 126 |
127 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
|
128 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
129 |
90 | 130 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
|
131 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL); |
90 | 132 |
133 g_free(buf); | |
626
d86cc11faab8
[gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
134 gtk_widget_show(plugin_dialog); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
135 gdk_window_raise(plugin_dialog->window); |
90 | 136 } |
1 | 137 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
138 static void load_which_plugin(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
139 { |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
140 char *file; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
141 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
142 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plugin_dialog)); |
1035
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
143 if (file_is_dir(file, plugin_dialog)) { |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
144 return; |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
145 } |
80a47e3b1bca
[gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1025
diff
changeset
|
146 |
1710
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
147 if (file) |
f42ce672c560
[gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1429
diff
changeset
|
148 load_plugin(file); |
142
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
149 |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
150 if (plugin_dialog) |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
151 gtk_widget_destroy(plugin_dialog); |
fbabd28795d2
[gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
139
diff
changeset
|
152 plugin_dialog = NULL; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
153 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
154 update_show_plugins(); |
90 | 155 } |
1 | 156 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
157 void show_plugins(GtkWidget *w, gpointer data) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
158 { |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
159 /* most of this code was shamelessly stolen from Glade */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
160 GtkWidget *mainvbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
161 GtkWidget *tophbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
162 GtkWidget *bothbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
163 GtkWidget *hbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
164 GtkWidget *vbox; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
165 GtkWidget *frame; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
166 GtkWidget *scrolledwindow; |
90 | 167 GtkWidget *label; |
168 GtkWidget *add; | |
96
247f540ea6e1
[gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
94
diff
changeset
|
169 GtkWidget *close; |
90 | 170 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
171 if (plugwindow) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
172 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
173 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2494
diff
changeset
|
174 GAIM_DIALOG(plugwindow); |
905 | 175 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim"); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
176 gtk_widget_realize(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
177 aol_icon(plugwindow->window); |
350
fd3cc0a28d5d
[gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
178 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins")); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
179 gtk_widget_set_usize(plugwindow, 515, 300); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
180 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
90 | 181 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
182 mainvbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
183 gtk_container_add(GTK_CONTAINER(plugwindow), mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
184 gtk_widget_show(mainvbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
185 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
186 /* Build the top */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
187 tophbox = gtk_hbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
188 gtk_box_pack_start(GTK_BOX(mainvbox), tophbox, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
189 gtk_widget_show(tophbox); |
90 | 190 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
191 /* Left side: frame with list of plugin file names */ |
3025 | 192 frame = gtk_frame_new(_("Loaded Plugins")); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
193 gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
194 gtk_widget_set_usize(frame, 140, -1); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
195 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
196 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
|
197 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
198 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
199 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
200 gtk_container_add(GTK_CONTAINER(frame), scrolledwindow); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
201 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
202 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
203 gtk_widget_show(scrolledwindow); |
90 | 204 |
205 pluglist = gtk_list_new(); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
206 gtk_list_set_selection_mode(GTK_LIST(pluglist), GTK_SELECTION_BROWSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
207 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), pluglist); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
208 gtk_widget_show(pluglist); |
90 | 209 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
210 /* Right side: frame with description and the filepath of plugin */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
211 frame = gtk_frame_new(_("Description")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
212 gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
213 gtk_container_set_border_width(GTK_CONTAINER(frame), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
214 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
|
215 gtk_widget_show(frame); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
216 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
217 vbox = gtk_vbox_new(FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
218 gtk_container_add(GTK_CONTAINER(frame), vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
219 gtk_widget_show(vbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
220 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
221 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
222 gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
223 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
224 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
225 gtk_widget_show(scrolledwindow); |
90 | 226 |
227 plugtext = gtk_text_new(NULL, NULL); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
228 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), plugtext); |
90 | 229 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE); |
230 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE); | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
231 gtk_widget_show(plugtext); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
232 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
233 hbox = gtk_hbox_new(FALSE, 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
234 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
235 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
236 gtk_widget_show(hbox); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
237 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
238 label = gtk_label_new(_("Filepath:")); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
239 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
240 gtk_widget_show(label); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
241 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
242 plugentry = gtk_entry_new(); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
243 gtk_box_pack_start(GTK_BOX(hbox), plugentry, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
244 gtk_entry_set_editable(GTK_ENTRY(plugentry), FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
245 gtk_widget_show(plugentry); |
90 | 246 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
247 /* Build the bottom button bar */ |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
248 bothbox = gtk_hbox_new(TRUE, 10); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
249 gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
250 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
251 gtk_widget_show(bothbox); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
252 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
253 if (!tooltips) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
254 tooltips = gtk_tooltips_new(); |
90 | 255 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
256 add = picture_button(plugwindow, _("Load"), gnome_add_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
257 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
258 gtk_box_pack_start(GTK_BOX(bothbox), add, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
259 gtk_tooltips_set_tip(tooltips, add, _("Load a plugin from a file"), ""); |
90 | 260 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
261 config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
262 gtk_widget_set_sensitive(config, FALSE); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
263 gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
264 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), ""); |
90 | 265 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
266 reload = picture_button(plugwindow, _("Reload"), refresh_xpm); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
267 gtk_widget_set_sensitive(reload, FALSE); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
268 gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
269 gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
270 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), ""); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
271 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
272 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm); |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
273 gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin_cb), pluglist); |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
274 gtk_box_pack_start(GTK_BOX(bothbox), unload, TRUE, TRUE, 0); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
275 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), ""); |
90 | 276 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
277 close = picture_button(plugwindow, _("Close"), cancel_xpm); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
278 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
279 gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
280 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), ""); |
90 | 281 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
282 update_show_plugins(); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
283 gtk_widget_show(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
284 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
285 |
2494
2c1950c5544a
[gaim-migrate @ 2507]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2405
diff
changeset
|
286 void update_show_plugins() |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
287 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
288 GList *plugs = plugins; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
289 struct gaim_plugin *p; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
290 GtkWidget *label; |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
291 GtkWidget *list_item; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
292 GtkWidget *hbox; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
293 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
294 if (plugwindow == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
295 return; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
296 |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
297 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
298 while (plugs) { |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
299 p = (struct gaim_plugin *)plugs->data; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
300 label = gtk_label_new(plugin_makelistname(p->handle)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
301 hbox = gtk_hbox_new(FALSE, 0); /* for left justification */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
302 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
303 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
304 list_item = gtk_list_item_new(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
305 gtk_container_add(GTK_CONTAINER(list_item), hbox); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
306 gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(list_clicked), p); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
307 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
308 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
309 gtk_widget_show(hbox); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
310 gtk_widget_show(label); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
311 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
312 gtk_widget_show(list_item); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
313 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
314 plugs = g_list_next(plugs); |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
315 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
316 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
317 /* Clear the display if nothing's selected */ |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
318 if (GTK_LIST(pluglist)->selection == NULL) { |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
319 guint text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
320 gtk_text_set_point(GTK_TEXT(plugtext), 0); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
321 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
322 gtk_entry_set_text(GTK_ENTRY(plugentry), ""); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
323 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
324 gtk_widget_set_sensitive(config, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
325 gtk_widget_set_sensitive(reload, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
326 gtk_widget_set_sensitive(unload, FALSE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
327 } |
1 | 328 } |
329 | |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
330 static void unload_plugin_cb(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
331 { |
90 | 332 GList *i; |
333 struct gaim_plugin *p; | |
334 | |
335 i = GTK_LIST(pluglist)->selection; | |
336 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
337 if (i == NULL) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
338 return; |
90 | 339 |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
340 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
1 | 341 |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
342 unload_plugin(p); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
343 update_show_plugins(); |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
344 } |
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
345 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
346 static void plugin_reload_cb(GtkWidget *w, gpointer data) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
347 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
348 GList *i; |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
349 struct gaim_plugin *p; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
350 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
351 i = GTK_LIST(pluglist)->selection; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
352 if (i == NULL) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
353 return; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
354 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
355 /* Just pass off plugin to the actual function */ |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
356 p = reload_plugin(gtk_object_get_user_data(GTK_OBJECT(i->data))); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
357 |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
358 update_show_plugins(); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
359 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
360 /* Try and reselect the plugin in list */ |
2280
13d5d7e829c9
[gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2274
diff
changeset
|
361 if (!pluglist) |
13d5d7e829c9
[gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2274
diff
changeset
|
362 return; |
2393
a7ecfd3f7714
[gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
363 gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, p)); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
364 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
365 |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
366 static void list_clicked(GtkWidget *w, struct gaim_plugin *p) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
367 { |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
368 gchar *temp; |
90 | 369 guint text_len; |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
370 void (*gaim_plugin_config)(); |
90 | 371 |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
372 if (confighandle != 0) |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
373 gtk_signal_disconnect(GTK_OBJECT(config), confighandle); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
374 |
90 | 375 text_len = gtk_text_get_length(GTK_TEXT(plugtext)); |
376 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
377 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
378 | |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
379 temp = g_strdup_printf("Name: %s\n\nDescription:\n%s", |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
380 (p->name != NULL) ? p->name : "", |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
381 (p->description != NULL) ? p->description : ""); |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
382 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1); |
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
383 g_free(temp); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
384 gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle)); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
385 |
943
446d7d2cc909
[gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
905
diff
changeset
|
386 /* Find out if this plug-in has a configuration function */ |
1047
ece2d1543b20
[gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1039
diff
changeset
|
387 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
|
388 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked", |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
389 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
390 gtk_widget_set_sensitive(config, TRUE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
391 } else { |
403
d6f02d7f78d8
[gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
397
diff
changeset
|
392 confighandle = 0; |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
393 gtk_widget_set_sensitive(config, FALSE); |
110
f7c6366ca703
[gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
96
diff
changeset
|
394 } |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
395 |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
396 gtk_widget_set_sensitive(reload, TRUE); |
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
397 gtk_widget_set_sensitive(unload, TRUE); |
90 | 398 } |
399 | |
2056
5028a07250c7
[gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1911
diff
changeset
|
400 static void hide_plugins(GtkWidget *w, gpointer data) |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
401 { |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
402 if (plugwindow) |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
403 gtk_widget_destroy(plugwindow); |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
404 plugwindow = NULL; |
425
ae7c762775cd
[gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
403
diff
changeset
|
405 config = NULL; |
522
11cbf8b403b6
[gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
425
diff
changeset
|
406 confighandle = 0; |
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
407 } |
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
408 |
1911
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
409 static const gchar *plugin_makelistname(GModule *module) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
410 { |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
411 static gchar filename[PATHSIZE]; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
412 gchar *filepath = g_module_name(module); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
413 char *cp; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
414 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
415 if (filepath == NULL || strlen(filepath) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
416 return NULL; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
417 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
418 if ((cp = strrchr(filepath, '/')) == NULL || *++cp == '\0') |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
419 cp = filepath; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
420 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
421 strncpy(filename, cp, sizeof(filename)); |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
422 filename[sizeof(filename) - 1] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
423 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
424 /* Try to pretty name by removing any trailing ".so" */ |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
425 if (strlen(filename) > 3 && |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
426 strncmp(filename + strlen(filename) - 3, ".so", 3) == 0) |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
427 filename[strlen(filename) - 3] = '\0'; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
428 |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
429 return filename; |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
430 } |
db3104dda736
[gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1874
diff
changeset
|
431 |
783
5bad8e4d1c88
[gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
780
diff
changeset
|
432 #endif |