[gtk/new-style-menu: 46/48] Rename GtkPopoverBar to GtkPopoverMenuBar



commit 17ec958f3026f361019051fe7b3d5503b62516df
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 9 16:19:07 2019 +0000

    Rename GtkPopoverBar to GtkPopoverMenuBar
    
    Clarity over beauty.

 demos/widget-factory/widget-factory.ui       |   2 +-
 gtk/gtk.h                                    |   2 +-
 gtk/{gtkpopoverbar.c => gtkpopovermenubar.c} | 174 +++++++++++++--------------
 gtk/{gtkpopoverbar.h => gtkpopovermenubar.h} |  24 ++--
 gtk/meson.build                              |   2 +-
 5 files changed, 98 insertions(+), 106 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 7b873fbc8a..f4292d5a1e 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -1822,7 +1822,7 @@ microphone-sensitivity-medium-symbolic</property>
                                   <object class="GtkBox">
                                     <property name="orientation">vertical</property>
                                     <child>
-                                      <object class="GtkPopoverBar">
+                                      <object class="GtkPopoverMenuBar">
                                         <property name="menu-model">menu_bar_model</property>
                                       </object>
                                     </child>
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 9bb5145c3d..6691d286c9 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -173,8 +173,8 @@
 #include <gtk/gtkpasswordentry.h>
 #include <gtk/gtkpicture.h>
 #include <gtk/gtkpopover.h>
-#include <gtk/gtkpopoverbar.h>
 #include <gtk/gtkpopovermenu.h>
+#include <gtk/gtkpopovermenubar.h>
 #include <gtk/gtkprintcontext.h>
 #include <gtk/gtkprintoperation.h>
 #include <gtk/gtkprintoperationpreview.h>
diff --git a/gtk/gtkpopoverbar.c b/gtk/gtkpopovermenubar.c
similarity index 68%
rename from gtk/gtkpopoverbar.c
rename to gtk/gtkpopovermenubar.c
index 49c1337455..65bf0e59b7 100644
--- a/gtk/gtkpopoverbar.c
+++ b/gtk/gtkpopovermenubar.c
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#include "gtkpopoverbar.h"
+#include "gtkpopovermenubar.h"
 #include "gtkpopovermenu.h"
 
 #include "gtkboxlayout.h"
@@ -39,31 +39,31 @@
 #include "gtkmain.h"
 #include "gtknative.h"
 
-#define GTK_TYPE_POPOVER_BAR_ITEM    (gtk_popover_bar_item_get_type ())
-#define GTK_POPOVER_BAR_ITEM(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_POPOVER_BAR_ITEM, 
GtkPopoverBarItem))
-#define GTK_IS_POPOVER_BAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_POPOVER_BAR_ITEM))
+#define GTK_TYPE_POPOVER_MENU_BAR_ITEM    (gtk_popover_menu_bar_item_get_type ())
+#define GTK_POPOVER_MENU_BAR_ITEM(obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GTK_TYPE_POPOVER_MENU_BAR_ITEM, GtkPopoverMenuBarItem))
+#define GTK_IS_POPOVER_MENU_BAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GTK_TYPE_POPOVER_MENU_BAR_ITEM))
 
-GType gtk_popover_bar_item_get_type (void) G_GNUC_CONST;
+GType gtk_popover_menu_bar_item_get_type (void) G_GNUC_CONST;
 
-typedef struct _GtkPopoverBarItem GtkPopoverBarItem;
+typedef struct _GtkPopoverMenuBarItem GtkPopoverMenuBarItem;
 
-struct _GtkPopoverBar
+struct _GtkPopoverMenuBar
 {
   GtkWidget parent;
 
   GMenuModel *model;
   GtkMenuTracker *tracker;
 
-  GtkPopoverBarItem *active_item;
+  GtkPopoverMenuBarItem *active_item;
 };
 
-typedef struct _GtkPopoverBarClass GtkPopoverBarClass;
-struct _GtkPopoverBarClass
+typedef struct _GtkPopoverMenuBarClass GtkPopoverMenuBarClass;
+struct _GtkPopoverMenuBarClass
 {
   GtkWidgetClass parent_class;
 };
 
-struct _GtkPopoverBarItem
+struct _GtkPopoverMenuBarItem
 {
   GtkWidget parent;
 
@@ -71,20 +71,20 @@ struct _GtkPopoverBarItem
   GtkPopover *popover;
 };
 
-typedef struct _GtkPopoverBarItemClass GtkPopoverBarItemClass;
-struct _GtkPopoverBarItemClass
+typedef struct _GtkPopoverMenuBarItemClass GtkPopoverMenuBarItemClass;
+struct _GtkPopoverMenuBarItemClass
 {
   GtkWidgetClass parent_class;
 
-  void (* activate) (GtkPopoverBarItem *item);
+  void (* activate) (GtkPopoverMenuBarItem *item);
 };
 
-G_DEFINE_TYPE (GtkPopoverBarItem, gtk_popover_bar_item, GTK_TYPE_WIDGET)
+G_DEFINE_TYPE (GtkPopoverMenuBarItem, gtk_popover_menu_bar_item, GTK_TYPE_WIDGET)
 
 static void
-set_active_item (GtkPopoverBar     *bar,
-                 GtkPopoverBarItem *item,
-                 gboolean           popup)
+set_active_item (GtkPopoverMenuBar     *bar,
+                 GtkPopoverMenuBarItem *item,
+                 gboolean               popup)
 {
   gboolean changed;
   gboolean was_popup;
@@ -135,12 +135,12 @@ clicked_cb (GtkGesture *gesture,
             gpointer    data)
 {
   GtkWidget *target;
-  GtkPopoverBar *bar;
+  GtkPopoverMenuBar *bar;
 
   target = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
-  bar = GTK_POPOVER_BAR (gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_BAR));
+  bar = GTK_POPOVER_MENU_BAR (gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_MENU_BAR));
 
-  set_active_item (bar, GTK_POPOVER_BAR_ITEM (target), TRUE);
+  set_active_item (bar, GTK_POPOVER_MENU_BAR_ITEM (target), TRUE);
 }
 
 static void
@@ -152,20 +152,20 @@ enter_cb (GtkEventController *controller,
           gpointer            data)
 {
   GtkWidget *target;
-  GtkPopoverBar *bar;
+  GtkPopoverMenuBar *bar;
 
   target = gtk_event_controller_get_widget (controller);
 
-  bar = GTK_POPOVER_BAR (gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_BAR));
+  bar = GTK_POPOVER_MENU_BAR (gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_MENU_BAR));
 
-  set_active_item (bar, GTK_POPOVER_BAR_ITEM (target), FALSE);
+  set_active_item (bar, GTK_POPOVER_MENU_BAR_ITEM (target), FALSE);
 }
 
 static gboolean
-gtk_popover_bar_focus (GtkWidget        *widget,
-                       GtkDirectionType  direction)
+gtk_popover_menu_bar_focus (GtkWidget        *widget,
+                            GtkDirectionType  direction)
 {
-  GtkPopoverBar *bar = GTK_POPOVER_BAR (widget);
+  GtkPopoverMenuBar *bar = GTK_POPOVER_MENU_BAR (widget);
   GtkWidget *next;
   if (bar->active_item &&
       gtk_widget_get_mapped (GTK_WIDGET (bar->active_item->popover)))
@@ -197,13 +197,13 @@ gtk_popover_bar_focus (GtkWidget        *widget,
   else
     return FALSE;
 
-  set_active_item (bar, GTK_POPOVER_BAR_ITEM (next), FALSE);
+  set_active_item (bar, GTK_POPOVER_MENU_BAR_ITEM (next), FALSE);
 
   return TRUE;
 }
 
 static void
-gtk_popover_bar_item_init (GtkPopoverBarItem *item)
+gtk_popover_menu_bar_item_init (GtkPopoverMenuBarItem *item)
 {
   GtkEventController *controller;
 
@@ -225,32 +225,32 @@ gtk_popover_bar_item_init (GtkPopoverBarItem *item)
 }
 
 static void
-gtk_popover_bar_item_dispose (GObject *object)
+gtk_popover_menu_bar_item_dispose (GObject *object)
 {
-  GtkPopoverBarItem *item = GTK_POPOVER_BAR_ITEM (object);
+  GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (object);
 
   g_clear_pointer (&item->label, gtk_widget_unparent);
   g_clear_pointer ((GtkWidget **)&item->popover, gtk_widget_unparent);
 
-  G_OBJECT_CLASS (gtk_popover_bar_item_parent_class)->dispose (object);
+  G_OBJECT_CLASS (gtk_popover_menu_bar_item_parent_class)->dispose (object);
 }
 
 static void
-gtk_popover_bar_item_finalize (GObject *object)
+gtk_popover_menu_bar_item_finalize (GObject *object)
 {
-  G_OBJECT_CLASS (gtk_popover_bar_item_parent_class)->finalize (object);
+  G_OBJECT_CLASS (gtk_popover_menu_bar_item_parent_class)->finalize (object);
 }
 
 static void
-gtk_popover_bar_item_measure (GtkWidget      *widget,
-                              GtkOrientation  orientation,
-                              int             for_size,
-                              int            *minimum,
-                              int            *natural,
-                              int            *minimum_baseline,
-                              int            *natural_baseline)
+gtk_popover_menu_bar_item_measure (GtkWidget      *widget,
+                                   GtkOrientation  orientation,
+                                   int             for_size,
+                                   int            *minimum,
+                                   int            *natural,
+                                   int            *minimum_baseline,
+                                   int            *natural_baseline)
 {
-  GtkPopoverBarItem *item = GTK_POPOVER_BAR_ITEM (widget);
+  GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (widget);
 
   gtk_widget_measure (item->label, orientation, for_size,
                       minimum, natural,
@@ -258,12 +258,12 @@ gtk_popover_bar_item_measure (GtkWidget      *widget,
 }
 
 static void
-gtk_popover_bar_item_size_allocate (GtkWidget *widget,
-                                    int        width,
-                                    int        height,
-                                    int        baseline)
+gtk_popover_menu_bar_item_size_allocate (GtkWidget *widget,
+                                         int        width,
+                                         int        height,
+                                         int        baseline)
 {
-  GtkPopoverBarItem *item = GTK_POPOVER_BAR_ITEM (widget);
+  GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (widget);
 
   gtk_widget_size_allocate (item->label,
                             &(GtkAllocation) { 0, 0, width, height },
@@ -273,30 +273,30 @@ gtk_popover_bar_item_size_allocate (GtkWidget *widget,
 }
 
 static void
-gtk_popover_bar_item_activate (GtkPopoverBarItem *item)
+gtk_popover_menu_bar_item_activate (GtkPopoverMenuBarItem *item)
 {
   gtk_popover_popup (GTK_POPOVER (item->popover));
 }
 
 static void
-gtk_popover_bar_item_class_init (GtkPopoverBarItemClass *klass)
+gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->dispose = gtk_popover_bar_item_dispose;
-  object_class->finalize = gtk_popover_bar_item_finalize;
+  object_class->dispose = gtk_popover_menu_bar_item_dispose;
+  object_class->finalize = gtk_popover_menu_bar_item_finalize;
 
-  widget_class->measure = gtk_popover_bar_item_measure;
-  widget_class->size_allocate = gtk_popover_bar_item_size_allocate;
+  widget_class->measure = gtk_popover_menu_bar_item_measure;
+  widget_class->size_allocate = gtk_popover_menu_bar_item_size_allocate;
 
-  klass->activate = gtk_popover_bar_item_activate;
+  klass->activate = gtk_popover_menu_bar_item_activate;
 
   widget_class->activate_signal =
     g_signal_new (I_("activate"),
                   G_OBJECT_CLASS_TYPE (object_class),
                   G_SIGNAL_RUN_FIRST,
-                  G_STRUCT_OFFSET (GtkPopoverBarItemClass, activate),
+                  G_STRUCT_OFFSET (GtkPopoverMenuBarItemClass, activate),
                   NULL, NULL,
                   NULL,
                   G_TYPE_NONE, 0);
@@ -312,7 +312,7 @@ enum
 
 static GParamSpec * bar_props[LAST_PROP];
 
-G_DEFINE_TYPE (GtkPopoverBar, gtk_popover_bar, GTK_TYPE_WIDGET)
+G_DEFINE_TYPE (GtkPopoverMenuBar, gtk_popover_menu_bar, GTK_TYPE_WIDGET)
 
 static void
 tracker_remove (gint     position,
@@ -335,8 +335,8 @@ tracker_remove (gint     position,
 }
 
 static void
-popover_unmap (GtkPopover    *popover,
-               GtkPopoverBar *bar)
+popover_unmap (GtkPopover        *popover,
+               GtkPopoverMenuBar *bar)
 {
   if (bar->active_item && bar->active_item->popover == popover)
     set_active_item (bar, NULL, FALSE);
@@ -347,18 +347,18 @@ tracker_insert (GtkMenuTrackerItem *item,
                 gint                position,
                 gpointer            user_data)
 {
-  GtkPopoverBar *bar = user_data;
+  GtkPopoverMenuBar *bar = user_data;
 
   if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU))
     {
-      GtkPopoverBarItem *widget;
+      GtkPopoverMenuBarItem *widget;
       GMenuModel *model;
       GtkWidget *sibling;
       GtkWidget *child;
       GtkPopover *popover;
       int i;
 
-      widget = g_object_new (GTK_TYPE_POPOVER_BAR_ITEM, NULL);
+      widget = g_object_new (GTK_TYPE_POPOVER_MENU_BAR_ITEM, NULL);
       g_object_bind_property (item, "label",
                               widget->label, "label",
                               G_BINDING_SYNC_CREATE);
@@ -391,17 +391,17 @@ tracker_insert (GtkMenuTrackerItem *item,
 }
 
 static void
-gtk_popover_bar_set_property (GObject      *object,
-                              guint         property_id,
-                              const GValue *value,
-                              GParamSpec   *pspec)
+gtk_popover_menu_bar_set_property (GObject      *object,
+                                   guint         property_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
 {
-  GtkPopoverBar *bar = GTK_POPOVER_BAR (object);
+  GtkPopoverMenuBar *bar = GTK_POPOVER_MENU_BAR (object);
 
   switch (property_id)
     {
       case PROP_MENU_MODEL:
-        gtk_popover_bar_set_menu_model (bar, g_value_get_object (value));
+        gtk_popover_menu_bar_set_menu_model (bar, g_value_get_object (value));
         break;
 
       default:
@@ -410,12 +410,12 @@ gtk_popover_bar_set_property (GObject      *object,
 }
 
 static void
-gtk_popover_bar_get_property (GObject    *object,
-                              guint       property_id,
-                              GValue     *value,
-                              GParamSpec *pspec)
+gtk_popover_menu_bar_get_property (GObject    *object,
+                                   guint       property_id,
+                                   GValue     *value,
+                                   GParamSpec *pspec)
 {
-  GtkPopoverBar *bar = GTK_POPOVER_BAR (object);
+  GtkPopoverMenuBar *bar = GTK_POPOVER_MENU_BAR (object);
 
   switch (property_id)
     {
@@ -430,9 +430,9 @@ gtk_popover_bar_get_property (GObject    *object,
 
 
 static void
-gtk_popover_bar_dispose (GObject *object)
+gtk_popover_menu_bar_dispose (GObject *object)
 {
-  GtkPopoverBar *bar = GTK_POPOVER_BAR (object);
+  GtkPopoverMenuBar *bar = GTK_POPOVER_MENU_BAR (object);
   GtkWidget *child;
 
   g_clear_pointer (&bar->tracker, gtk_menu_tracker_free);
@@ -445,18 +445,11 @@ gtk_popover_bar_dispose (GObject *object)
 }
 
 static void
-gtk_popover_bar_class_init (GtkPopoverBarClass *klass)
+gtk_popover_menu_bar_class_init (GtkPopoverMenuBarClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->dispose = gtk_popover_bar_dispose;
-  object_class->set_property = gtk_popover_bar_set_property;
-  object_class->get_property = gtk_popover_bar_get_property;
-
-  widget_class->focus = gtk_popover_bar_focus;
-
-=======
   object_class->dispose = gtk_popover_menu_bar_dispose;
   object_class->set_property = gtk_popover_menu_bar_set_property;
   object_class->get_property = gtk_popover_menu_bar_get_property;
@@ -471,7 +464,6 @@ gtk_popover_bar_class_init (GtkPopoverBarClass *klass)
    * The model should only contain submenus as toplevel
    * items.
    */
->>>>>>> 2cfe644c96... fix up finalization:gtk/gtkpopovermenubar.c
   bar_props[PROP_MENU_MODEL] =
       g_param_spec_object ("menu-model",
                            P_("Menu model"),
@@ -486,23 +478,23 @@ gtk_popover_bar_class_init (GtkPopoverBarClass *klass)
 }
 
 static void
-gtk_popover_bar_init (GtkPopoverBar *bar)
+gtk_popover_menu_bar_init (GtkPopoverMenuBar *bar)
 {
 }
 
 GtkWidget *
-gtk_popover_bar_new_from_model (GMenuModel *model)
+gtk_popover_menu_bar_new_from_model (GMenuModel *model)
 {
-  return g_object_new (GTK_TYPE_POPOVER_BAR,
+  return g_object_new (GTK_TYPE_POPOVER_MENU_BAR,
                        "menu-model", model,
                        NULL);
 }
 
 void
-gtk_popover_bar_set_menu_model (GtkPopoverBar *bar,
-                                GMenuModel    *model)
+gtk_popover_menu_bar_set_menu_model (GtkPopoverMenuBar *bar,
+                                     GMenuModel        *model)
 {
-  g_return_if_fail (GTK_IS_POPOVER_BAR (bar));
+  g_return_if_fail (GTK_IS_POPOVER_MENU_BAR (bar));
   g_return_if_fail (G_IS_MENU_MODEL (model));
 
   if (g_set_object (&bar->model, model))
@@ -531,9 +523,9 @@ gtk_popover_bar_set_menu_model (GtkPopoverBar *bar,
 }
 
 GMenuModel *
-gtk_popover_bar_get_menu_model (GtkPopoverBar *bar)
+gtk_popover_menu_bar_get_menu_model (GtkPopoverMenuBar *bar)
 {
-  g_return_val_if_fail (GTK_IS_POPOVER_BAR (bar), NULL);
+  g_return_val_if_fail (GTK_IS_POPOVER_MENU_BAR (bar), NULL);
 
   return bar->model;
 }
diff --git a/gtk/gtkpopoverbar.h b/gtk/gtkpopovermenubar.h
similarity index 53%
rename from gtk/gtkpopoverbar.h
rename to gtk/gtkpopovermenubar.h
index eca22b5828..7fa1253128 100644
--- a/gtk/gtkpopoverbar.h
+++ b/gtk/gtkpopovermenubar.h
@@ -15,8 +15,8 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __GTK_POPOVER_BAR_H__
-#define __GTK_POPOVER_BAR_H__
+#ifndef __GTK_POPOVER_MENU_BAR_H__
+#define __GTK_POPOVER_MENU_BAR_H__
 
 
 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
@@ -29,25 +29,25 @@
 G_BEGIN_DECLS
 
 
-#define        GTK_TYPE_POPOVER_BAR               (gtk_popover_bar_get_type ())
-#define GTK_POPOVER_BAR(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_POPOVER_BAR, 
GtkPopoverBar))
-#define GTK_IS_POPOVER_BAR(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_POPOVER_BAR))
+#define        GTK_TYPE_POPOVER_MENU_BAR               (gtk_popover_menu_bar_get_type ())
+#define GTK_POPOVER_MENU_BAR(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GTK_TYPE_POPOVER_MENU_BAR, GtkPopoverMenuBar))
+#define GTK_IS_POPOVER_MENU_BAR(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GTK_TYPE_POPOVER_MENU_BAR))
 
-typedef struct _GtkPopoverBar GtkPopoverBar;
+typedef struct _GtkPopoverMenuBar GtkPopoverMenuBar;
 
 GDK_AVAILABLE_IN_ALL
-GType        gtk_popover_bar_get_type       (void) G_GNUC_CONST;
+GType        gtk_popover_menu_bar_get_type       (void) G_GNUC_CONST;
 
 GDK_AVAILABLE_IN_ALL
-GtkWidget *  gtk_popover_bar_new_from_model (GMenuModel    *model);
+GtkWidget *  gtk_popover_menu_bar_new_from_model (GMenuModel        *model);
 
 GDK_AVAILABLE_IN_ALL
-void         gtk_popover_bar_set_menu_model (GtkPopoverBar *bar,
-                                             GMenuModel    *model);
+void         gtk_popover_menu_bar_set_menu_model (GtkPopoverMenuBar *bar,
+                                                  GMenuModel        *model);
 GDK_AVAILABLE_IN_ALL
-GMenuModel * gtk_popover_bar_get_menu_model (GtkPopoverBar *bar);
+GMenuModel * gtk_popover_menu_bar_get_menu_model (GtkPopoverMenuBar *bar);
 
 G_END_DECLS
 
 
-#endif /* __GTK_POPOVER_BAR_H__ */
+#endif /* __GTK_POPOVER_MENU_BAR_H__ */
diff --git a/gtk/meson.build b/gtk/meson.build
index 2c844edbef..98f80c4f04 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -296,8 +296,8 @@ gtk_public_sources = files([
   'gtkpasswordentry.c',
   'gtkpicture.c',
   'gtkpopover.c',
-  'gtkpopoverbar.c',
   'gtkpopovermenu.c',
+  'gtkpopovermenubar.c',
   'gtkprintcontext.c',
   'gtkprintoperation.c',
   'gtkprintoperationpreview.c',


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