Commit a2143194 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Play some games with initial window size

Map the window non-resizable, to get a perfect size for the
landing page. We make it resizable afterwards.
parent 5a933f46
......@@ -75,6 +75,10 @@ void
gr_recipes_page_set_categories_expanded (GrRecipesPage *page,
gboolean expanded)
{
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (page->scrolled_win),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_revealer_set_transition_duration (GTK_REVEALER (page->categories_expander), expanded ? 250 : 0);
gtk_revealer_set_transition_duration (GTK_REVEALER (page->diet_more), expanded ? 250 : 0);
......
......@@ -13,7 +13,7 @@
<object class="GtkScrolledWindow" id="scrolled_win">
<property name="visible">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="vscrollbar-policy">never</property>
<property name="propagate-natural-height">1</property>
<child>
<object class="GtkBox">
......
......@@ -281,6 +281,15 @@ window_keypress_handler (GtkWidget *widget,
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (window->search_bar), event);
}
static void
window_mapped_handler (GtkWidget *widget)
{
GrWindow *window = GR_WINDOW (widget);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gr_recipes_page_set_categories_expanded (GR_RECIPES_PAGE (window->recipes_page), FALSE);
}
static void
hide_or_show_header_end_stack (GObject *object,
GParamSpec *pspec,
......@@ -344,6 +353,7 @@ gr_window_class_init (GrWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, search_changed);
gtk_widget_class_bind_template_callback (widget_class, stop_search);
gtk_widget_class_bind_template_callback (widget_class, window_keypress_handler);
gtk_widget_class_bind_template_callback (widget_class, window_mapped_handler);
}
static void
......@@ -379,7 +389,7 @@ gr_window_show_recipe (GrWindow *window,
update_cooking_button (window, gr_details_page_is_cooking (GR_DETAILS_PAGE (window->details_page)));
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (window->search_bar), FALSE);
gtk_header_bar_set_title (GTK_HEADER_BAR (window->header), gr_recipe_get_name (recipe));
gtk_stack_set_visible_child_name (GTK_STACK (window->header_start_stack), "back");
......
......@@ -2,10 +2,9 @@
<interface domain="recipes">
<!-- interface-requires gtk+ 3.8 -->
<template class="GrWindow" parent="GtkApplicationWindow">
<property name="default-width">1024</property>
<property name="default-height">768</property>
<property name="resizable">1</property>
<property name="resizable">0</property>
<signal name="key-press-event" handler="window_keypress_handler" after="yes"/>
<signal name="map" handler="window_mapped_handler" after="yes"/>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="visible">1</property>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment