changeset 110:f7c6366ca703

[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 <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 12 Apr 2000 22:18:15 +0000
parents 45bcfa3b584c
children d927bb34e2c6
files plugins/simple.c src/plugins.c
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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";
 }
--- 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) {