pidgin: 01227b6f: Remove GTK version checks which are no l...

qulogic at pidgin.im qulogic at pidgin.im
Sat Feb 20 02:12:13 EST 2010


-----------------------------------------------------------------
Revision: 01227b6f027e973ca36dd44d581d5895f6453075
Ancestor: 9d4f4577f00074017bc7a68c5106ca0f0a2f8753
Author: qulogic at pidgin.im
Date: 2010-02-19T07:40:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/01227b6f027e973ca36dd44d581d5895f6453075

Modified files:
        pidgin/gtkprivacy.c pidgin/gtkrequest.c
        pidgin/gtksavedstatuses.c

ChangeLog: 

Remove GTK version checks which are no longer necessary. Refs #1332 too.

-------------- next part --------------
============================================================
--- pidgin/gtkprivacy.c	2d3c230c4d7ca22a0ea4a76771096f567b100322
+++ pidgin/gtkprivacy.c	18fdd26c09ac0b5c3e27b5d68dfa195c7a853bac
@@ -220,11 +220,7 @@ select_account_cb(GtkWidget *dropdown, P
 
 	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 @@ select_account_cb(GtkWidget *dropdown, P
  * 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 @@ privacy_dialog_new(void)
 	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 @@ privacy_dialog_new(void)
 	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,28 +387,7 @@ privacy_dialog_new(void)
 
 	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);
 	gtk_box_pack_start(GTK_BOX(vbox), dialog->allow_widget, TRUE, TRUE, 0);
@@ -453,11 +417,7 @@ privacy_dialog_new(void)
 	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);
============================================================
--- pidgin/gtkrequest.c	530a9d904947b13764032c4c37fe4d5febeadbac
+++ pidgin/gtkrequest.c	850852851504598f938b1d9e3155d11896b88562
@@ -229,21 +229,12 @@ field_bool_cb(GtkToggleButton *button, P
 			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 @@ create_choice_field(PurpleRequestField *
 
 	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 @@ create_choice_field(PurpleRequestField *
 
 		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
 	{
============================================================
--- pidgin/gtksavedstatuses.c	0b280f63ea704e5c1598ed8c026c8c1a7698df04
+++ pidgin/gtksavedstatuses.c	6488f54e7d56d6e394da0a19e6b3880797522f77
@@ -118,11 +118,7 @@ typedef struct
 
 	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 @@ status_editor_ok_cb(GtkButton *button, g
 		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 @@ editor_title_changed_cb(GtkWidget *widge
 	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 @@ create_status_type_menu(PurpleStatusPrim
 	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 @@ pidgin_status_editor_show(gboolean edit,
 		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 */


More information about the Commits mailing list