[empathy] Remove calls to gtk_dialog_set_has_separator() if building against GTK+ 3



commit 290a4853102e645d76318e8e09ef45420a6559bc
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Sep 7 10:46:12 2010 +0100

    Remove calls to gtk_dialog_set_has_separator() if building against GTK+ 3
    
    gtk_dialog_set_has_separator() has been removed in GTK+ 3, but can't be
    removed (or the property's default value changed) in GTK+ 2 without breaking
    API. This adds a wrapper macro to keep the calls when building against GTK+ 2,
    and remove them when building against GTK+ 3.

 configure.ac                                       |    2 ++
 libempathy-gtk/empathy-contact-dialogs.c           |    8 ++++----
 libempathy-gtk/empathy-contact-selector-dialog.c   |    2 +-
 libempathy-gtk/empathy-individual-dialogs.c        |    2 +-
 libempathy-gtk/empathy-individual-edit-dialog.c    |    2 +-
 .../empathy-individual-information-dialog.c        |    2 +-
 libempathy-gtk/empathy-linking-dialog.c            |    3 ++-
 libempathy-gtk/empathy-status-preset-dialog.c      |    2 +-
 libempathy-gtk/empathy-ui-utils.h                  |   16 ++++++++++++++++
 src/empathy-accounts-dialog.c                      |    3 +++
 src/empathy-import-dialog.c                        |    4 ++++
 src/empathy-preferences.c                          |    4 ++++
 12 files changed, 40 insertions(+), 10 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5003809..93391df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -205,6 +205,8 @@ if test "x$have_gtk3" == "xyes"; then
    PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED_GTK3)
    PKG_CHECK_MODULES(UNIQUE, unique-3.0 >= $UNIQUE_REQUIRED)
    PKG_CHECK_MODULES(GCR, gcr-3 >= $KEYRING_REQUIRED)
+
+   AC_DEFINE(HAVE_GTK3, 1, [Define if we're compiling against GTK+ 3])
 else
    PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED)
 
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 003710b..6da1810 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -178,7 +178,7 @@ empathy_contact_information_dialog_show (EmpathyContact *contact,
 
 	/* Create dialog */
 	dialog = gtk_dialog_new ();
-	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+	empathy_dialog_remove_separator (GTK_DIALOG (dialog));
 	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 	gtk_window_set_title (GTK_WINDOW (dialog),
 		empathy_contact_get_alias (contact));
@@ -238,7 +238,7 @@ empathy_contact_edit_dialog_show (EmpathyContact *contact,
 
 	/* Create dialog */
 	dialog = gtk_dialog_new ();
-	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+	empathy_dialog_remove_separator (GTK_DIALOG (dialog));
 	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 	gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Contact Information"));
 
@@ -290,7 +290,7 @@ empathy_contact_personal_dialog_show (GtkWindow *parent)
 
 	/* Create dialog */
 	personal_dialog = gtk_dialog_new ();
-	gtk_dialog_set_has_separator (GTK_DIALOG (personal_dialog), FALSE);
+	empathy_dialog_remove_separator (GTK_DIALOG (personal_dialog));
 	gtk_window_set_resizable (GTK_WINDOW (personal_dialog), FALSE);
 	gtk_window_set_title (GTK_WINDOW (personal_dialog), _("Personal Information"));
 
@@ -396,7 +396,7 @@ empathy_new_contact_dialog_show_with_contact (GtkWindow *parent,
 
 	/* Create dialog */
 	dialog = gtk_dialog_new ();
-	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+	empathy_dialog_remove_separator (GTK_DIALOG (dialog));
 	gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 	gtk_window_set_title (GTK_WINDOW (dialog), _("New Contact"));
 
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c
index 47a8402..7989e9c 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.c
+++ b/libempathy-gtk/empathy-contact-selector-dialog.c
@@ -316,7 +316,7 @@ empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
 
   /* Tweak the dialog */
-  gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+  empathy_dialog_remove_separator (GTK_DIALOG (dialog));
 
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
   gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);
diff --git a/libempathy-gtk/empathy-individual-dialogs.c b/libempathy-gtk/empathy-individual-dialogs.c
index cd5c0f3..5568281 100644
--- a/libempathy-gtk/empathy-individual-dialogs.c
+++ b/libempathy-gtk/empathy-individual-dialogs.c
@@ -107,7 +107,7 @@ empathy_new_individual_dialog_show_with_individual (GtkWindow *parent,
 
   /* Create dialog */
   dialog = gtk_dialog_new ();
-  gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+  empathy_dialog_remove_separator (GTK_DIALOG (dialog));
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
   gtk_window_set_title (GTK_WINDOW (dialog), _("New Contact"));
 
diff --git a/libempathy-gtk/empathy-individual-edit-dialog.c b/libempathy-gtk/empathy-individual-edit-dialog.c
index 3f5f35d..30ca1cc 100644
--- a/libempathy-gtk/empathy-individual-edit-dialog.c
+++ b/libempathy-gtk/empathy-individual-edit-dialog.c
@@ -243,7 +243,7 @@ empathy_individual_edit_dialog_init (
   dialog->priv = priv;
   priv->individual = NULL;
 
-  gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+  empathy_dialog_remove_separator (GTK_DIALOG (dialog));
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
   gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Contact Information"));
 
diff --git a/libempathy-gtk/empathy-individual-information-dialog.c b/libempathy-gtk/empathy-individual-information-dialog.c
index 438c0bb..e6d4a90 100644
--- a/libempathy-gtk/empathy-individual-information-dialog.c
+++ b/libempathy-gtk/empathy-individual-information-dialog.c
@@ -273,7 +273,7 @@ empathy_individual_information_dialog_init (
   dialog->priv = priv;
   priv->individual = NULL;
 
-  gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+  empathy_dialog_remove_separator (GTK_DIALOG (dialog));
   gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
 
   content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
diff --git a/libempathy-gtk/empathy-linking-dialog.c b/libempathy-gtk/empathy-linking-dialog.c
index cb6461a..2e62e5d 100644
--- a/libempathy-gtk/empathy-linking-dialog.c
+++ b/libempathy-gtk/empathy-linking-dialog.c
@@ -34,6 +34,7 @@
 
 #include "empathy-linking-dialog.h"
 #include "empathy-individual-linker.h"
+#include "empathy-ui-utils.h"
 
 /**
  * SECTION:empathy-individual-widget
@@ -107,7 +108,7 @@ empathy_linking_dialog_init (EmpathyLinkingDialog *self)
   dialog = GTK_DIALOG (self);
 
   /* Set up dialog */
-  gtk_dialog_set_has_separator (dialog, FALSE);
+  empathy_dialog_remove_separator (GTK_DIALOG (dialog));
   gtk_window_set_resizable (GTK_WINDOW (self), TRUE);
   /* Translators: this is the title of the linking dialogue (reached by
    * right-clicking on a contact and selecting "Linkâ?¦"). "Link" in this title
diff --git a/libempathy-gtk/empathy-status-preset-dialog.c b/libempathy-gtk/empathy-status-preset-dialog.c
index 315a750..2a5904b 100644
--- a/libempathy-gtk/empathy-status-preset-dialog.c
+++ b/libempathy-gtk/empathy-status-preset-dialog.c
@@ -521,7 +521,7 @@ empathy_status_preset_dialog_init (EmpathyStatusPresetDialog *self)
 
 	gtk_window_set_title (GTK_WINDOW (self),
 			_("Edit Custom Messages"));
-	gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+	empathy_dialog_remove_separator (GTK_DIALOG (self));
 	gtk_dialog_add_button (GTK_DIALOG (self),
 			GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
 
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index 0b76d09..43da188 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -129,6 +129,22 @@ void        empathy_window_iconify                      (GtkWindow        *windo
 							 GtkStatusIcon    *status_icon);
 GtkWindow * empathy_get_toplevel_window                 (GtkWidget        *widget);
 
+/**
+ * empathy_dialog_remove_separator:
+ * @d: a #GtkDialog
+ *
+ * Replacement for gtk_dialog_set_has_separator(), which was removed for GTK+ 3.
+ * This is a no-op for GTK+ 3, and expands to a call to
+ * gtk_dialog_set_has_separator() with %FALSE for GTK+ 2.
+ *
+ * FIXME: Once we depend on GTK+ 3 unconditionally, this macro can be removed.
+ */
+#ifndef HAVE_GTK3
+#define empathy_dialog_remove_separator(d) gtk_dialog_set_has_separator(d, FALSE);
+#else
+#define empathy_dialog_remove_separator(d)
+#endif
+
 /* URL */
 gchar *     empathy_make_absolute_url                   (const gchar      *url);
 
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 4bf6927..2ad2fb7 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -2155,7 +2155,10 @@ accounts_dialog_build_ui (EmpathyAccountsDialog *dialog)
 
   gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+  /* FIXME: Remove this once we unconditionally depend on GTK+ 3 */
+#ifndef HAVE_GTK3
   gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+#endif
 
   /* add dialog buttons */
   gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), GTK_BUTTONBOX_END);
diff --git a/src/empathy-import-dialog.c b/src/empathy-import-dialog.c
index e8b1ed8..1fc00c0 100644
--- a/src/empathy-import-dialog.c
+++ b/src/empathy-import-dialog.c
@@ -198,7 +198,11 @@ empathy_import_dialog_init (EmpathyImportDialog *self)
   gtk_container_set_border_width (GTK_CONTAINER (self), 5);
   gtk_window_set_title (GTK_WINDOW (self), _("Import Accounts"));
   gtk_window_set_modal (GTK_WINDOW (self), TRUE);
+
+  /* FIXME: Remove this once we unconditionally depend on GTK+ 3 */
+#ifndef HAVE_GTK3
   gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+#endif
 }
 
 static void
diff --git a/src/empathy-preferences.c b/src/empathy-preferences.c
index acf5eab..edc4059 100644
--- a/src/empathy-preferences.c
+++ b/src/empathy-preferences.c
@@ -884,7 +884,11 @@ empathy_preferences_init (EmpathyPreferences *preferences)
 	gtk_window_set_position (GTK_WINDOW (preferences),
 				 GTK_WIN_POS_CENTER_ON_PARENT);
 	gtk_window_set_icon_name (GTK_WINDOW (preferences), "gtk-preferences");
+
+	/* FIXME: Remove this once we unconditionally depend on GTK+ 3 */
+#ifndef HAVE_GTK3
 	gtk_dialog_set_has_separator (GTK_DIALOG (preferences), FALSE);
+#endif
 
 	filename = empathy_file_lookup ("empathy-preferences.ui", "src");
 	gui = empathy_builder_get_file (filename,



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