From b52fde3fcc6524f79cd9fd75717ae69057a61368 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Thu, 1 Aug 2013 15:55:35 +0100 Subject: [PATCH] shell: prevent the window from being taller than the height of the monitor https://bugzilla.gnome.org/show_bug.cgi?id=705297 --- shell/cc-window.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/shell/cc-window.c b/shell/cc-window.c index f2fcc2368..5118b22da 100644 --- a/shell/cc-window.c +++ b/shell/cc-window.c @@ -111,6 +111,8 @@ static gboolean cc_window_set_active_panel_from_id (CcShell *shell, GVariant *parameters, GError **err); +static gint get_monitor_height (CcWindow *self); + static const gchar * get_icon_name_from_g_icon (GIcon *gicon) { @@ -894,12 +896,24 @@ stack_page_notify_cb (GtkStack *stack, if (g_strcmp0 (id, OVERVIEW_PAGE) == 0 || g_strcmp0 (id, SEARCH_PAGE) == 0) { + gint header_height, maximum_height; + gtk_widget_hide (priv->previous_button); gtk_widget_show (priv->search_entry); gtk_widget_hide (priv->lock_button); gtk_widget_get_preferred_height_for_width (GTK_WIDGET (priv->main_vbox), FIXED_WIDTH, NULL, &nat_height); + gtk_widget_get_preferred_height_for_width (GTK_WIDGET (priv->header), + FIXED_WIDTH, NULL, &header_height); + + /* find the maximum height by using the monitor height minus an allowance + * for title bar, etc. */ + maximum_height = get_monitor_height (self) - 100; + + if (maximum_height > 0 && nat_height + header_height > maximum_height) + nat_height = maximum_height - header_height; + gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (priv->scrolled_window), priv->small_screen == SMALL_SCREEN_TRUE ? SMALL_SCREEN_FIXED_HEIGHT : nat_height); }