[evolution-exchange] Be able to compile against Gtk+ 2.23.0



commit e9596e5a2f5e2c1bc5c8700eafc3ead17f819020
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 26 10:38:22 2010 +0200

    Be able to compile against Gtk+ 2.23.0

 eplugin/exchange-delegates-user.c      |   44 ++++++++++++++++---------------
 eplugin/exchange-folder-subscription.c |   35 +++++++++++++++++++------
 eplugin/exchange-permissions-dialog.c  |   10 ++++---
 eplugin/exchange-send-options.c        |   19 +++++++------
 eplugin/gtk-compat.h                   |   27 +++++++++++++++++++
 5 files changed, 92 insertions(+), 43 deletions(-)
---
diff --git a/eplugin/exchange-delegates-user.c b/eplugin/exchange-delegates-user.c
index a8bf13b..6487d12 100644
--- a/eplugin/exchange-delegates-user.c
+++ b/eplugin/exchange-delegates-user.c
@@ -43,6 +43,8 @@
 
 #include <string.h>
 
+#include "gtk-compat.h"
+
 #define EXCHANGE_DELEGATES_USER_CUSTOM    -3
 /* Can't use E2K_PERMISSIONS_ROLE_CUSTOM, because it's -1, which
  * means "end of list" to e_dialog_combo_box_get/set
@@ -130,7 +132,7 @@ static void
 set_perms (GtkWidget *combobox, E2kPermissionsRole role)
 {
 	if (!is_delegate_role (role)) {
-		gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Custom"));
+		gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Custom"));
 		role = EXCHANGE_DELEGATES_USER_CUSTOM;
 	}
 
@@ -297,45 +299,45 @@ exchange_delegates_user_edit (ExchangeAccount *account,
 	gtk_label_set_justify (GTK_LABEL (contact_label), GTK_JUSTIFY_CENTER);
 	gtk_misc_set_alignment (GTK_MISC (contact_label), 0, 0.5);
 
-	calendar_perms_combobox = gtk_combo_box_new_text ();
+	calendar_perms_combobox = gtk_combo_box_text_new ();
 	gtk_widget_show (calendar_perms_combobox);
 	gtk_table_attach (GTK_TABLE (folders_table), calendar_perms_combobox, 1, 2, 0, 1,
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("None"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("Reviewer (read-only)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("Author (read, create)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (calendar_perms_combobox), _("Editor (read, create, edit)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (calendar_perms_combobox), _("None"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (calendar_perms_combobox), _("Reviewer (read-only)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (calendar_perms_combobox), _("Author (read, create)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (calendar_perms_combobox), _("Editor (read, create, edit)"));
 
-	task_perms_combobox = gtk_combo_box_new_text ();
+	task_perms_combobox = gtk_combo_box_text_new ();
 	gtk_widget_show (task_perms_combobox);
 	gtk_table_attach (GTK_TABLE (folders_table), task_perms_combobox, 1, 2, 1, 2,
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("None"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("Reviewer (read-only)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("Author (read, create)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (task_perms_combobox), _("Editor (read, create, edit)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (task_perms_combobox), _("None"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (task_perms_combobox), _("Reviewer (read-only)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (task_perms_combobox), _("Author (read, create)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (task_perms_combobox), _("Editor (read, create, edit)"));
 
-	inbox_perms_combobox = gtk_combo_box_new_text ();
+	inbox_perms_combobox = gtk_combo_box_text_new ();
 	gtk_widget_show (inbox_perms_combobox);
 	gtk_table_attach (GTK_TABLE (folders_table), inbox_perms_combobox, 1, 2, 2, 3,
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("None"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("Reviewer (read-only)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("Author (read, create)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (inbox_perms_combobox), _("Editor (read, create, edit)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (inbox_perms_combobox), _("None"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (inbox_perms_combobox), _("Reviewer (read-only)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (inbox_perms_combobox), _("Author (read, create)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (inbox_perms_combobox), _("Editor (read, create, edit)"));
 
-	contact_perms_combobox = gtk_combo_box_new_text ();
+	contact_perms_combobox = gtk_combo_box_text_new ();
 	gtk_widget_show (contact_perms_combobox);
 	gtk_table_attach (GTK_TABLE (folders_table), contact_perms_combobox, 1, 2, 3, 4,
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("None"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("Reviewer (read-only)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("Author (read, create)"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (contact_perms_combobox), _("Editor (read, create, edit)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (contact_perms_combobox), _("None"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (contact_perms_combobox), _("Reviewer (read-only)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (contact_perms_combobox), _("Author (read, create)"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (contact_perms_combobox), _("Editor (read, create, edit)"));
 
 	delegate_mail = gtk_check_button_new_with_mnemonic (_("_Summarize permissions"));
 	gtk_widget_show (delegate_mail);
diff --git a/eplugin/exchange-folder-subscription.c b/eplugin/exchange-folder-subscription.c
index 2067f5c..d61a7eb 100644
--- a/eplugin/exchange-folder-subscription.c
+++ b/eplugin/exchange-folder-subscription.c
@@ -38,6 +38,7 @@
 #include "exchange-config-listener.h"
 #include "exchange-folder-subscription.h"
 #include "exchange-operations.h"
+#include "gtk-compat.h"
 
 static void
 user_response (ENameSelectorDialog *name_selector_dialog, gint response, gpointer data)
@@ -63,7 +64,7 @@ setup_name_selector (GtkWidget *placeholder, GtkWidget *button_user, ENameSelect
 	ENameSelectorDialog *name_selector_dialog;
 	GtkWidget *widget;
 
-	g_assert (GTK_IS_CONTAINER (placeholder));
+	g_return_val_if_fail (GTK_IS_CONTAINER (placeholder), NULL);
 
 	name_selector = e_name_selector_new ();
 
@@ -89,7 +90,7 @@ setup_name_selector (GtkWidget *placeholder, GtkWidget *button_user, ENameSelect
 static void
 setup_folder_name_combo (GtkWidget *widget, const gchar *fname)
 {
-	GtkComboBox *combo;
+	GtkComboBoxText *combo;
 	const gchar *strings[] = {
 		"Calendar",
 		"Inbox",
@@ -100,13 +101,13 @@ setup_folder_name_combo (GtkWidget *widget, const gchar *fname)
 	};
 	gint i;
 
-	combo = GTK_COMBO_BOX (widget);
-	g_assert (GTK_IS_COMBO_BOX_ENTRY (combo));
+	combo = GTK_COMBO_BOX_TEXT (widget);
+	g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (combo));
 
-	gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (combo)));
+	gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (combo))));
 
 	for (i = 0; strings[i] != NULL; i++)
-		gtk_combo_box_append_text (combo, strings[i]);
+		gtk_combo_box_text_append_text (combo, strings[i]);
 
 	gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))), fname);
 }
@@ -139,11 +140,11 @@ user_name_entry_changed_callback (GtkEditable *editable, gpointer data)
 static void
 setup_server_combobox (GtkWidget *widget, gchar *mail_account)
 {
-	g_return_if_fail (GTK_IS_COMBO_BOX (widget));
+	g_return_if_fail (GTK_IS_COMBO_BOX_TEXT (widget));
 
 	gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (GTK_COMBO_BOX (widget))));
 
-	gtk_combo_box_append_text (GTK_COMBO_BOX (widget), mail_account);
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), mail_account);
 	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
 
 	/* FIXME: Default to the current storage in the shell view.  */
@@ -345,13 +346,29 @@ create_folder_subscription_dialog (ExchangeAccount *account, const gchar *fname)
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (0), 0, 0);
 
+#if GTK_CHECK_VERSION(2,23,0)
+	/* FIXME Rewrite this when removing the version check. */
+	{
+		GtkListStore *store;
+
+		store = gtk_list_store_new (1, G_TYPE_STRING);
+		folder_name_combo = g_object_new (
+			GTK_TYPE_COMBO_BOX,
+			"model", store,
+			"has-entry", TRUE,
+			"entry-text-column", 0,
+			NULL);
+		g_object_unref (store);
+	}
+#else
 	folder_name_combo = gtk_combo_box_entry_new_text ();
+#endif
 	gtk_widget_show (folder_name_combo);
 	gtk_table_attach (GTK_TABLE (table1), folder_name_combo, 1, 2, 2, 3,
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
 
-	server_combobox = gtk_combo_box_new_text ();
+	server_combobox = gtk_combo_box_text_new ();
 	gtk_widget_show (server_combobox);
 	gtk_table_attach (GTK_TABLE (table1), server_combobox, 1, 2, 0, 1,
 			  (GtkAttachOptions) (GTK_FILL),
diff --git a/eplugin/exchange-permissions-dialog.c b/eplugin/exchange-permissions-dialog.c
index 51d1398..82b2cfb 100644
--- a/eplugin/exchange-permissions-dialog.c
+++ b/eplugin/exchange-permissions-dialog.c
@@ -42,6 +42,8 @@
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-alert-dialog.h>
 
+#include "gtk-compat.h"
+
 struct _ExchangePermissionsDialogPrivate {
 	ExchangeAccount *account;
 	gchar *base_uri, *folder_path;
@@ -542,14 +544,14 @@ display_role (ExchangePermissionsDialog *dialog)
 
 	if (role == E2K_PERMISSIONS_ROLE_CUSTOM) {
 		if (dialog->priv->custom_added == FALSE) {
-			gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->role_optionmenu), _("Custom"));
+			gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->priv->role_optionmenu), _("Custom"));
 			dialog->priv->custom_added = TRUE;
 		}
 		role = E2K_PERMISSIONS_ROLE_NUM_ROLES;
 	}
 	else	{
 		if (dialog->priv->custom_added) {
-			gtk_combo_box_remove_text (GTK_COMBO_BOX (dialog->priv->role_optionmenu), E2K_PERMISSIONS_ROLE_NUM_ROLES);
+			gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (dialog->priv->role_optionmenu), E2K_PERMISSIONS_ROLE_NUM_ROLES);
 			dialog->priv->custom_added = FALSE;
 		}
 	}
@@ -680,11 +682,11 @@ exchange_permissions_role_optionmenu_new (void)
 	const gchar **roles;
 	gint role;
 
-	menu = gtk_combo_box_new_text ();
+	menu = gtk_combo_box_text_new ();
 	roles = g_new (const gchar *, E2K_PERMISSIONS_ROLE_NUM_ROLES + 1);
 	for (role = 0; role < E2K_PERMISSIONS_ROLE_NUM_ROLES; role++) {
 		roles[role] = e2k_permissions_role_get_name (role);
-		gtk_combo_box_append_text (GTK_COMBO_BOX (menu), roles[role]);
+		gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (menu), roles[role]);
 	}
 
 	roles[role] = NULL;
diff --git a/eplugin/exchange-send-options.c b/eplugin/exchange-send-options.c
index 31b6a56..47c6cf0 100644
--- a/eplugin/exchange-send-options.c
+++ b/eplugin/exchange-send-options.c
@@ -32,6 +32,7 @@
 #include <e-util/e-alert-dialog.h>
 
 #include "exchange-send-options.h"
+#include "gtk-compat.h"
 
 G_DEFINE_TYPE (ExchangeSendOptionsDialog, exchange_sendoptions_dialog, G_TYPE_OBJECT)
 
@@ -385,24 +386,24 @@ exchange_sendoptions_dialog_run (ExchangeSendOptionsDialog *sod, GtkWidget *pare
 			  (GtkAttachOptions) (0), 0, 0);
 	gtk_misc_set_alignment (GTK_MISC (sensitivity_label), 0, 0.5);
 
-	sensitivity_combo_box = gtk_combo_box_new_text ();
+	sensitivity_combo_box = gtk_combo_box_text_new ();
 	gtk_widget_show (sensitivity_combo_box);
 	gtk_table_attach (GTK_TABLE (msg_settings_table), sensitivity_combo_box, 1, 2, 1, 2,
 			  (GtkAttachOptions) (GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Normal"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Personal"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Private"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (sensitivity_combo_box), _("Confidential"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (sensitivity_combo_box), _("Normal"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (sensitivity_combo_box), _("Personal"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (sensitivity_combo_box), _("Private"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (sensitivity_combo_box), _("Confidential"));
 
-	imp_combo_box = gtk_combo_box_new_text ();
+	imp_combo_box = gtk_combo_box_text_new ();
 	gtk_widget_show (imp_combo_box);
 	gtk_table_attach (GTK_TABLE (msg_settings_table), imp_combo_box, 1, 2, 0, 1,
 			  (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
 			  (GtkAttachOptions) (GTK_FILL), 0, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (imp_combo_box), _("Normal"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (imp_combo_box), _("High"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (imp_combo_box), _("Low"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (imp_combo_box), _("Normal"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (imp_combo_box), _("High"));
+	gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (imp_combo_box), _("Low"));
 
 	del_enabled_check = gtk_check_button_new_with_mnemonic (_("Send as Delegate"));
 	gtk_widget_show (del_enabled_check);
diff --git a/eplugin/gtk-compat.h b/eplugin/gtk-compat.h
new file mode 100644
index 0000000..3505e66
--- /dev/null
+++ b/eplugin/gtk-compat.h
@@ -0,0 +1,27 @@
+#ifndef __GTK_COMPAT_H__
+#define __GTK_COMPAT_H__
+
+#include <gtk/gtk.h>
+
+/* Provide a GTK+ compatibility layer. */
+
+#if !GTK_CHECK_VERSION (2,23,0)
+#define gtk_combo_box_text_new			gtk_combo_box_new_text
+#define gtk_combo_box_text_append_text		gtk_combo_box_append_text
+#define gtk_combo_box_text_remove		gtk_combo_box_remove_text
+#define gtk_combo_box_text_prepend_text		gtk_combo_box_prepend_text
+#define gtk_combo_box_text_get_active_text	gtk_combo_box_get_active_text
+#define GTK_COMBO_BOX_TEXT			GTK_COMBO_BOX
+#define GTK_IS_COMBO_BOX_TEXT			GTK_IS_COMBO_BOX
+#define GtkComboBoxText				GtkComboBox
+#endif
+
+#if GTK_CHECK_VERSION (2,23,0)
+#define GTK_COMBO_BOX_ENTRY			GTK_COMBO_BOX
+#define GTK_IS_COMBO_BOX_ENTRY			GTK_IS_COMBO_BOX
+#else
+#define gtk_combo_box_set_entry_text_column \
+	gtk_combo_box_entry_set_text_column
+#endif
+
+#endif /* __GTK_COMPAT_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]