# HG changeset patch
# Node ID 1f088267b35c
# Parent  c7091b7a9d1a
diff --git a/ChangeLog.API b/ChangeLog.API
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -1182,8 +1182,12 @@ version 3.0.0 (??/??/????):
 		* pidgin_pounces_init
 		* pidgin_pounces_manager_hide
 		* pidgin_pounces_manager_show
+		* pidgin_prefs_checkbox
+		* pidgin_prefs_dropdown
+		* pidgin_prefs_dropdown_from_list
 		* pidgin_prefs_labeled_entry
 		* pidgin_prefs_labeled_password
+		* pidgin_prefs_labeled_spin_button
 		* pidgin_prefs_show
 		* pidgin_privacy_dialog_hide
 		* pidgin_privacy_dialog_show
diff --git a/pidgin/prefs/pidginprefs.h b/pidgin/prefs/pidginprefs.h
--- a/pidgin/prefs/pidginprefs.h
+++ b/pidgin/prefs/pidginprefs.h
@@ -45,70 +45,6 @@ G_DECLARE_FINAL_TYPE(PidginPrefsWindow, 
 void pidgin_prefs_init(void);
 
 /**
- * pidgin_prefs_checkbox:
- * @title: The text to be displayed as the checkbox label
- * @key:   The key of the purple bool pref that will be represented by the checkbox
- * @page:  The page to which the new checkbox will be added
- *
- * Add a new checkbox for a boolean preference
- *
- * Returns: (transfer full): The new checkbox
- */
-GtkWidget *pidgin_prefs_checkbox(const char *title, const char *key,
-		GtkWidget *page);
-
-/**
- * pidgin_prefs_labeled_spin_button:
- * @page:  The page to which the spin button will be added
- * @title: The text to be displayed as the spin button label
- * @key:   The key of the int pref that will be represented by the spin button
- * @min:   The minimum value of the spin button
- * @max:   The maximum value of the spin button
- * @sg:    If not NULL, the size group to which the spin button will be added
- *
- * Add a new spin button representing an int preference
- *
- * Returns: (transfer full): An hbox containing both the label and the spinner.  Can be
- *          used to set the widgets to sensitive or insensitive based on the
- *          value of a checkbox.
- */
-GtkWidget *pidgin_prefs_labeled_spin_button(GtkWidget *page,
-		const gchar *title, const char *key, int min, int max, GtkSizeGroup *sg);
-
-/**
- * pidgin_prefs_dropdown:
- * @page:  The page to which the dropdown will be added
- * @title: The text to be displayed as the dropdown label
- * @type:  The type of preference to be stored in the generated dropdown
- * @key:   The key of the pref that will be represented by the dropdown
- * @...:   The choices to be added to the dropdown, choices should be
- *              paired as label/value
- *
- * Add a new dropdown representing a preference of the specified type
- *
- * Returns: (transfer full): The new dropdown. 
- */
-GtkWidget *pidgin_prefs_dropdown(GtkWidget *page, const gchar *title,
-		PurplePrefType type, const char *key, ...);
-
-/**
- * pidgin_prefs_dropdown_from_list:
- * @page:      The page to which the dropdown will be added
- * @title:     The text to be displayed as the dropdown label
- * @type:      The type of preference to be stored in the dropdown
- * @key:       The key of the pref that will be represented by the dropdown
- * @menuitems: (element-type PurpleKeyValuePair): The choices to be added to the dropdown, choices should
- *             be paired as label/value
- *
- * Add a new dropdown representing a preference of the specified type
- *
- * Returns: (transfer full): The new dropdown. 
- */
-GtkWidget *pidgin_prefs_dropdown_from_list(GtkWidget *page,
-		const gchar * title, PurplePrefType type, const char *key,
-		GList *menuitems);
-
-/**
  * pidgin_prefs_update_old:
  *
  * Rename legacy prefs and delete some that no longer exist.
diff --git a/pidgin/prefs/pidginprefs.c b/pidgin/prefs/pidginprefs.c
--- a/pidgin/prefs/pidginprefs.c
+++ b/pidgin/prefs/pidginprefs.c
@@ -58,29 +58,6 @@ update_spin_value(G_GNUC_UNUSED GtkWidge
 	purple_prefs_set_int(key, value);
 }
 
-GtkWidget *
-pidgin_prefs_labeled_spin_button(GtkWidget *box, const gchar *title,
-		const char *key, int min, int max, GtkSizeGroup *sg)
-{
-	GtkWidget *spin;
-	GtkAdjustment *adjust;
-	int val;
-
-	val = purple_prefs_get_int(key);
-
-	adjust = GTK_ADJUSTMENT(gtk_adjustment_new(val, min, max, 1, 1, 0));
-	spin = gtk_spin_button_new(adjust, 1, 0);
-	g_object_set_data(G_OBJECT(spin), "val", (char *)key);
-	if (max < 10000)
-		gtk_widget_set_size_request(spin, 50, -1);
-	else
-		gtk_widget_set_size_request(spin, 60, -1);
-	g_signal_connect(G_OBJECT(adjust), "value-changed",
-					 G_CALLBACK(update_spin_value), GTK_WIDGET(spin));
-
-	return pidgin_add_widget_to_vbox(GTK_BOX(box), title, sg, spin, FALSE, NULL);
-}
-
 void
 pidgin_prefs_bind_spin_button(const char *key, GtkWidget *spin)
 {
@@ -117,253 +94,6 @@ pidgin_prefs_bind_entry(const char *key,
 }
 
 static void
-dropdown_set(GtkComboBox *combo_box, G_GNUC_UNUSED gpointer data)
-{
-	GtkTreeIter iter;
-	GtkTreeModel *tree_model;
-	PurplePrefType type;
-	const char *key;
-
-	tree_model = gtk_combo_box_get_model(combo_box);
-	if (!gtk_combo_box_get_active_iter(combo_box, &iter)) {
-		return;
-	}
-
-	type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(combo_box), "type"));
-	key = g_object_get_data(G_OBJECT(combo_box), "key");
-	if (type == PURPLE_PREF_INT) {
-		gint value;
-		gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-		purple_prefs_set_int(key, value);
-	} else if (type == PURPLE_PREF_STRING) {
-		gchar *value;
-		gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-		purple_prefs_set_string(key, value);
-		g_free(value);
-	} else if (type == PURPLE_PREF_BOOLEAN) {
-		gboolean value;
-		gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-		purple_prefs_set_bool(key, value);
-	} else {
-		g_return_if_reached();
-	}
-}
-
-GtkWidget *
-pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title,
-		PurplePrefType type, const char *key, GList *menuitems)
-{
-	GtkWidget *dropdown = NULL;
-	GtkWidget *label = NULL;
-	GtkListStore *store = NULL;
-	GtkTreeIter active;
-	GtkCellRenderer *renderer;
-	gint pref_int_value = 0;
-	const gchar *pref_str_value = NULL;
-	gboolean pref_bool_value = FALSE;
-
-	g_return_val_if_fail(menuitems != NULL, NULL);
-
-	if (type == PURPLE_PREF_INT) {
-		pref_int_value = purple_prefs_get_int(key);
-		store = gtk_list_store_new(PIDGIN_PREF_COMBO_N_COLUMNS, G_TYPE_STRING,
-		                           G_TYPE_INT);
-	} else if (type == PURPLE_PREF_STRING) {
-		pref_str_value = purple_prefs_get_string(key);
-		store = gtk_list_store_new(PIDGIN_PREF_COMBO_N_COLUMNS, G_TYPE_STRING,
-		                           G_TYPE_STRING);
-	} else if (type == PURPLE_PREF_BOOLEAN) {
-		pref_bool_value = purple_prefs_get_bool(key);
-		store = gtk_list_store_new(PIDGIN_PREF_COMBO_N_COLUMNS, G_TYPE_STRING,
-		                           G_TYPE_BOOLEAN);
-	} else {
-		g_return_val_if_reached(NULL);
-	}
-
-	dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
-	g_object_set_data(G_OBJECT(dropdown), "type", GINT_TO_POINTER(type));
-
-	for (; menuitems != NULL; menuitems = g_list_next(menuitems)) {
-		const PurpleKeyValuePair *menu_item = menuitems->data;
-		GtkTreeIter iter;
-
-		if (menu_item->key == NULL) {
-			break;
-		}
-
-		gtk_list_store_append(store, &iter);
-		gtk_list_store_set(store, &iter,
-		                   PIDGIN_PREF_COMBO_TEXT, menu_item->key,
-		                   -1);
-
-		if (type == PURPLE_PREF_INT) {
-			gint value = GPOINTER_TO_INT(menu_item->value);
-			gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_VALUE, value, -1);
-			if (pref_int_value == value) {
-				active = iter;
-			}
-
-		} else if (type == PURPLE_PREF_STRING) {
-			const gchar *value = (const gchar *)menu_item->value;
-			gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_VALUE, value, -1);
-			if (purple_strequal(pref_str_value, value)) {
-				active = iter;
-			}
-
-		} else if (type == PURPLE_PREF_BOOLEAN) {
-			gboolean value = (gboolean)GPOINTER_TO_INT(menu_item->value);
-			gtk_list_store_set(store, &iter, PIDGIN_PREF_COMBO_VALUE, value, -1);
-			if (pref_bool_value == value) {
-				active = iter;
-			}
-		}
-	}
-
-	renderer = gtk_cell_renderer_text_new();
-	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE);
-	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
-	                               "text", 0,
-	                               NULL);
-
-	gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dropdown), &active);
-
-	g_signal_connect(dropdown, "changed", G_CALLBACK(dropdown_set), NULL);
-
-	pidgin_add_widget_to_vbox(GTK_BOX(box), title, NULL, dropdown, FALSE, &label);
-
-	g_object_set_data(G_OBJECT(dropdown), "key", (gpointer)key);
-
-	return label;
-}
-
-GtkWidget *
-pidgin_prefs_dropdown(GtkWidget *box, const gchar *title, PurplePrefType type,
-			   const char *key, ...)
-{
-	va_list ap;
-	GList *menuitems = NULL;
-	GtkWidget *dropdown = NULL;
-	char *name;
-
-	g_return_val_if_fail(type == PURPLE_PREF_BOOLEAN || type == PURPLE_PREF_INT ||
-			type == PURPLE_PREF_STRING, NULL);
-
-	va_start(ap, key);
-	while ((name = va_arg(ap, char *)) != NULL) {
-		PurpleKeyValuePair *kvp;
-
-		if (type == PURPLE_PREF_INT || type == PURPLE_PREF_BOOLEAN) {
-			kvp = purple_key_value_pair_new(name, GINT_TO_POINTER(va_arg(ap, int)));
-		} else {
-			kvp = purple_key_value_pair_new(name, va_arg(ap, char *));
-		}
-		menuitems = g_list_prepend(menuitems, kvp);
-	}
-	va_end(ap);
-
-	g_return_val_if_fail(menuitems != NULL, NULL);
-
-	menuitems = g_list_reverse(menuitems);
-
-	dropdown = pidgin_prefs_dropdown_from_list(box, title, type, key,
-			menuitems);
-
-	g_list_free_full(menuitems, (GDestroyNotify)purple_key_value_pair_free);
-
-	return dropdown;
-}
-
-static void
-bind_dropdown_set(GtkComboBox *combo_box, gpointer data)
-{
-	PidginPrefCombo *combo = data;
-	GtkTreeIter iter;
-	GtkTreeModel *tree_model;
-
-	tree_model = gtk_combo_box_get_model(combo_box);
-	if (!gtk_combo_box_get_active_iter(combo_box, &iter))
-		return;
-
-	if (combo->type == PURPLE_PREF_INT) {
-		gint value;
-		gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-		purple_prefs_set_int(combo->key, value);
-	} else if (combo->type == PURPLE_PREF_STRING) {
-		gchar *value;
-		gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-		purple_prefs_set_string(combo->key, value);
-		g_free(value);
-	} else if (combo->type == PURPLE_PREF_BOOLEAN) {
-		gboolean value;
-		gtk_tree_model_get(tree_model, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-		purple_prefs_set_bool(combo->key, value);
-	} else {
-		g_return_if_reached();
-	}
-}
-
-void
-pidgin_prefs_bind_dropdown(PidginPrefCombo *combo)
-{
-	GtkTreeModel *store = NULL;
-	GtkTreeIter iter;
-	GtkTreeIter active;
-	int pref_int_value = 0;
-	const char *pref_str_value = NULL;
-	gboolean pref_bool_value = FALSE;
-
-	if (combo->type == PURPLE_PREF_INT) {
-		pref_int_value = purple_prefs_get_int(combo->key);
-	} else if (combo->type == PURPLE_PREF_STRING) {
-		pref_str_value = purple_prefs_get_string(combo->key);
-	} else if (combo->type == PURPLE_PREF_BOOLEAN) {
-		pref_bool_value = purple_prefs_get_bool(combo->key);
-	} else {
-		g_return_if_reached();
-	}
-
-	store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo->combo));
-
-	if (!gtk_tree_model_get_iter_first(store, &iter)) {
-		g_return_if_reached();
-	}
-
-	do {
-		if (combo->type == PURPLE_PREF_INT) {
-			gint value = 0;
-			gtk_tree_model_get(store, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-			if (pref_int_value == value) {
-				active = iter;
-				break;
-			}
-
-		} else if (combo->type == PURPLE_PREF_STRING) {
-			gchar *value = NULL;
-			gtk_tree_model_get(store, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-			if (purple_strequal(pref_str_value, value)) {
-				active = iter;
-				g_free(value);
-				break;
-			}
-			g_free(value);
-
-		} else if (combo->type == PURPLE_PREF_BOOLEAN) {
-			gboolean value = FALSE;
-			gtk_tree_model_get(store, &iter, PIDGIN_PREF_COMBO_VALUE, &value, -1);
-			if (pref_bool_value == value) {
-				active = iter;
-				break;
-			}
-		}
-	} while (gtk_tree_model_iter_next(store, &iter));
-
-	gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo->combo), &active);
-
-	g_signal_connect(G_OBJECT(combo->combo), "changed",
-			G_CALLBACK(bind_dropdown_set), combo);
-}
-
-static void
 bind_combo_row_set(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec,
                    gpointer data)
 {
@@ -407,23 +137,6 @@ set_bool_pref(GtkWidget *w, const char *
 			gtk_check_button_get_active(GTK_CHECK_BUTTON(w)));
 }
 
-GtkWidget *
-pidgin_prefs_checkbox(const char *text, const char *key, GtkWidget *page)
-{
-	GtkWidget *button;
-
-	button = gtk_check_button_new_with_mnemonic(text);
-	gtk_check_button_set_active(GTK_CHECK_BUTTON(button),
-			purple_prefs_get_bool(key));
-
-	gtk_box_append(GTK_BOX(page), button);
-
-	g_signal_connect(G_OBJECT(button), "clicked",
-			G_CALLBACK(set_bool_pref), (char *)key);
-
-	return button;
-}
-
 void
 pidgin_prefs_bind_checkbox(const char *key, GtkWidget *button)
 {
