[gtk+] Drop deprecated gtk_dialog_get_action_area
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Drop deprecated gtk_dialog_get_action_area
- Date: Sun, 20 Nov 2016 02:23:38 +0000 (UTC)
commit b404ecf294e84a2079a5277d6c8f5f0c65eb10f3
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Nov 19 21:18:20 2016 -0500
Drop deprecated gtk_dialog_get_action_area
Add an internal version for the few places where we still need it,
and drop it from everywhere else.
gtk/gtkaboutdialog.c | 23 +++++++++++------------
gtk/gtkdialog.c | 17 -----------------
gtk/gtkdialog.h | 2 --
gtk/gtkdialogprivate.h | 1 +
gtk/gtkmessagedialog.c | 3 +--
gtk/gtkmountoperation.c | 3 +--
gtk/gtkrecentchooserdialog.c | 2 --
testsuite/gtk/builder.c | 7 +------
testsuite/gtk/templates.c | 3 ---
9 files changed, 15 insertions(+), 46 deletions(-)
---
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index 8a53711..11f33b4 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -686,28 +686,27 @@ apply_use_header_bar (GtkAboutDialog *about)
g_object_get (about, "use-header-bar", &use_header_bar, NULL);
if (!use_header_bar)
{
- GtkWidget *action_area;
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- action_area = gtk_dialog_get_action_area (GTK_DIALOG (about));
- G_GNUC_END_IGNORE_DEPRECATIONS
-
priv->credits_button = gtk_toggle_button_new_with_mnemonic (_("C_redits"));
g_object_bind_property (priv->credits_page, "visible",
priv->credits_button, "visible", G_BINDING_SYNC_CREATE);
g_signal_connect (priv->credits_button, "toggled", G_CALLBACK (toggle_credits), about);
- gtk_container_add_with_properties (GTK_CONTAINER (action_area), priv->credits_button,
- "secondary", TRUE,
- NULL);
+
+ gtk_dialog_add_action_widget (GTK_DIALOG (about), priv->credits_button, GTK_RESPONSE_NONE);
+ gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (priv->credits_button)),
+ priv->credits_button,
+ "secondary", TRUE,
+ NULL);
priv->license_button = gtk_toggle_button_new_with_mnemonic (_("_License"));
g_object_bind_property (priv->license_page, "visible",
priv->license_button, "visible", G_BINDING_SYNC_CREATE);
g_signal_connect (priv->license_button, "toggled", G_CALLBACK (toggle_license), about);
- gtk_container_add_with_properties (GTK_CONTAINER (action_area), priv->license_button,
- "secondary", TRUE,
- NULL);
+ gtk_dialog_add_action_widget (GTK_DIALOG (about), priv->license_button, GTK_RESPONSE_NONE);
+ gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (priv->license_button)),
+ priv->license_button,
+ "secondary", TRUE,
+ NULL);
gtk_dialog_add_button (GTK_DIALOG (about), _("_Close"), GTK_RESPONSE_DELETE_EVENT);
}
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index d8464b3..a554cc9 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -69,10 +69,6 @@
* recommended; it allows you to set the dialog title, some convenient
* flags, and add simple buttons.
*
- * If “dialog” is a newly created dialog, the two primary areas of the
- * window can be accessed through gtk_dialog_get_content_area() and
- * gtk_dialog_get_action_area(), as can be seen from the example below.
- *
* A “modal” dialog (that is, one which freezes the rest of the application
* from user input), can be created by calling gtk_window_set_modal() on the
* dialog. Use the GTK_WINDOW() macro to cast the widget returned from
@@ -1604,19 +1600,6 @@ gtk_dialog_buildable_add_child (GtkBuildable *buildable,
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
}
-/**
- * gtk_dialog_get_action_area:
- * @dialog: a #GtkDialog
- *
- * Returns the action area of @dialog.
- *
- * Returns: (transfer none): the action area
- *
- * Since: 2.14
- *
- * Deprecated:3.12: Direct access to the action area
- * is discouraged; use gtk_dialog_add_button(), etc.
- */
GtkWidget *
gtk_dialog_get_action_area (GtkDialog *dialog)
{
diff --git a/gtk/gtkdialog.h b/gtk/gtkdialog.h
index 1538bef..505db6a 100644
--- a/gtk/gtkdialog.h
+++ b/gtk/gtkdialog.h
@@ -188,8 +188,6 @@ void gtk_dialog_response (GtkDialog *dialog,
GDK_AVAILABLE_IN_ALL
gint gtk_dialog_run (GtkDialog *dialog);
-GDK_DEPRECATED_IN_3_10
-GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog);
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
GDK_AVAILABLE_IN_3_12
diff --git a/gtk/gtkdialogprivate.h b/gtk/gtkdialogprivate.h
index 626d188..1c32daa 100644
--- a/gtk/gtkdialogprivate.h
+++ b/gtk/gtkdialogprivate.h
@@ -30,6 +30,7 @@
G_BEGIN_DECLS
void gtk_dialog_set_use_header_bar_from_setting (GtkDialog *dialog);
+GtkWidget *gtk_dialog_get_action_area (GtkDialog *dialog);
G_END_DECLS
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index 39af8f0..c90056f 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -28,6 +28,7 @@
#include <string.h>
#include "gtkmessagedialog.h"
+#include "gtkdialogprivate.h"
#include "gtkaccessible.h"
#include "gtkbuildable.h"
#include "gtklabel.h"
@@ -293,9 +294,7 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
priv->message_type = GTK_MESSAGE_OTHER;
gtk_widget_init_template (GTK_WIDGET (dialog));
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
-G_GNUC_END_IGNORE_DEPRECATIONS
gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), GTK_BUTTONBOX_EXPAND);
settings = gtk_widget_get_settings (GTK_WIDGET (dialog));
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index db8a602..d4f55d9 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -51,6 +51,7 @@
#include "gtkmain.h"
#include "gtksettings.h"
#include "gtkstylecontextprivate.h"
+#include "gtkdialogprivate.h"
#include <glib/gprintf.h>
@@ -527,9 +528,7 @@ gtk_mount_operation_ask_password_do_gtk (GtkMountOperation *operation,
priv->dialog = dialog;
content_area = gtk_dialog_get_content_area (dialog);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
action_area = gtk_dialog_get_action_area (dialog);
-G_GNUC_END_IGNORE_DEPRECATIONS
/* Set the dialog up with HIG properties */
gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
diff --git a/gtk/gtkrecentchooserdialog.c b/gtk/gtkrecentchooserdialog.c
index 9e067f9..63c3351 100644
--- a/gtk/gtkrecentchooserdialog.c
+++ b/gtk/gtkrecentchooserdialog.c
@@ -155,9 +155,7 @@ gtk_recent_chooser_item_activated_cb (GtkRecentChooser *chooser,
if (gtk_window_activate_default (GTK_WINDOW (dialog)))
return;
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
action_area = gtk_dialog_get_action_area (rc_dialog);
-G_GNUC_END_IGNORE_DEPRECATIONS
children = gtk_container_get_children (GTK_CONTAINER (action_area));
for (l = children; l; l = l->next)
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c
index 60fc331..327bc9b 100644
--- a/testsuite/gtk/builder.c
+++ b/testsuite/gtk/builder.c
@@ -876,7 +876,7 @@ static void
test_children (void)
{
GtkBuilder * builder;
- GtkWidget *content_area, *dialog_action_area;
+ GtkWidget *content_area;
GList *children;
const gchar buffer1[] =
"<interface>"
@@ -939,16 +939,11 @@ test_children (void)
g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (content_area)), "dialog1-vbox") == 0);
action_area = gtk_builder_get_object (builder, "dialog1-action_area");
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
-G_GNUC_END_IGNORE_DEPRECATIONS
g_assert (action_area != NULL);
g_assert (GTK_IS_BUTTON_BOX (action_area));
g_assert (gtk_orientable_get_orientation (GTK_ORIENTABLE (action_area)) == GTK_ORIENTATION_HORIZONTAL);
g_assert (gtk_widget_get_parent (GTK_WIDGET (action_area)) != NULL);
- g_assert (dialog_action_area != NULL);
g_assert (gtk_buildable_get_name (GTK_BUILDABLE (action_area)) != NULL);
- g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (dialog_action_area)), "dialog1-action_area") ==
0);
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (builder);
}
diff --git a/testsuite/gtk/templates.c b/testsuite/gtk/templates.c
index 316dc15..a6e201c 100644
--- a/testsuite/gtk/templates.c
+++ b/testsuite/gtk/templates.c
@@ -37,9 +37,6 @@ test_dialog_basic (void)
dialog = gtk_dialog_new();
g_assert (GTK_IS_DIALOG (dialog));
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- g_assert (gtk_dialog_get_action_area (GTK_DIALOG (dialog)) != NULL);
-G_GNUC_END_IGNORE_DEPRECATIONS
g_assert (gtk_dialog_get_content_area (GTK_DIALOG (dialog)) != NULL);
gtk_widget_destroy (dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]