[glade/modern-ui: 26/34] GladeAdaptorChooserWidget: set scrolled window max height on map
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/modern-ui: 26/34] GladeAdaptorChooserWidget: set scrolled window max height on map
- Date: Sat, 30 Dec 2017 16:45:30 +0000 (UTC)
commit 5c5cec96a9eb72187ca359169e19c5405c0b0dfc
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Fri Jun 30 23:50:30 2017 -0300
GladeAdaptorChooserWidget: set scrolled window max height on map
gladeui/glade-adaptor-chooser-widget.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-adaptor-chooser-widget.c b/gladeui/glade-adaptor-chooser-widget.c
index e37db5a..468e10e 100644
--- a/gladeui/glade-adaptor-chooser-widget.c
+++ b/gladeui/glade-adaptor-chooser-widget.c
@@ -43,6 +43,7 @@ struct _GladeAdaptorChooserWidgetPrivate
GtkTreeModelFilter *treemodelfilter;
GtkSearchEntry *searchentry;
GtkEntryCompletion *entrycompletion;
+ GtkScrolledWindow *scrolledwindow;
/* Needed for gtk_tree_view_column_set_cell_data_func() */
GtkTreeViewColumn *column_icon;
@@ -419,6 +420,25 @@ _glade_adaptor_chooser_widget_constructed (GObject *object)
chooser, NULL);
}
+static void
+_glade_adaptor_chooser_widget_map (GtkWidget *widget)
+{
+ GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
+
+ if (toplevel)
+ {
+ _GladeAdaptorChooserWidgetPrivate *priv = GET_PRIVATE (widget);
+ gint height = gtk_widget_get_allocated_height (toplevel) - 100;
+
+ if (height > 512)
+ height = height * 0.75;
+
+ gtk_scrolled_window_set_max_content_height (priv->scrolledwindow, height);
+ }
+
+ GTK_WIDGET_CLASS (_glade_adaptor_chooser_widget_parent_class)->map (widget);
+}
+
static GType
_glade_adaptor_chooser_widget_flags_get_type (void)
{
@@ -447,6 +467,8 @@ _glade_adaptor_chooser_widget_class_init (_GladeAdaptorChooserWidgetClass *klass
object_class->get_property = _glade_adaptor_chooser_widget_get_property;
object_class->constructed = _glade_adaptor_chooser_widget_constructed;
+ widget_class->map = _glade_adaptor_chooser_widget_map;
+
g_object_class_install_property (object_class,
PROP_SHOW_FLAGS,
g_param_spec_flags ("show-flags",
@@ -486,6 +508,7 @@ _glade_adaptor_chooser_widget_class_init (_GladeAdaptorChooserWidgetClass *klass
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, icon_cell);
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, column_adaptor);
gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, adaptor_cell);
+ gtk_widget_class_bind_template_child_private (widget_class, _GladeAdaptorChooserWidget, scrolledwindow);
gtk_widget_class_bind_template_callback (widget_class, on_treeview_row_activated);
gtk_widget_class_bind_template_callback (widget_class, on_searchentry_search_changed);
gtk_widget_class_bind_template_callback (widget_class, on_searchentry_activate);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]