[gnome-control-center/wip/feborges/new-search-panel: 22/25] search: Adjust panel height according to num of rows
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/feborges/new-search-panel: 22/25] search: Adjust panel height according to num of rows
- Date: Tue, 12 Sep 2017 10:17:19 +0000 (UTC)
commit ebb4b33d873b1665bbaf3c72880f687439311f21
Author: Felipe Borges <felipeborges gnome org>
Date: Sat Apr 29 13:21:05 2017 +0200
search: Adjust panel height according to num of rows
We cannot benefit here from the cc_list_box_setup_scrolling ()
list-box helper function because we are also embedding other
widgets in the scrolled window, such as the box which contains
the panel usage instructions and the gear button.
In doing so, we manually set the "cc-scrolling-scrolled-window"
and "cc-max-row-visible" properties in the GtkListBox so the
cc_list_box_adjust_scrolling () helper function can properly
calculate the total height of the visible list box rows.
MAX_ROWS_VISIBLE is arbitrarily set to 7 instead of 5 because
the other children of the scrolled window are not computed in
the cc_list_box_adjust_scrolling () function. The two lines
GtkLabel height summed to its vertical margins should equal
something around the size of two rows (2 + 5 = 7).
This commit should be reverted when the new Control Center
resizable shell gets introduced.
https://bugzilla.gnome.org/show_bug.cgi?id=775958
panels/search/cc-search-panel.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/panels/search/cc-search-panel.c b/panels/search/cc-search-panel.c
index 6907920..73627ea 100644
--- a/panels/search/cc-search-panel.c
+++ b/panels/search/cc-search-panel.c
@@ -26,6 +26,8 @@
#include <gio/gdesktopappinfo.h>
#include <glib/gi18n.h>
+#define MAX_ROWS_VISIBLE 7
+
CC_PANEL_REGISTER (CcSearchPanel, cc_search_panel)
#define WID(s) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, s))
@@ -557,6 +559,8 @@ search_providers_discover_ready (GObject *source,
g_object_unref (provider);
}
+ cc_list_box_adjust_scrolling (GTK_LIST_BOX (self->priv->list_box));
+
/* propagate a write to GSettings, to make sure we always have
* all the providers in the list.
*/
@@ -762,6 +766,13 @@ cc_search_panel_init (CcSearchPanel *self)
populate_search_providers (self);
widget = WID ("search_vbox");
+
+ /* For the cc_list_box_adjust_scrolling () helper function. */
+ g_object_set_data (G_OBJECT (self->priv->list_box),
+ "cc-scrolling-scrolled-window", widget);
+ g_object_set_data (G_OBJECT (self->priv->list_box),
+ "cc-max-rows-visible", GUINT_TO_POINTER (MAX_ROWS_VISIBLE));
+
gtk_container_add (GTK_CONTAINER (self), widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]