[Xfce4-commits] [xfce/libxfce4ui] 02/04: fix: remove deprecation warnings

noreply at xfce.org noreply at xfce.org
Sat Jun 24 19:35:27 CEST 2017


This is an automated email from the git hooks/post-receive script.

e   r   i   c       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/libxfce4ui.

commit 668644fed9d218f72d1764a19ca61bf6e45dec38
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sat Jun 24 12:43:18 2017 +0300

    fix: remove deprecation warnings
    
    And update the Gtk3 requirement to 3.18.
---
 configure.ac.in                            | 10 ++++++++--
 libxfce4kbd-private/xfce-shortcut-dialog.c | 27 ++++++++++++++++++++++++---
 libxfce4ui/xfce-dialogs.c                  |  1 -
 libxfce4ui/xfce-gdk-extensions.c           |  2 +-
 libxfce4ui/xfce-gtk-extensions.c           | 10 +++++++++-
 5 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 2ff8ee5..f88b029 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -126,7 +126,7 @@ XDT_CHECK_LIBSM()
 dnl ***********************************
 dnl *** Check for required packages ***
 dnl ***********************************
-XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.30.0])
+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.42.0])
 XDT_CHECK_PACKAGE([GTK2], [gtk+-2.0], [2.24.0])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.12.0])
 
@@ -134,10 +134,16 @@ dnl ***********************************************************
 dnl *** Optional support for a GTK+3 version of the library ***
 dnl ***********************************************************
 XDT_CHECK_OPTIONAL_PACKAGE([GTK3],
-                           [gtk+-3.0], [3.2.0], [gtk3],
+                           [gtk+-3.0], [3.18.0], [gtk3],
                            [GTK+ 3 support])
 AM_CONDITIONAL([ENABLE_GTK3_LIBRARY], [test "x$GTK3_FOUND" = "xyes"])
 
+AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_42, [Ignore post 2.42 deprecations])
+AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_42, [Prevent post 2.42 APIs])
+
+AC_DEFINE(GDK_VERSION_MIN_REQUIRED, GDK_VERSION_3_18, [Ignore post 3.18 deprecations])
+AC_DEFINE(GDK_VERSION_MAX_ALLOWED, GDK_VERSION_3_18, [Prevent post 3.18 APIs])
+
 dnl ***************************************
 dnl *** Check for gobject-introspection ***
 dnl ***************************************
diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c
index bb29b1e..82c3d5c 100644
--- a/libxfce4kbd-private/xfce-shortcut-dialog.c
+++ b/libxfce4kbd-private/xfce-shortcut-dialog.c
@@ -194,7 +194,9 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
                                       const gchar        *action)
 {
   GtkWidget   *content_box;
+#if !GTK_CHECK_VERSION (3, 14, 0)
   GtkWidget   *alignment;
+#endif
   GtkWidget   *box;
   GtkWidget   *button;
   GtkWidget   *label;
@@ -252,19 +254,26 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
   gtk_widget_show (button);
 
   /* Main content container */
+#if !GTK_CHECK_VERSION (3, 14, 0)
   alignment = gtk_alignment_new (0, 0, 1, 1);
   gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 12, 0);
   gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
                      alignment);
   gtk_widget_show (alignment);
+#endif
 
-  #if GTK_CHECK_VERSION (3, 0, 0)
+#if GTK_CHECK_VERSION (3, 0, 0)
   content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-  #else
+#else
   content_box = gtk_vbox_new (FALSE, 6);
-  #endif
+#endif
   gtk_container_set_border_width (GTK_CONTAINER (content_box), 6);
+#if GTK_CHECK_VERSION (3, 14, 0)
+  gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+                     content_box);
+#else
   gtk_container_add (GTK_CONTAINER (alignment), content_box);
+#endif
   gtk_widget_show (content_box);
 
   /* TRANSLATORS: this creates the explanation for the user. The first %s is replaced
@@ -279,7 +288,11 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
 
   label = gtk_label_new (NULL);
   gtk_label_set_markup (GTK_LABEL (label), explanation_label_markup);
+#if GTK_CHECK_VERSION (3, 14, 0)
+  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
   gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
   gtk_container_add (GTK_CONTAINER (content_box), label);
   gtk_widget_show (label);
@@ -297,12 +310,20 @@ xfce_shortcut_dialog_create_contents (XfceShortcutDialog *dialog,
   gtk_widget_show (box);
 
   label = gtk_label_new (_("Shortcut:"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+  gtk_label_set_yalign (GTK_LABEL (label), 0.5);
+#else
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
   gtk_container_add (GTK_CONTAINER (box), label);
   gtk_widget_show (label);
 
   dialog->shortcut_label = gtk_label_new (_("No keys pressed yet, proceed."));
+#if GTK_CHECK_VERSION (3, 14, 0)
+  gtk_label_set_yalign (GTK_LABEL (dialog->shortcut_label), 0.5);
+#else
   gtk_misc_set_alignment (GTK_MISC (dialog->shortcut_label), 0.0, 0.5);
+#endif
   gtk_container_add (GTK_CONTAINER (box), dialog->shortcut_label);
   gtk_widget_show (dialog->shortcut_label);
 
diff --git a/libxfce4ui/xfce-dialogs.c b/libxfce4ui/xfce-dialogs.c
index a89db80..7f84e8c 100644
--- a/libxfce4ui/xfce-dialogs.c
+++ b/libxfce4ui/xfce-dialogs.c
@@ -554,7 +554,6 @@ xfce_message_dialog_new_valist (GtkWindow   *parent,
 {
 #if GTK_CHECK_VERSION (3, 0, 0)
   GtkBuilder  *gxml;
-  GError      *error = NULL;
   GtkWidget   *dialog;
   GtkWidget   *dialog_image;
   GtkWidget   *image;
diff --git a/libxfce4ui/xfce-gdk-extensions.c b/libxfce4ui/xfce-gdk-extensions.c
index 260f38b..7b1e0b9 100644
--- a/libxfce4ui/xfce-gdk-extensions.c
+++ b/libxfce4ui/xfce-gdk-extensions.c
@@ -63,7 +63,7 @@ xfce_gdk_screen_get_active (gint *monitor_return)
   gint              rootx, rooty;
   GdkScreen        *screen;
 
-#if GTK_CHECK_VERSION (3, 20, 0)
+#if 0 /* GTK_CHECK_VERSION (3, 20, 0) */
   GdkSeat *seat;
 
   display = gdk_display_get_default ();
diff --git a/libxfce4ui/xfce-gtk-extensions.c b/libxfce4ui/xfce-gtk-extensions.c
index 224136b..94a705f 100644
--- a/libxfce4ui/xfce-gtk-extensions.c
+++ b/libxfce4ui/xfce-gtk-extensions.c
@@ -136,15 +136,23 @@ xfce_gtk_frame_box_new (const gchar  *label,
       frame_label = gtk_label_new (markup_label);
       gtk_label_set_use_markup (GTK_LABEL (frame_label), TRUE);
       g_free (markup_label);
-      gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
+#if GTK_CHECK_VERSION (3, 14, 0)
+  gtk_label_set_yalign (GTK_LABEL (frame_label), 0.5);
+#else
+  gtk_misc_set_alignment (GTK_MISC (frame_label), 0.0, 0.5);
+#endif
       gtk_frame_set_label_widget (GTK_FRAME (frame), frame_label);
       gtk_widget_show (frame_label);
     }
 
+/* We're ignoring this for now because we directly return the alignment
+ * and who knows if our consumers want to poke at it. */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   container = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
   gtk_alignment_set_padding (GTK_ALIGNMENT (container), PADDING, PADDING, PADDING * 3, PADDING);
   gtk_container_add (GTK_CONTAINER (frame), container);
   gtk_widget_show (container);
+G_GNUC_END_IGNORE_DEPRECATIONS
 
   if (G_LIKELY (container_return != NULL))
     *container_return = container;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list