comparison src/plugins.c @ 138:e8ea1e2fdf0c

[gaim-migrate @ 148] Bugfixes and memleaks mostly. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 19 Apr 2000 12:36:18 +0000
parents 00c1ee609648
children c009c4f4ad02
comparison
equal deleted inserted replaced
137:fe81c8b4951d 138:e8ea1e2fdf0c
85 85
86 void load_plugin(GtkWidget *w, gpointer data) 86 void load_plugin(GtkWidget *w, gpointer data)
87 { 87 {
88 char *buf = g_malloc(BUF_LEN); 88 char *buf = g_malloc(BUF_LEN);
89 89
90 if (!plugin_dialog) { 90 if (plugin_dialog) {
91 plugin_dialog = gtk_file_selection_new("Gaim - Plugin List"); 91 g_free(buf);
92 92 gtk_widget_show(plugin_dialog);
93 gtk_file_selection_hide_fileop_buttons( 93 gdk_window_raise(plugin_dialog->window);
94 return;
95 }
96
97 plugin_dialog = gtk_file_selection_new("Gaim - Plugin List");
98
99 gtk_file_selection_hide_fileop_buttons(
94 GTK_FILE_SELECTION(plugin_dialog)); 100 GTK_FILE_SELECTION(plugin_dialog));
95 101
96 if(getenv("PLUGIN_DIR") == NULL) { 102 if(getenv("PLUGIN_DIR") == NULL) {
97 g_snprintf(buf, BUF_LEN - 1, "%s/%s", getenv("HOME"), PLUGIN_DIR); 103 g_snprintf(buf, BUF_LEN - 1, "%s/%s", getenv("HOME"), PLUGIN_DIR);
98 } else { 104 } else {
106 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button), 112 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->ok_button),
107 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL); 113 "clicked", GTK_SIGNAL_FUNC(load_which_plugin), NULL);
108 114
109 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button), 115 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(plugin_dialog)->cancel_button),
110 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL); 116 "clicked", GTK_SIGNAL_FUNC(destroy_plugins), NULL);
111
112 }
113 117
114 g_free(buf); 118 g_free(buf);
115 gtk_widget_show(plugin_dialog); 119 gtk_widget_show(plugin_dialog);
116 gdk_window_raise(plugin_dialog->window); 120 gdk_window_raise(plugin_dialog->window);
117 } 121 }
333 if ((error = (char *)dlerror()) == NULL) 337 if ((error = (char *)dlerror()) == NULL)
334 (*gaim_plugin_remove)(); 338 (*gaim_plugin_remove)();
335 while (c) { 339 while (c) {
336 g = (struct gaim_callback *)c->data; 340 g = (struct gaim_callback *)c->data;
337 if (g->handle == p->handle) { 341 if (g->handle == p->handle) {
338 callbacks = g_list_remove(callbacks, c); 342 callbacks = g_list_remove(callbacks, c->data);
339 g_free(g); 343 g_free(g);
344 c = callbacks;
345 if (c == NULL) break;
340 } 346 }
341 c = c->next; 347 c = c->next;
342 } 348 }
343 dlclose(p->handle); 349 /* don't ask me why this works */
350 if (callbacks != NULL) dlclose(p->handle);
344 351
345 plugins = g_list_remove(plugins, p); 352 plugins = g_list_remove(plugins, p);
353 g_free(p->filename);
346 g_free(p); 354 g_free(p);
347 gtk_widget_set_sensitive(config, 0); 355 gtk_widget_set_sensitive(config, 0);
348 update_show_plugins(); 356 update_show_plugins();
349 } 357 }
350 358
392 GList *c = callbacks; 400 GList *c = callbacks;
393 struct gaim_callback *g = NULL; 401 struct gaim_callback *g = NULL;
394 while (c) { 402 while (c) {
395 g = (struct gaim_callback *)c->data; 403 g = (struct gaim_callback *)c->data;
396 if (handle == g->handle && func == g->function) { 404 if (handle == g->handle && func == g->function) {
397 callbacks = g_list_remove(callbacks, g); 405 callbacks = g_list_remove(callbacks, c->data);
398 g_free(g); 406 g_free(g);
407 c = callbacks;
408 if (c == NULL) break;
399 } 409 }
400 c = c->next; 410 c = c->next;
401 } 411 }
402 } 412 }
403 413