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



commit bde6c76e4015514ad8123acfdc439d99eb0c5b4d
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             |  7 +++++++
 src/ephy-action-bar-end.h             |  1 +
 src/ephy-action-bar-start.c           | 11 +++++++++++
 src/ephy-action-bar-start.h           |  1 +
 src/ephy-header-bar.c                 |  9 +++++++++
 src/resources/gtk/action-bar-start.ui |  5 +++++
 6 files changed, 34 insertions(+)
---
diff --git a/src/ephy-action-bar-end.c b/src/ephy-action-bar-end.c
index 40d202e4b..3452489fb 100644
--- a/src/ephy-action-bar-end.c
+++ b/src/ephy-action-bar-end.c
@@ -302,3 +302,10 @@ 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 54b6839ad..ee198efcd 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;
 };
@@ -573,6 +574,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
@@ -612,3 +616,10 @@ ephy_action_bar_start_change_combined_stop_reload_state (EphyActionBarStart *act
                                  _(REFRESH_BUTTON_TOOLTIP));
   }
 }
+
+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 e64b8178a..62b1b962b 100644
--- a/src/ephy-action-bar-start.h
+++ b/src/ephy-action-bar-start.h
@@ -33,5 +33,6 @@ EphyActionBarStart *ephy_action_bar_start_new                               (voi
 GtkWidget          *ephy_action_bar_start_get_navigation_box                (EphyActionBarStart 
*action_bar_start);
 void                ephy_action_bar_start_change_combined_stop_reload_state (EphyActionBarStart 
*action_bar_start,
                                                                              gboolean            loading);
+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 218e654b1..d8cd58417 100644
--- a/src/ephy-header-bar.c
+++ b/src/ephy-header-bar.c
@@ -145,6 +145,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);
 
@@ -253,6 +254,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]