[Xfce4-commits] [xfce/exo] 01/01: Add helper functions to remove gtk_dialog_get_action_area deprecation warnings

noreply at xfce.org noreply at xfce.org
Tue Jul 4 12:44:59 CEST 2017


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

b   l   u   e   s   a   b   r   e       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/exo.

commit 87bd0a0e3c42c6c1b9dfcb3d95cceecdcda3ca3b
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Tue Jul 4 06:44:53 2017 -0400

    Add helper functions to remove gtk_dialog_get_action_area deprecation warnings
---
 exo-desktop-item-edit/main.c           |  6 ++--
 exo-helper/exo-helper-chooser-dialog.c |  4 +--
 exo/Makefile.am                        |  4 +++
 exo/exo-common.c                       | 60 ++++++++++++++++++++++++++++++++++
 exo/exo-common.h                       | 31 ++++++++++++++++++
 exo/exo-toolbars-editor-dialog.c       |  5 +--
 6 files changed, 102 insertions(+), 8 deletions(-)

diff --git a/exo-desktop-item-edit/main.c b/exo-desktop-item-edit/main.c
index 54581f7..2e19285 100644
--- a/exo-desktop-item-edit/main.c
+++ b/exo-desktop-item-edit/main.c
@@ -36,6 +36,7 @@
 
 #include <gio/gio.h>
 #include <libxfce4ui/libxfce4ui.h>
+#include <exo/exo-common.h>
 #include <exo-desktop-item-edit/exo-die-editor.h>
 #include <exo-desktop-item-edit/exo-die-utils.h>
 
@@ -128,7 +129,6 @@ main (int argc, char **argv)
   GtkWidget       *chooser;
   GtkWidget       *message;
   GtkWidget       *button;
-  GtkWidget       *bbox;
   GtkWidget       *dialog;
   GtkWidget       *editor;
   GKeyFile        *key_file;
@@ -329,9 +329,7 @@ main (int argc, char **argv)
   gtk_window_set_icon_name (GTK_WINDOW (dialog), ICON_NAMES[mode]);
 
   button = gtk_button_new_with_mnemonic (_("_Help"));
-  bbox = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
-  gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0);
-  gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (bbox), button, TRUE);
+  exo_dialog_add_secondary_button(GTK_DIALOG (dialog), GTK_WIDGET (button));
   g_signal_connect (G_OBJECT (button), "clicked",
       G_CALLBACK (exo_die_help), dialog);
   gtk_widget_show (button);
diff --git a/exo-helper/exo-helper-chooser-dialog.c b/exo-helper/exo-helper-chooser-dialog.c
index 9c622f8..33669ef 100644
--- a/exo-helper/exo-helper-chooser-dialog.c
+++ b/exo-helper/exo-helper-chooser-dialog.c
@@ -23,6 +23,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <libxfce4ui/libxfce4ui.h>
 
+#include <exo/exo-common.h>
 #include <exo-helper/exo-helper-chooser-dialog.h>
 
 
@@ -103,8 +104,7 @@ exo_helper_chooser_dialog_init (ExoHelperChooserDialog *chooser_dialog)
   /* add the "Help" button */
   button = gtk_button_new_with_mnemonic (_("_Help"));
   g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK (exo_helper_chooser_dialog_show_help), chooser_dialog);
-  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (chooser_dialog))), button, FALSE, TRUE, 0);
-  gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (chooser_dialog))), button, TRUE);
+  exo_dialog_add_secondary_button (GTK_DIALOG (chooser_dialog), GTK_WIDGET (button));
   gtk_widget_show (button);
 
   notebook = gtk_notebook_new ();
diff --git a/exo/Makefile.am b/exo/Makefile.am
index e67916e..6ddddb5 100644
--- a/exo/Makefile.am
+++ b/exo/Makefile.am
@@ -14,6 +14,7 @@ libexo_headers =							\
 	exo-binding.h							\
 	exo-cell-renderer-ellipsized-text.h				\
 	exo-cell-renderer-icon.h					\
+	exo-common.h					\
 	exo-execute.h							\
 	exo-gdk-pixbuf-extensions.h					\
 	exo-gtk-extensions.h						\
@@ -58,6 +59,7 @@ libexo_1_la_SOURCES =							\
 	exo-binding.c							\
 	exo-cell-renderer-ellipsized-text.c				\
 	exo-cell-renderer-icon.c					\
+	exo-common.c							\
 	exo-config.c							\
 	exo-execute.c							\
 	exo-gdk-pixbuf-extensions.c					\
@@ -122,6 +124,7 @@ lib_LTLIBRARIES += libexo-2.la
 libexo_2_include_HEADERS =						\
 	exo.h								\
 	exo-binding.h							\
+	exo-common.h							\
 	exo-config.h							\
 	exo-execute.h							\
 	exo-gdk-pixbuf-extensions.h					\
@@ -148,6 +151,7 @@ libexo_2_la_SOURCES =							\
 	exo-marshal.h							\
 	exo-private.c							\
 	exo-private.h							\
+	exo-common.c							\
 	exo-config.c							\
 	exo-execute.c							\
 	exo-gdk-pixbuf-extensions.c					\
diff --git a/exo/exo-common.c b/exo/exo-common.c
new file mode 100644
index 0000000..c862645
--- /dev/null
+++ b/exo/exo-common.c
@@ -0,0 +1,60 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <exo/exo-common.h>
+
+/**
+ * exo_dialog_get_action_area:
+ * @dialog : a #GtkDialog.
+ *
+ * Returns the action area of a #GtkDialog. The internal function has been
+ * deprecated in GTK+, so this wraps and dispels the deprecation warning.
+ *
+ * Returns: the action area.
+ **/
+GtkWidget *
+exo_dialog_get_action_area (GtkDialog *dialog)
+{
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+    return gtk_dialog_get_action_area (dialog);
+G_GNUC_END_IGNORE_DEPRECATIONS
+}
+
+/**
+ * exo_dialog_add_secondary_button:
+ * @dialog : a #GtkDialog.
+ * @button : a #GtkButton to add and mark as secondary.
+ *
+ * Convenience function to add a secondary button to a #GtkDialog.
+ **/
+void
+exo_dialog_add_secondary_button (GtkDialog *dialog,
+                                 GtkWidget *button)
+{
+    GtkWidget *button_box;
+
+    button_box = exo_dialog_get_action_area (dialog);
+    gtk_box_pack_start (GTK_BOX (button_box), button, FALSE, FALSE, 0);
+    gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (button_box), button, TRUE);
+}
diff --git a/exo/exo-common.h b/exo/exo-common.h
new file mode 100644
index 0000000..ce5a0a6
--- /dev/null
+++ b/exo/exo-common.h
@@ -0,0 +1,31 @@
+/* vi:set et ai sw=2 sts=2 ts=2: */
+/*-
+ * Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EXO_COMMON_H__
+#define __EXO_COMMON_H__
+
+#include <gtk/gtk.h>
+
+GtkWidget *     exo_dialog_get_action_area          (GtkDialog *dialog);
+
+void            exo_dialog_add_secondary_button     (GtkDialog *dialog,
+                                                     GtkWidget *button);
+
+#endif /* !__EXO_COMMON_H__ */
diff --git a/exo/exo-toolbars-editor-dialog.c b/exo/exo-toolbars-editor-dialog.c
index 9fb7db2..938d8ea 100644
--- a/exo/exo-toolbars-editor-dialog.c
+++ b/exo/exo-toolbars-editor-dialog.c
@@ -33,6 +33,7 @@
 
 #include <libxfce4util/libxfce4util.h>
 
+#include <exo/exo-common.h>
 #include <exo/exo-private.h>
 #include <exo/exo-string.h>
 #include <exo/exo-toolbars-editor.h>
@@ -99,7 +100,7 @@ exo_toolbars_editor_dialog_init (ExoToolbarsEditorDialog *dialog)
   button = gtk_button_new ();
   g_signal_connect_swapped (G_OBJECT (button), "clicked",
                             G_CALLBACK (exo_toolbars_editor_dialog_add_toolbar), dialog);
-  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), button, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (exo_dialog_get_action_area (GTK_DIALOG (dialog))), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
 
   align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
@@ -121,7 +122,7 @@ exo_toolbars_editor_dialog_init (ExoToolbarsEditorDialog *dialog)
   button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
   g_signal_connect_swapped (G_OBJECT (button), "clicked",
                             G_CALLBACK (gtk_widget_destroy), dialog);
-  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))), button, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (exo_dialog_get_action_area (GTK_DIALOG (dialog))), button, FALSE, TRUE, 0);
   gtk_widget_show (button);
 }
 

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


More information about the Xfce4-commits mailing list