annotate src/plugins.c @ 2359:ad56a93661fc

[gaim-migrate @ 2372] hi usa committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 26 Sep 2001 00:53:49 +0000
parents 571971659533
children 8a304d8c5ce3
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
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <string.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <sys/time.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include <sys/types.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
41 #include <sys/stat.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
42
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
43 #include <unistd.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
44 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
45 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include <gtk/gtk.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
47 #include "gaim.h"
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
48
885
db5f5c33e83f [gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
49 #ifdef GAIM_PLUGINS
db5f5c33e83f [gaim-migrate @ 895]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 829
diff changeset
50
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
51 #include <dlfcn.h>
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
52
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
53 #include "pixmaps/gnome_add.xpm"
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
54 #include "pixmaps/gnome_remove.xpm"
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
55 #include "pixmaps/gnome_preferences.xpm"
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
56 #include "pixmaps/refresh.xpm"
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
57 #include "pixmaps/cancel.xpm"
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 #define PATHSIZE 1024 /* XXX: stolen from dialogs.c */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
60
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
61
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
62 /* ------------------ Global Variables ----------------------- */
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
63
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
64 GList *plugins = NULL;
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
65 GList *callbacks = NULL;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
66
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
67 /* ------------------ Local Variables ------------------------ */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
68
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
69 static GtkWidget *plugin_dialog = NULL;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
70
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
71 static GtkWidget *pluglist = NULL;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
72 static GtkWidget *plugtext = NULL;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
73 static GtkWidget *plugwindow = NULL;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
74 static GtkWidget *plugentry = NULL;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
75
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
76 static GtkTooltips *tooltips = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
77
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
78 static GtkWidget *config = NULL;
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
79 static guint confighandle = 0;
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
80 static GtkWidget *reload = NULL;
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
81 static GtkWidget *unload = NULL;
1025
84a5d80e52f1 [gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
82 static char *last_dir = NULL;
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
83
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
84 /* --------------- Function Declarations --------------------- */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
85
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
86 void show_plugins(GtkWidget *, gpointer);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
87 void load_plugin(char *);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
88
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
89 void gaim_signal_connect(GModule *, enum gaim_event, void *, void *);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
90 void gaim_signal_disconnect(GModule *, enum gaim_event, void *);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
91 void gaim_plugin_unload(GModule *);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
92
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
93 /* UI button callbacks */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
94 static void plugin_reload_cb(GtkWidget *, gpointer);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
95
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
96 static const gchar *plugin_makelistname(GModule *);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
97 static void plugin_remove_callbacks(GModule *);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
98
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
99 static void plugin_reload(struct gaim_plugin *p);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
100
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
101 static void destroy_plugins(GtkWidget *, gpointer);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
102 static void load_file(GtkWidget *, gpointer);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
103 static void load_which_plugin(GtkWidget *, gpointer);
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
104 static void unload_plugin(GtkWidget *, gpointer);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
105 static void unload_immediate(GModule *);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
106 static void list_clicked(GtkWidget *, struct gaim_plugin *);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
107 static void update_show_plugins();
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
108 static void hide_plugins(GtkWidget *, gpointer);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
109
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
110 /* ------------------ Code Below ---------------------------- */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
111
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
112 static void destroy_plugins(GtkWidget *w, gpointer data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
113 {
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
114 if (plugin_dialog)
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
115 gtk_widget_destroy(plugin_dialog);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
116 plugin_dialog = NULL;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
117 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
118
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
119 static void load_file(GtkWidget *w, gpointer data)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
120 {
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
121 gchar *buf;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
122
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
123 if (plugin_dialog) {
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
124 gtk_widget_show(plugin_dialog);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
125 gdk_window_raise(plugin_dialog->window);
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
126 return;
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
127 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
128
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
129 plugin_dialog = gtk_file_selection_new(_("Gaim - Plugin List"));
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
130
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
131 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
132
1025
84a5d80e52f1 [gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
133 if (!last_dir)
1163
8f70ecf3e884 [gaim-migrate @ 1173]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1145
diff changeset
134 buf = g_strdup(LIBDIR);
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
135 else
1025
84a5d80e52f1 [gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
136 buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
138 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
139 gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
140 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy",
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
141 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
142
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
143 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
144 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
145
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
146 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
147 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
148
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
149 g_free(buf);
626
d86cc11faab8 [gaim-migrate @ 636]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 619
diff changeset
150 gtk_widget_show(plugin_dialog);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
151 gdk_window_raise(plugin_dialog->window);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
152 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
153
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
154 static void load_which_plugin(GtkWidget *w, gpointer data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
155 {
1035
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
156 char *file;
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
157
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
158 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
159 if (file_is_dir(file, plugin_dialog)) {
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
160 return;
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
161 }
80a47e3b1bca [gaim-migrate @ 1045]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1025
diff changeset
162
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
163 if (file)
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
164 load_plugin(file);
142
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
165
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
166 if (plugin_dialog)
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
167 gtk_widget_destroy(plugin_dialog);
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
168 plugin_dialog = NULL;
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
169 }
fbabd28795d2 [gaim-migrate @ 152]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 139
diff changeset
170
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
171 void load_plugin(char *filename)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
172 {
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
173 struct gaim_plugin *plug;
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
174 GList *c = plugins;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
175 char *(*gaim_plugin_init)(GModule *);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
176 char *(*cfunc)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
177 char *error;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
178 char *retval;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
179
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
180 if (!g_module_supported())
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
181 return;
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
182 if (filename && !strlen(filename))
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
183 return;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
184
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
185 while (filename && c) {
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
186 plug = (struct gaim_plugin *)c->data;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
187 if (!strcmp(filename, g_module_name(plug->handle))) {
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
188 /* just need to reload plugin */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
189 plugin_reload(plug);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
190 return;
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
191 } else
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
192 c = g_list_next(c);
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
193 }
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
194 plug = g_malloc(sizeof *plug);
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
195
1710
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
196 if (filename) {
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
197 if (last_dir)
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
198 g_free(last_dir);
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
199 last_dir = g_dirname(filename);
f42ce672c560 [gaim-migrate @ 1720]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1429
diff changeset
200 }
1025
84a5d80e52f1 [gaim-migrate @ 1035]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1000
diff changeset
201
1236
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1185
diff changeset
202 debug_printf("Loading %s\n", filename);
dcf9242241ee [gaim-migrate @ 1246]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1185
diff changeset
203 plug->handle = g_module_open(filename, 0);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
204 if (!plug->handle) {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
205 error = (char *)g_module_error();
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
206 do_error_dialog(error, _("Plugin Error"));
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
207 g_free(plug);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
208 return;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
209 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
210
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
211 if (!g_module_symbol(plug->handle, "gaim_plugin_init", (gpointer *)&gaim_plugin_init)) {
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
212 do_error_dialog(g_module_error(), _("Plugin Error"));
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
213 g_module_close(plug->handle);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
214 g_free(plug);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
215 return;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
216 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
217
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
218 retval = (*gaim_plugin_init)(plug->handle);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
219 debug_printf("loaded plugin returned %s\n", retval ? retval : "NULL");
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
220 if (retval) {
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
221 plugin_remove_callbacks(plug->handle);
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
222 do_error_dialog(retval, _("Plugin Error"));
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
223 g_module_close(plug->handle);
391
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
224 g_free(plug);
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
225 return;
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
226 }
be408b41c172 [gaim-migrate @ 401]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 350
diff changeset
227
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
228 plugins = g_list_append(plugins, plug);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
229
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
230 if (g_module_symbol(plug->handle, "name", (gpointer *)&cfunc))
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
231 plug->name = (*cfunc)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
232 else
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
233 plug->name = NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
234
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
235 if (g_module_symbol(plug->handle, "description", (gpointer *)&cfunc))
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
236 plug->description = (*cfunc)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
237 else
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
238 plug->description = NULL;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
239
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
240 update_show_plugins();
153
8ed64c704fb0 [gaim-migrate @ 163]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 142
diff changeset
241 save_prefs();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
242 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
243
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
244 void show_plugins(GtkWidget *w, gpointer data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
245 {
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
246 /* most of this code was shamelessly stolen from Glade */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
247 GtkWidget *mainvbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
248 GtkWidget *tophbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
249 GtkWidget *bothbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
250 GtkWidget *hbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
251 GtkWidget *vbox;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
252 GtkWidget *frame;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
253 GtkWidget *scrolledwindow;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
254 GtkWidget *label;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
255 GtkWidget *add;
96
247f540ea6e1 [gaim-migrate @ 106]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 94
diff changeset
256 GtkWidget *close;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
257
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
258 if (plugwindow)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
259 return;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
260
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
261 plugwindow = gtk_window_new(GTK_WINDOW_DIALOG);
905
2876c40108cd [gaim-migrate @ 915]
Rob Flynn <gaim@robflynn.com>
parents: 885
diff changeset
262 gtk_window_set_wmclass(GTK_WINDOW(plugwindow), "plugins", "Gaim");
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
263 gtk_widget_realize(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
264 aol_icon(plugwindow->window);
350
fd3cc0a28d5d [gaim-migrate @ 360]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 349
diff changeset
265 gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins"));
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
266 gtk_widget_set_usize(plugwindow, 515, 300);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
267 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
268
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
269 mainvbox = gtk_vbox_new(FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
270 gtk_container_add(GTK_CONTAINER(plugwindow), mainvbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
271 gtk_widget_show(mainvbox);
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 /* Build the top */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
274 tophbox = gtk_hbox_new(FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
275 gtk_box_pack_start(GTK_BOX(mainvbox), tophbox, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
276 gtk_widget_show(tophbox);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
277
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
278 /* Left side: frame with list of plugin file names */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
279 frame = gtk_frame_new(_("Plugins"));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
280 gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
281 gtk_widget_set_usize(frame, 140, -1);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
282 gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
283 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
284 gtk_widget_show(frame);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
285
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
286 scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
287 gtk_container_add(GTK_CONTAINER(frame), scrolledwindow);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
288 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
289 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
290 gtk_widget_show(scrolledwindow);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
291
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
292 pluglist = gtk_list_new();
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
293 gtk_list_set_selection_mode(GTK_LIST(pluglist), GTK_SELECTION_BROWSE);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
294 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), pluglist);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
295 gtk_widget_show(pluglist);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
296
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
297 /* Right side: frame with description and the filepath of plugin */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
298 frame = gtk_frame_new(_("Description"));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
299 gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
300 gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
301 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
302 gtk_widget_show(frame);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
303
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
304 vbox = gtk_vbox_new(FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
305 gtk_container_add(GTK_CONTAINER(frame), vbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
306 gtk_widget_show(vbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
307
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
308 scrolledwindow = gtk_scrolled_window_new(NULL, NULL);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
309 gtk_box_pack_start(GTK_BOX(vbox), scrolledwindow, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
310 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
311 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
312 gtk_widget_show(scrolledwindow);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
313
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
314 plugtext = gtk_text_new(NULL, NULL);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
315 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), plugtext);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
316 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
317 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
318 gtk_widget_show(plugtext);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
319
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
320 hbox = gtk_hbox_new(FALSE, 5);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
321 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
322 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
323 gtk_widget_show(hbox);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
324
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
325 label = gtk_label_new(_("Filepath:"));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
326 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
327 gtk_widget_show(label);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
328
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
329 plugentry = gtk_entry_new();
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
330 gtk_box_pack_start(GTK_BOX(hbox), plugentry, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
331 gtk_entry_set_editable(GTK_ENTRY(plugentry), FALSE);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
332 gtk_widget_show(plugentry);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
333
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
334 /* Build the bottom button bar */
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
335 bothbox = gtk_hbox_new(TRUE, 10);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
336 gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
337 gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
338 gtk_widget_show(bothbox);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
339
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
340 if (!tooltips)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
341 tooltips = gtk_tooltips_new();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
342
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
343 add = picture_button(plugwindow, _("Load"), gnome_add_xpm);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
344 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
345 gtk_box_pack_start(GTK_BOX(bothbox), add, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
346 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
347
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
348 config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
349 gtk_widget_set_sensitive(config, FALSE);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
350 gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
351 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
352
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
353 reload = picture_button(plugwindow, _("Reload"), refresh_xpm);
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
354 gtk_widget_set_sensitive(reload, FALSE);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
355 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
356 gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
357 gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), "");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
358
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
359 unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
360 gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin), pluglist);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
361 gtk_box_pack_start(GTK_BOX(bothbox), unload, TRUE, TRUE, 0);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
362 gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), "");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
363
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
364 close = picture_button(plugwindow, _("Close"), cancel_xpm);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
365 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
366 gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
367 gtk_tooltips_set_tip(tooltips, close, _("Close this window"), "");
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
368
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
369 update_show_plugins();
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
370 gtk_widget_show(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
371 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
372
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
373 static void update_show_plugins()
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
374 {
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
375 GList *plugs = plugins;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
376 struct gaim_plugin *p;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
377 GtkWidget *label;
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
378 GtkWidget *list_item;
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
379 GtkWidget *hbox;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
380
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
381 if (plugwindow == NULL)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
382 return;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
383
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
384 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
385 while (plugs) {
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
386 p = (struct gaim_plugin *)plugs->data;
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
387 label = gtk_label_new(plugin_makelistname(p->handle));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
388 hbox = gtk_hbox_new(FALSE, 0); /* for left justification */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
389 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
390
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
391 list_item = gtk_list_item_new();
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
392 gtk_container_add(GTK_CONTAINER(list_item), hbox);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
393 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
394 gtk_object_set_user_data(GTK_OBJECT(list_item), p);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
395
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
396 gtk_widget_show(hbox);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
397 gtk_widget_show(label);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
398 gtk_container_add(GTK_CONTAINER(pluglist), list_item);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
399 gtk_widget_show(list_item);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
400
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
401 plugs = g_list_next(plugs);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
402 }
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
403
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
404 /* Clear the display if nothing's selected */
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
405 if (GTK_LIST(pluglist)->selection == NULL) {
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
406 guint text_len = gtk_text_get_length(GTK_TEXT(plugtext));
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
407 gtk_text_set_point(GTK_TEXT(plugtext), 0);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
408 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
409 gtk_entry_set_text(GTK_ENTRY(plugentry), "");
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
410
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
411 gtk_widget_set_sensitive(config, FALSE);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
412 gtk_widget_set_sensitive(reload, FALSE);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
413 gtk_widget_set_sensitive(unload, FALSE);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
414 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
415 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
416
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
417 static void unload_plugin(GtkWidget *w, gpointer data)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
418 {
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
419 GList *i;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
420 struct gaim_plugin *p;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
421 void (*gaim_plugin_remove)();
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
422
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
423 i = GTK_LIST(pluglist)->selection;
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
424
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
425 if (i == NULL)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
426 return;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
427
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
428 p = gtk_object_get_user_data(GTK_OBJECT(i->data));
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
429
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
430 /* Attempt to call the plugin's remove function (if there) */
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
431 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove))
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
432 (*gaim_plugin_remove)();
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
433
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
434 unload_immediate(p->handle);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
435 update_show_plugins();
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
436 }
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
437
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
438 static void unload_for_real(void *handle)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
439 {
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
440 GList *i;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
441 struct gaim_plugin *p = NULL;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
442
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
443 i = plugins;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
444 while (i) {
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
445 p = (struct gaim_plugin *)i->data;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
446 if (handle == p->handle)
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
447 break;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
448 p = NULL;
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
449 i = g_list_next(i);
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
450 }
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
451
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
452 if (!p)
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
453 return;
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
454
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
455 debug_printf("Unloading %s\n", g_module_name(p->handle));
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
456
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
457 plugin_remove_callbacks(p->handle);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
458
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
459 plugins = g_list_remove(plugins, p);
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 970
diff changeset
460 g_free(p);
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
461 update_show_plugins();
154
1c4e47c0c5dd [gaim-migrate @ 164]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 153
diff changeset
462 save_prefs();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
463 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
464
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
465 static void unload_immediate(GModule *handle)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
466 {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
467 unload_for_real(handle);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
468 g_module_close(handle);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
469 }
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
470
2150
eb2cadb18479 [gaim-migrate @ 2160]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2140
diff changeset
471 static gboolean unload_timeout(gpointer handle)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
472 {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
473 g_module_close(handle);
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
474 return FALSE;
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
475 }
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
476
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
477 void gaim_plugin_unload(GModule *handle)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
478 {
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
479 unload_for_real(handle);
2131
acc11216ec5d [gaim-migrate @ 2141]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2125
diff changeset
480 g_timeout_add(5000, unload_timeout, handle);
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
481 }
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
482
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
483 static void plugin_reload_cb(GtkWidget *w, gpointer data)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
484 {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
485 GList *i;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
486
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
487 i = GTK_LIST(pluglist)->selection;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
488 if (i == NULL)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
489 return;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
490
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
491 /* Just pass off plugin to the actual function */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
492 plugin_reload(gtk_object_get_user_data(GTK_OBJECT(i->data)));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
493 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
494
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
495 /* Do unload/load cycle of plugin. */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
496 static void plugin_reload(struct gaim_plugin *p)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
497 {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
498 char file[PATHSIZE];
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
499 void (*gaim_plugin_remove)();
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
500 GModule *handle = p->handle;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
501 struct gaim_plugin *plug;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
502 GList *plugs;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
503
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
504 strncpy(file, g_module_name(handle), sizeof(file));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
505 file[sizeof(file) - 1] = '\0';
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
506
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
507 debug_printf("Reloading %s\n", file);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
508
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
509 /* Unload */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
510 if (g_module_symbol(handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove))
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
511 (*gaim_plugin_remove)();
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
512 unload_immediate(handle);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
513
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
514 /* Load */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
515 load_plugin(file);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
516
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
517 /* Try and reselect the plugin in list */
2280
13d5d7e829c9 [gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2274
diff changeset
518 if (!pluglist)
13d5d7e829c9 [gaim-migrate @ 2290]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2274
diff changeset
519 return;
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
520 plugs = plugins;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
521 while (plugs) {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
522 plug = plugs->data;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
523 if (!strcmp(file, g_module_name(plug->handle))) {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
524 gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, plug));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
525 return;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
526 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
527 plugs = plugs->next;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
528 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
529 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
530
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
531 static void list_clicked(GtkWidget *w, struct gaim_plugin *p)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
532 {
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
533 gchar *temp;
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
534 guint text_len;
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
535 void (*gaim_plugin_config)();
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
536
522
11cbf8b403b6 [gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 425
diff changeset
537 if (confighandle != 0)
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
538 gtk_signal_disconnect(GTK_OBJECT(config), confighandle);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
539
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
540 text_len = gtk_text_get_length(GTK_TEXT(plugtext));
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
541 gtk_text_set_point(GTK_TEXT(plugtext), 0);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
542 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len);
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
543
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
544 temp = g_strdup_printf("Name: %s\n\nDescription:\n%s",
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
545 (p->name != NULL) ? p->name : "",
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
546 (p->description != NULL) ? p->description : "");
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
547 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1);
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
548 g_free(temp);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
549 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
550
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
551 /* Find out if this plug-in has a configuration function */
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
552 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
553 confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked",
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
554 GTK_SIGNAL_FUNC(gaim_plugin_config), NULL);
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
555 gtk_widget_set_sensitive(config, TRUE);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
556 } else {
403
d6f02d7f78d8 [gaim-migrate @ 413]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 397
diff changeset
557 confighandle = 0;
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
558 gtk_widget_set_sensitive(config, FALSE);
110
f7c6366ca703 [gaim-migrate @ 120]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 96
diff changeset
559 }
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
560
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
561 gtk_widget_set_sensitive(reload, TRUE);
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
562 gtk_widget_set_sensitive(unload, TRUE);
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
563 }
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
564
2056
5028a07250c7 [gaim-migrate @ 2066]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1911
diff changeset
565 static void hide_plugins(GtkWidget *w, gpointer data)
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
566 {
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
567 if (plugwindow)
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
568 gtk_widget_destroy(plugwindow);
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
569 plugwindow = NULL;
425
ae7c762775cd [gaim-migrate @ 435]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 403
diff changeset
570 config = NULL;
522
11cbf8b403b6 [gaim-migrate @ 532]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 425
diff changeset
571 confighandle = 0;
92
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
572 }
f3c6cf79f651 [gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 90
diff changeset
573
1911
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
574 static const gchar *plugin_makelistname(GModule *module)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
575 {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
576 static gchar filename[PATHSIZE];
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
577 gchar *filepath = g_module_name(module);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
578 char *cp;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
579
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
580 if (filepath == NULL || strlen(filepath) == 0)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
581 return NULL;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
582
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
583 if ((cp = strrchr(filepath, '/')) == NULL || *++cp == '\0')
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
584 cp = filepath;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
585
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
586 strncpy(filename, cp, sizeof(filename));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
587 filename[sizeof(filename) - 1] = '\0';
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
588
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
589 /* Try to pretty name by removing any trailing ".so" */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
590 if (strlen(filename) > 3 &&
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
591 strncmp(filename + strlen(filename) - 3, ".so", 3) == 0)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
592 filename[strlen(filename) - 3] = '\0';
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
593
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
594 return filename;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
595 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
596
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
597 /* Remove all callbacks associated with plugin handle */
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
598 static void plugin_remove_callbacks(GModule *handle)
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
599 {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
600 GList *c = callbacks;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
601 struct gaim_callback *g;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
602
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
603 debug_printf("%d callbacks to search\n", g_list_length(callbacks));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
604
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
605 while (c) {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
606 g = (struct gaim_callback *)c->data;
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
607 if (g->handle == handle) {
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
608 c = g_list_next(c);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
609 callbacks = g_list_remove(callbacks, (gpointer)g);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
610 debug_printf("Removing callback, %d remain\n", g_list_length(callbacks));
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
611 } else
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
612 c = g_list_next(c);
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
613 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
614 }
db3104dda736 [gaim-migrate @ 1921]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1874
diff changeset
615
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
616 void gaim_signal_connect(GModule *handle, enum gaim_event which, void *func, void *data)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
617 {
981
7e231bc0018a [gaim-migrate @ 991]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 970
diff changeset
618 struct gaim_callback *call = g_new0(struct gaim_callback, 1);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
619 call->handle = handle;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
620 call->event = which;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
621 call->function = func;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
622 call->data = data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
623
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
624 callbacks = g_list_append(callbacks, call);
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
625 debug_printf("Adding callback %d\n", g_list_length(callbacks));
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
626 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
627
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
628 void gaim_signal_disconnect(GModule *handle, enum gaim_event which, void *func)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
629 {
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
630 GList *c = callbacks;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
631 struct gaim_callback *g = NULL;
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
632
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
633 while (c) {
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
634 g = (struct gaim_callback *)c->data;
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
635 if (handle == g->handle && func == g->function) {
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
636 callbacks = g_list_remove(callbacks, c->data);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
637 g_free(g);
138
e8ea1e2fdf0c [gaim-migrate @ 148]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 134
diff changeset
638 c = callbacks;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
639 if (c == NULL)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
640 break;
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
641 }
943
446d7d2cc909 [gaim-migrate @ 953]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 905
diff changeset
642 c = g_list_next(c);
94
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
643 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
644 }
9f6ce50ffb78 [gaim-migrate @ 104]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 92
diff changeset
645
90
f5b305c0d974 [gaim-migrate @ 100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1
diff changeset
646 #endif /* GAIM_PLUGINS */
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
647
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
648 static char *event_name(enum gaim_event event)
797
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
649 {
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
650 static char buf[128];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
651 switch (event) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
652 case event_signon:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
653 sprintf(buf, "event_signon");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
654 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
655 case event_signoff:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
656 sprintf(buf, "event_signoff");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
657 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
658 case event_away:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
659 sprintf(buf, "event_away");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
660 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
661 case event_back:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
662 sprintf(buf, "event_back");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
663 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
664 case event_im_recv:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
665 sprintf(buf, "event_im_recv");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
666 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
667 case event_im_send:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
668 sprintf(buf, "event_im_send");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
669 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
670 case event_buddy_signon:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
671 sprintf(buf, "event_buddy_signon");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
672 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
673 case event_buddy_signoff:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
674 sprintf(buf, "event_buddy_signoff");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
675 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
676 case event_buddy_away:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
677 sprintf(buf, "event_buddy_away");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
678 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
679 case event_buddy_back:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
680 sprintf(buf, "event_buddy_back");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
681 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
682 case event_buddy_idle:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
683 sprintf(buf, "event_buddy_idle");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
684 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
685 case event_buddy_unidle:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
686 sprintf(buf, "event_buddy_unidle");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
687 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
688 case event_blist_update:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
689 sprintf(buf, "event_blist_update");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
690 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
691 case event_chat_invited:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
692 sprintf(buf, "event_chat_invited");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
693 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
694 case event_chat_join:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
695 sprintf(buf, "event_chat_join");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
696 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
697 case event_chat_leave:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
698 sprintf(buf, "event_chat_leave");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
699 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
700 case event_chat_buddy_join:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
701 sprintf(buf, "event_chat_buddy_join");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
702 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
703 case event_chat_buddy_leave:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
704 sprintf(buf, "event_chat_buddy_leave");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
705 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
706 case event_chat_recv:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
707 sprintf(buf, "event_chat_recv");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
708 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
709 case event_chat_send:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
710 sprintf(buf, "event_chat_send");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
711 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
712 case event_warned:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
713 sprintf(buf, "event_warned");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
714 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
715 case event_error:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
716 sprintf(buf, "event_error");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
717 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
718 case event_quit:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
719 sprintf(buf, "event_quit");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
720 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
721 case event_new_conversation:
1745
c39cc2b44226 [gaim-migrate @ 1755]
Rob Flynn <gaim@robflynn.com>
parents: 1712
diff changeset
722 sprintf(buf, "event_new_conversation");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
723 break;
1749
5bfc58c20e82 [gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1745
diff changeset
724 case event_set_info:
5bfc58c20e82 [gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1745
diff changeset
725 sprintf(buf, "event_set_info");
5bfc58c20e82 [gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1745
diff changeset
726 break;
1874
1e33bd2d7780 [gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1749
diff changeset
727 case event_draw_menu:
1e33bd2d7780 [gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1749
diff changeset
728 sprintf(buf, "event_draw_menu");
1e33bd2d7780 [gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1749
diff changeset
729 break;
2104
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
730 case event_im_displayed_sent:
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
731 sprintf(buf, "event_im_displayed_sent");
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
732 break;
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
733 case event_im_displayed_rcvd:
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
734 sprintf(buf, "event_im_displayed_rcvd");
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
735 break;
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
736 case event_chat_send_invite:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
737 sprintf(buf, "event_chat_send_invite");
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
738 break;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
739 default:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
740 sprintf(buf, "event_unknown");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
741 break;
797
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
742 }
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
743 return buf;
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
744 }
c13e78ae0f86 [gaim-migrate @ 807]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 789
diff changeset
745
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
746 int plugin_event(enum gaim_event event, void *arg1, void *arg2, void *arg3, void *arg4)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
747 {
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
748 #ifdef USE_PERL
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
749 char buf[BUF_LONG];
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
750 #endif
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
751 #ifdef GAIM_PLUGINS
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
752 GList *c = callbacks;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
753 struct gaim_callback *g;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
754
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
755 while (c) {
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
756 void (*zero)(void *);
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
757 void (*one)(void *, void *);
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
758 void (*two)(void *, void *, void *);
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
759 void (*three)(void *, void *, void *, void *);
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
760 void (*four)(void *, void *, void *, void *, void *);
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
761
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
762 g = (struct gaim_callback *)c->data;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
763 if (g->event == event && g->function !=NULL) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
764 switch (event) {
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
765
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
766 /* no args */
1058
4927ce25d8cc [gaim-migrate @ 1068]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1057
diff changeset
767 case event_blist_update:
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
768 case event_quit:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
769 zero = g->function;
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
770 (*zero)(g->data);
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
771 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
772
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
773 /* one arg */
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
774 case event_signon:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
775 case event_signoff:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
776 case event_new_conversation:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
777 case event_error:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
778 one = g->function;
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
779 (*one)(arg1, g->data);
1000
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
780 break;
91b7377e7b45 [gaim-migrate @ 1010]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 981
diff changeset
781
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
782 /* two args */
1047
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
783 case event_buddy_signon:
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
784 case event_buddy_signoff:
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
785 case event_buddy_away:
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
786 case event_buddy_back:
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
787 case event_buddy_idle:
ece2d1543b20 [gaim-migrate @ 1057]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1039
diff changeset
788 case event_buddy_unidle:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
789 case event_chat_leave:
1749
5bfc58c20e82 [gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1745
diff changeset
790 case event_set_info:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
791 case event_draw_menu:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
792 two = g->function;
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
793 (*two)(arg1, arg2, g->data);
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
794 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
795
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
796 /* three args */
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
797 case event_im_send:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
798 case event_im_displayed_sent:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
799 case event_chat_join:
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
800 case event_chat_buddy_join:
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
801 case event_chat_buddy_leave:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
802 case event_chat_send:
1404
96e93119268d [gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
803 case event_away:
96e93119268d [gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
804 case event_back:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
805 case event_warned:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
806 three = g->function;
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
807 (*three)(arg1, arg2, arg3, g->data);
2273
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2150
diff changeset
808 break;
0b5c3338fa3d [gaim-migrate @ 2283]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2150
diff changeset
809
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
810 /* four args */
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
811 case event_im_recv:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
812 case event_chat_recv:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
813 case event_im_displayed_rcvd:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
814 case event_chat_send_invite:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
815 case event_chat_invited:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
816 four = g->function;
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
817 (*four)(arg1, arg2, arg3, arg4, g->data);
1874
1e33bd2d7780 [gaim-migrate @ 1884]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1749
diff changeset
818 break;
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
819
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
820 default:
1250
b5783215b245 [gaim-migrate @ 1260]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1236
diff changeset
821 debug_printf("unknown event %d\n", event);
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
822 break;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
823 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
824 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
825 c = c->next;
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
826 }
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
827 #endif /* GAIM_PLUGINS */
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
828 #ifdef USE_PERL
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
829 switch (event) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
830 case event_signon:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
831 case event_signoff:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
832 case event_away:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
833 case event_back:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
834 g_snprintf(buf, sizeof buf, "%lu", (unsigned long)arg1);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
835 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
836 case event_im_recv:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
837 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1,
1712
560b3117aedf [gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
838 *(char **)arg2 ? *(char **)arg2 : "(null)",
560b3117aedf [gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
839 *(char **)arg3 ? *(char **)arg3 : "(null)");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
840 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
841 case event_im_send:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
842 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1,
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
843 (char *)arg2, *(char **)arg3 ? *(char **)arg3 : "(null)");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
844 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
845 case event_buddy_signon:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
846 case event_buddy_signoff:
1749
5bfc58c20e82 [gaim-migrate @ 1759]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1745
diff changeset
847 case event_set_info:
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
848 case event_buddy_away:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
849 case event_buddy_back:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
850 case event_buddy_idle:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
851 case event_buddy_unidle:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
852 g_snprintf(buf, sizeof buf, "%lu \"%s\"", (unsigned long)arg1, (char *)arg2);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
853 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
854 case event_chat_invited:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
855 g_snprintf(buf, sizeof buf, "%lu \"%s\" \"%s\" %s", (unsigned long)arg1,
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
856 (char *)arg2, (char *)arg3, arg4 ? (char *)arg4 : "");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
857 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
858 case event_chat_join:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
859 case event_chat_buddy_join:
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
860 case event_chat_buddy_leave:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
861 g_snprintf(buf, sizeof buf, "%lu %d \"%s\"", (unsigned long)arg1,
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
862 (int)arg2, (char *)arg3);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
863 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
864 case event_chat_leave:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
865 g_snprintf(buf, sizeof buf, "%lu %d", (unsigned long)arg1, (int)arg2);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
866 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
867 case event_chat_recv:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
868 case event_chat_send_invite:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
869 g_snprintf(buf, sizeof buf, "%lu %d \"%s\" %s", (unsigned long)arg1,
2359
ad56a93661fc [gaim-migrate @ 2372]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2355
diff changeset
870 (int)arg2, (char *)arg3, *(char **)arg4 ? *(char **)arg4 : "(null)");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
871 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
872 case event_chat_send:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
873 g_snprintf(buf, sizeof buf, "%lu %d %s", (unsigned long)arg1, (int)arg2,
1712
560b3117aedf [gaim-migrate @ 1722]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1710
diff changeset
874 *(char **)arg3 ? *(char **)arg3 : "(null)");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
875 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
876 case event_warned:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
877 g_snprintf(buf, sizeof buf, "%lu \"%s\" %d", (unsigned long)arg1,
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
878 arg2 ? (char *)arg2 : "", (int)arg3);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
879 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
880 case event_quit:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
881 buf[0] = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
882 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
883 case event_new_conversation:
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
884 g_snprintf(buf, sizeof buf, "\"%s\"", (char *)arg1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
885 break;
2104
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
886 case event_im_displayed_sent:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
887 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1,
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
888 (char *)arg2, *(char **)arg3 ? *(char **)arg3 : "(null)");
2104
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
889 break;
0b81421021fd [gaim-migrate @ 2114]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2102
diff changeset
890 case event_im_displayed_rcvd:
2355
571971659533 [gaim-migrate @ 2368]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2345
diff changeset
891 g_snprintf(buf, sizeof buf, "%lu \"%s\" %s", (unsigned long)arg1,
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
892 (char *)arg2, (char *)arg3 ? (char *)arg3 : "(null)");
2102
899c22dcee42 [gaim-migrate @ 2112]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2090
diff changeset
893 break;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
894 default:
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
895 return 0;
783
5bad8e4d1c88 [gaim-migrate @ 793]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 780
diff changeset
896 }
2345
a49e8f1afbc4 [gaim-migrate @ 2358]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2280
diff changeset
897 return perl_event(event_name(event), buf);
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1058
diff changeset
898 #else
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1058
diff changeset
899 return 0;
780
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
900 #endif
c714def9cebb [gaim-migrate @ 790]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 656
diff changeset
901 }
2125
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
902
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
903 /* Calls the gaim_plugin_remove function in any loaded plugin that has one */
2140
66a84ff0445a [gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
904 #ifdef GAIM_PLUGINS
2125
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
905 void remove_all_plugins()
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
906 {
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
907 GList *c = plugins;
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
908 struct gaim_plugin *p;
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
909 void (*gaim_plugin_remove)();
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
910
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
911 while (c) {
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
912 p = (struct gaim_plugin *)c->data;
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
913 if (g_module_symbol(p->handle, "gaim_plugin_remove", (gpointer *)&gaim_plugin_remove))
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
914 (*gaim_plugin_remove)();
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
915 g_free(p);
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
916 c = c->next;
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
917 }
af59d854de29 [gaim-migrate @ 2135]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2104
diff changeset
918 }
2140
66a84ff0445a [gaim-migrate @ 2150]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2131
diff changeset
919 #endif