shell: prevent the window from being taller than the height of the monitor

https://bugzilla.gnome.org/show_bug.cgi?id=705297
This commit is contained in:
Thomas Wood 2013-08-01 15:55:35 +01:00
parent fe48cc9e6e
commit b52fde3fcc

View file

@ -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);
}