changeset 30883:014dbe36b722

finch: Add support for string lists as account options
author Paul Aurich <paul@darkrain42.org>
date Fri, 27 Aug 2010 06:28:09 +0000
parents ec12d2883266
children 60a43860ae56 8084631e2e84
files ChangeLog finch/gntaccount.c
diffstat 2 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Aug 27 05:14:08 2010 +0000
+++ b/ChangeLog	Fri Aug 27 06:28:09 2010 +0000
@@ -12,6 +12,10 @@
 	* Add support for the Gadu-Gadu protocol in the gevolution plugin to
 	  provide Evolution integration with contacts with GG IDs. (#10709)
 
+	Finch:
+	* Add support for drop-down account options (like the SILC cipher
+	  and HMAC options or the QQ protocol version).
+
 	XMPP:
 	* Fix a crash when multiple accounts are simultaneously performing
 	  SASL authentication when built with Cyrus SASL support.  (thanks
--- a/finch/gntaccount.c	Fri Aug 27 05:14:08 2010 +0000
+++ b/finch/gntaccount.c	Fri Aug 27 06:28:09 2010 +0000
@@ -236,7 +236,8 @@
 			}
 			else if (type == PURPLE_PREF_STRING_LIST)
 			{
-				/* TODO: */
+				gchar *value = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(entry));
+				purple_account_set_string(account, setting, value);
 			}
 			else
 			{
@@ -430,8 +431,26 @@
 
 			if (type == PURPLE_PREF_STRING_LIST)
 			{
-				/* TODO: Use a combobox */
-				/*       Don't forget to append the widget to prpl_entries */
+				GntWidget *combo = gnt_combo_box_new();
+				GList *opt_iter = purple_account_option_get_list(option);
+				const char *dv = purple_account_option_get_default_list_value(option);
+				const char *active = dv;
+
+				if (account)
+					active = purple_account_get_string(account,
+						purple_account_option_get_setting(option), dv);
+
+				gnt_box_add_widget(GNT_BOX(box), combo);
+				dialog->prpl_entries = g_list_append(dialog->prpl_entries, combo);
+
+				for ( ; opt_iter; opt_iter = opt_iter->next)
+				{
+					PurpleKeyValuePair *kvp = opt_iter->data;
+					gnt_combo_box_add_data(GNT_COMBO_BOX(combo), kvp->value, kvp->key);
+
+					if (g_str_equal(kvp->value, active))
+						gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), kvp->value);
+				}
 			}
 			else
 			{