summaryrefslogtreecommitdiff
path: root/endless/eoswindow.c
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2014-05-07 16:35:26 -0700
committerMatt Watson <mattdangerw@gmail.com>2014-05-12 00:21:28 -0700
commitf8985bd6313c7bba1c29a2ce3b40a021d2db0b84 (patch)
tree183e053e39a3c7989b3b4ae2b15735c704129eb9 /endless/eoswindow.c
parentf03c35bc78c8c743196588160f07bba516fb6149 (diff)
Remove the main area widget
This has been totally unused in all our applications and has been having sizing problem with height for width and width for height request. We had grand plans for this, but since its unclear if there's a future in which this widget is used think it makes sense to remove [endlessm/eos-sdk#985]
Diffstat (limited to 'endless/eoswindow.c')
-rw-r--r--endless/eoswindow.c97
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);