# HG changeset patch # User Eric Warmenhoven # Date 955577895 0 # Node ID f7c6366ca7033b00b8d840d1d2502410e8075b0e # Parent 45bcfa3b584cc2f5a1db27ab246ccdaf71c4c005 [gaim-migrate @ 120] Okay, this is cool. Plugins are now configurable. They can each do whatever whenever someone clicks a little "Configure Plugin" button. This is optional; plugins don't have to be configurable, and if they're not, the button isn't clickable. committer: Tailor Script diff -r 45bcfa3b584c -r f7c6366ca703 plugins/simple.c --- a/plugins/simple.c Wed Apr 12 21:30:29 2000 +0000 +++ b/plugins/simple.c Wed Apr 12 22:18:15 2000 +0000 @@ -15,6 +15,10 @@ handle = NULL; } +void gaim_plugin_config() { + printf("configuring plugin.\n"); +} + char *name() { return "Simple Plugin Version 1.0"; } diff -r 45bcfa3b584c -r f7c6366ca703 src/plugins.c --- a/src/plugins.c Wed Apr 12 21:30:29 2000 +0000 +++ b/src/plugins.c Wed Apr 12 22:18:15 2000 +0000 @@ -57,6 +57,8 @@ static GtkWidget *plugtext; static GtkWidget *plugwindow; +static GtkWidget *config; + /* --------------- Function Declarations --------------------- */ void load_plugin (GtkWidget *, gpointer); @@ -224,6 +226,10 @@ GTK_SIGNAL_FUNC(load_plugin), NULL); gtk_box_pack_start(GTK_BOX(botbox), add, TRUE, FALSE, 5); + config = gtk_button_new_with_label("Configure Plugin"); + gtk_widget_set_sensitive(config, 0); + gtk_box_pack_start(GTK_BOX(botbox), config, TRUE, FALSE, 5); + remove = gtk_button_new_with_label("Unload Plugin"); gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(unload), pluglist); @@ -269,6 +275,7 @@ gtk_widget_show(pluglist); gtk_widget_show(plugtext); gtk_widget_show(add); + gtk_widget_show(config); gtk_widget_show(remove); gtk_widget_show(close); @@ -343,6 +350,8 @@ void list_clicked(GtkWidget *w, struct gaim_plugin *p) { gchar buffer[2048]; guint text_len; + void (*gaim_plugin_config)(); + char *error; text_len = gtk_text_get_length(GTK_TEXT(plugtext)); gtk_text_set_point(GTK_TEXT(plugtext), 0); @@ -350,6 +359,15 @@ g_snprintf(buffer, sizeof buffer, "%s\n%s", p->name, p->description); gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, buffer, -1); + + gaim_plugin_config = dlsym(p->handle, "gaim_plugin_config"); + if ((error = dlerror()) == NULL) { + gtk_signal_connect(GTK_OBJECT(config), "clicked", + GTK_SIGNAL_FUNC(gaim_plugin_config), NULL); + gtk_widget_set_sensitive(config, 1); + } else { + gtk_widget_set_sensitive(config, 0); + } } void hide_plugins(GtkWidget *w, gpointer data) {