annotate src/plugins.c @ 3550:e9b2003ee562

[gaim-migrate @ 3625] I reversed the last patch. it stopped gaim from compiling, and while i can easily see that PLUGIN_API_VERSION isn't defined, i don't know what was up with the illegal usage of a struct. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 25 Sep 2002 14:27:18 +0000
parents cfbdfe334975
children cd938f18f3f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * ----------------
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 * The Plug-in plug
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 * Plugin support is currently being maintained by Mike Saraf
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24 * msaraf@dwc.edu
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 *
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
26 * Well, I didn't see any work done on it for a while, so I'm going to try
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
27 * my hand at it. - Eric warmenhoven@yahoo.com
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
28 *
1745
c39cc2b44226 [gaim-migrate @ 1755]
Rob Flynn <gaim@robflynn.com>
parents: 1712
diff changeset
29 * Mike is my roomate. I can assure you that he's lazy :-P -- Rob rob@marko.net
c39cc2b44226 [gaim-migrate @ 1755]
Rob Flynn <gaim@robflynn.com>
parents: 1712
diff changeset
30 *
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
31 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include <sys/time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42 #include <sys/types.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #include <sys/stat.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 #include <unistd.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
61
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
62 static GtkWidget *plugin_dialog = NULL;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
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
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
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
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
92 static void clear_plugin_display();
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
93 static struct gaim_plugin *get_selected_plugin(GtkWidget *);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
94 static void select_plugin(GtkWidget *w, struct gaim_plugin *p);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
95 static void list_clicked(GtkWidget *, gpointer);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
96
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
97 /* ------------------ Code Below ---------------------------- */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
98
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
99 static void destroy_plugins(GtkWidget *w, gpointer data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
100 {
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
101 if (plugin_dialog)
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
102 gtk_widget_destroy(plugin_dialog);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
103 plugin_dialog = NULL;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
104 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
105
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
106 static void load_file(GtkWidget *w, gpointer data)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
107 {
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
108 gchar *buf;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
109
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
110 if (plugin_dialog) {
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
111 gtk_widget_show(plugin_dialog);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
112 gdk_window_raise(plugin_dialog->window);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
113 return;
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
114 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
115
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
116 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List"));
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
117
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
118 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(plugin_dialog));
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
119
1025
84a5d80e52f1 [gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
120 if (!last_dir)
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
121 buf = g_strdup(LIBDIR);
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
122 else
1025
84a5d80e52f1 [gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
123 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
124
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
125 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
126 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
127 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy",
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
128 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
129
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
130 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
131 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
132
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
133 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
134 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
135
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
136 g_free(buf);
626
d86cc11faab8 [gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 619
diff changeset
137 gtk_widget_show(plugin_dialog);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
138 gdk_window_raise(plugin_dialog->window);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
139 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
141 static void load_which_plugin(GtkWidget *w, gpointer data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
142 {
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
143 const char *file;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
144 struct gaim_plugin *p;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
145
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
146 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
147 if (file_is_dir(file, plugin_dialog)) {
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
148 return;
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
149 }
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
150
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
151 if (file)
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
152 p = load_plugin(file);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
153 else
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
154 p = NULL;
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
155
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
156 if (plugin_dialog)
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
157 gtk_widget_destroy(plugin_dialog);
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
158 plugin_dialog = NULL;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
159
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
160 update_show_plugins();
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
161 /* Select newly loaded plugin */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
162 if(p == NULL)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
163 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
164 select_plugin(pluglist, p);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
165 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
166
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
167 void show_plugins(GtkWidget *w, gpointer data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
168 {
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
169 /* most of this code was shamelessly stolen from Glade */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
170 GtkWidget *mainvbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
171 GtkWidget *tophbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
172 GtkWidget *bothbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
173 GtkWidget *hbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
174 GtkWidget *vbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
175 GtkWidget *frame;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
176 GtkWidget *scrolledwindow;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
177 GtkWidget *label;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
178 GtkWidget *add;
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
179 GtkWidget *close;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
180 /* stuff needed for GtkTreeView *pluglist */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
181 GtkListStore *store;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
182 GtkCellRenderer *renderer;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
183 GtkTreeViewColumn *column;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
184 GtkTreeSelection *selection;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
185 /* needed for GtkTextView *plugtext */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
186 GtkTextBuffer *buffer;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
187
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
188 if (plugwindow) {
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
189 gtk_window_present(GTK_WINDOW(plugwindow));
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
190 return;
3472
d33ec392a5e1 [gaim-migrate @ 3523]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
191 }
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
192
2725
f3c094e78609 [gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2494
diff changeset
193 GAIM_DIALOG(plugwindow);
905
2876c40108cd [gaim-migrate @ 915]
Rob Flynn <gaim@robflynn.com>
parents: 885
diff changeset
194 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim");
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
195 gtk_widget_realize(plugwindow);
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
196 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins"));
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
197 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
198
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
199 mainvbox = gtk_vbox_new(FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
200 gtk_container_add(GTK_CONTAINER(plugwindow), mainvbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
201 gtk_widget_show(mainvbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
202
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
203 /* Build the top */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
204 tophbox = gtk_hbox_new(FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
205 gtk_box_pack_start(GTK_BOX(mainvbox), tophbox, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
206 gtk_widget_show(tophbox);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
207
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
208 /* Left side: frame with list of plugin file names */
3025
0486d3d00d0e [gaim-migrate @ 3038]
Sean Egan <seanegan@gmail.com>
parents: 2725
diff changeset
209 frame = gtk_frame_new(_("Loaded Plugins"));
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
210 gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
211 gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
212 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
213 gtk_widget_show(frame);
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 scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
216 gtk_container_add(GTK_CONTAINER(frame), scrolledwindow);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
217 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
218 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
219 gtk_widget_show(scrolledwindow);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
220 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
221 GTK_SHADOW_IN);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
222
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
223 /* Create & show plugin list */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
224 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
225 pluglist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
226 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pluglist), FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
227 renderer = gtk_cell_renderer_text_new();
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
228 column = gtk_tree_view_column_new_with_attributes("text",
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
229 renderer, "text", 0, NULL);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
230 gtk_tree_view_append_column(GTK_TREE_VIEW(pluglist), column);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
231 gtk_container_add(GTK_CONTAINER(scrolledwindow), pluglist);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
232
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
233 g_object_unref(G_OBJECT(store));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
234
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
235 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pluglist));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
236 g_signal_connect(G_OBJECT(selection), "changed",
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
237 G_CALLBACK(list_clicked),
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
238 NULL);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
239
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
240 gtk_widget_show(pluglist);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
241
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
242 /* Right side: frame with description and the filepath of plugin */
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
243 frame = gtk_frame_new(_("Selected Plugin"));
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
244 gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
245 gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
246 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
247 gtk_widget_show(frame);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
248
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
249 vbox = gtk_vbox_new(FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
250 gtk_container_add(GTK_CONTAINER(frame), vbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
251 gtk_widget_show(vbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
252
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
253 scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
254 gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
255 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
256 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
257 gtk_widget_show(scrolledwindow);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
258 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
259 GTK_SHADOW_IN);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
260
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
261 /* Create & show the plugin description widget */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
262 plugtext = gtk_text_view_new();
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
263 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(plugtext), GTK_WRAP_WORD);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
264 gtk_text_view_set_editable(GTK_TEXT_VIEW(plugtext), FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
265 gtk_container_add(GTK_CONTAINER(scrolledwindow), plugtext);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
266 gtk_widget_set_size_request(GTK_WIDGET(plugtext), -1, 200);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
267
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
268 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
269 gtk_text_buffer_create_tag(buffer, "bold", "weight",
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
270 PANGO_WEIGHT_BOLD, NULL);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
271 gtk_widget_show(plugtext);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
272
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
273 hbox = gtk_hbox_new(FALSE, 5);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
274 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
275 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
276 gtk_widget_show(hbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
277
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
278 label = gtk_label_new(_("Filepath:"));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
279 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
280 gtk_widget_show(label);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
281
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
282 plugentry = gtk_entry_new();
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
283 gtk_box_pack_start(GTK_BOX(hbox), plugentry, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
284 gtk_entry_set_editable(GTK_ENTRY(plugentry), FALSE);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
285 gtk_widget_show(plugentry);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
286
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
287 /* Build the bottom button bar */
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
288 bothbox = gtk_hbox_new(TRUE, 3);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
289 gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
290 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
291 gtk_widget_show(bothbox);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
292
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
293 if (!tooltips)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
294 tooltips = gtk_tooltips_new();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
295
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
296 add = picture_button(plugwindow, _("Load"), gnome_add_xpm);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
297 gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
298 gtk_box_pack_start_defaults(GTK_BOX(bothbox), add);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
299 gtk_tooltips_set_tip(tooltips, add, _("Load a plugin from a file"), "");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
300
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
301 config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
302 gtk_widget_set_sensitive(config, FALSE);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
303 gtk_box_pack_start_defaults(GTK_BOX(bothbox), config);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
304 gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), "");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
305
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
306 reload = picture_button(plugwindow, _("Reload"), refresh_xpm);
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
307 gtk_widget_set_sensitive(reload, FALSE);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
308 gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
309 gtk_box_pack_start_defaults(GTK_BOX(bothbox), reload);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
310 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), "");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
311
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
312 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
313 gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin_cb), pluglist);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
314 gtk_box_pack_start_defaults(GTK_BOX(bothbox), unload);
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
315 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), "");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
316
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
317 close = picture_button(plugwindow, _("Close"), cancel_xpm);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
318 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL);
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
319 gtk_box_pack_start_defaults(GTK_BOX(bothbox), close);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
320 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), "");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
321
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
322 update_show_plugins();
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
323 gtk_widget_show(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
324 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
325
2494
2c1950c5544a [gaim-migrate @ 2507]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2405
diff changeset
326 void update_show_plugins()
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
327 {
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
328 GList *plugs = plugins;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
329 struct gaim_plugin *p;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
330 int pnum = 0;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
331 GtkListStore *store;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
332 GtkTreeIter iter;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
333
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
334 if (plugwindow == NULL)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
335 return;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
336
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
337 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pluglist)));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
338 gtk_list_store_clear(store);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
339 while (plugs) {
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
340 p = (struct gaim_plugin *)plugs->data;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
341 gtk_list_store_append(store, &iter);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
342 gtk_list_store_set(store, &iter, 0, plugin_makelistname(p->handle), -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
343 gtk_list_store_set(store, &iter, 1, pnum++, -1);
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
344 plugs = g_list_next(plugs);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
345 }
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
346
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
347 clear_plugin_display();
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
349
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
350 static void unload_plugin_cb(GtkWidget *w, gpointer data)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
351 {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
352 struct gaim_plugin *p;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
353 p = get_selected_plugin(pluglist);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
354 if(p == NULL)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
355 return;
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
356 unload_plugin(p);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
357 update_show_plugins();
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
358 }
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
359
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
360 static void plugin_reload_cb(GtkWidget *w, gpointer data)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
361 {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
362 struct gaim_plugin *p;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
363 p = get_selected_plugin(pluglist);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
364 if(p == NULL)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
365 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
366 p = reload_plugin(p);
2393
a7ecfd3f7714 [gaim-migrate @ 2406]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
367 update_show_plugins();
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
368
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
369 /* Try and reselect the plugin in list */
2280
13d5d7e829c9 [gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2274
diff changeset
370 if (!pluglist)
13d5d7e829c9 [gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2274
diff changeset
371 return;
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
372 select_plugin(pluglist, p);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
373 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
374
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
375
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
376 static void list_clicked(GtkWidget *w, gpointer data)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
377 {
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
378 void (*gaim_plugin_config)();
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
379 struct gaim_plugin *p;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
380 GtkTextBuffer *buffer;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
381 GtkTextIter iter;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
382
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
383 if (confighandle != 0) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
384 gtk_signal_disconnect(GTK_OBJECT(config), confighandle);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
385 confighandle = 0;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
386 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
387
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
388 p = get_selected_plugin(pluglist);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
389 if(p == NULL) { /* No selected plugin */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
390 clear_plugin_display();
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
391 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
392 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
393
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
394 /* Set text and filepath widgets */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
395 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
396 gtk_text_buffer_set_text(buffer, "", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
397 gtk_text_buffer_get_start_iter(buffer, &iter);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
398
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
399 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, "Name:", -1,
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
400 "bold", NULL);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
401 gtk_text_buffer_insert(buffer, &iter, " ", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
402 gtk_text_buffer_insert(buffer, &iter, (p->name != NULL) ? p->name : "", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
403 gtk_text_buffer_insert(buffer, &iter, "\n\n", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
404 gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, "Description:", -1,
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
405 "bold", NULL);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
406 gtk_text_buffer_insert(buffer, &iter, "\n", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
407 gtk_text_buffer_insert(buffer, &iter,
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
408 (p->description != NULL) ? p->description : "", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
409
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
410 gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle));
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
411 /* Find out if this plug-in has a configuration function */
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
412 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
413 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked",
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
414 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
415 gtk_widget_set_sensitive(config, TRUE);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
416 } else {
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
417 confighandle = 0;
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
418 gtk_widget_set_sensitive(config, FALSE);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
419 }
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
420
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
421 gtk_widget_set_sensitive(reload, TRUE);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
422 gtk_widget_set_sensitive(unload, TRUE);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
423 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
424
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
425 static void hide_plugins(GtkWidget *w, gpointer data)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
426 {
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
427 if (plugwindow)
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
428 gtk_widget_destroy(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
429 plugwindow = NULL;
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
430 config = NULL;
522
11cbf8b403b6 [gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 425
diff changeset
431 confighandle = 0;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
432 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
433
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
434 static const gchar *plugin_makelistname(GModule *module)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
435 {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
436 static gchar filename[PATHSIZE];
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
437 const gchar *filepath = (char *)g_module_name(module);
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3374
diff changeset
438 const char *cp;
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
439
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
440 if (filepath == NULL || strlen(filepath) == 0)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
441 return NULL;
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 if ((cp = strrchr(filepath, '/')) == NULL || *++cp == '\0')
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
444 cp = filepath;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
445
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
446 strncpy(filename, cp, sizeof(filename));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
447 filename[sizeof(filename) - 1] = '\0';
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
448
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
449 /* Try to pretty name by removing any trailing ".so" */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
450 if (strlen(filename) > 3 &&
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
451 strncmp(filename + strlen(filename) - 3, ".so", 3) == 0)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
452 filename[strlen(filename) - 3] = '\0';
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
453
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
454 return filename;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
455 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
456
3374
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
457 static struct gaim_plugin *get_selected_plugin(GtkWidget *w) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
458 /* Given the pluglist widget, this will return a pointer to the plugin
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
459 * currently selected in the list, and NULL if none is selected. */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
460 gint index;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
461 GList *plugs = plugins;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
462 GtkTreeSelection *sel;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
463 GtkTreeIter iter;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
464 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(w));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
465
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
466 /* Get list index of selected plugin */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
467 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
468 if(!gtk_tree_selection_get_selected(sel, &model, &iter))
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
469 return NULL;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
470 gtk_tree_model_get(model, &iter, 1, &index, -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
471
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
472 /* Get plugin entry from index */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
473 plugs = g_list_nth(plugins, index);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
474 if(plugs == NULL)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
475 return NULL;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
476 else
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
477 return (struct gaim_plugin *)plugs->data;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
478 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
479
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
480 static void select_plugin(GtkWidget *w, struct gaim_plugin *p) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
481 /* Given the pluglist widget and a plugin, this will try to select
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
482 * entry in the list which corresponds with the plugin. */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
483 GtkTreeSelection *sel;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
484 GtkTreeIter iter;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
485 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(w));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
486 gchar temp[10];
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
487
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
488 if(g_list_index(plugins, p) == -1)
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
489 return;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
490
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
491 snprintf(temp, 10, "%d", g_list_index(plugins, p));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
492 gtk_tree_model_get_iter_from_string(model,
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
493 &iter, temp);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
494 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
495 gtk_tree_selection_select_iter(sel, &iter);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
496 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
497
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
498 static void clear_plugin_display() {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
499 GtkTreeSelection *selection;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
500 GtkTextBuffer *buffer;
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
501
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
502 /* Clear the plugin display if nothing's selected */
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
503 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pluglist));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
504 if(gtk_tree_selection_get_selected(selection, NULL, NULL) == FALSE) {
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
505 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext));
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
506 gtk_text_buffer_set_text(buffer, "", -1);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
507 gtk_entry_set_text(GTK_ENTRY(plugentry), "");
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
508
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
509 gtk_widget_set_sensitive(config, FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
510 gtk_widget_set_sensitive(reload, FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
511 gtk_widget_set_sensitive(unload, FALSE);
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
512 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
513 }
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
514
3cd2fbddf95a [gaim-migrate @ 3393]
Sean Egan <seanegan@gmail.com>
parents: 3025
diff changeset
515 #endif