changeset 9529:803e642650e1

[gaim-migrate @ 10356] " This patch adds support for a plugin preference representing informative text, such as a short statement regarding an option or elaborating on the available choices." --Christopher (siege) O'Brien (14:55:43) rw_grim: oh yeah, i checked out siege's patch for plugin prefs.. looks good to me.. i didn't actually test it.. but it's nothing major.. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 14 Jul 2004 19:13:42 +0000
parents 7ca073ddf9b0
children 78f9641ad4e5
files src/gtkpluginpref.c src/pluginpref.h
diffstat 2 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkpluginpref.c	Wed Jul 14 19:11:07 2004 +0000
+++ b/src/gtkpluginpref.c	Wed Jul 14 19:13:42 2004 +0000
@@ -104,8 +104,7 @@
 	switch(gaim_plugin_pref_get_type(pref)) {
 		case GAIM_PLUGIN_PREF_CHOICE:
 			gtk_label = gaim_gtk_prefs_dropdown_from_list(parent, pref_label,
-											  GAIM_PREF_INT, pref_name,
-											  gaim_plugin_pref_get_choices(pref));
+					GAIM_PREF_INT, pref_name, gaim_plugin_pref_get_choices(pref));
 			gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0.5);
 
 			if(sg)
@@ -116,11 +115,22 @@
 		default:
 			gaim_plugin_pref_get_bounds(pref, &min, &max);
 			gaim_gtk_prefs_labeled_spin_button(parent, pref_label, 
-											   pref_name, min, max, sg);
+					pref_name, min, max, sg);
 			break;
 	}
 }
 
+
+static void
+make_info_pref(GtkWidget *parent, GaimPluginPref *pref) {
+	GtkWidget *gtk_label = gtk_label_new(gaim_plugin_pref_get_label(pref));
+	gtk_misc_set_alignment(GTK_MISC(gtk_label), 0, 0);
+	gtk_label_set_line_wrap(GTK_LABEL(gtk_label), TRUE);
+	gtk_box_pack_start(GTK_BOX(parent), gtk_label, FALSE, FALSE, 0);
+	gtk_widget_show(gtk_label);
+}
+
+
 GtkWidget *
 gaim_gtk_plugin_pref_create_frame(GaimPluginPrefFrame *frame) {
 	GaimPluginPref *pref;
@@ -149,9 +159,13 @@
 		if(name == NULL) {
 			if(label == NULL)
 				continue;
-		
-			parent = gaim_gtk_make_frame(ret, label);
-			gtk_widget_show(parent);
+
+			if(gaim_plugin_pref_get_type(pref) == GAIM_PLUGIN_PREF_INFO) {
+				make_info_pref(parent, pref);
+			} else {
+				parent = gaim_gtk_make_frame(ret, label);
+				gtk_widget_show(parent);
+			}
 
 			continue;
 		}
--- a/src/pluginpref.h	Wed Jul 14 19:11:07 2004 +0000
+++ b/src/pluginpref.h	Wed Jul 14 19:13:42 2004 +0000
@@ -31,7 +31,8 @@
 
 typedef enum {
 	GAIM_PLUGIN_PREF_NONE,
-	GAIM_PLUGIN_PREF_CHOICE
+	GAIM_PLUGIN_PREF_CHOICE,
+	GAIM_PLUGIN_PREF_INFO,   /**< no-value label */
 } GaimPluginPrefType;
 
 #include <glib.h>