[epiphany] bookmark-properties-grid: Change to a box container and rename widget



commit bf8cb47f9a4fb2daad91b59d9517c3d306503194
Author: vanadiae <vanadiae35 gmail com>
Date:   Mon Jun 14 16:12:23 2021 +0200

    bookmark-properties-grid: Change to a box container and rename widget
    
    Currently the EphyBookmarkPropertiesGrid uses a GtkGrid to layout the
    different widgets. But it only uses a single column, which means the
    grid is basically useless as a GtkBox would do the job better without
    requiring the different packing properties (as long as the childs are in
    increasing order).
    
    So this commit changes it to a GtkBox subclass and renames the widget
    accordingly, without including "box" in the name as it's not useful.
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/978>

 po/POTFILES.in                                     |   2 +-
 src/bookmarks/ephy-add-bookmark-popover.c          |  10 +-
 ...roperties-grid.c => ephy-bookmark-properties.c} | 202 ++++++++++-----------
 ...roperties-grid.h => ephy-bookmark-properties.h} |  18 +-
 src/bookmarks/ephy-bookmark-row.c                  |  10 +-
 src/meson.build                                    |   4 +-
 src/resources/epiphany.gresource.xml               |   2 +-
 ...k-properties-grid.ui => bookmark-properties.ui} | 103 ++++-------
 8 files changed, 156 insertions(+), 195 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index aec24f2dc..e755a283c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -36,7 +36,7 @@ lib/widgets/ephy-download-widget.c
 lib/widgets/ephy-file-chooser.c
 lib/widgets/ephy-location-entry.c
 lib/widgets/ephy-security-popover.c
-src/bookmarks/ephy-bookmark-properties-grid.c
+src/bookmarks/ephy-bookmark-properties.c
 src/bookmarks/ephy-bookmark-row.c
 src/bookmarks/ephy-bookmarks-import.c
 src/bookmarks/ephy-bookmarks-manager.h
diff --git a/src/bookmarks/ephy-add-bookmark-popover.c b/src/bookmarks/ephy-add-bookmark-popover.c
index 1fd476c83..8f25bf482 100644
--- a/src/bookmarks/ephy-add-bookmark-popover.c
+++ b/src/bookmarks/ephy-add-bookmark-popover.c
@@ -22,7 +22,7 @@
 
 #include "ephy-add-bookmark-popover.h"
 
-#include "ephy-bookmark-properties-grid.h"
+#include "ephy-bookmark-properties.h"
 #include "ephy-bookmarks-manager.h"
 #include "ephy-embed-container.h"
 #include "ephy-location-entry.h"
@@ -237,12 +237,12 @@ ephy_add_bookmark_popover_show (EphyAddBookmarkPopover *self)
                            self,
                            G_CONNECT_SWAPPED);
 
-  self->grid = ephy_bookmark_properties_grid_new (bookmark,
-                                                  EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_POPOVER,
-                                                  GTK_WIDGET (self));
+  self->grid = ephy_bookmark_properties_new (bookmark,
+                                             EPHY_BOOKMARK_PROPERTIES_TYPE_POPOVER,
+                                             GTK_WIDGET (self));
   gtk_container_add (GTK_CONTAINER (self), self->grid);
   gtk_popover_set_default_widget (GTK_POPOVER (self),
-                                  ephy_bookmark_properties_grid_get_add_tag_button 
(EPHY_BOOKMARK_PROPERTIES_GRID (self->grid)));
+                                  ephy_bookmark_properties_get_add_tag_button (EPHY_BOOKMARK_PROPERTIES 
(self->grid)));
 
   g_free (self->address);
   self->address = g_strdup (address);
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.c b/src/bookmarks/ephy-bookmark-properties.c
similarity index 68%
rename from src/bookmarks/ephy-bookmark-properties-grid.c
rename to src/bookmarks/ephy-bookmark-properties.c
index 1b7395f8f..99924a02f 100644
--- a/src/bookmarks/ephy-bookmark-properties-grid.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#include "ephy-bookmark-properties-grid.h"
+#include "ephy-bookmark-properties.h"
 
 #include "ephy-bookmarks-manager.h"
 #include "ephy-debug.h"
@@ -32,15 +32,15 @@
 #include <libsoup/soup.h>
 #include <string.h>
 
-struct _EphyBookmarkPropertiesGrid {
-  GtkGrid parent_instance;
+struct _EphyBookmarkProperties {
+  GtkBox parent_instance;
 
   EphyBookmarksManager *manager;
   EphyBookmark *bookmark;
   gboolean bookmark_is_modified;
   gboolean bookmark_is_removed;
 
-  EphyBookmarkPropertiesGridType type;
+  EphyBookmarkPropertiesType type;
   GtkWidget *parent;
 
   GtkWidget *popover_bookmark_label;
@@ -54,7 +54,7 @@ struct _EphyBookmarkPropertiesGrid {
   GtkWidget *add_tag_button;
 };
 
-G_DEFINE_TYPE (EphyBookmarkPropertiesGrid, ephy_bookmark_properties_grid, GTK_TYPE_GRID)
+G_DEFINE_TYPE (EphyBookmarkProperties, ephy_bookmark_properties, GTK_TYPE_BOX)
 
 enum {
   PROP_0,
@@ -93,7 +93,7 @@ flow_box_sort_func (GtkFlowBoxChild *child1,
 }
 
 static void
-update_tags_scrollbar (EphyBookmarkPropertiesGrid *self)
+update_tags_scrollbar (EphyBookmarkProperties *self)
 {
   g_autoptr (GList) children = NULL;
   gint n_tags;
@@ -108,15 +108,15 @@ update_tags_scrollbar (EphyBookmarkPropertiesGrid *self)
 }
 
 static void
-ephy_bookmark_properties_grid_tags_box_child_activated_cb (EphyBookmarkPropertiesGrid *self,
-                                                           GtkFlowBoxChild            *child,
-                                                           GtkFlowBox                 *flow_box)
+ephy_bookmark_properties_tags_box_child_activated_cb (EphyBookmarkProperties *self,
+                                                      GtkFlowBoxChild        *child,
+                                                      GtkFlowBox             *flow_box)
 {
   GtkStyleContext *context;
   GtkWidget *box;
   GtkWidget *label;
 
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (GTK_IS_FLOW_BOX_CHILD (child));
   g_assert (GTK_IS_FLOW_BOX (flow_box));
 
@@ -136,14 +136,14 @@ ephy_bookmark_properties_grid_tags_box_child_activated_cb (EphyBookmarkPropertie
 }
 
 static void
-ephy_bookmark_properties_grid_tag_widget_button_clicked_cb (EphyBookmarkPropertiesGrid *self,
-                                                            GtkButton                  *button)
+ephy_bookmark_properties_tag_widget_button_clicked_cb (EphyBookmarkProperties *self,
+                                                       GtkButton              *button)
 {
   GtkWidget *box;
   GtkWidget *flow_box_child;
   GtkLabel *label;
 
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (GTK_IS_BUTTON (button));
 
   box = gtk_widget_get_parent (GTK_WIDGET (button));
@@ -158,9 +158,9 @@ ephy_bookmark_properties_grid_tag_widget_button_clicked_cb (EphyBookmarkProperti
 }
 
 static GtkWidget *
-ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *self,
-                                                 const char                 *tag,
-                                                 gboolean                    selected)
+ephy_bookmark_properties_create_tag_widget (EphyBookmarkProperties *self,
+                                            const char             *tag,
+                                            gboolean                selected)
 {
   GtkWidget *widget;
   GtkWidget *box;
@@ -201,7 +201,7 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
     gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
     gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
     g_signal_connect_object (button, "clicked",
-                             G_CALLBACK (ephy_bookmark_properties_grid_tag_widget_button_clicked_cb),
+                             G_CALLBACK (ephy_bookmark_properties_tag_widget_button_clicked_cb),
                              self,
                              G_CONNECT_SWAPPED);
   }
@@ -221,16 +221,16 @@ ephy_bookmark_properties_grid_create_tag_widget (EphyBookmarkPropertiesGrid *sel
 }
 
 static void
-ephy_bookmarks_properties_grid_actions_add_tag (GSimpleAction *action,
-                                                GVariant      *value,
-                                                gpointer       user_data)
+ephy_bookmark_properties_actions_add_tag (GSimpleAction *action,
+                                          GVariant      *value,
+                                          gpointer       user_data)
 {
-  EphyBookmarkPropertiesGrid *self = user_data;
+  EphyBookmarkProperties *self = user_data;
   GtkEntryBuffer *buffer;
   GtkWidget *widget;
   const char *text;
 
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
 
   buffer = gtk_entry_get_buffer (GTK_ENTRY (self->add_tag_entry));
   text = gtk_entry_buffer_get_text (buffer);
@@ -242,7 +242,7 @@ ephy_bookmarks_properties_grid_actions_add_tag (GSimpleAction *action,
   ephy_bookmark_add_tag (self->bookmark, text);
 
   /* Create a new widget for the new tag */
-  widget = ephy_bookmark_properties_grid_create_tag_widget (self, text, TRUE);
+  widget = ephy_bookmark_properties_create_tag_widget (self, text, TRUE);
   gtk_flow_box_insert (GTK_FLOW_BOX (self->tags_box), widget, -1);
   update_tags_scrollbar (self);
 
@@ -254,34 +254,34 @@ ephy_bookmarks_properties_grid_actions_add_tag (GSimpleAction *action,
 }
 
 static void
-ephy_bookmarks_properties_grid_actions_remove_bookmark (GSimpleAction *action,
-                                                        GVariant      *value,
-                                                        gpointer       user_data)
+ephy_bookmark_properties_actions_remove_bookmark (GSimpleAction *action,
+                                                  GVariant      *value,
+                                                  gpointer       user_data)
 {
-  EphyBookmarkPropertiesGrid *self = user_data;
+  EphyBookmarkProperties *self = user_data;
 
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
 
   self->bookmark_is_removed = TRUE;
   ephy_bookmarks_manager_remove_bookmark (self->manager, self->bookmark);
 
-  if (self->type == EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG)
+  if (self->type == EPHY_BOOKMARK_PROPERTIES_TYPE_DIALOG)
     gtk_widget_destroy (self->parent);
 }
 
 static void
-ephy_bookmark_properties_grid_buffer_text_changed_cb (EphyBookmarkPropertiesGrid *self,
-                                                      GParamSpec                 *pspec,
-                                                      GtkEntryBuffer             *buffer)
+ephy_bookmark_properties_buffer_text_changed_cb (EphyBookmarkProperties *self,
+                                                 GParamSpec             *pspec,
+                                                 GtkEntryBuffer         *buffer)
 {
   GActionGroup *group;
   GAction *action;
   const char *text;
 
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (GTK_IS_ENTRY_BUFFER (buffer));
 
-  group = gtk_widget_get_action_group (GTK_WIDGET (self), "grid");
+  group = gtk_widget_get_action_group (GTK_WIDGET (self), "bookmark-properties");
   action = g_action_map_lookup_action (G_ACTION_MAP (group), "add-tag");
   text = gtk_entry_buffer_get_text (buffer);
   if (ephy_bookmarks_manager_tag_exists (self->manager, text) || g_strcmp0 (text, "") == 0)
@@ -291,11 +291,11 @@ ephy_bookmark_properties_grid_buffer_text_changed_cb (EphyBookmarkPropertiesGrid
 }
 
 static void
-ephy_bookmark_properties_grid_bookmark_title_changed_cb (EphyBookmarkPropertiesGrid *self,
-                                                         EphyBookmark               *bookmark,
-                                                         EphyBookmarksManager       *manager)
+ephy_bookmark_properties_bookmark_title_changed_cb (EphyBookmarkProperties *self,
+                                                    EphyBookmark           *bookmark,
+                                                    EphyBookmarksManager   *manager)
 {
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (EPHY_IS_BOOKMARK (bookmark));
   g_assert (EPHY_IS_BOOKMARKS_MANAGER (manager));
 
@@ -303,11 +303,11 @@ ephy_bookmark_properties_grid_bookmark_title_changed_cb (EphyBookmarkPropertiesG
 }
 
 static void
-ephy_bookmark_properties_grid_bookmark_url_changed_cb (EphyBookmarkPropertiesGrid *self,
-                                                       EphyBookmark               *bookmark,
-                                                       EphyBookmarksManager       *manager)
+ephy_bookmark_properties_bookmark_url_changed_cb (EphyBookmarkProperties *self,
+                                                  EphyBookmark           *bookmark,
+                                                  EphyBookmarksManager   *manager)
 {
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (EPHY_IS_BOOKMARK (bookmark));
   g_assert (EPHY_IS_BOOKMARKS_MANAGER (manager));
 
@@ -315,12 +315,12 @@ ephy_bookmark_properties_grid_bookmark_url_changed_cb (EphyBookmarkPropertiesGri
 }
 
 static void
-ephy_bookmark_properties_grid_bookmark_tag_added_cb (EphyBookmarkPropertiesGrid *self,
-                                                     EphyBookmark               *bookmark,
-                                                     const char                 *tag,
-                                                     EphyBookmarksManager       *manager)
+ephy_bookmark_properties_bookmark_tag_added_cb (EphyBookmarkProperties *self,
+                                                EphyBookmark           *bookmark,
+                                                const char             *tag,
+                                                EphyBookmarksManager   *manager)
 {
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (EPHY_IS_BOOKMARK (bookmark));
   g_assert (EPHY_IS_BOOKMARKS_MANAGER (manager));
 
@@ -328,12 +328,12 @@ ephy_bookmark_properties_grid_bookmark_tag_added_cb (EphyBookmarkPropertiesGrid
 }
 
 static void
-ephy_bookmark_properties_grid_bookmark_tag_removed_cb (EphyBookmarkPropertiesGrid *self,
-                                                       EphyBookmark               *bookmark,
-                                                       const char                 *tag,
-                                                       EphyBookmarksManager       *manager)
+ephy_bookmark_properties_bookmark_tag_removed_cb (EphyBookmarkProperties *self,
+                                                  EphyBookmark           *bookmark,
+                                                  const char             *tag,
+                                                  EphyBookmarksManager   *manager)
 {
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
   g_assert (EPHY_IS_BOOKMARK (bookmark));
   g_assert (EPHY_IS_BOOKMARKS_MANAGER (manager));
   g_assert (tag);
@@ -342,12 +342,12 @@ ephy_bookmark_properties_grid_bookmark_tag_removed_cb (EphyBookmarkPropertiesGri
 }
 
 static void
-ephy_bookmark_properties_grid_set_property (GObject      *object,
-                                            guint         prop_id,
-                                            const GValue *value,
-                                            GParamSpec   *pspec)
+ephy_bookmark_properties_set_property (GObject      *object,
+                                       guint         prop_id,
+                                       const GValue *value,
+                                       GParamSpec   *pspec)
 {
-  EphyBookmarkPropertiesGrid *self = EPHY_BOOKMARK_PROPERTIES_GRID (object);
+  EphyBookmarkProperties *self = EPHY_BOOKMARK_PROPERTIES (object);
 
   switch (prop_id) {
     case PROP_BOOKMARK:
@@ -365,20 +365,20 @@ ephy_bookmark_properties_grid_set_property (GObject      *object,
 }
 
 static void
-ephy_bookmark_properties_grid_constructed (GObject *object)
+ephy_bookmark_properties_constructed (GObject *object)
 {
-  EphyBookmarkPropertiesGrid *self = EPHY_BOOKMARK_PROPERTIES_GRID (object);
+  EphyBookmarkProperties *self = EPHY_BOOKMARK_PROPERTIES (object);
   GSequence *tags;
   GSequence *bookmark_tags;
   GSequenceIter *iter;
   const char *address;
 
-  G_OBJECT_CLASS (ephy_bookmark_properties_grid_parent_class)->constructed (object);
+  G_OBJECT_CLASS (ephy_bookmark_properties_parent_class)->constructed (object);
 
   /* Set appearance based on type */
-  if (self->type == EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG) {
+  if (self->type == EPHY_BOOKMARK_PROPERTIES_TYPE_DIALOG) {
     gtk_container_remove (GTK_CONTAINER (self), self->popover_bookmark_label);
-  } else if (self->type == EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_POPOVER) {
+  } else if (self->type == EPHY_BOOKMARK_PROPERTIES_TYPE_POPOVER) {
     gtk_container_remove (GTK_CONTAINER (self), self->address_label);
     gtk_container_remove (GTK_CONTAINER (self), self->address_entry);
   }
@@ -392,7 +392,7 @@ ephy_bookmark_properties_grid_constructed (GObject *object)
                           G_BINDING_DEFAULT);
 
   /* Set text for address entry */
-  if (self->type == EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG) {
+  if (self->type == EPHY_BOOKMARK_PROPERTIES_TYPE_DIALOG) {
     g_autofree char *decoded_address = NULL;
 
     address = ephy_bookmark_get_url (self->bookmark);
@@ -420,22 +420,22 @@ ephy_bookmark_properties_grid_constructed (GObject *object)
                            NULL))
       selected = TRUE;
 
-    widget = ephy_bookmark_properties_grid_create_tag_widget (self, tag, selected);
+    widget = ephy_bookmark_properties_create_tag_widget (self, tag, selected);
     gtk_flow_box_insert (GTK_FLOW_BOX (self->tags_box), widget, -1);
   }
   update_tags_scrollbar (self);
 
   g_signal_connect_object (self->tags_box, "child-activated",
-                           G_CALLBACK (ephy_bookmark_properties_grid_tags_box_child_activated_cb),
+                           G_CALLBACK (ephy_bookmark_properties_tags_box_child_activated_cb),
                            self,
                            G_CONNECT_SWAPPED);
   gtk_widget_show_all (self->tags_box);
 }
 
 static void
-ephy_bookmark_properties_grid_finalize (GObject *object)
+ephy_bookmark_properties_finalize (GObject *object)
 {
-  EphyBookmarkPropertiesGrid *self = EPHY_BOOKMARK_PROPERTIES_GRID (object);
+  EphyBookmarkProperties *self = EPHY_BOOKMARK_PROPERTIES (object);
 
   if (self->bookmark_is_modified && !self->bookmark_is_removed)
     g_signal_emit_by_name (self->manager, "synchronizable-modified", self->bookmark, FALSE);
@@ -445,18 +445,18 @@ ephy_bookmark_properties_grid_finalize (GObject *object)
                                ephy_bookmarks_manager_save_warn_on_error_cb,
                                NULL);
 
-  G_OBJECT_CLASS (ephy_bookmark_properties_grid_parent_class)->finalize (object);
+  G_OBJECT_CLASS (ephy_bookmark_properties_parent_class)->finalize (object);
 }
 
 static void
-ephy_bookmark_properties_grid_class_init (EphyBookmarkPropertiesGridClass *klass)
+ephy_bookmark_properties_class_init (EphyBookmarkPropertiesClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->set_property = ephy_bookmark_properties_grid_set_property;
-  object_class->constructed = ephy_bookmark_properties_grid_constructed;
-  object_class->finalize = ephy_bookmark_properties_grid_finalize;
+  object_class->set_property = ephy_bookmark_properties_set_property;
+  object_class->constructed = ephy_bookmark_properties_constructed;
+  object_class->finalize = ephy_bookmark_properties_finalize;
 
   obj_properties[PROP_BOOKMARK] =
     g_param_spec_object ("bookmark",
@@ -467,10 +467,10 @@ ephy_bookmark_properties_grid_class_init (EphyBookmarkPropertiesGridClass *klass
 
   obj_properties[PROP_TYPE] =
     g_param_spec_enum ("type",
-                       "An EphyBookmarkPropertiesGrid object",
-                       "The type of widget the grid will be used for",
-                       EPHY_TYPE_BOOKMARK_PROPERTIES_GRID_TYPE,
-                       EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG,
+                       "An EphyBookmarkProperties object",
+                       "The type of widget the bookmark properties will be used for",
+                       EPHY_TYPE_BOOKMARK_PROPERTIES_TYPE,
+                       EPHY_BOOKMARK_PROPERTIES_TYPE_DIALOG,
                        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
   obj_properties[PROP_PARENT] =
@@ -482,25 +482,25 @@ ephy_bookmark_properties_grid_class_init (EphyBookmarkPropertiesGridClass *klass
 
   g_object_class_install_properties (object_class, LAST_PROP, obj_properties);
 
-  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/epiphany/gtk/bookmark-properties-grid.ui");
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, popover_bookmark_label);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, name_entry);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, address_label);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, address_entry);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, popover_tags_label);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, tags_box);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, tags_scrolled_window);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, add_tag_entry);
-  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkPropertiesGrid, add_tag_button);
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/epiphany/gtk/bookmark-properties.ui");
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, popover_bookmark_label);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, name_entry);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, address_label);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, address_entry);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, popover_tags_label);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, tags_box);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, tags_scrolled_window);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, add_tag_entry);
+  gtk_widget_class_bind_template_child (widget_class, EphyBookmarkProperties, add_tag_button);
 }
 
 static const GActionEntry entries[] = {
-  { "add-tag", ephy_bookmarks_properties_grid_actions_add_tag },
-  { "remove-bookmark", ephy_bookmarks_properties_grid_actions_remove_bookmark }
+  { "add-tag", ephy_bookmark_properties_actions_add_tag },
+  { "remove-bookmark", ephy_bookmark_properties_actions_remove_bookmark }
 };
 
 static void
-ephy_bookmark_properties_grid_init (EphyBookmarkPropertiesGrid *self)
+ephy_bookmark_properties_init (EphyBookmarkProperties *self)
 {
   g_autoptr (GSimpleActionGroup) group = NULL;
   GAction *action;
@@ -510,22 +510,22 @@ ephy_bookmark_properties_grid_init (EphyBookmarkPropertiesGrid *self)
   self->manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
   g_signal_connect_object (self->manager,
                            "bookmark-title-changed",
-                           G_CALLBACK (ephy_bookmark_properties_grid_bookmark_title_changed_cb),
+                           G_CALLBACK (ephy_bookmark_properties_bookmark_title_changed_cb),
                            self,
                            G_CONNECT_SWAPPED);
   g_signal_connect_object (self->manager,
                            "bookmark-url-changed",
-                           G_CALLBACK (ephy_bookmark_properties_grid_bookmark_url_changed_cb),
+                           G_CALLBACK (ephy_bookmark_properties_bookmark_url_changed_cb),
                            self,
                            G_CONNECT_SWAPPED);
   g_signal_connect_object (self->manager,
                            "bookmark-tag-added",
-                           G_CALLBACK (ephy_bookmark_properties_grid_bookmark_tag_added_cb),
+                           G_CALLBACK (ephy_bookmark_properties_bookmark_tag_added_cb),
                            self,
                            G_CONNECT_SWAPPED);
   g_signal_connect_object (self->manager,
                            "bookmark-tag-removed",
-                           G_CALLBACK (ephy_bookmark_properties_grid_bookmark_tag_removed_cb),
+                           G_CALLBACK (ephy_bookmark_properties_bookmark_tag_removed_cb),
                            self,
                            G_CONNECT_SWAPPED);
 
@@ -536,7 +536,7 @@ ephy_bookmark_properties_grid_init (EphyBookmarkPropertiesGrid *self)
   group = g_simple_action_group_new ();
   g_action_map_add_action_entries (G_ACTION_MAP (group), entries,
                                    G_N_ELEMENTS (entries), self);
-  gtk_widget_insert_action_group (GTK_WIDGET (self), "grid",
+  gtk_widget_insert_action_group (GTK_WIDGET (self), "bookmark-properties",
                                   G_ACTION_GROUP (group));
 
   /* Disable the "add-tag" action until text is inserted in the corresponding
@@ -546,20 +546,20 @@ ephy_bookmark_properties_grid_init (EphyBookmarkPropertiesGrid *self)
 
   g_signal_connect_object (gtk_entry_get_buffer (GTK_ENTRY (self->add_tag_entry)),
                            "notify::text",
-                           G_CALLBACK (ephy_bookmark_properties_grid_buffer_text_changed_cb),
+                           G_CALLBACK (ephy_bookmark_properties_buffer_text_changed_cb),
                            self,
                            G_CONNECT_SWAPPED);
 }
 
 GtkWidget *
-ephy_bookmark_properties_grid_new (EphyBookmark                   *bookmark,
-                                   EphyBookmarkPropertiesGridType  type,
-                                   GtkWidget                      *parent)
+ephy_bookmark_properties_new (EphyBookmark               *bookmark,
+                              EphyBookmarkPropertiesType  type,
+                              GtkWidget                  *parent)
 {
   g_assert (EPHY_IS_BOOKMARK (bookmark));
   g_assert (GTK_IS_WIDGET (parent));
 
-  return g_object_new (EPHY_TYPE_BOOKMARK_PROPERTIES_GRID,
+  return g_object_new (EPHY_TYPE_BOOKMARK_PROPERTIES,
                        "bookmark", bookmark,
                        "type", type,
                        "parent", parent,
@@ -567,9 +567,9 @@ ephy_bookmark_properties_grid_new (EphyBookmark                   *bookmark,
 }
 
 GtkWidget *
-ephy_bookmark_properties_grid_get_add_tag_button (EphyBookmarkPropertiesGrid *self)
+ephy_bookmark_properties_get_add_tag_button (EphyBookmarkProperties *self)
 {
-  g_assert (EPHY_IS_BOOKMARK_PROPERTIES_GRID (self));
+  g_assert (EPHY_IS_BOOKMARK_PROPERTIES (self));
 
   return self->add_tag_button;
 }
diff --git a/src/bookmarks/ephy-bookmark-properties-grid.h b/src/bookmarks/ephy-bookmark-properties.h
similarity index 56%
rename from src/bookmarks/ephy-bookmark-properties-grid.h
rename to src/bookmarks/ephy-bookmark-properties.h
index 763f7b67d..907da0193 100644
--- a/src/bookmarks/ephy-bookmark-properties-grid.h
+++ b/src/bookmarks/ephy-bookmark-properties.h
@@ -26,19 +26,19 @@
 
 G_BEGIN_DECLS
 
-#define EPHY_TYPE_BOOKMARK_PROPERTIES_GRID (ephy_bookmark_properties_grid_get_type ())
+#define EPHY_TYPE_BOOKMARK_PROPERTIES (ephy_bookmark_properties_get_type ())
 
-G_DECLARE_FINAL_TYPE (EphyBookmarkPropertiesGrid, ephy_bookmark_properties_grid, EPHY, 
BOOKMARK_PROPERTIES_GRID, GtkGrid)
+G_DECLARE_FINAL_TYPE (EphyBookmarkProperties, ephy_bookmark_properties, EPHY, BOOKMARK_PROPERTIES, GtkBox)
 
 typedef enum {
-  EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG,
-  EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_POPOVER
-} EphyBookmarkPropertiesGridType;
+  EPHY_BOOKMARK_PROPERTIES_TYPE_DIALOG,
+  EPHY_BOOKMARK_PROPERTIES_TYPE_POPOVER
+} EphyBookmarkPropertiesType;
 
-GtkWidget *ephy_bookmark_properties_grid_new                (EphyBookmark                   *bookmark,
-                                                             EphyBookmarkPropertiesGridType  type,
-                                                             GtkWidget                      *parent);
+GtkWidget *ephy_bookmark_properties_new                (EphyBookmark                   *bookmark,
+                                                        EphyBookmarkPropertiesType  type,
+                                                        GtkWidget                      *parent);
 
-GtkWidget *ephy_bookmark_properties_grid_get_add_tag_button (EphyBookmarkPropertiesGrid *self);
+GtkWidget *ephy_bookmark_properties_get_add_tag_button (EphyBookmarkProperties *self);
 
 G_END_DECLS
diff --git a/src/bookmarks/ephy-bookmark-row.c b/src/bookmarks/ephy-bookmark-row.c
index 42f845a9d..5caef810c 100644
--- a/src/bookmarks/ephy-bookmark-row.c
+++ b/src/bookmarks/ephy-bookmark-row.c
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#include "ephy-bookmark-properties-grid.h"
+#include "ephy-bookmark-properties.h"
 #include "ephy-bookmark-row.h"
 #include "ephy-embed-prefs.h"
 #include "ephy-embed-shell.h"
@@ -67,11 +67,11 @@ ephy_bookmark_row_button_clicked_cb (EphyBookmarkRow *row,
 
   content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
 
-  grid = ephy_bookmark_properties_grid_new (ephy_bookmark_row_get_bookmark (row),
-                                            EPHY_BOOKMARK_PROPERTIES_GRID_TYPE_DIALOG,
-                                            dialog);
+  grid = ephy_bookmark_properties_new (ephy_bookmark_row_get_bookmark (row),
+                                       EPHY_BOOKMARK_PROPERTIES_TYPE_DIALOG,
+                                       dialog);
   gtk_window_set_default (GTK_WINDOW (dialog),
-                          ephy_bookmark_properties_grid_get_add_tag_button (EPHY_BOOKMARK_PROPERTIES_GRID 
(grid)));
+                          ephy_bookmark_properties_get_add_tag_button (EPHY_BOOKMARK_PROPERTIES (grid)));
 
   gtk_container_add (GTK_CONTAINER (content_area), grid);
 
diff --git a/src/meson.build b/src/meson.build
index 7f77173f2..a55502727 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,5 @@
 types_headers = [
-  'bookmarks/ephy-bookmark-properties-grid.h',
+  'bookmarks/ephy-bookmark-properties.h',
   'ephy-link.h',
   'ephy-session.h',
   'ephy-shell.h',
@@ -15,7 +15,7 @@ subdir('webextension')
 libephymain_sources = [
   'bookmarks/ephy-add-bookmark-popover.c',
   'bookmarks/ephy-bookmark.c',
-  'bookmarks/ephy-bookmark-properties-grid.c',
+  'bookmarks/ephy-bookmark-properties.c',
   'bookmarks/ephy-bookmark-row.c',
   'bookmarks/ephy-bookmarks-export.c',
   'bookmarks/ephy-bookmarks-import.c',
diff --git a/src/resources/epiphany.gresource.xml b/src/resources/epiphany.gresource.xml
index e85aafef2..835d3efee 100644
--- a/src/resources/epiphany.gresource.xml
+++ b/src/resources/epiphany.gresource.xml
@@ -15,7 +15,7 @@
     <file preprocess="xml-stripblanks" compressed="true">gtk/action-bar-end.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/action-bar-start.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/action-bar.ui</file>
-    <file preprocess="xml-stripblanks" compressed="true">gtk/bookmark-properties-grid.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true">gtk/bookmark-properties.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/bookmark-row.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/bookmarks-popover.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">gtk/clear-data-view.ui</file>
diff --git a/src/resources/gtk/bookmark-properties-grid.ui b/src/resources/gtk/bookmark-properties.ui
similarity index 77%
rename from src/resources/gtk/bookmark-properties-grid.ui
rename to src/resources/gtk/bookmark-properties.ui
index 563da013c..2f2d6b211 100644
--- a/src/resources/gtk/bookmark-properties-grid.ui
+++ b/src/resources/gtk/bookmark-properties.ui
@@ -2,12 +2,11 @@
 <!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.18"/>
-  <template class="EphyBookmarkPropertiesGrid" parent="GtkGrid">
+  <template class="EphyBookmarkProperties" parent="GtkBox">
     <property name="visible">True</property>
     <property name="border_width">12</property>
     <property name="orientation">vertical</property>
-    <property name="row_spacing">6</property>
-    <property name="column_spacing">6</property>
+    <property name="spacing">6</property>
     <child>
       <object class="GtkLabel" id="popover_bookmark_label">
         <property name="visible">True</property>
@@ -16,10 +15,6 @@
           <attribute name="weight" value="bold"/>
         </attributes>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">0</property>
-      </packing>
     </child>
     <child>
       <object class="GtkLabel">
@@ -32,20 +27,12 @@
           <class name="dim-label"/>
         </style>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">1</property>
-      </packing>
     </child>
     <child>
       <object class="GtkEntry" id="name_entry">
         <property name="visible">True</property>
         <property name="max_width_chars">32</property>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">2</property>
-      </packing>
     </child>
     <child>
       <object class="GtkLabel" id="address_label">
@@ -60,19 +47,11 @@
           <class name="dim-label"/>
         </style>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">3</property>
-      </packing>
     </child>
     <child>
       <object class="GtkEntry" id="address_entry">
         <property name="visible">True</property>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">4</property>
-      </packing>
     </child>
     <child>
       <object class="GtkLabel" id="popover_tags_label">
@@ -85,10 +64,34 @@
           <class name="dim-label"/>
         </style>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">5</property>
-      </packing>
+    </child>
+    <child>
+      <object class="GtkScrolledWindow" id="tags_scrolled_window">
+        <property name="visible">True</property>
+        <property name="vexpand">True</property>
+        <property name="min_content_height">38</property>
+        <property name="max_content_width">270</property>
+        <property name="max_content_height">182</property>
+        <property name="propagate_natural_width">True</property>
+        <property name="propagate_natural_height">True</property>
+        <child>
+          <object class="GtkViewport">
+            <property name="visible">True</property>
+            <child>
+              <object class="GtkFlowBox" id="tags_box">
+                <property name="visible">True</property>
+                <property name="homogeneous">True</property>
+                <property name="valign">start</property>
+                <property name="column_spacing">6</property>
+                <property name="row_spacing">6</property>
+                <property name="min_children_per_line">2</property>
+                <property name="max_children_per_line">3</property>
+                <property name="selection_mode">none</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
     </child>
     <child>
       <object class="GtkBox">
@@ -103,7 +106,6 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">0</property>
           </packing>
         </child>
         <child>
@@ -112,55 +114,18 @@
             <property name="visible">True</property>
             <property name="can_default">True</property>
             <property name="receives_default">False</property>
-            <property name="action_name">grid.add-tag</property>
+            <property name="action_name">bookmark-properties.add-tag</property>
             <property name="use_underline">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
           </packing>
         </child>
         <style>
           <class name="linked"/>
         </style>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">7</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkScrolledWindow" id="tags_scrolled_window">
-        <property name="visible">True</property>
-        <property name="vexpand">True</property>
-        <property name="min_content_height">38</property>
-        <property name="max_content_width">270</property>
-        <property name="max_content_height">182</property>
-        <property name="propagate_natural_width">True</property>
-        <property name="propagate_natural_height">True</property>
-        <child>
-          <object class="GtkViewport">
-            <property name="visible">True</property>
-            <child>
-              <object class="GtkFlowBox" id="tags_box">
-                <property name="visible">True</property>
-                <property name="homogeneous">True</property>
-                <property name="valign">start</property>
-                <property name="column_spacing">6</property>
-                <property name="row_spacing">6</property>
-                <property name="min_children_per_line">2</property>
-                <property name="max_children_per_line">3</property>
-                <property name="selection_mode">none</property>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">6</property>
-      </packing>
     </child>
     <child>
       <object class="GtkButton" id="remove_bookmark_button">
@@ -168,17 +133,13 @@
         <property name="visible">True</property>
         <property name="receives_default">False</property>
         <property name="halign">end</property>
-        <property name="action_name">grid.remove-bookmark</property>
+        <property name="action_name">bookmark-properties.remove-bookmark</property>
         <property name="use_underline">True</property>
         <property name="margin_top">6</property>
         <style>
           <class name="destructive-action"/>
         </style>
       </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">8</property>
-      </packing>
     </child>
   </template>
 </interface>


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