[gtk/wip/baedert/for-master: 66/66] statusbar: Remove _get_message_area() from public API



commit 0ca55a638075b694e6c9ab294ecc421c2906261c
Author: Timm Bäder <mail baedert org>
Date:   Sun Feb 23 16:53:53 2020 +0100

    statusbar: Remove _get_message_area() from public API
    
    The message should be manipulated via push() and pop().

 docs/reference/gtk/gtk4-sections.txt |  1 -
 gtk/a11y/gtkstatusbaraccessible.c    | 46 ++----------------------------------
 gtk/gtkstatusbar.c                   |  9 +++----
 gtk/gtkstatusbar.h                   |  3 ---
 gtk/gtkstatusbarprivate.h            | 30 +++++++++++++++++++++++
 5 files changed, 37 insertions(+), 52 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index e8761954f2..08f27b2a7d 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -2531,7 +2531,6 @@ gtk_statusbar_push
 gtk_statusbar_pop
 gtk_statusbar_remove
 gtk_statusbar_remove_all
-gtk_statusbar_get_message_area
 <SUBSECTION Standard>
 GTK_STATUSBAR
 GTK_IS_STATUSBAR
diff --git a/gtk/a11y/gtkstatusbaraccessible.c b/gtk/a11y/gtkstatusbaraccessible.c
index d21fc7295d..b4d2f38505 100644
--- a/gtk/a11y/gtkstatusbaraccessible.c
+++ b/gtk/a11y/gtkstatusbaraccessible.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 #include <gtk/gtk.h>
+#include "gtkstatusbarprivate.h"
 #include "gtkstatusbaraccessible.h"
 
 
@@ -51,50 +52,11 @@ gtk_statusbar_accessible_initialize (AtkObject *obj,
   obj->role = ATK_ROLE_STATUSBAR;
 }
 
-static GtkWidget *
-find_label_child (GtkContainer *container)
-{
-  GList *children, *tmp_list;
-  GtkWidget *child;
-
-  children = gtk_container_get_children (container);
-
-  child = NULL;
-  for (tmp_list = children; tmp_list != NULL; tmp_list = tmp_list->next)
-    {
-      if (GTK_IS_LABEL (tmp_list->data))
-        {
-          child = GTK_WIDGET (tmp_list->data);
-          break;
-        }
-      else if (GTK_IS_CONTAINER (tmp_list->data))
-        {
-          child = find_label_child (GTK_CONTAINER (tmp_list->data));
-          if (child)
-            break;
-        }
-    }
-  g_list_free (children);
-
-  return child;
-}
-
-static GtkWidget *
-get_label_from_statusbar (GtkStatusbar *statusbar)
-{
-  GtkWidget *box;
-
-  box = gtk_statusbar_get_message_area (statusbar);
-
-  return find_label_child (GTK_CONTAINER (box));
-}
-
 static const gchar *
 gtk_statusbar_accessible_get_name (AtkObject *obj)
 {
   const gchar *name;
   GtkWidget *widget;
-  GtkWidget *label;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
   if (widget == NULL)
@@ -104,11 +66,7 @@ gtk_statusbar_accessible_get_name (AtkObject *obj)
   if (name != NULL)
     return name;
 
-  label = get_label_from_statusbar (GTK_STATUSBAR (widget));
-  if (GTK_IS_LABEL (label))
-    return gtk_label_get_label (GTK_LABEL (label));
-
-  return NULL;
+  return gtk_statusbar_get_message (GTK_STATUSBAR (widget));
 }
 
 static gint
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c
index cf140118e2..a570dec71f 100644
--- a/gtk/gtkstatusbar.c
+++ b/gtk/gtkstatusbar.c
@@ -26,6 +26,7 @@
 #include "config.h"
 
 #include "gtkstatusbar.h"
+#include "gtkstatusbarprivate.h"
 
 #include "gtkbinlayout.h"
 #include "gtkframe.h"
@@ -501,7 +502,7 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
     }
 }
 
-/**
+/** < private >
  * gtk_statusbar_get_message_area:
  * @statusbar: a #GtkStatusbar
  *
@@ -509,14 +510,14 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
  *
  * Returns: (type Gtk.Box) (transfer none): a #GtkBox
  */
-GtkWidget*
-gtk_statusbar_get_message_area (GtkStatusbar *statusbar)
+const char*
+gtk_statusbar_get_message (GtkStatusbar *statusbar)
 {
   GtkStatusbarPrivate *priv = gtk_statusbar_get_instance_private (statusbar);
 
   g_return_val_if_fail (GTK_IS_STATUSBAR (statusbar), NULL);
 
-  return priv->message_area;
+  return gtk_label_get_label (GTK_LABEL (priv->label));
 }
 
 static void
diff --git a/gtk/gtkstatusbar.h b/gtk/gtkstatusbar.h
index de63712c59..530f82e75f 100644
--- a/gtk/gtkstatusbar.h
+++ b/gtk/gtkstatusbar.h
@@ -62,9 +62,6 @@ GDK_AVAILABLE_IN_ALL
 void       gtk_statusbar_remove_all            (GtkStatusbar *statusbar,
                                         guint         context_id);
 
-GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_statusbar_get_message_area  (GtkStatusbar *statusbar);
-
 G_END_DECLS
 
 #endif /* __GTK_STATUSBAR_H__ */
diff --git a/gtk/gtkstatusbarprivate.h b/gtk/gtkstatusbarprivate.h
new file mode 100644
index 0000000000..4dc942726c
--- /dev/null
+++ b/gtk/gtkstatusbarprivate.h
@@ -0,0 +1,30 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ * GtkStatusbar Copyright (C) 1998 Shawn T. Amundson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_STATUSBAR_PRIVATE_H__
+#define __GTK_STATUSBAR_PRIVATE_H__
+
+#include "gtkwidget.h"
+
+G_BEGIN_DECLS
+
+const char *    gtk_statusbar_get_message   (GtkStatusbar *statusbar);
+
+G_END_DECLS
+
+#endif /* __GTK_STATUSBAR_H__ */


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