diff options
Diffstat (limited to 'endless/eoswindow.c')
-rw-r--r-- | endless/eoswindow.c | 97 |
1 files changed, 23 insertions, 74 deletions
diff --git a/endless/eoswindow.c b/endless/eoswindow.c index ce95ae8..1ac5678 100644 --- a/endless/eoswindow.c +++ b/endless/eoswindow.c @@ -8,7 +8,6 @@ #include "eospagemanager.h" #include "eospagemanager-private.h" #include "eostopbar-private.h" -#include "eosmainarea-private.h" #include <gtk/gtk.h> @@ -89,7 +88,6 @@ typedef struct { EosApplication *application; GtkWidget *top_bar; - GtkWidget *main_area; GtkWidget *overlay; GtkSizeGroup *overlay_size_group; GtkWidget *edge_finishing; @@ -149,59 +147,6 @@ override_background_css(EosWindow *self, gchar *background_css) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } -/* - * update_page_actions: - * @self: the window - * - * Ensures that the currently shown state of the action area is in line with - * the child properties of the currently showing page. - */ -static void -update_page_actions (EosWindow *self) -{ - EosWindowPrivate *priv = eos_window_get_instance_private (self); - EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager); - EosMainArea *ma = EOS_MAIN_AREA (priv->main_area); - GtkWidget *page = priv->current_page; - - if (page != NULL) - { - gboolean fake_action_area = eos_page_manager_get_page_actions (pm, page); - eos_main_area_set_actions (ma, fake_action_area); - } - else - { - eos_main_area_set_actions (ma, FALSE); - } -} - -/* - * update_page_toolbox: - * @self: the window - * - * Ensures that the currently shown state of the toolbox is in line with - * the child properties of the currently showing page. - */ -static void -update_page_toolbox (EosWindow *self) -{ - EosWindowPrivate *priv = eos_window_get_instance_private (self); - EosPageManager *pm = EOS_PAGE_MANAGER (priv->page_manager); - EosMainArea *ma = EOS_MAIN_AREA (priv->main_area); - GtkWidget *page = priv->current_page; - - if (page != NULL) - { - GtkWidget *custom_toolbox_widget = - eos_page_manager_get_page_custom_toolbox_widget (pm, page); - eos_main_area_set_toolbox (ma, custom_toolbox_widget); - } - else - { - eos_main_area_set_toolbox (ma, NULL); - } -} - /** * update_page_left_topbar: * @self: the window @@ -346,11 +291,7 @@ update_visible_page_properties (GtkWidget *widget, { EosWindow *self = (EosWindow *)data; const gchar *property_name = child_property->name; - if (g_strcmp0 (property_name, "page-actions") == 0) - update_page_actions (self); - else if (g_strcmp0 (property_name, "custom-toolbox-widget") == 0) - update_page_toolbox (self); - else if (g_strcmp0 (property_name, "left-topbar-widget") == 0) + if (g_strcmp0 (property_name, "left-topbar-widget") == 0) update_page_left_topbar (self); else if (g_strcmp0 (property_name, "center-topbar-widget") == 0) update_page_center_topbar (self); @@ -365,8 +306,8 @@ update_visible_page_properties (GtkWidget *widget, * update_page: * @self: the window * - * Ensures that the state of the window, the window's main area and top bar are - * in line with the currently showing page and its child properties. + * Ensures that the state of the window and top bar are in line with the + * currently showing page and its child properties. */ static void update_page (EosWindow *self) @@ -381,8 +322,6 @@ update_page (EosWindow *self) } priv->current_page = eos_page_manager_get_visible_page (pm); - update_page_actions (self); - update_page_toolbox (self); sync_stack_animation (self); update_page_left_topbar (self); update_page_center_topbar (self); @@ -505,6 +444,7 @@ eos_window_finalize (GObject *object) EosWindow *self = EOS_WINDOW (object); EosWindowPrivate *priv = eos_window_get_instance_private (self); + g_object_unref (priv->edge_finishing); g_object_unref (priv->background_provider); g_object_unref (priv->font_size_provider); g_free (priv->current_background_css_props); @@ -848,15 +788,11 @@ eos_window_init (EosWindow *self) override_background_css (self, background_css); g_free (background_css); - priv->main_area = eos_main_area_new (); - gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), priv->main_area); - - // We want the overlay to size to the main area, the widget on top. The + // We want the overlay to size to the page manager, the widget on top. The // overlay gets its size request from the widget on the bottom, the // background frame with no minimum size. So we use a size group. priv->overlay_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH); gtk_size_group_add_widget (priv->overlay_size_group, priv->background_stack); - gtk_size_group_add_widget (priv->overlay_size_group, priv->main_area); priv->edge_finishing = gtk_drawing_area_new (); gtk_widget_set_vexpand (priv->edge_finishing, FALSE); @@ -869,8 +805,8 @@ eos_window_init (EosWindow *self) G_CALLBACK (after_edge_finishing_realize_cb), NULL); g_signal_connect (priv->edge_finishing, "draw", G_CALLBACK (on_edge_finishing_draw_cb), NULL); - gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), - priv->edge_finishing); + // We ref the edge finishing as it gets reparented when page managers change + g_object_ref(priv->edge_finishing); gtk_window_maximize (GTK_WINDOW (self)); gtk_window_set_default_size (GTK_WINDOW (self), DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT); @@ -940,11 +876,24 @@ eos_window_set_page_manager (EosWindow *self, g_return_if_fail (page_manager != NULL && EOS_IS_PAGE_MANAGER (page_manager)); EosWindowPrivate *priv = eos_window_get_instance_private (self); - EosMainArea *main_area = EOS_MAIN_AREA (priv->main_area); + if (priv->page_manager != NULL) + { + // We need to remove the edge finishing and add it again so it always + // appears over the page manager + gtk_container_remove (GTK_CONTAINER (priv->overlay), + priv->edge_finishing); + gtk_size_group_remove_widget (priv->overlay_size_group, + GTK_WIDGET (priv->page_manager)); + gtk_container_remove (GTK_CONTAINER (priv->overlay), + GTK_WIDGET (priv->page_manager)); + } priv->page_manager = page_manager; - - eos_main_area_set_content (main_area, + gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), + GTK_WIDGET (priv->page_manager)); + gtk_overlay_add_overlay (GTK_OVERLAY (priv->overlay), + priv->edge_finishing); + gtk_size_group_add_widget (priv->overlay_size_group, GTK_WIDGET (priv->page_manager)); update_page (self); |