[gnome-control-center] window: Synchronize sidebar and header with a size group
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] window: Synchronize sidebar and header with a size group
- Date: Wed, 16 Aug 2017 19:48:32 +0000 (UTC)
commit 10c97222832e0a2d68a86f10738482e703c0430b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Aug 16 16:47:14 2017 -0300
window: Synchronize sidebar and header with a size group
Instead of using a callback on size-allocate, and setting
a custom size request. Using a sizegroup is much cleaner
and avoid some potential issues we could have in the future.
shell/cc-window.c | 10 ----------
shell/window.ui | 12 ++++++++++--
2 files changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/shell/cc-window.c b/shell/cc-window.c
index cc9edf2..2eecbea 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -350,15 +350,6 @@ previous_button_clicked_cb (GtkButton *button,
cc_panel_list_set_view (CC_PANEL_LIST (shell->panel_list), CC_PANEL_LIST_MAIN);
}
-static void
-sidelist_size_allocate_cb (GtkWidget *box,
- GdkRectangle *allocation,
- CcWindow *self)
-{
- /* Keep the sidelist and the first headerbar synchronized */
- gtk_widget_set_size_request (self->header, allocation->width, -1);
-}
-
/* CcShell implementation */
static void
_shell_embed_widget_in_header (CcShell *shell,
@@ -647,7 +638,6 @@ cc_window_class_init (CcWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, previous_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, gdk_window_set_cb);
gtk_widget_class_bind_template_callback (widget_class, search_entry_activate_cb);
- gtk_widget_class_bind_template_callback (widget_class, sidelist_size_allocate_cb);
gtk_widget_class_bind_template_callback (widget_class, update_list_title);
gtk_widget_class_bind_template_callback (widget_class, window_map_event_cb);
}
diff --git a/shell/window.ui b/shell/window.ui
index 98a005f..b3a73d7 100644
--- a/shell/window.ui
+++ b/shell/window.ui
@@ -13,12 +13,11 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="sidebar_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="orientation">vertical</property>
- <signal name="size-allocate" handler="sidelist_size_allocate_cb" object="CcWindow" swapped="no"
/>
<child>
<object class="GtkSearchBar" id="search_bar">
<property name="visible">True</property>
@@ -192,4 +191,13 @@
<widget name="previous_button"/>
</widgets>
</object>
+
+ <!-- Synchronize left header and sidebar -->
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="header"/>
+ <widget name="sidebar_box"/>
+ </widgets>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]