[gtk/seal-popover-menu] Privatize popover menu pieces



commit db5d419f327c693be469c422cabed98c7a272617
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jun 10 00:30:33 2019 +0000

    Privatize popover menu pieces
    
    Don't allow manual creation of popover menus
    anymore. This lets us also make GtkModelButton
    private

 docs/reference/gtk/gtk4-docs.xml                  |   1 -
 docs/reference/gtk/gtk4-sections.txt              |  22 +---
 docs/reference/gtk/gtk4.types.in                  |   1 -
 gtk/gtk.h                                         |   1 -
 gtk/gtkactionhelper.c                             |   2 +-
 gtk/gtkcolorswatch.c                              |   2 +-
 gtk/gtkfilechooserwidget.c                        |   2 +-
 gtk/gtkmenusectionbox.c                           |   4 +-
 gtk/gtkmodelbutton.c                              |  26 +++-
 gtk/{gtkmodelbutton.h => gtkmodelbuttonprivate.h} |  15 +--
 gtk/gtkplacessidebar.c                            |   2 +-
 gtk/gtkpopovermenu.c                              | 147 ++++++++++------------
 gtk/gtkpopovermenu.h                              |  12 +-
 gtk/gtkpopovermenubar.c                           |  27 ++--
 gtk/gtkpopovermenuprivate.h                       |  33 +++++
 gtk/inspector/css-node-tree.c                     |   1 -
 gtk/meson.build                                   |   1 -
 tests/testmodelbutton.c                           |   3 +-
 testsuite/gtk/notify.c                            |   4 -
 19 files changed, 160 insertions(+), 146 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-docs.xml b/docs/reference/gtk/gtk4-docs.xml
index e574d082ee..03fef7352a 100644
--- a/docs/reference/gtk/gtk4-docs.xml
+++ b/docs/reference/gtk/gtk4-docs.xml
@@ -145,7 +145,6 @@
       <xi:include href="xml/gtkscalebutton.xml" />
       <xi:include href="xml/gtkvolumebutton.xml" />
       <xi:include href="xml/gtklockbutton.xml" />
-      <xi:include href="xml/gtkmodelbutton.xml" />
     </chapter>
 
     <chapter id="NumericEntry">
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index bbb9d6a475..7b9939ae25 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -6474,18 +6474,14 @@ gtk_popover_get_type
 <FILE>gtkpopovermenu</FILE>
 <TITLE>GtkPopoverMenu</TITLE>
 GtkPopoverMenu
-gtk_popover_menu_new
 gtk_popover_menu_new_from_model
-gtk_popover_menu_add_submenu
-gtk_popover_menu_open_submenu
+gtk_popover_menu_set_menu_model
+gtk_popover_menu_get_menu_model
 
 <SUBSECTION Standard>
 GTK_TYPE_POPOVER_MENU
 GTK_IS_POPOVER_MENU
-GTK_IS_POPOVER_MENU_CLASS
 GTK_POPOVER_MENU
-GTK_POPOVER_MENU_CLASS
-GTK_POPOVER_MENU_GET_CLASS
 
 <SUBSECTION Private>
 gtk_popover_menu_get_type
@@ -6508,20 +6504,6 @@ GTK_POPOVER_MENU_BAR
 gtk_popover_menu_bar_get_type
 </SECTION>
 
-<SECTION>
-<FILE>gtkmodelbutton</FILE>
-<TITLE>GtkModelButton</TITLE>
-GtkModelButton
-GtkButtonRole
-gtk_model_button_new
-<SUBSECTION Standard>
-GTK_TYPE_MODEL_BUTTON
-GTK_MODEL_BUTTON
-GTK_IS_MODEL_BUTTON
-<SUBSECTION Private>
-gtk_model_button_get_type
-</SECTION>
-
 <SECTION>
 <FILE>gtkeventcontroller</FILE>
 <TITLE>GtkEventController</TITLE>
diff --git a/docs/reference/gtk/gtk4.types.in b/docs/reference/gtk/gtk4.types.in
index 0cfaf1c4e4..41502b0c33 100644
--- a/docs/reference/gtk/gtk4.types.in
+++ b/docs/reference/gtk/gtk4.types.in
@@ -114,7 +114,6 @@ gtk_menu_item_get_type
 gtk_menu_shell_get_type
 gtk_menu_tool_button_get_type
 gtk_message_dialog_get_type
-gtk_model_button_get_type
 gtk_mount_operation_get_type
 gtk_notebook_get_type
 gtk_notebook_page_get_type
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 6691d286c9..46d7495616 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -159,7 +159,6 @@
 #include <gtk/gtkmenushell.h>
 #include <gtk/gtkmenutoolbutton.h>
 #include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkmodelbutton.h>
 #include <gtk/gtkmountoperation.h>
 #include <gtk/gtknative.h>
 #include <gtk/gtknativedialog.h>
diff --git a/gtk/gtkactionhelper.c b/gtk/gtkactionhelper.c
index f82b16f012..458d872050 100644
--- a/gtk/gtkactionhelper.c
+++ b/gtk/gtkactionhelper.c
@@ -22,8 +22,8 @@
 
 #include "gtkwidgetprivate.h"
 #include "gtkdebug.h"
-#include "gtkmodelbutton.h"
 #include "gtktypebuiltins.h"
+#include "gtkmodelbuttonprivate.h"
 
 #include <string.h>
 
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index a5d3f52499..9c92c9f7ea 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -32,7 +32,7 @@
 #include "gtkimage.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
-#include "gtkmodelbutton.h"
+#include "gtkmodelbuttonprivate.h"
 #include "gtkpopover.h"
 #include "gtkprivate.h"
 #include "gtksnapshot.h"
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index bb68a75fb5..1b65a2a4a7 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -75,7 +75,7 @@
 #include "gtkrevealer.h"
 #include "gtkspinner.h"
 #include "gtkseparator.h"
-#include "gtkmodelbutton.h"
+#include "gtkmodelbuttonprivate.h"
 #include "gtkgesturelongpress.h"
 #include "gtkgestureclick.h"
 #include "gtkeventcontrollerkey.h"
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index 47f443b637..3dee169a75 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -25,12 +25,12 @@
 #include "gtkwidgetprivate.h"
 #include "gtklabel.h"
 #include "gtkmenutracker.h"
-#include "gtkmodelbutton.h"
+#include "gtkmodelbuttonprivate.h"
 #include "gtkseparator.h"
 #include "gtksizegroup.h"
 #include "gtkstack.h"
 #include "gtkstylecontext.h"
-#include "gtkpopovermenu.h"
+#include "gtkpopovermenuprivate.h"
 #include "gtkorientable.h"
 #include "gtkiconprivate.h"
 
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index ede101df55..2c33a4461c 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -19,7 +19,7 @@
 
 #include "config.h"
 
-#include "gtkmodelbutton.h"
+#include "gtkmodelbuttonprivate.h"
 
 #include "gtkbutton.h"
 #include "gtkbuttonprivate.h"
@@ -173,6 +173,30 @@ typedef GtkButtonClass GtkModelButtonClass;
 
 G_DEFINE_TYPE (GtkModelButton, gtk_model_button, GTK_TYPE_BUTTON)
 
+GType
+gtk_button_role_get_type (void)
+{
+  static gsize gtk_button_role_type;
+
+  if (g_once_init_enter (&gtk_button_role_type))
+    {
+      static const GEnumValue values[] = {
+        { GTK_BUTTON_ROLE_NORMAL, "GTK_BUTTON_ROLE_NORMAL", "normal" },
+        { GTK_BUTTON_ROLE_CHECK, "GTK_BUTTON_ROLE_CHECK", "check" },
+        { GTK_BUTTON_ROLE_RADIO, "GTK_BUTTON_ROLE_RADIO", "radio" },
+        { GTK_BUTTON_ROLE_TITLE, "GTK_BUTTON_ROLE_RADIO", "title" },
+        { 0, NULL, NULL }
+      };
+      GType type;
+
+      type = g_enum_register_static (I_("GtkButtonRole"), values);
+
+      g_once_init_leave (&gtk_button_role_type, type);
+    }
+
+  return gtk_button_role_type;
+}
+
 enum
 {
   PROP_0,
diff --git a/gtk/gtkmodelbutton.h b/gtk/gtkmodelbuttonprivate.h
similarity index 87%
rename from gtk/gtkmodelbutton.h
rename to gtk/gtkmodelbuttonprivate.h
index dde881da08..db10e01476 100644
--- a/gtk/gtkmodelbutton.h
+++ b/gtk/gtkmodelbuttonprivate.h
@@ -17,12 +17,8 @@
  * Author: Matthias Clasen
  */
 
-#ifndef __GTK_MODEL_BUTTON_H__
-#define __GTK_MODEL_BUTTON_H__
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
+#ifndef __GTK_MODEL_BUTTON_PRIVATE_H__
+#define __GTK_MODEL_BUTTON_PRIVATE_H__
 
 #include <gtk/gtkwidget.h>
 
@@ -52,12 +48,13 @@ typedef enum {
   GTK_BUTTON_ROLE_TITLE
 } GtkButtonRole;
 
-GDK_AVAILABLE_IN_ALL
+#define GTK_TYPE_BUTTON_ROLE         (gtk_button_role_get_type ())
+GType       gtk_button_role_get_type (void) G_GNUC_CONST;
+
 GType       gtk_model_button_get_type (void) G_GNUC_CONST;
 
-GDK_AVAILABLE_IN_ALL
 GtkWidget * gtk_model_button_new      (void);
 
 G_END_DECLS
 
-#endif /* __GTK_MODEL_BUTTON_H__ */
+#endif /* __GTK_MODEL_BUTTON_PRIVATE_H__ */
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index ddddbe0f49..5918a99a5e 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -59,7 +59,7 @@
 #include "gtkentry.h"
 #include "gtkgesturelongpress.h"
 #include "gtkbox.h"
-#include "gtkmodelbutton.h"
+#include "gtkmodelbuttonprivate.h"
 #include "gtkprivate.h"
 #include "gtkeventcontrollerkey.h"
 #include "gtkgestureclick.h"
diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c
index 3c570c1d45..f85e93c1c9 100644
--- a/gtk/gtkpopovermenu.c
+++ b/gtk/gtkpopovermenu.c
@@ -17,6 +17,8 @@
 
 #include "config.h"
 #include "gtkpopovermenu.h"
+#include "gtkpopovermenuprivate.h"
+
 #include "gtkstack.h"
 #include "gtkstylecontext.h"
 #include "gtkintl.h"
@@ -118,6 +120,8 @@ typedef struct _GtkPopoverMenuClass GtkPopoverMenuClass;
 struct _GtkPopoverMenu
 {
   GtkPopover parent_instance;
+
+  GMenuModel *model;
 };
 
 struct _GtkPopoverMenuClass
@@ -126,7 +130,8 @@ struct _GtkPopoverMenuClass
 };
 
 enum {
-  PROP_VISIBLE_SUBMENU = 1
+  PROP_VISIBLE_SUBMENU = 1,
+  PROP_MENU_MODEL
 };
 
 G_DEFINE_TYPE (GtkPopoverMenu, gtk_popover_menu, GTK_TYPE_POPOVER)
@@ -176,6 +181,16 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
   gtk_widget_add_controller (GTK_WIDGET (popover), controller);
 }
 
+static void
+gtk_popover_menu_dispose (GObject *object)
+{
+  GtkPopoverMenu *popover = GTK_POPOVER_MENU (object);
+
+  g_clear_object (&popover->model);
+
+  G_OBJECT_CLASS (gtk_popover_menu_parent_class)->dispose (object);
+}
+
 static void
 gtk_popover_menu_map (GtkWidget *widget)
 {
@@ -190,47 +205,6 @@ gtk_popover_menu_unmap (GtkWidget *widget)
   GTK_WIDGET_CLASS (gtk_popover_menu_parent_class)->unmap (widget);
 }
 
-static void
-gtk_popover_menu_add (GtkContainer *container,
-                      GtkWidget    *child)
-{
-  GtkWidget *stack;
-
-  stack = gtk_bin_get_child (GTK_BIN (container));
-
-  if (stack == NULL)
-    {
-      GTK_CONTAINER_CLASS (gtk_popover_menu_parent_class)->add (container, child);
-    }
-  else
-    {
-      const char *name;
-
-      if (gtk_widget_get_name (child))
-        name = gtk_widget_get_name (child);
-      else if (gtk_stack_get_child_by_name (GTK_STACK (stack), "main"))
-        name = "submenu";
-      else
-        name = "main";
-
-      gtk_popover_menu_add_submenu (GTK_POPOVER_MENU (container), child, name);
-    }
-}
-
-static void
-gtk_popover_menu_remove (GtkContainer *container,
-                         GtkWidget    *child)
-{
-  GtkWidget *stack;
-
-  stack = gtk_bin_get_child (GTK_BIN (container));
-
-  if (child == stack)
-    GTK_CONTAINER_CLASS (gtk_popover_menu_parent_class)->remove (container, child);
-  else
-    gtk_container_remove (GTK_CONTAINER (stack), child);
-}
-
 static void
 gtk_popover_menu_get_property (GObject    *object,
                                guint       property_id,
@@ -247,6 +221,10 @@ gtk_popover_menu_get_property (GObject    *object,
       g_value_set_string (value, gtk_stack_get_visible_child_name (GTK_STACK (stack)));
       break;
 
+    case PROP_MENU_MODEL:
+      g_value_set_object (value, gtk_popover_menu_get_menu_model (GTK_POPOVER_MENU (object)));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -269,6 +247,10 @@ gtk_popover_menu_set_property (GObject      *object,
       gtk_stack_set_visible_child_name (GTK_STACK (stack), g_value_get_string (value));
       break;
 
+    case PROP_MENU_MODEL:
+      gtk_popover_menu_set_menu_model (GTK_POPOVER_MENU (object), g_value_get_object (value));
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -310,10 +292,10 @@ gtk_popover_menu_focus (GtkWidget        *widget,
 static void
 gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
 {
-  GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  object_class->dispose = gtk_popover_menu_dispose;
   object_class->set_property = gtk_popover_menu_set_property;
   object_class->get_property = gtk_popover_menu_get_property;
 
@@ -321,9 +303,6 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
   widget_class->unmap = gtk_popover_menu_unmap;
   widget_class->focus = gtk_popover_menu_focus;
 
-  container_class->add = gtk_popover_menu_add;
-  container_class->remove = gtk_popover_menu_remove;
-
   g_object_class_install_property (object_class,
                                    PROP_VISIBLE_SUBMENU,
                                    g_param_spec_string ("visible-submenu",
@@ -331,27 +310,14 @@ gtk_popover_menu_class_init (GtkPopoverMenuClass *klass)
                                                         P_("The name of the visible submenu"),
                                                         NULL,
                                                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-}
 
-/**
- * gtk_popover_menu_new:
- * @relative_to: (allow-none): #GtkWidget the popover is related to
- *
- * Creates a new popover menu.
- *
- * Returns: a new #GtkPopoverMenu
- */
-GtkWidget *
-gtk_popover_menu_new (GtkWidget *relative_to)
-{
-  GtkWidget *popover;
-
-  g_return_val_if_fail (relative_to == NULL || GTK_IS_WIDGET (relative_to), NULL);
-
-  popover = g_object_new (GTK_TYPE_POPOVER_MENU, NULL);
-  gtk_popover_set_relative_to (GTK_POPOVER (popover), relative_to);
-
-  return popover;
+  g_object_class_install_property (object_class,
+                                   PROP_MENU_MODEL,
+                                   g_param_spec_object ("menu-model",
+                                                        P_("Menu model"),
+                                                        P_("The model from which the menu is made."),
+                                                        G_TYPE_MENU_MODEL,
+                                                        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 /**
@@ -381,14 +347,6 @@ gtk_popover_menu_open_submenu (GtkPopoverMenu *popover,
   gtk_stack_set_visible_child_name (GTK_STACK (stack), name);
 }
 
-/**
- * gtk_popover_menu_add_submenu:
- * @popover: a #GtkPopoverMenu
- * @submenu: a widget to add as submenu
- * @name: the name for the submenu
- *
- * Adds a submenu to the popover menu.
- */
 void
 gtk_popover_menu_add_submenu (GtkPopoverMenu *popover,
                               GtkWidget      *submenu,
@@ -397,14 +355,13 @@ gtk_popover_menu_add_submenu (GtkPopoverMenu *popover,
   GtkWidget *stack;
 
   stack = gtk_bin_get_child (GTK_BIN (popover));
-
   gtk_stack_add_named (GTK_STACK (stack), submenu, name);
 }
 
 /**
  * gtk_popover_menu_new_from_model:
  * @relative_to: (allow-none): #GtkWidget the popover is related to
- * @model: a #GMenuModel
+ * @model: (allow-none): a #GMenuModel, or %NULL
  *
  * Creates a #GtkPopoverMenu and populates it according to
  * @model. The popover is pointed to the @relative_to widget.
@@ -426,10 +383,42 @@ gtk_popover_menu_new_from_model (GtkWidget  *relative_to,
   GtkWidget *popover;
 
   g_return_val_if_fail (relative_to == NULL || GTK_IS_WIDGET (relative_to), NULL);
-  g_return_val_if_fail (G_IS_MENU_MODEL (model), NULL);
+  g_return_val_if_fail (model == NULL || G_IS_MENU_MODEL (model), NULL);
 
-  popover = gtk_popover_menu_new (relative_to);
-  gtk_menu_section_box_new_toplevel (GTK_POPOVER_MENU (popover), model);
+  popover = g_object_new (GTK_TYPE_POPOVER_MENU, NULL);
+  gtk_popover_set_relative_to (GTK_POPOVER (popover), relative_to);
+  gtk_popover_menu_set_menu_model (GTK_POPOVER_MENU (popover), model);
 
   return popover;
 }
+
+void
+gtk_popover_menu_set_menu_model (GtkPopoverMenu *popover,
+                                 GMenuModel     *model)
+{
+  g_return_if_fail (GTK_IS_POPOVER_MENU (popover));
+  g_return_if_fail (model == NULL || G_IS_MENU_MODEL (model));
+
+  if (g_set_object (&popover->model, model))
+    {
+      GtkWidget *stack;
+      GtkWidget *child;
+
+      stack = gtk_bin_get_child (GTK_BIN (popover));
+      while ((child = gtk_widget_get_first_child (stack)))
+        gtk_widget_destroy (child);
+
+      if (model)
+        gtk_menu_section_box_new_toplevel (popover, model);
+
+      g_object_notify (G_OBJECT (popover), "menu-model");
+    }
+}
+
+GMenuModel *
+gtk_popover_menu_get_menu_model (GtkPopoverMenu *popover)
+{
+  g_return_val_if_fail (GTK_IS_POPOVER_MENU (popover), NULL);
+
+  return popover->model;
+}
diff --git a/gtk/gtkpopovermenu.h b/gtk/gtkpopovermenu.h
index 143a190b70..965c1b51b9 100644
--- a/gtk/gtkpopovermenu.h
+++ b/gtk/gtkpopovermenu.h
@@ -35,20 +35,14 @@ typedef struct _GtkPopoverMenu GtkPopoverMenu;
 GDK_AVAILABLE_IN_ALL
 GType       gtk_popover_menu_get_type (void) G_GNUC_CONST;
 
-GDK_AVAILABLE_IN_ALL
-GtkWidget * gtk_popover_menu_new            (GtkWidget   *relative_to);
-
 GDK_AVAILABLE_IN_ALL
 GtkWidget * gtk_popover_menu_new_from_model (GtkWidget  *relative_to,
                                              GMenuModel *model);
-
 GDK_AVAILABLE_IN_ALL
-void        gtk_popover_menu_add_submenu (GtkPopoverMenu *popover,
-                                          GtkWidget      *submenu,
-                                          const char     *name);
+void        gtk_popover_menu_set_menu_model (GtkPopoverMenu *popover,
+                                             GMenuModel     *model);
 GDK_AVAILABLE_IN_ALL
-void        gtk_popover_menu_open_submenu (GtkPopoverMenu *popover,
-                                           const char     *name);
+GMenuModel *gtk_popover_menu_get_menu_model (GtkPopoverMenu *popover);
 
 
 G_END_DECLS
diff --git a/gtk/gtkpopovermenubar.c b/gtk/gtkpopovermenubar.c
index 023ae4cd42..4eae44387b 100644
--- a/gtk/gtkpopovermenubar.c
+++ b/gtk/gtkpopovermenubar.c
@@ -513,7 +513,7 @@ gtk_popover_menu_bar_init (GtkPopoverMenuBar *bar)
 
 /**
  * gtk_popover_menu_bar_new_from_model:
- * @model: a #GMenuModel
+ * @model: (allow-none): a #GMenuModel, or %NULL
  *
  * Creates a #GtkPopoverMenuBar from a #GMenuModel.
  *
@@ -530,7 +530,7 @@ gtk_popover_menu_bar_new_from_model (GMenuModel *model)
 /**
  * gtk_popover_menu_bar_set_menu_model:
  * @bar: a #GtkPopoverMenuBar
- * @model: a #GMenuModel
+ * @model: (allow-none): a #GMenuModel, or %NULL
  *
  * Sets a menu model from which @bar should take
  * its contents.
@@ -552,16 +552,19 @@ gtk_popover_menu_bar_set_menu_model (GtkPopoverMenuBar *bar,
 
       g_clear_pointer (&bar->tracker, gtk_menu_tracker_free);
 
-      muxer = _gtk_widget_get_action_muxer (GTK_WIDGET (bar), TRUE);
-      bar->tracker = gtk_menu_tracker_new (GTK_ACTION_OBSERVABLE (muxer),
-                                           model,
-                                           FALSE,
-                                           TRUE,
-                                           FALSE,
-                                           NULL,
-                                           tracker_insert,
-                                           tracker_remove,
-                                           bar);
+      if (model)
+        {
+          muxer = _gtk_widget_get_action_muxer (GTK_WIDGET (bar), TRUE);
+          bar->tracker = gtk_menu_tracker_new (GTK_ACTION_OBSERVABLE (muxer),
+                                               model,
+                                               FALSE,
+                                               TRUE,
+                                               FALSE,
+                                               NULL,
+                                               tracker_insert,
+                                               tracker_remove,
+                                               bar);
+        }
 
       g_object_notify_by_pspec (G_OBJECT (bar), bar_props[PROP_MENU_MODEL]);
     }
diff --git a/gtk/gtkpopovermenuprivate.h b/gtk/gtkpopovermenuprivate.h
new file mode 100644
index 0000000000..086cd37ee2
--- /dev/null
+++ b/gtk/gtkpopovermenuprivate.h
@@ -0,0 +1,33 @@
+/* GTK - The GIMP Toolkit
+ * Copyright © 2019 Red Hat, Inc.
+ *
+ * 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_POPOVER_MENU_PRIVATE_H__
+#define __GTK_POPOVER_MENU_PRIVATE_H__
+
+#include "gtkpopovermenu.h"
+
+G_BEGIN_DECLS
+
+void  gtk_popover_menu_add_submenu (GtkPopoverMenu *popover,
+                                    GtkWidget      *submenu,
+                                    const char     *name);
+void gtk_popover_menu_open_submenu (GtkPopoverMenu *popover,
+                                    const gchar    *name);
+
+G_END_DECLS
+
+#endif /* __GTK_POPOVER_MENU_PRIVATE_H__ */
diff --git a/gtk/inspector/css-node-tree.c b/gtk/inspector/css-node-tree.c
index 9926faf8f9..a95bb84092 100644
--- a/gtk/inspector/css-node-tree.c
+++ b/gtk/inspector/css-node-tree.c
@@ -40,7 +40,6 @@
 #include "gtktreeview.h"
 #include "gtktreeselection.h"
 #include "gtktypebuiltins.h"
-#include "gtkmodelbutton.h"
 #include "gtkstack.h"
 
 #include <glib/gi18n-lib.h>
diff --git a/gtk/meson.build b/gtk/meson.build
index c5bd9b154f..1d68c33069 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -536,7 +536,6 @@ gtk_public_headers = files([
   'gtkmenushell.h',
   'gtkmenutoolbutton.h',
   'gtkmessagedialog.h',
-  'gtkmodelbutton.h',
   'gtkmountoperation.h',
   'gtknative.h',
   'gtknativedialog.h',
diff --git a/tests/testmodelbutton.c b/tests/testmodelbutton.c
index 62764f3910..d1f07fcf74 100644
--- a/tests/testmodelbutton.c
+++ b/tests/testmodelbutton.c
@@ -1,4 +1,5 @@
 #include <gtk/gtk.h>
+#include "gtk/gtkmodelbuttonprivate.h"
 
 static void
 on_action_beep (GSimpleAction *action,
@@ -46,7 +47,7 @@ on_application_activate (GApplication *gapplication,
 
   gicon = g_themed_icon_new ("face-smile");
 
-  model_button = g_object_new (GTK_TYPE_MODEL_BUTTON,
+  model_button = g_object_new (g_type_from_name ("GtkModelButton"),
                                "action-name", "app.beep",
                                "text", "It’s-a-me! ModelButton",
                                "icon", gicon,
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 99b8f82ae8..7da18b39ac 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -590,10 +590,6 @@ test_type (gconstpointer data)
          g_str_equal (pspec->name, "use-header-bar"))
        continue;
 
-      if (type == GTK_TYPE_MODEL_BUTTON &&
-          pspec->owner_type == GTK_TYPE_BUTTON)
-        continue;
-
       if (g_type_is_a (type, GTK_TYPE_SHORTCUTS_SHORTCUT) &&
          g_str_equal (pspec->name, "accelerator"))
        continue;


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