changeset 29411:ded4c63c39a9

Remove GTK version checks which are no longer necessary. Refs #1332 too.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 19 Feb 2010 07:40:34 +0000
parents 93876452633b
children 0aafa5cc2628
files pidgin/gtkprivacy.c pidgin/gtkrequest.c pidgin/gtksavedstatuses.c
diffstat 3 files changed, 1 insertions(+), 147 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkprivacy.c	Fri Feb 19 07:29:30 2010 +0000
+++ b/pidgin/gtkprivacy.c	Fri Feb 19 07:40:34 2010 +0000
@@ -220,11 +220,7 @@
 
 	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;
 		}
 	}
@@ -237,17 +233,10 @@
  * 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));
@@ -354,10 +343,7 @@
 	GtkWidget *button;
 	GtkWidget *dropdown;
 	GtkWidget *label;
-#if !GTK_CHECK_VERSION(2,4,0)
-	GtkWidget *menu;
-#endif
-	int selected = 0;
+	int selected = -1;
 	int i;
 
 	dialog = g_new0(PidginPrivacyDialog, 1);
@@ -385,7 +371,6 @@
 	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);
@@ -402,27 +387,6 @@
 
 	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);
-
-	/* Build the menu for that. */
-	menu = gtk_menu_new();
-
-	for (i = 0; i < menu_entry_count; i++) {
-		pidgin_new_item(menu, _(menu_entries[i].text));
-
-		if (menu_entries[i].num == dialog->account->perm_deny)
-			selected = i;
-	}
-
-	gtk_option_menu_set_menu(GTK_OPTION_MENU(dialog->type_menu), menu);
-	gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->type_menu), selected);
-
-	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);
@@ -453,11 +417,7 @@
 	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	Fri Feb 19 07:29:30 2010 +0000
+++ b/pidgin/gtkrequest.c	Fri Feb 19 07:40:34 2010 +0000
@@ -229,21 +229,12 @@
 			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)
@@ -937,7 +928,6 @@
 
 	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)
@@ -951,32 +941,6 @@
 
 		g_signal_connect(G_OBJECT(widget), "changed",
 						 G_CALLBACK(field_choice_menu_cb), field);
-#else
-		GtkWidget *menu;
-		GtkWidget *item;
-
-		widget = gtk_option_menu_new();
-
-		menu = gtk_menu_new();
-
-		for (l = labels; l != NULL; l = l->next)
-		{
-			const char *text = l->data;
-
-			item = gtk_menu_item_new_with_label(text);
-			gtk_widget_show(item);
-
-			gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-		}
-
-		gtk_widget_show(menu);
-		gtk_option_menu_set_menu(GTK_OPTION_MENU(widget), menu);
-		gtk_option_menu_set_history(GTK_OPTION_MENU(widget),
-						purple_request_field_choice_get_default_value(field));
-
-		g_signal_connect(G_OBJECT(widget), "changed",
-						 G_CALLBACK(field_choice_menu_cb), field);
-#endif
 	}
 	else
 	{
--- a/pidgin/gtksavedstatuses.c	Fri Feb 19 07:29:30 2010 +0000
+++ b/pidgin/gtksavedstatuses.c	Fri Feb 19 07:40:34 2010 +0000
@@ -118,11 +118,7 @@
 
 	gchar *original_title;
 	GtkEntry *title;
-#if GTK_CHECK_VERSION(2,4,0)
 	GtkComboBox *type;
-#else
-	GtkOptionMenu *type;
-#endif
 	GtkIMHtml *message;
 } StatusEditor;
 
@@ -746,11 +742,7 @@
 		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);
 
@@ -844,8 +836,6 @@
 	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,
@@ -900,62 +890,6 @@
 	return dropdown;
 }
 
-#else
-
-static GtkWidget *
-create_stock_item(const gchar *str, const gchar *icon)
-{
-	GtkWidget *menuitem = gtk_menu_item_new();
-	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);
-
-	gtk_widget_show(label);
-	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
-	gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
-	gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
-	gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
-
-	gtk_container_add(GTK_CONTAINER(menuitem), hbox);
-
-	return menuitem;
-}
-
-static GtkWidget *
-create_status_type_menu(PurpleStatusPrimitive type)
-{
-	int i;
-	GtkWidget *dropdown;
-	GtkWidget *menu;
-	GtkWidget *item;
-
-	dropdown = gtk_option_menu_new();
-	menu = gtk_menu_new();
-
-	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;
-
-		item = create_stock_item(purple_primitive_get_name_from_type(i),
-					get_stock_icon_from_primitive(i));
-		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
-	}
-
-	gtk_menu_set_active(GTK_MENU(menu), type - (PURPLE_STATUS_UNSET + 1));
-	gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
-	gtk_widget_show_all(menu);
-
-	return dropdown;
-}
-
-#endif
-
 static void edit_substatus(StatusEditor *status_editor, PurpleAccount *account);
 
 static void
@@ -1221,11 +1155,7 @@
 		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 */