[epiphany/wip/exalm/center: 4/4] action-bar-start: Add empty space to balance the downloads button



commit b04ed2c889d5fff8208c54702f570986aa0c23e0
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Sep 29 21:37:07 2019 +0500

    action-bar-start: Add empty space to balance the downloads button
    
    Add a placeholder widget, expose it and downloads button via public methods.
    Create a size group in EphyHeaderBar to sync them together.
    
    Fixes https://gitlab.gnome.org/GNOME/epiphany/issues/956

 src/ephy-action-bar-end.c             |  6 ++++++
 src/ephy-action-bar-end.h             |  1 +
 src/ephy-action-bar-start.c           | 10 ++++++++++
 src/ephy-action-bar-start.h           |  1 +
 src/ephy-header-bar.c                 |  9 +++++++++
 src/resources/gtk/action-bar-start.ui |  5 +++++
 6 files changed, 32 insertions(+)
---
diff --git a/src/ephy-action-bar-end.c b/src/ephy-action-bar-end.c
index 40d202e4b..d5113c63c 100644
--- a/src/ephy-action-bar-end.c
+++ b/src/ephy-action-bar-end.c
@@ -302,3 +302,9 @@ ephy_action_bar_end_get_bookmarks_button (EphyActionBarEnd *action_bar_end)
 {
   return action_bar_end->bookmarks_button;
 }
+
+GtkWidget *
+ephy_action_bar_end_get_downloads_revealer (EphyActionBarEnd *action_bar_end)
+{
+  return action_bar_end->downloads_revealer;
+}
diff --git a/src/ephy-action-bar-end.h b/src/ephy-action-bar-end.h
index 801888168..a0d397bc9 100644
--- a/src/ephy-action-bar-end.h
+++ b/src/ephy-action-bar-end.h
@@ -32,5 +32,6 @@ G_DECLARE_FINAL_TYPE (EphyActionBarEnd, ephy_action_bar_end, EPHY, ACTION_BAR_EN
 EphyActionBarEnd *ephy_action_bar_end_new                       (void);
 void              ephy_action_bar_end_set_show_bookmarks_button (EphyActionBarEnd *action_bar_end,
                                                                  gboolean          show);
+GtkWidget        *ephy_action_bar_end_get_downloads_revealer    (EphyActionBarEnd *action_bar_end);
 
 G_END_DECLS
diff --git a/src/ephy-action-bar-start.c b/src/ephy-action-bar-start.c
index b7a7489aa..368b2a8cf 100644
--- a/src/ephy-action-bar-start.c
+++ b/src/ephy-action-bar-start.c
@@ -44,6 +44,7 @@ struct _EphyActionBarStart {
   GtkWidget *combined_stop_reload_image;
   GtkWidget *homepage_button;
   GtkWidget *new_tab_button;
+  GtkWidget *placeholder;
 
   guint navigation_buttons_menu_timeout;
   gboolean is_fullscreen;
@@ -586,6 +587,9 @@ ephy_action_bar_start_class_init (EphyActionBarStartClass *klass)
   gtk_widget_class_bind_template_child (widget_class,
                                         EphyActionBarStart,
                                         new_tab_button);
+  gtk_widget_class_bind_template_child (widget_class,
+                                        EphyActionBarStart,
+                                        placeholder);
 }
 
 static void
@@ -637,3 +641,9 @@ ephy_action_bar_set_is_fullscreen (EphyActionBarStart *action_bar_start,
   action_bar_start->is_fullscreen = fullscreen;
   update_new_tab_button_visibility (action_bar_start);
 }
+
+GtkWidget *
+ephy_action_bar_start_get_placeholder (EphyActionBarStart *action_bar_start)
+{
+  return action_bar_start->placeholder;
+}
diff --git a/src/ephy-action-bar-start.h b/src/ephy-action-bar-start.h
index b30ac44da..cf3ae9bc0 100644
--- a/src/ephy-action-bar-start.h
+++ b/src/ephy-action-bar-start.h
@@ -35,5 +35,6 @@ void                ephy_action_bar_start_change_combined_stop_reload_state (Eph
                                                                              gboolean            loading);
 void                ephy_action_bar_set_is_fullscreen                       (EphyActionBarStart 
*action_bar_start,
                                                                              gboolean            fullscreen);
+GtkWidget          *ephy_action_bar_start_get_placeholder                   (EphyActionBarStart 
*action_bar_start);
 
 G_END_DECLS
diff --git a/src/ephy-header-bar.c b/src/ephy-header-bar.c
index 324a5deca..e997de125 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -171,6 +171,7 @@ ephy_header_bar_constructed (GObject *object)
   GtkBuilder *builder;
   EphyEmbedShell *embed_shell;
   HdyColumn *column;
+  GtkSizeGroup *downloads_size_group;
 
   G_OBJECT_CLASS (ephy_header_bar_parent_class)->constructed (object);
 
@@ -292,6 +293,14 @@ ephy_header_bar_constructed (GObject *object)
 
   gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar),
                            GTK_WIDGET (header_bar->end_revealer));
+
+  /* Sync the size of placeholder in EphyActionBarStart with downloads button */
+  downloads_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+  gtk_size_group_add_widget (downloads_size_group,
+                             ephy_action_bar_start_get_placeholder (header_bar->action_bar_start));
+  gtk_size_group_add_widget (downloads_size_group,
+                             ephy_action_bar_end_get_downloads_revealer (header_bar->action_bar_end));
+  g_object_unref (downloads_size_group);
 }
 
 static void
diff --git a/src/resources/gtk/action-bar-start.ui b/src/resources/gtk/action-bar-start.ui
index 2c3e5742c..06c7ec533 100644
--- a/src/resources/gtk/action-bar-start.ui
+++ b/src/resources/gtk/action-bar-start.ui
@@ -106,5 +106,10 @@
         </child>
       </object>
     </child>
+    <child>
+      <object class="GtkBox" id="placeholder">
+        <property name="visible">True</property>
+      </object>
+    </child>
   </template>
 </interface>


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