Mercurial > pidgin.yaz
annotate src/plugins.c @ 92:f3c6cf79f651
[gaim-migrate @ 102]
Loading/unloading plugins works correctly. I have to add "hooks" to the
rest of gaim now to do certain things. Other than that, it's all good.
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Fri, 07 Apr 2000 22:48:58 +0000 |
| parents | f5b305c0d974 |
| children | 9f6ce50ffb78 |
| rev | line source |
|---|---|
| 1 | 1 /* |
| 2 * gaim | |
| 3 * | |
| 4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
| 5 * | |
| 6 * This program is free software; you can redistribute it and/or modify | |
| 7 * it under the terms of the GNU General Public License as published by | |
| 8 * the Free Software Foundation; either version 2 of the License, or | |
| 9 * (at your option) any later version. | |
| 10 * | |
| 11 * This program is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 * GNU General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU General Public License | |
| 17 * along with this program; if not, write to the Free Software | |
| 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 * | |
| 20 * ---------------- | |
| 21 * The Plug-in plug | |
| 22 * | |
| 23 * Plugin support is currently being maintained by Mike Saraf | |
| 24 * msaraf@dwc.edu | |
| 25 * | |
| 90 | 26 * Well, I didn't see any work done on it for a while, so I'm going to try |
| 27 * my hand at it. - Eric warmenhoven@yahoo.com | |
| 28 * | |
| 1 | 29 */ |
| 30 | |
| 90 | 31 #ifdef GAIM_PLUGINS |
| 32 | |
| 1 | 33 #include <string.h> |
| 34 #include <sys/time.h> | |
| 35 | |
| 36 #include <sys/types.h> | |
| 37 #include <sys/stat.h> | |
| 38 | |
| 39 #include <unistd.h> | |
| 40 #include <stdio.h> | |
| 41 #include <stdlib.h> | |
| 42 #include <gtk/gtk.h> | |
| 43 #include "gaim.h" | |
| 44 | |
| 90 | 45 #include <dlfcn.h> |
| 46 | |
| 1 | 47 /* ------------------ Local Variables -------------------------*/ |
| 48 | |
| 90 | 49 static GtkWidget *plugin_dialog = NULL; |
| 50 static GList *plugins = NULL; | |
| 51 | |
| 52 static GtkWidget *pluglist; | |
| 53 static GtkWidget *plugtext; | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
54 static GtkWidget *plugwindow; |
| 1 | 55 |
| 56 /* --------------- Function Declarations -------------------- */ | |
| 57 | |
| 90 | 58 void load_plugin (GtkWidget *, gpointer); |
| 59 void unload_plugin(GtkWidget *, gpointer); | |
| 60 void show_plugins (GtkWidget *, gpointer); | |
| 61 | |
| 62 static void destroy_plugins (GtkWidget *, gpointer); | |
| 63 static void load_which_plugin(GtkWidget *, gpointer); | |
| 64 static void unload (GtkWidget *, gpointer); | |
| 65 static void list_clicked (GtkWidget *, struct gaim_plugin *); | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
66 static void update_show_plugins(); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
67 static void hide_plugins (GtkWidget *, gpointer); |
| 90 | 68 |
| 1 | 69 /* ------------------ Code Below ---------------------------- */ |
| 70 | |
| 90 | 71 static void destroy_plugins(GtkWidget *w, gpointer data) { |
| 72 if (plugin_dialog) | |
| 73 gtk_widget_destroy(plugin_dialog); | |
| 74 plugin_dialog = NULL; | |
| 75 } | |
| 76 | |
| 77 void load_plugin(GtkWidget *w, gpointer data) | |
| 1 | 78 { |
| 90 | 79 char *buf = g_malloc(BUF_LEN); |
| 1 | 80 |
| 90 | 81 if (!plugin_dialog) { |
| 82 plugin_dialog = gtk_file_selection_new("Gaim - Plugin List"); | |
| 83 | |
| 84 gtk_file_selection_hide_fileop_buttons( | |
| 85 GTK_FILE_SELECTION(plugin_dialog)); | |
| 86 | |
| 87 if(getenv("PLUGIN_DIR") == NULL) { | |
| 88 g_snprintf(buf, BUF_LEN - 1, "%s/%s", getenv("HOME"), PLUGIN_DIR); | |
| 89 } else { | |
| 90 g_snprintf(buf, BUF_LEN - 1, "%s/", getenv("PLUGIN_DIR")); | |
| 91 } | |
| 1 | 92 |
| 90 | 93 gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf); |
| 94 gtk_signal_connect(GTK_OBJECT(plugin_dialog), "destroy", | |
| 95 GTK_SIGNAL_FUNC(destroy_plugins), plugin_dialog); | |
| 96 | |
| 97 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button), | |
| 98 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL); | |
| 99 | |
| 100 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button), | |
| 101 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL); | |
| 102 | |
| 103 } | |
| 104 | |
| 105 g_free(buf); | |
| 106 gtk_widget_show(plugin_dialog); | |
| 107 gdk_window_raise(plugin_dialog->window); | |
| 108 } | |
| 1 | 109 |
| 90 | 110 void load_which_plugin(GtkWidget *w, gpointer data) { |
| 111 struct gaim_plugin *plug; | |
| 112 void (*gaim_plugin_init)(); | |
| 113 char *(*cfunc)(); | |
| 114 char *error; | |
| 115 | |
| 116 plug = g_malloc(sizeof *plug); | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
117 plug->filename = g_strdup(gtk_file_selection_get_filename( |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
118 GTK_FILE_SELECTION(plugin_dialog))); |
| 90 | 119 /* do NOT OR with RTLD_GLOBAL, otherwise plugins may conflict |
| 120 * (it's really just a way to work around other people's bad | |
| 121 * programming, by not using RTLD_GLOBAL :P ) */ | |
| 122 plug->handle = dlopen(plug->filename, RTLD_LAZY); | |
| 123 if (!plug->handle) { | |
| 124 error = dlerror(); | |
| 125 do_error_dialog(error, "Plugin Error"); | |
| 126 g_free(plug); | |
| 127 return; | |
| 128 } | |
| 129 | |
| 130 if (plugin_dialog) | |
| 131 gtk_widget_destroy(plugin_dialog); | |
| 132 plugin_dialog = NULL; | |
| 1 | 133 |
| 90 | 134 gaim_plugin_init = dlsym(plug->handle, "gaim_plugin_init"); |
| 135 if ((error = dlerror()) != NULL) { | |
| 136 do_error_dialog(error, "Plugin Error"); | |
| 137 dlclose(plug->handle); | |
| 138 g_free(plug); | |
| 139 return; | |
| 140 } | |
| 141 | |
| 142 plugins = g_list_append(plugins, plug); | |
| 143 (*gaim_plugin_init)(); | |
| 1 | 144 |
| 90 | 145 cfunc = dlsym(plug->handle, "name"); |
| 146 if ((error = dlerror()) == NULL) | |
| 147 plug->name = (*cfunc)(); | |
| 148 else | |
| 149 plug->name = NULL; | |
| 1 | 150 |
| 90 | 151 cfunc = dlsym(plug->handle, "description"); |
| 152 if ((error = dlerror()) == NULL) | |
| 153 plug->description = (*cfunc)(); | |
| 154 else | |
| 155 plug->description = NULL; | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
156 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
157 update_show_plugins(); |
| 90 | 158 } |
| 1 | 159 |
| 90 | 160 void unload_plugin(GtkWidget *w, gpointer data) { |
| 161 /* FIXME */ | |
| 1 | 162 } |
| 163 | |
| 90 | 164 void show_plugins(GtkWidget *w, gpointer data) { |
| 165 /* most of this code was shamelessly stolen from prefs.c */ | |
| 166 GtkWidget *page; | |
| 167 GtkWidget *topbox; | |
| 168 GtkWidget *botbox; | |
| 169 GtkWidget *sw; | |
| 170 GtkWidget *label; | |
| 171 GtkWidget *list_item; | |
| 172 GtkWidget *sw2; | |
| 173 GtkWidget *add; | |
| 174 GtkWidget *remove; | |
| 175 GList *plugs = plugins; | |
| 176 struct gaim_plugin *p; | |
| 177 gchar buffer[1024]; | |
| 178 | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
179 if (plugwindow) return; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
180 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
181 plugwindow = gtk_window_new(GTK_WINDOW_DIALOG); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
182 gtk_widget_realize(plugwindow); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
183 aol_icon(plugwindow->window); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
184 gtk_container_border_width(GTK_CONTAINER(plugwindow), 10); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
185 gtk_window_set_title(GTK_WINDOW(plugwindow), "Gaim - Plugins"); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
186 gtk_widget_set_usize(plugwindow, 400, 250); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
187 gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
188 GTK_SIGNAL_FUNC(hide_plugins), NULL); |
| 90 | 189 |
| 190 page = gtk_vbox_new(FALSE, 0); | |
| 191 topbox = gtk_hbox_new(FALSE, 0); | |
| 192 botbox = gtk_hbox_new(FALSE, 0); | |
| 193 | |
| 194 sw2 = gtk_scrolled_window_new(NULL, NULL); | |
| 195 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), | |
| 196 GTK_POLICY_AUTOMATIC, | |
| 197 GTK_POLICY_AUTOMATIC); | |
| 198 | |
| 199 pluglist = gtk_list_new(); | |
| 200 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), pluglist); | |
| 201 gtk_box_pack_start(GTK_BOX(topbox), sw2, TRUE, TRUE, 0); | |
| 202 | |
| 203 sw = gtk_scrolled_window_new(NULL, NULL); | |
| 204 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
| 205 GTK_POLICY_AUTOMATIC, | |
| 206 GTK_POLICY_AUTOMATIC); | |
| 207 | |
| 208 plugtext = gtk_text_new(NULL, NULL); | |
| 209 gtk_container_add(GTK_CONTAINER(sw), plugtext); | |
| 210 gtk_box_pack_start(GTK_BOX(topbox), sw, TRUE, TRUE, 0); | |
| 211 gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE); | |
| 212 gtk_text_set_editable(GTK_TEXT(plugtext), FALSE); | |
| 213 | |
| 214 add = gtk_button_new_with_label("Load Plugin"); | |
| 215 gtk_signal_connect(GTK_OBJECT(add), "clicked", | |
| 216 GTK_SIGNAL_FUNC(load_plugin), NULL); | |
| 217 gtk_box_pack_start(GTK_BOX(botbox), add, TRUE, FALSE, 5); | |
| 218 | |
| 219 remove = gtk_button_new_with_label("Unload Plugin"); | |
| 220 gtk_signal_connect(GTK_OBJECT(remove), "clicked", | |
| 221 GTK_SIGNAL_FUNC(unload), pluglist); | |
| 222 gtk_box_pack_start(GTK_BOX(botbox), remove, TRUE, FALSE, 5); | |
| 223 | |
| 224 gtk_box_pack_start(GTK_BOX(page), topbox, TRUE, TRUE, 0); | |
| 225 gtk_box_pack_start(GTK_BOX(page), botbox, FALSE, FALSE, 0); | |
| 226 | |
| 227 if (plugs != NULL) { | |
| 228 p = (struct gaim_plugin *)plugs->data; | |
| 229 g_snprintf(buffer, sizeof(buffer), "%s", p->filename); | |
| 230 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1); | |
| 231 } | |
| 232 | |
| 233 while (plugs) { | |
| 234 p = (struct gaim_plugin *)plugs->data; | |
| 235 label = gtk_label_new(p->filename); | |
| 236 list_item = gtk_list_item_new(); | |
| 237 gtk_container_add(GTK_CONTAINER(list_item), label); | |
| 238 gtk_signal_connect(GTK_OBJECT(list_item), "select", | |
| 239 GTK_SIGNAL_FUNC(list_clicked), p); | |
| 240 gtk_object_set_user_data(GTK_OBJECT(list_item), p); | |
| 241 | |
| 242 gtk_widget_show(label); | |
| 243 gtk_container_add(GTK_CONTAINER(pluglist), list_item); | |
| 244 gtk_widget_show(list_item); | |
| 245 | |
| 246 plugs = plugs->next; | |
| 247 } | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
248 if (plugins != NULL) |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
249 gtk_list_select_item(GTK_LIST(pluglist), 0); |
| 90 | 250 |
| 251 gtk_widget_show(page); | |
| 252 gtk_widget_show(topbox); | |
| 253 gtk_widget_show(botbox); | |
| 254 gtk_widget_show(sw); | |
| 255 gtk_widget_show(sw2); | |
| 256 gtk_widget_show(pluglist); | |
| 257 gtk_widget_show(plugtext); | |
| 258 gtk_widget_show(add); | |
| 259 gtk_widget_show(remove); | |
| 260 | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
261 gtk_container_add(GTK_CONTAINER(plugwindow), page); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
262 gtk_widget_show(plugwindow); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
263 } |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
264 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
265 void update_show_plugins() { |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
266 GList *plugs = plugins; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
267 struct gaim_plugin *p; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
268 GtkWidget *label; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
269 GtkWidget *list_item; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
270 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
271 if (pluglist == NULL) return; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
272 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
273 gtk_list_clear_items(GTK_LIST(pluglist), 0, -1); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
274 while (plugs) { |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
275 p = (struct gaim_plugin *)plugs->data; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
276 label = gtk_label_new(p->filename); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
277 list_item = gtk_list_item_new(); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
278 gtk_container_add(GTK_CONTAINER(list_item), label); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
279 gtk_signal_connect(GTK_OBJECT(list_item), "select", |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
280 GTK_SIGNAL_FUNC(list_clicked), p); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
281 gtk_object_set_user_data(GTK_OBJECT(list_item), p); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
282 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
283 gtk_widget_show(label); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
284 gtk_container_add(GTK_CONTAINER(pluglist), list_item); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
285 gtk_widget_show(list_item); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
286 plugs = plugs->next; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
287 } |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
288 if (plugins != NULL) |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
289 gtk_list_select_item(GTK_LIST(pluglist), 0); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
290 else { |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
291 gtk_text_set_point(GTK_TEXT(plugtext), 0); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
292 gtk_text_forward_delete(GTK_TEXT(plugtext), |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
293 gtk_text_get_length(GTK_TEXT(plugtext))); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
294 } |
| 1 | 295 } |
| 296 | |
| 90 | 297 void unload(GtkWidget *w, gpointer data) { |
| 298 GList *i; | |
| 299 struct gaim_plugin *p; | |
| 300 void (*gaim_plugin_remove)(); | |
| 301 char *error; | |
| 302 | |
| 303 i = GTK_LIST(pluglist)->selection; | |
| 304 | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
305 if (i == NULL) return; |
| 90 | 306 |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
307 p = gtk_object_get_user_data(GTK_OBJECT(i->data)); |
| 1 | 308 |
| 90 | 309 gaim_plugin_remove = dlsym(p->handle, "gaim_plugin_remove"); |
| 310 if ((error = dlerror()) == NULL) | |
| 311 (*gaim_plugin_remove)(); | |
| 312 dlclose(p->handle); | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
313 |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
314 plugins = g_list_remove(plugins, p); |
| 90 | 315 g_free(p); |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
316 update_show_plugins(); |
| 90 | 317 } |
| 318 | |
| 319 void list_clicked(GtkWidget *w, struct gaim_plugin *p) { | |
| 320 gchar buffer[2048]; | |
| 321 guint text_len; | |
| 322 | |
| 323 text_len = gtk_text_get_length(GTK_TEXT(plugtext)); | |
| 324 gtk_text_set_point(GTK_TEXT(plugtext), 0); | |
| 325 gtk_text_forward_delete(GTK_TEXT(plugtext), text_len); | |
| 326 | |
| 327 g_snprintf(buffer, sizeof buffer, "%s\n%s", p->name, p->description); | |
| 328 gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1); | |
| 329 } | |
| 330 | |
|
92
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
331 void hide_plugins(GtkWidget *w, gpointer data) { |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
332 if (plugwindow) |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
333 gtk_widget_destroy(plugwindow); |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
334 plugwindow = NULL; |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
335 } |
|
f3c6cf79f651
[gaim-migrate @ 102]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
90
diff
changeset
|
336 |
| 90 | 337 #endif /* GAIM_PLUGINS */ |
