changeset 32576:604bec1b4582

propagate from branch 'im.pidgin.pidgin' (head 37d6e0111ed0e45196fbb2da9737166f9d743096) to branch 'im.pidgin.cpw.qulogic.gtk3' (head 2a648982262f2389aa3a6c742b8b41612aa8cfe8)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sun, 19 Apr 2009 03:17:46 +0000
parents 8cf9251e49ef (diff) 618255d76deb (current diff)
children a70f05468fb4
files pidgin/gtkblist.c pidgin/gtkimhtmltoolbar.c pidgin/gtkprefs.c
diffstat 13 files changed, 356 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkblist.c	Sun Apr 19 03:17:46 2009 +0000
@@ -5269,6 +5269,9 @@
 headline_style_set (GtkWidget *widget,
 		    GtkStyle  *prev_style)
 {
+#if GTK_CHECK_VERSION(2,12,0)
+	/* TODO: Need to figure out how to do this in 2.12+ */
+#else
 	GtkTooltips *tooltips;
 	GtkStyle *style;
 
@@ -5295,6 +5298,7 @@
 	gtkblist->changing_style = FALSE;
 
 	g_object_unref (tooltips);
+#endif
 }
 
 /******************************************/
--- a/pidgin/gtkconv.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkconv.c	Sun Apr 19 03:17:46 2009 +0000
@@ -5220,7 +5220,9 @@
 	gtkconv->send_history = g_list_append(NULL, NULL);
 
 	/* Setup some initial variables. */
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtkconv->tooltips = gtk_tooltips_new();
+#endif
 	gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
 	gtkconv->unseen_count = 0;
 
@@ -5413,7 +5415,9 @@
 		g_free(gtkconv->u.chat);
 	}
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
+#endif
 
 	gtkconv->send_history = g_list_first(gtkconv->send_history);
 	g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL);
@@ -6628,8 +6632,13 @@
 			topic = purple_conv_chat_get_topic(chat);
 
 			gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : "");
+#if GTK_CHECK_VERSION(2,12,0)
+			gtk_widget_set_tooltip_text(gtkchat->topic_text,
+			                            topic ? topic : "");
+#else
 			gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text,
 			                     topic ? topic : "", NULL);
+#endif
 		}
 	}
 
@@ -9398,8 +9407,12 @@
 	g_signal_connect(G_OBJECT(gtkconv->close), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image);
 	gtk_widget_show(close_image);
 	gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image);
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation"));
+#else
 	gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close,
 	                     _("Close conversation"), NULL);
+#endif
 
 	g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event",
 			 G_CALLBACK(close_conv_cb), gtkconv);
--- a/pidgin/gtkconv.h	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkconv.h	Sun Apr 19 03:17:46 2009 +0000
@@ -121,7 +121,11 @@
 
 	gboolean make_sound;
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gpointer depr2;
+#else
 	GtkTooltips *tooltips;
+#endif
 
 	GtkWidget *tab_cont;
 	GtkWidget *tabby;
--- a/pidgin/gtkdocklet-x11.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkdocklet-x11.c	Sun Apr 19 03:17:46 2009 +0000
@@ -39,7 +39,9 @@
 /* globals */
 static EggTrayIcon *docklet = NULL;
 static GtkWidget *image = NULL;
+#if !GTK_CHECK_VERSION(2,12,0)
 static GtkTooltips *tooltips = NULL;
+#endif
 static GdkPixbuf *blank_icon = NULL;
 static int embed_timeout = 0;
 static int docklet_height = 0;
@@ -164,6 +166,13 @@
 static void
 docklet_x11_set_tooltip(gchar *tooltip)
 {
+#if GTK_CHECK_VERSION(2,12,0)
+	if (tooltip) {
+		gtk_widget_set_tooltip_text(image->parent, tooltip);
+	} else {
+		gtk_widget_set_tooltip_text(image->parent, ""); /* NULL? */
+	}
+#else
 	if (!tooltips)
 		tooltips = gtk_tooltips_new();
 
@@ -175,6 +184,7 @@
 		gtk_tooltips_set_tip(tooltips, image->parent, "", NULL);
 		gtk_tooltips_disable(tooltips);
 	}
+#endif
 }
 
 #if GTK_CHECK_VERSION(2,2,0)
--- a/pidgin/gtkimhtmltoolbar.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Sun Apr 19 03:17:46 2009 +0000
@@ -669,7 +669,11 @@
 	g_object_set_data(G_OBJECT(button), "smiley_text", face);
 	g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar);
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_widget_set_tooltip_text(button, face);
+#else
 	gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL);
+#endif
 
 	/* these look really weird with borders */
 	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
@@ -683,7 +687,11 @@
 		g_snprintf(tip, sizeof(tip),
 			_("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"),
 			face);
+#if GTK_CHECK_VERSION(2,12,0)
+		gtk_widget_set_tooltip_text(button, tip);
+#else
 		gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL);
+#endif
 		gtk_widget_set_sensitive(button, FALSE);
 	} else if (psmiley) {
 		/* Remove the button if the smiley is destroyed */
@@ -1147,7 +1155,9 @@
 	}
 
 	g_free(toolbar->sml);
+#if !GTK_CHECK_VERSION(2,12,0)
 	gtk_object_sink(GTK_OBJECT(toolbar->tooltips));
+#endif
 
 	menu = g_object_get_data(object, "font_menu");
 	if (menu)
@@ -1244,7 +1254,11 @@
 			g_signal_connect(G_OBJECT(button), "clicked",
 					 G_CALLBACK(buttons[iter].callback), toolbar);
 			*(buttons[iter].button) = button;
+#if GTK_CHECK_VERSION(2,12,0)
+			gtk_widget_set_tooltip_text(button, buttons[iter].tooltip);
+#else
 			gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL);
+#endif
 		} else
 			button = gtk_vseparator_new();
 		gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
@@ -1334,7 +1348,9 @@
 	toolbar->smiley_dialog = NULL;
 	toolbar->image_dialog = NULL;
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	toolbar->tooltips = gtk_tooltips_new();
+#endif
 
 	gtk_box_set_spacing(GTK_BOX(toolbar), 3);
 
--- a/pidgin/gtkimhtmltoolbar.h	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkimhtmltoolbar.h	Sun Apr 19 03:17:46 2009 +0000
@@ -46,7 +46,11 @@
 
 	GtkWidget *imhtml;
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gpointer depr1;
+#else
 	GtkTooltips *tooltips;
+#endif
 
 	GtkWidget *bold;
 	GtkWidget *italic;
--- a/pidgin/gtkmenutray.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkmenutray.c	Sun Apr 19 03:17:46 2009 +0000
@@ -104,9 +104,11 @@
 		gtk_widget_destroy(GTK_WIDGET(tray->tray));
 #endif
 
+#if !GTK_CHECK_VERSION(2,12,0)
 	if (tray->tooltips) {
 		gtk_object_sink(GTK_OBJECT(tray->tooltips));
 	}
+#endif
 
 	G_OBJECT_CLASS(parent_class)->finalize(obj);
 }
@@ -244,13 +246,15 @@
 void
 pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip)
 {
+#if !GTK_CHECK_VERSION(2,12,0)
 	if (!menu_tray->tooltips)
 		menu_tray->tooltips = gtk_tooltips_new();
+#endif
 
 	/* Should we check whether widget is a child of menu_tray? */
 
 	/*
-	 * If the widget does not have it's own window, then it
+	 * If the widget does not have its own window, then it
 	 * must have automatically been added to an event box
 	 * when it was added to the menu tray.  If this is the
 	 * case, we want to set the tooltip on the widget's parent,
@@ -259,6 +263,10 @@
 	if (GTK_WIDGET_NO_WINDOW(widget))
 		widget = widget->parent;
 
+#if GTK_CHECK_VERSION(2,12,0)
+	gtk_widget_set_tooltip_text(widget, tooltip);
+#else
 	gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL);
+#endif
 }
 
--- a/pidgin/gtkmenutray.h	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkmenutray.h	Sun Apr 19 03:17:46 2009 +0000
@@ -40,7 +40,11 @@
 struct _PidginMenuTray {
 	GtkMenuItem gparent;					/**< The parent instance */
 	GtkWidget *tray;						/**< The tray */
+#if GTK_CHECK_VERSION(2,12,0)
+	gpointer depr1;
+#else
 	GtkTooltips *tooltips;					/**< Tooltips */
+#endif
 };
 
 /** A PidginMenuTrayClass */
--- a/pidgin/gtkprefs.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkprefs.c	Sun Apr 19 03:17:46 2009 +0000
@@ -164,14 +164,52 @@
 	return pidgin_add_widget_to_vbox(GTK_BOX(page), title, sg, entry, TRUE, NULL);
 }
 
+/* TODO: Maybe move this up somewheres... */
+enum {
+	PREF_DROPDOWN_TEXT,
+	PREF_DROPDOWN_VALUE,
+	PREF_DROPDOWN_COUNT
+};
 
 static void
 dropdown_set(GObject *w, const char *key)
 {
 	const char *str_value;
 	int int_value;
+	gboolean bool_value;
 	PurplePrefType type;
 
+#if GTK_CHECK_VERSION(2,4,0)
+	GtkTreeIter iter;
+	GtkTreeModel *tree_model;
+
+	tree_model = gtk_combo_box_get_model(GTK_COMBO_BOX(w));
+	gtk_combo_box_get_active_iter(GTK_COMBO_BOX(w), &iter);
+
+	type = GPOINTER_TO_INT(g_object_get_data(w, "type"));
+
+	if (type == PURPLE_PREF_INT) {
+		gtk_tree_model_get(tree_model, &iter,
+		                   PREF_DROPDOWN_VALUE, &int_value,
+		                   -1);
+
+		purple_prefs_set_int(key, int_value);
+	}
+	else if (type == PURPLE_PREF_STRING) {
+		gtk_tree_model_get(tree_model, &iter,
+		                   PREF_DROPDOWN_VALUE, &str_value,
+		                   -1);
+
+		purple_prefs_set_string(key, str_value);
+	}
+	else if (type == PURPLE_PREF_BOOLEAN) {
+		gtk_tree_model_get(tree_model, &iter,
+		                   PREF_DROPDOWN_VALUE, &bool_value,
+		                   -1);
+
+		purple_prefs_set_bool(key, bool_value);
+	}
+#else
 	type = GPOINTER_TO_INT(g_object_get_data(w, "type"));
 
 	if (type == PURPLE_PREF_INT) {
@@ -185,64 +223,129 @@
 		purple_prefs_set_string(key, str_value);
 	}
 	else if (type == PURPLE_PREF_BOOLEAN) {
-		purple_prefs_set_bool(key,
-				GPOINTER_TO_INT(g_object_get_data(w, "value")));
+		bool_value = (gboolean)GPOINTER_TO_INT(g_object_get_data(w, "value"));
+		purple_prefs_set_bool(key, bool_value);
 	}
+#endif
 }
 
 GtkWidget *
 pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title,
 		PurplePrefType type, const char *key, GList *menuitems)
 {
-	GtkWidget  *dropdown, *opt, *menu;
+	GtkWidget  *dropdown;
 	GtkWidget  *label = NULL;
 	gchar      *text;
 	const char *stored_str = NULL;
 	int         stored_int = 0;
+	gboolean    stored_bool = FALSE;
 	int         int_value  = 0;
 	const char *str_value  = NULL;
+	gboolean    bool_value = FALSE;
+#if GTK_CHECK_VERSION(2,4,0)
+	GtkListStore *store;
+	GtkTreeIter iter;
+	GtkTreeIter active;
+	GtkCellRenderer *renderer;
+
+	g_return_val_if_fail(menuitems != NULL, NULL);
+
+	if (type == PURPLE_PREF_INT) {
+		store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_INT);
+		stored_int = purple_prefs_get_int(key);
+	} else if (type == PURPLE_PREF_STRING) {
+		store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+		stored_str = purple_prefs_get_string(key);
+	} else if (type == PURPLE_PREF_BOOLEAN) {
+		store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_BOOLEAN);
+		stored_bool = purple_prefs_get_bool(key);
+	}
+
+	dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+	g_object_set_data(G_OBJECT(dropdown), "type", GINT_TO_POINTER(type));
+
+	while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) {
+		menuitems = g_list_next(menuitems);
+		g_return_val_if_fail(menuitems != NULL, NULL);
+
+		gtk_list_store_append(store, &iter);
+		gtk_list_store_set(store, &iter,
+		                   PREF_DROPDOWN_TEXT, text,
+		                   -1);
+
+		if (type == PURPLE_PREF_INT) {
+			int_value = GPOINTER_TO_INT(menuitems->data);
+			gtk_list_store_set(store, &iter,
+			                   PREF_DROPDOWN_VALUE, int_value,
+			                   -1);
+		}
+		else if (type == PURPLE_PREF_STRING) {
+			str_value = (const char *)menuitems->data;
+			gtk_list_store_set(store, &iter,
+			                   PREF_DROPDOWN_VALUE, str_value,
+			                   -1);
+		}
+		else if (type == PURPLE_PREF_BOOLEAN) {
+			bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data);
+			gtk_list_store_set(store, &iter,
+			                   PREF_DROPDOWN_VALUE, bool_value,
+			                   -1);
+		}
+
+		if ((type == PURPLE_PREF_INT && stored_int == int_value) ||
+			(type == PURPLE_PREF_STRING && stored_str != NULL &&
+			 !strcmp(stored_str, str_value)) ||
+			(type == PURPLE_PREF_BOOLEAN &&
+			 (stored_bool == bool_value))) {
+
+			active = iter;
+		}
+
+		menuitems = g_list_next(menuitems);
+	}
+
+	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(G_OBJECT(dropdown), "changed",
+	                 G_CALLBACK(dropdown_set), (char *)key);
+
+#else
+	GtkWidget  *opt, *menu;
 	int         o = 0;
 
 	g_return_val_if_fail(menuitems != NULL, NULL);
 
-#if 0 /* GTK_CHECK_VERSION(2,4,0) */
-	if(type == PURPLE_PREF_INT)
-		model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
-	else if(type == PURPLE_PREF_STRING)
-		model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
-	dropdown = gtk_combo_box_new_with_model(model);
-#else
 	dropdown = gtk_option_menu_new();
 	menu = gtk_menu_new();
-#endif
 
 	if (type == PURPLE_PREF_INT)
 		stored_int = purple_prefs_get_int(key);
 	else if (type == PURPLE_PREF_STRING)
 		stored_str = purple_prefs_get_string(key);
-
-	while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) {
+	else if (type == PURPLE_PREF_BOOLEAN)
+		stored_bool = purple_prefs_get_bool(key);
+
+	while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) {
 		menuitems = g_list_next(menuitems);
 		g_return_val_if_fail(menuitems != NULL, NULL);
 
 		opt = gtk_menu_item_new_with_label(text);
 
 		g_object_set_data(G_OBJECT(opt), "type", GINT_TO_POINTER(type));
-
-		if (type == PURPLE_PREF_INT) {
+		g_object_set_data(G_OBJECT(opt), "value", menuitems->data);
+
+		if (type == PURPLE_PREF_INT)
 			int_value = GPOINTER_TO_INT(menuitems->data);
-			g_object_set_data(G_OBJECT(opt), "value",
-							  GINT_TO_POINTER(int_value));
-		}
-		else if (type == PURPLE_PREF_STRING) {
+		else if (type == PURPLE_PREF_STRING)
 			str_value = (const char *)menuitems->data;
-
-			g_object_set_data(G_OBJECT(opt), "value", (char *)str_value);
-		}
-		else if (type == PURPLE_PREF_BOOLEAN) {
-			g_object_set_data(G_OBJECT(opt), "value",
-					menuitems->data);
-		}
+		else if (type == PURPLE_PREF_BOOLEAN)
+			bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data);
 
 		g_signal_connect(G_OBJECT(opt), "activate",
 						 G_CALLBACK(dropdown_set), (char *)key);
@@ -254,7 +357,7 @@
 			(type == PURPLE_PREF_STRING && stored_str != NULL &&
 			 !strcmp(stored_str, str_value)) ||
 			(type == PURPLE_PREF_BOOLEAN &&
-			 (purple_prefs_get_bool(key) == GPOINTER_TO_INT(menuitems->data)))) {
+			 (stored_bool == bool_value))) {
 
 			gtk_menu_set_active(GTK_MENU(menu), o);
 		}
@@ -266,6 +369,8 @@
 
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
 
+#endif
+
 	pidgin_add_widget_to_vbox(GTK_BOX(box), title, NULL, dropdown, FALSE, &label);
 
 	return label;
--- a/pidgin/gtkprivacy.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkprivacy.c	Sun Apr 19 03:17:46 2009 +0000
@@ -220,7 +220,11 @@
 
 	for (i = 0; i < menu_entry_count; i++) {
 		if (menu_entries[i].num == account->perm_deny) {
+#if GTK_CHECK_VERSION(2,4,0)
+			gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i);
+#else
 			gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->type_menu), i);
+#endif
 			break;
 		}
 	}
@@ -233,10 +237,17 @@
  * TODO: Setting the permit/deny setting needs to go through privacy.c
  *       Even better: the privacy API needs to not suck.
  */
+#if GTK_CHECK_VERSION(2,4,0)
+static void
+type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog)
+{
+	int new_type = menu_entries[gtk_combo_box_get_active(combo)].num;
+#else
 static void
 type_changed_cb(GtkOptionMenu *optmenu, PidginPrivacyDialog *dialog)
 {
 	int new_type = menu_entries[gtk_option_menu_get_history(optmenu)].num;
+#endif
 
 	dialog->account->perm_deny = new_type;
 	serv_set_permit_deny(purple_account_get_connection(dialog->account));
@@ -343,7 +354,9 @@
 	GtkWidget *button;
 	GtkWidget *dropdown;
 	GtkWidget *label;
+#if !GTK_CHECK_VERSION(2,4,0)
 	GtkWidget *menu;
+#endif
 	int selected = 0;
 	int i;
 
@@ -372,6 +385,24 @@
 	dialog->account = pidgin_account_option_menu_get_selected(dropdown);
 
 	/* Add the drop-down list with the allow/block types. */
+#if GTK_CHECK_VERSION(2,4,0)
+	dialog->type_menu = gtk_combo_box_new_text();
+	gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0);
+	gtk_widget_show(dialog->type_menu);
+
+	for (i = 0; i < menu_entry_count; i++) {
+		gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu),
+		                          _(menu_entries[i].text));
+
+		if (menu_entries[i].num == dialog->account->perm_deny)
+			selected = i;
+	}
+
+	gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), selected);
+
+	g_signal_connect(G_OBJECT(dialog->type_menu), "changed",
+					 G_CALLBACK(type_changed_cb), dialog);
+#else
 	dialog->type_menu = gtk_option_menu_new();
 	gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0);
 	gtk_widget_show(dialog->type_menu);
@@ -391,6 +422,7 @@
 
 	g_signal_connect(G_OBJECT(dialog->type_menu), "changed",
 					 G_CALLBACK(type_changed_cb), dialog);
+#endif
 
 	/* Build the treeview for the allow list. */
 	dialog->allow_widget = build_allow_list(dialog);
@@ -421,7 +453,11 @@
 	button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLOSE, G_CALLBACK(close_cb), dialog);
 	dialog->close_button = button;
 
+#if GTK_CHECK_VERSION(2,4,0)
+	type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog);
+#else
 	type_changed_cb(GTK_OPTION_MENU(dialog->type_menu), dialog);
+#endif
 #if 0
 	if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) {
 		gtk_widget_show(dialog->allow_widget);
--- a/pidgin/gtkrequest.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtkrequest.c	Sun Apr 19 03:17:46 2009 +0000
@@ -202,12 +202,21 @@
 			gtk_toggle_button_get_active(button));
 }
 
+#if GTK_CHECK_VERSION(2,4,0)
+static void
+field_choice_menu_cb(GtkComboBox *menu, PurpleRequestField *field)
+{
+	purple_request_field_choice_set_value(field,
+			gtk_combo_box_get_active(menu));
+}
+#else
 static void
 field_choice_menu_cb(GtkOptionMenu *menu, PurpleRequestField *field)
 {
 	purple_request_field_choice_set_value(field,
 			gtk_option_menu_get_history(menu));
 }
+#endif
 
 static void
 field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field)
@@ -870,6 +879,21 @@
 
 	if (num_labels > 5)
 	{
+#if GTK_CHECK_VERSION(2,4,0)
+		widget = gtk_combo_box_new_text();
+
+		for (l = labels; l != NULL; l = l->next)
+		{
+			const char *text = l->data;
+			gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text);
+		}
+
+		gtk_combo_box_set_active(GTK_COMBO_BOX(widget),
+						purple_request_field_choice_get_default_value(field));
+
+		g_signal_connect(G_OBJECT(widget), "changed",
+						 G_CALLBACK(field_choice_menu_cb), field);
+#else
 		GtkWidget *menu;
 		GtkWidget *item;
 
@@ -894,6 +918,7 @@
 
 		g_signal_connect(G_OBJECT(widget), "changed",
 						 G_CALLBACK(field_choice_menu_cb), field);
+#endif
 	}
 	else
 	{
--- a/pidgin/gtksavedstatuses.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/gtksavedstatuses.c	Sun Apr 19 03:17:46 2009 +0000
@@ -119,7 +119,11 @@
 
 	gchar *original_title;
 	GtkEntry *title;
+#if GTK_CHECK_VERSION(2,4,0)
+	GtkComboBox *type;
+#else
 	GtkOptionMenu *type;
+#endif
 	GtkIMHtml *message;
 } StatusEditor;
 
@@ -795,7 +799,11 @@
 		return;
 	}
 
+#if GTK_CHECK_VERSION(2,4,0)
+	type = gtk_combo_box_get_active(dialog->type) + (PURPLE_STATUS_UNSET + 1);
+#else
 	type = gtk_option_menu_get_history(dialog->type) + (PURPLE_STATUS_UNSET + 1);
+#endif
 	message = gtk_imhtml_get_markup(dialog->message);
 	unformatted = purple_markup_strip_html(message);
 
@@ -889,6 +897,64 @@
 	gtk_widget_set_sensitive(GTK_WIDGET(dialog->save_button), (*text != '\0'));
 }
 
+#if GTK_CHECK_VERSION(2,4,0)
+
+enum {
+	STATUS_MENU_STOCK_ICON,
+	STATUS_MENU_NAME,
+	STATUS_MENU_COUNT
+};
+
+static GtkWidget *
+create_status_type_menu(PurpleStatusPrimitive type)
+{
+	int i;
+	GtkWidget *dropdown;
+	GtkListStore *store;
+	GtkTreeIter iter;
+	GtkCellRenderer *renderer;
+
+	store = gtk_list_store_new(STATUS_MENU_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+
+	for (i = PURPLE_STATUS_UNSET + 1; i < PURPLE_STATUS_NUM_PRIMITIVES; i++)
+	{
+		if (i == PURPLE_STATUS_MOBILE || i == PURPLE_STATUS_TUNE)
+			/*
+			 * Special-case these.  They're intended to be independent
+			 * status types, so don't show them in the list.
+			 */
+			continue;
+
+		gtk_list_store_append(store, &iter);
+		/* TODO: how's this get the right size (since it seems to work fine)? */
+		gtk_list_store_set(store, &iter,
+		                   STATUS_MENU_STOCK_ICON, get_stock_icon_from_primitive(i),
+		                   STATUS_MENU_NAME, purple_primitive_get_name_from_type(i),
+		                   -1);
+	}
+
+	dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+
+	renderer = gtk_cell_renderer_pixbuf_new();
+	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, FALSE);
+	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer,
+	                               "stock-id", STATUS_MENU_STOCK_ICON,
+	                               NULL);
+
+	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", STATUS_MENU_NAME,
+	                               NULL);
+
+	gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown),
+	                         type - (PURPLE_STATUS_UNSET + 1));
+
+	return dropdown;
+}
+
+#else
+
 static GtkWidget *
 create_stock_item(const gchar *str, const gchar *icon)
 {
@@ -896,7 +962,7 @@
 	GtkWidget *label = gtk_label_new_with_mnemonic(str);
 	GtkWidget *hbox = gtk_hbox_new(FALSE, 4);
 	GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
-	GtkWidget *image = gtk_image_new_from_stock(icon, icon_size);;
+	GtkWidget *image = gtk_image_new_from_stock(icon, icon_size);
 
 	gtk_widget_show(label);
 	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
@@ -941,6 +1007,8 @@
 	return dropdown;
 }
 
+#endif
+
 static void edit_substatus(StatusEditor *status_editor, PurpleAccount *account);
 
 static void
@@ -1206,7 +1274,11 @@
 		dropdown = create_status_type_menu(purple_savedstatus_get_type(saved_status));
 	else
 		dropdown = create_status_type_menu(PURPLE_STATUS_AWAY);
+#if GTK_CHECK_VERSION(2,4,0)
+	dialog->type = GTK_COMBO_BOX(dropdown);
+#else
 	dialog->type = GTK_OPTION_MENU(dropdown);
+#endif
 	pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Status:"), sg, dropdown, TRUE, NULL);
 
 	/* Status message */
--- a/pidgin/plugins/gestures/gestures.c	Sat Apr 18 22:46:29 2009 +0000
+++ b/pidgin/plugins/gestures/gestures.c	Sun Apr 19 03:17:46 2009 +0000
@@ -149,6 +149,15 @@
 }
 
 #if 0
+#if GTK_CHECK_VERSION(2,4,0)
+static void
+mouse_button_menu_cb(GtkComboBox *opt, gpointer data)
+{
+	int button = gtk_combo_box_get_active(opt);
+
+	gstroke_set_mouse_button(button + 2);
+}
+#else
 static void
 mouse_button_menu_cb(GtkMenuItem *item, gpointer data)
 {
@@ -157,6 +166,7 @@
 	gstroke_set_mouse_button(button + 2);
 }
 #endif
+#endif
 
 static void
 toggle_draw_cb(GtkToggleButton *toggle, gpointer data)
@@ -224,8 +234,10 @@
 	GtkWidget *toggle;
 #if 0
 	GtkWidget *opt;
+#if GTK_CHECK_VERSION(2,4,0)
 	GtkWidget *menu, *item;
 #endif
+#endif
 
 	/* Outside container */
 	ret = gtk_vbox_new(FALSE, 18);
@@ -235,6 +247,19 @@
 	vbox = pidgin_make_frame(ret, _("Mouse Gestures Configuration"));
 
 #if 0
+#if GTK_CHECK_VERSION(2,4,0)
+	/* Mouse button drop-down menu */
+	opt = gtk_combo_box_new_text();
+
+	gtk_combo_box_append_text(_("Middle mouse button"));
+	gtk_combo_box_append_text(_("Right mouse button"));
+	g_signal_connect(G_OBJECT(opt), "changed",
+	                 G_CALLBACK(mouse_button_menu_cb), NULL);
+
+	gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0);
+	gtk_combo_box_set_active(GTK_COMBO_BOX(opt),
+							gstroke_get_mouse_button() - 2);
+#else
 	/* Mouse button drop-down menu */
 	menu = gtk_menu_new();
 	opt = gtk_option_menu_new();
@@ -254,6 +279,7 @@
 	gtk_option_menu_set_history(GTK_OPTION_MENU(opt),
 								gstroke_get_mouse_button() - 2);
 #endif
+#endif
 
 	/* "Visual gesture display" checkbox */
 	toggle = gtk_check_button_new_with_mnemonic(_("_Visual gesture display"));