summaryrefslogtreecommitdiff
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
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]
-rw-r--r--docs/reference/endless/endless-sections.txt4
-rw-r--r--endless/Makefile.am1
-rw-r--r--endless/eosmainarea-private.h63
-rw-r--r--endless/eosmainarea.c435
-rw-r--r--endless/eospagemanager.c185
-rw-r--r--endless/eospagemanager.h18
-rw-r--r--endless/eoswindow.c97
-rw-r--r--test/endless/test-page-manager.c115
-rw-r--r--test/endless/test-window.c73
9 files changed, 23 insertions, 968 deletions
diff --git a/docs/reference/endless/endless-sections.txt b/docs/reference/endless/endless-sections.txt
index 9715286..0799fba 100644
--- a/docs/reference/endless/endless-sections.txt
+++ b/docs/reference/endless/endless-sections.txt
@@ -64,10 +64,6 @@ eos_page_manager_get_visible_page_name
eos_page_manager_set_visible_page_name
eos_page_manager_get_page_name
eos_page_manager_set_page_name
-eos_page_manager_get_page_actions
-eos_page_manager_set_page_actions
-eos_page_manager_get_page_custom_toolbox_widget
-eos_page_manager_set_page_custom_toolbox_widget
eos_page_manager_get_page_left_topbar_widget
eos_page_manager_set_page_left_topbar_widget
eos_page_manager_get_page_center_topbar_widget
diff --git a/endless/Makefile.am b/endless/Makefile.am
index 74d8b3c..a1d4e15 100644
--- a/endless/Makefile.am
+++ b/endless/Makefile.am
@@ -44,7 +44,6 @@ endless_library_sources = \
endless/eoshello.c \
endless/eosinit.c endless/eosinit-private.h \
endless/eospagemanager.c endless/eospagemanager-private.h \
- endless/eosmainarea.c endless/eosmainarea-private.h \
endless/eosresource.c endless/eosresource-private.h \
endless/eossplashpagemanager.c \
endless/eostopbar.c endless/eostopbar-private.h \
diff --git a/endless/eosmainarea-private.h b/endless/eosmainarea-private.h
deleted file mode 100644
index 9edb535..0000000
--- a/endless/eosmainarea-private.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright 2013 Endless Mobile, Inc. */
-
-#ifndef EOS_MAIN_AREA_H
-#define EOS_MAIN_AREA_H
-
-#include "eostypes.h"
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define EOS_TYPE_MAIN_AREA eos_main_area_get_type()
-
-#define EOS_MAIN_AREA(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- EOS_TYPE_MAIN_AREA, EosMainArea))
-
-#define EOS_MAIN_AREA_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- EOS_TYPE_MAIN_AREA, EosMainAreaClass))
-
-#define EOS_IS_MAIN_AREA(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- EOS_TYPE_MAIN_AREA))
-
-#define EOS_IS_MAIN_AREA_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- EOS_TYPE_MAIN_AREA))
-
-#define EOS_MAIN_AREA_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- EOS_TYPE_MAIN_AREA, EosMainAreaClass))
-
-typedef struct _EosMainArea EosMainArea;
-typedef struct _EosMainAreaClass EosMainAreaClass;
-
-struct _EosMainArea
-{
- GtkContainer parent;
-};
-
-struct _EosMainAreaClass
-{
- GtkContainerClass parent_class;
-};
-
-GType eos_main_area_get_type (void) G_GNUC_CONST;
-
-GtkWidget *eos_main_area_new (void);
-
-void eos_main_area_set_toolbox (EosMainArea *self,
- GtkWidget *toolbox);
-GtkWidget *eos_main_area_get_toolbox (EosMainArea *self);
-void eos_main_area_set_content (EosMainArea *self,
- GtkWidget *content);
-GtkWidget *eos_main_area_get_content (EosMainArea *self);
-void eos_main_area_set_actions (EosMainArea *self,
- gboolean actions_visible);
-gboolean eos_main_area_get_actions (EosMainArea *self);
-
-G_END_DECLS
-
-#endif /* EOS_MAIN_AREA_H */
diff --git a/endless/eosmainarea.c b/endless/eosmainarea.c
deleted file mode 100644
index 81920d8..0000000
--- a/endless/eosmainarea.c
+++ /dev/null
@@ -1,435 +0,0 @@
-/* Copyright 2013 Endless Mobile, Inc. */
-
-#include "config.h"
-#include "eosmainarea-private.h"
-
-#include <gtk/gtk.h>
-
-/*
- * SECTION:main_area
- * @short_description: The main area for your application, under the top bar.
- * @title: EosMainArea
- *
- * EosMainArea has three areas it manages for you: the left toolbar area, the
- * right action area, and the center content area. They can be set with the
- * toolbar, actions and content properties. You will just about always want to
- * set the content widget to display something, but the toolbar and action
- * area will not appear unless set.
- */
-
-typedef struct {
- GtkWidget *toolbox;
- GtkWidget *content;
- GtkWidget *actions_standin;
- guint actions_visible : 1;
-} EosMainAreaPrivate;
-
-G_DEFINE_TYPE_WITH_PRIVATE (EosMainArea, eos_main_area, GTK_TYPE_CONTAINER)
-
-static void
-eos_main_area_get_preferred_width (GtkWidget *widget,
- gint *minimal,
- gint *natural)
-{
- EosMainArea *self = EOS_MAIN_AREA (widget);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
-
- GtkWidget *toolbox = priv->toolbox;
- GtkWidget *content = priv->content;
- *minimal = *natural = 0;
-
- if ((toolbox && gtk_widget_get_visible (toolbox)) ||
- priv->actions_visible)
- {
- gint toolbox_minimal, toolbox_natural;
- gtk_widget_get_preferred_width (toolbox,
- &toolbox_minimal, &toolbox_natural);
-
- *minimal += 2 * toolbox_minimal;
- *natural += 2 * toolbox_natural;
- }
-
- if (content && gtk_widget_get_visible (content))
- {
- gint content_minimal, content_natural;
- gtk_widget_get_preferred_width (content,
- &content_minimal, &content_natural);
-
- *minimal += content_minimal;
- *natural += content_natural;
- }
-}
-
-static void
-eos_main_area_get_preferred_height (GtkWidget *widget,
- gint *minimal,
- gint *natural)
-{
- EosMainArea *self = EOS_MAIN_AREA (widget);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
-
- GtkWidget *toolbox = priv->toolbox;
- GtkWidget *content = priv->content;
- *minimal = *natural = 0;
-
- if (toolbox && gtk_widget_get_visible (toolbox))
- {
- gint toolbox_minimal, toolbox_natural;
- gtk_widget_get_preferred_height (toolbox,
- &toolbox_minimal, &toolbox_natural);
-
- *minimal = MAX (*minimal, toolbox_minimal);
- *natural = MAX (*natural, toolbox_natural);
- }
-
- if (content && gtk_widget_get_visible (content))
- {
- gint content_minimal, content_natural;
- gtk_widget_get_preferred_height (content,
- &content_minimal, &content_natural);
-
- *minimal = MAX (*minimal, content_minimal);
- *natural = MAX (*natural, content_natural);
- }
-}
-
-/* Don't size width for height or height for width, at least for now... */
-static void
-eos_main_area_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- EosMainArea *self = EOS_MAIN_AREA (widget);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
-
- GtkWidget *toolbox = priv->toolbox;
- GtkWidget *content = priv->content;
-
- gtk_widget_set_allocation (widget, allocation);
-
- gint num_sidebars = 0;
- gboolean content_visible = content && gtk_widget_get_visible (content);
- gboolean toolbox_visible = toolbox && gtk_widget_get_visible (toolbox);
- if (toolbox_visible)
- num_sidebars++;
- if (priv->actions_visible)
- num_sidebars++;
-
- gint toolbox_min_width = 0, toolbox_nat_width = 0;
- gint toolbox_min_height, toolbox_nat_height;
- if (toolbox_visible)
- {
- gtk_widget_get_preferred_width (toolbox,
- &toolbox_min_width, &toolbox_nat_width);
- gtk_widget_get_preferred_height (toolbox,
- &toolbox_min_height, &toolbox_nat_height);
- }
-
- gint content_min_width = 0, content_nat_width = 0;
- gint content_min_height, content_nat_height;
- if (content_visible)
- {
- gtk_widget_get_preferred_width (content,
- &content_min_width, &content_nat_width);
- gtk_widget_get_preferred_height (content,
- &content_min_height, &content_nat_height);
- }
-
- /* Calculate width of sidebars. We allocate space in the following order:
- Sidebars min width, content min width, sidebars natural width, content
- natural width. */
- gint sidebar_width = 0;
- gint total_sidebars_width = allocation->width - content_min_width;
- if (num_sidebars > 0)
- {
- if (allocation->width < toolbox_min_width * num_sidebars)
- {
- sidebar_width = allocation->width / num_sidebars;
- }
- else if (content_visible &&
- total_sidebars_width < toolbox_nat_width * num_sidebars)
- {
- sidebar_width = total_sidebars_width / num_sidebars;
- }
- else
- {
- sidebar_width = toolbox_nat_width;
- }
- }
-
- /* Allocate size */
- gint x = allocation->x;
- gint y = allocation->y;
- if (toolbox_visible)
- {
- GtkAllocation toolbox_allocation;
- toolbox_allocation.x = x;
- toolbox_allocation.y = y;
- toolbox_allocation.width = sidebar_width;
- toolbox_allocation.height = MIN (toolbox_nat_height, allocation->height);
- gtk_widget_size_allocate (toolbox, &toolbox_allocation);
- x += toolbox_allocation.width;
- }
- if (priv->actions_visible)
- {
- GtkAllocation actions_allocation;
- actions_allocation.x = allocation->x + allocation->width - sidebar_width;
- actions_allocation.y = y;
- actions_allocation.width = sidebar_width;
- actions_allocation.height = allocation->height;
- gtk_widget_size_allocate (priv->actions_standin,
- &actions_allocation);
- }
- if (content_visible)
- {
- GtkAllocation content_allocation;
- content_allocation.x = x;
- content_allocation.y = y;
- content_allocation.width = MAX (0,
- allocation->width - num_sidebars * sidebar_width);
- content_allocation.height = allocation->height;
- gtk_widget_size_allocate (content, &content_allocation);
- }
-}
-
-static void
-eos_main_area_add (GtkContainer *container,
- GtkWidget *widget)
-{
- EosMainArea *self = EOS_MAIN_AREA (container);
-
- /* Print out warning message?? */
-
- eos_main_area_set_content(self, widget);
-}
-
-static void
-eos_main_area_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- EosMainArea *self = EOS_MAIN_AREA(container);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
-
- if (priv->content == widget)
- eos_main_area_set_content (self, NULL);
- else if (priv->toolbox == widget)
- eos_main_area_set_toolbox (self, NULL);
-}
-
-static void
-eos_main_area_forall(GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- EosMainArea *self = EOS_MAIN_AREA (container);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
-
- if (priv->toolbox)
- (*callback) (priv->toolbox, callback_data);
-
- if (priv->content)
- (*callback) (priv->content, callback_data);
-
- if (include_internals && priv->actions_visible)
- (*callback) (priv->actions_standin, callback_data);
-}
-
-static void
-eos_main_area_destroy (GtkWidget *widget)
-{
- EosMainArea *self = EOS_MAIN_AREA (widget);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
-
- gtk_widget_destroy (priv->actions_standin);
-
- GTK_WIDGET_CLASS (eos_main_area_parent_class)->destroy (widget);
-}
-
-static void
-eos_main_area_class_init (EosMainAreaClass *klass)
-{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
-
- widget_class->get_preferred_width = eos_main_area_get_preferred_width;
- widget_class->get_preferred_height = eos_main_area_get_preferred_height;
- widget_class->size_allocate = eos_main_area_size_allocate;
- widget_class->destroy = eos_main_area_destroy;
-
- container_class->forall = eos_main_area_forall;
- container_class->add = eos_main_area_add;
- container_class->remove = eos_main_area_remove;
-}
-
-static void
-eos_main_area_init (EosMainArea *self)
-{
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- gtk_widget_set_has_window(GTK_WIDGET(self), FALSE);
-
- priv->actions_standin = gtk_event_box_new ();
- g_object_ref_sink (priv->actions_standin);
- GdkRGBA red = { 1.0, 0.0, 0.0, 1.0 };
- gtk_widget_override_background_color (priv->actions_standin,
- GTK_STATE_FLAG_NORMAL,
- &red);
- gtk_widget_show (priv->actions_standin);
-}
-
-/* Internal Public API */
-
-/*
- * eos_main_area_new:
- *
- * Creates a main area. It is invisible by default.
- *
- * Returns: a pointer to the main area widget.
- */
-GtkWidget *
-eos_main_area_new (void)
-{
- return GTK_WIDGET (g_object_new (EOS_TYPE_MAIN_AREA, NULL));
-}
-
-
-/*
- * eos_main_area_set_toolbox:
- * @self: a #EosMainArea
- * @toolbox: the toolbox widget to be displayed on left of content.
- *
- * Adds the toolbox widget to the main area. Passing %NULL will hide the
- * toolbox area.
- */
-void
-eos_main_area_set_toolbox (EosMainArea *self,
- GtkWidget *toolbox)
-{
- g_return_if_fail (EOS_IS_MAIN_AREA (self));
- g_return_if_fail (toolbox == NULL || GTK_IS_WIDGET (toolbox));
-
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- GtkWidget *self_widget = GTK_WIDGET (self);
-
- if (priv->toolbox == toolbox)
- return;
-
- if (priv->toolbox)
- gtk_widget_unparent (priv->toolbox);
-
- priv->toolbox = toolbox;
- if (toolbox)
- {
- gtk_widget_set_parent (toolbox, self_widget);
- gtk_widget_show (toolbox);
- }
-}
-
-/*
- * eos_main_area_get_toolbox:
- * @self: a #EosMainArea
- *
- * Retrieves the toolbox widget for the main area.
- *
- * Return value: (transfer none): the toolbox widget,
- * or %NULL if there is none
- */
-GtkWidget *
-eos_main_area_get_toolbox (EosMainArea *self)
-{
- g_return_val_if_fail (EOS_IS_MAIN_AREA (self), NULL);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- return priv->toolbox;
-}
-
-/*
- * eos_main_area_set_content:
- * @self: a #EosMainArea
- * @content: the content widget to be displayed in the center.
- *
- * Adds the content widget to the main area.
- */
-void
-eos_main_area_set_content (EosMainArea *self,
- GtkWidget *content)
-{
- g_return_if_fail (EOS_IS_MAIN_AREA (self));
- g_return_if_fail (content == NULL || GTK_IS_WIDGET (content));
- g_return_if_fail (content == NULL || gtk_widget_get_parent (content) == NULL);
-
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- GtkWidget *self_widget = GTK_WIDGET (self);
-
- if (priv->content == content)
- return;
-
- if (priv->content)
- gtk_widget_unparent (priv->content);
-
- priv->content = content;
- if (content)
- gtk_widget_set_parent (content, self_widget);
-}
-
-/*
- * eos_main_area_get_content:
- * @self: a #EosMainArea
- *
- * Retrieves the content widget for the main area.
- *
- * Return value: (transfer none): the content widget,
- * or %NULL if there is none
- */
-GtkWidget *
-eos_main_area_get_content (EosMainArea *self)
-{
- g_return_val_if_fail (EOS_IS_MAIN_AREA (self), NULL);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- return priv->content;
-}
-
-/*
- * eos_main_area_set_actions:
- * @self: a #EosMainArea
- * @actions: %TRUE if there will be actions area on right of content.
- *
- * Sets whether an actions area should be displayed on the right of the
- * content. For now just a boolean eventually a widget/list of actions or
- * something.
- */
-void
-eos_main_area_set_actions (EosMainArea *self,
- gboolean actions_visible)
-{
- g_return_if_fail (EOS_IS_MAIN_AREA (self));
-
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- GtkWidget *self_widget = GTK_WIDGET (self);
-
- actions_visible = actions_visible != FALSE;
-
- if (priv->actions_visible == actions_visible)
- return;
-
- priv->actions_visible = actions_visible;
-
- if (priv->actions_visible)
- gtk_widget_set_parent (priv->actions_standin, self_widget);
- else
- gtk_widget_unparent (priv->actions_standin);
-}
-
-/*
- * eos_main_area_get_actions:
- * @self: a #EosMainArea
- *
- * Retrieves the actions boolean value. See set_actions.
- *
- * Return value: stand in actions boolean, for now.
- */
-gboolean
-eos_main_area_get_actions (EosMainArea *self)
-{
- g_return_val_if_fail (EOS_IS_MAIN_AREA (self), FALSE);
- EosMainAreaPrivate *priv = eos_main_area_get_instance_private (self);
- return priv->actions_visible;
-}
diff --git a/endless/eospagemanager.c b/endless/eospagemanager.c
index f1812da..af36b3e 100644
--- a/endless/eospagemanager.c
+++ b/endless/eospagemanager.c
@@ -93,8 +93,6 @@
typedef struct {
GtkWidget *page;
gchar *name;
- gboolean fake_page_actions_visible;
- GtkWidget *custom_toolbox_widget;
GtkWidget *left_topbar_widget;
GtkWidget *center_topbar_widget;
gchar *background_uri;
@@ -147,8 +145,6 @@ enum
{
CHILD_PROP_0,
CHILD_PROP_NAME,
- CHILD_PROP_PAGE_ACTIONS,
- CHILD_PROP_CUSTOM_TOOLBOX_WIDGET,
CHILD_PROP_LEFT_TOPBAR_WIDGET,
CHILD_PROP_CENTER_TOPBAR_WIDGET,
CHILD_PROP_BACKGROUND_URI,
@@ -594,17 +590,6 @@ eos_page_manager_get_child_property (GtkContainer *container,
child));
break;
- case CHILD_PROP_PAGE_ACTIONS:
- g_value_set_boolean (value,
- eos_page_manager_get_page_actions (self, child));
- break;
-
- case CHILD_PROP_CUSTOM_TOOLBOX_WIDGET:
- g_value_set_object (value,
- eos_page_manager_get_page_custom_toolbox_widget (self,
- child));
- break;
-
case CHILD_PROP_LEFT_TOPBAR_WIDGET:
g_value_set_object (value,
eos_page_manager_get_page_left_topbar_widget (self,
@@ -658,16 +643,6 @@ eos_page_manager_set_child_property (GtkContainer *container,
g_value_get_boolean (value));
break;
- case CHILD_PROP_PAGE_ACTIONS:
- eos_page_manager_set_page_actions (self, child,
- g_value_get_boolean (value));
- break;
-
- case CHILD_PROP_CUSTOM_TOOLBOX_WIDGET:
- eos_page_manager_set_page_custom_toolbox_widget (self, child,
- g_value_get_object (value));
- break;
-
case CHILD_PROP_LEFT_TOPBAR_WIDGET:
eos_page_manager_set_page_left_topbar_widget (self, child,
g_value_get_object (value));
@@ -784,39 +759,6 @@ eos_page_manager_class_init (EosPageManagerClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * EosPageManager:page-actions:
- *
- * The actions exported by this page, to be displayed in the action area on
- * the right of the window.
- *
- * <warning><para>Currently, this property is a boolean value. %TRUE means
- * to display a fake action area, and %FALSE means don't display.
- * </para></warning>
- */
- eos_page_manager_child_props[CHILD_PROP_PAGE_ACTIONS] =
- g_param_spec_boolean ("page-actions", "Page Actions",
- "Actions the page exports into the action area",
- FALSE,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- /**
- * EosPageManager:custom-toolbox-widget:
- *
- * The custom toolbox widget belonging to this page, to be displayed on the
- * left of the window when the page is displaying. Setting this to %NULL
- * indicates that there should be no toolbox widget.
- *
- * <warning><para>Currently, there is no such thing as a
- * <emphasis>non-</emphasis>custom toolbox widget.
- * </para></warning>
- */
- eos_page_manager_child_props[CHILD_PROP_CUSTOM_TOOLBOX_WIDGET] =
- g_param_spec_object ("custom-toolbox-widget", "Custom toolbox widget",
- "Custom toolbox widget displayed left of the page",
- GTK_TYPE_WIDGET,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- /**
* EosPageManager:left-topbar-widget:
*
* The left topbar widget belonging to this page, to be displayed on the
@@ -1116,133 +1058,6 @@ eos_page_manager_set_page_name (EosPageManager *self,
}
/**
- * eos_page_manager_get_page_actions:
- * @self: the page manager
- * @page: the page to be queried
- *
- * Gets whether to display a fake actions area when displaying @page.
- * See #EosPageManager:page-actions for more information.
- *
- * <warning><para>This function is a temporary implementation, do not expect
- * this API to remain stable.
- * </para></warning>
- *
- * Returns: %TRUE if the fake actions area should be visible when displaying
- * @page, or %FALSE if it should not.
- */
-gboolean
-eos_page_manager_get_page_actions (EosPageManager *self,
- GtkWidget *page)
-{
- g_return_val_if_fail (self != NULL && EOS_IS_PAGE_MANAGER (self), FALSE);
- g_return_val_if_fail (page != NULL && GTK_IS_WIDGET (page), FALSE);
-
- EosPageManagerPageInfo *info = find_page_info_by_widget (self, page);
- g_return_val_if_fail (info != NULL, FALSE);
-
- return info->fake_page_actions_visible;
-}
-
-/**
- * eos_page_manager_set_page_actions:
- * @self: the page manager
- * @page: the page
- * @actions_visible: whether to display an action area beside @page
- *
- * Sets whether to display a fake actions area when displaying @page.
- * See #EosPageManager:page-actions for more information.
- *
- * <warning><para>This function is a temporary implementation, do not expect
- * this API to remain stable.
- * </para></warning>
- */
-void
-eos_page_manager_set_page_actions (EosPageManager *self,
- GtkWidget *page,
- gboolean actions_visible)
-{
- g_return_if_fail (self != NULL && EOS_IS_PAGE_MANAGER (self));
- g_return_if_fail (page != NULL && GTK_IS_WIDGET (page));
-
- EosPageManagerPageInfo *info = find_page_info_by_widget (self, page);
- g_return_if_fail (info != NULL);
-
- if (info->fake_page_actions_visible == actions_visible)
- return;
-
- info->fake_page_actions_visible = actions_visible;
-
- gtk_container_child_notify (GTK_CONTAINER (self), page, "page-actions");
-}
-
-/**
- * eos_page_manager_get_page_custom_toolbox_widget:
- * @self: the page manager
- * @page: the page to be queried
- *
- * Retrieves @page's custom toolbox widget, if it has one.
- * See #EosPageManager:custom-toolbox-widget for more information.
- *
- * <note><para>
- * Currently, there is no possible way to have a non-custom toolbox widget.
- * </para></note>
- *
- * Returns: (transfer none): the custom toolbox #GtkWidget of @page, or %NULL if
- * there is none.
- */
-GtkWidget *
-eos_page_manager_get_page_custom_toolbox_widget (EosPageManager *self,
- GtkWidget *page)
-{
- g_return_val_if_fail (self != NULL && EOS_IS_PAGE_MANAGER (self), NULL);
- g_return_val_if_fail (page != NULL && GTK_IS_WIDGET (page), NULL);
-
- EosPageManagerPageInfo *info = find_page_info_by_widget (self, page);
- g_return_val_if_fail (info != NULL, NULL);
-
- return info->custom_toolbox_widget;
-}
-
-/**
- * eos_page_manager_set_page_custom_toolbox_widget:
- * @self: the page manager
- * @page: the page
- * @custom_toolbox_widget: (allow-none): custom toolbox widget for @page
- *
- * Sets the custom toolbox widget to display to the left of @page.
- * See #EosPageManager:custom-toolbox-widget for more information.
- *
- * <note><para>
- * Currently, there is no possible way to have a non-custom toolbox widget.
- * </para></note>
- */
-void
-eos_page_manager_set_page_custom_toolbox_widget (EosPageManager *self,
- GtkWidget *page,
- GtkWidget *custom_toolbox_widget)
-{
- g_return_if_fail (self != NULL && EOS_IS_PAGE_MANAGER (self));
- g_return_if_fail (page != NULL && GTK_IS_WIDGET (page));
- g_return_if_fail (custom_toolbox_widget == NULL ||
- GTK_IS_WIDGET (custom_toolbox_widget));
-
- EosPageManagerPageInfo *info = find_page_info_by_widget (self, page);
- g_return_if_fail (info != NULL);
-
- if (info->custom_toolbox_widget == custom_toolbox_widget)
- return;
-
- if (info->custom_toolbox_widget)
- g_object_unref (info->custom_toolbox_widget);
-
- g_object_ref (custom_toolbox_widget);
- info->custom_toolbox_widget = custom_toolbox_widget;
-
- gtk_container_child_notify (GTK_CONTAINER (self), page,
- "custom-toolbox-widget");
-}
-
-/**
* eos_page_manager_get_page_left_topbar_widget:
* @self: the page manager
* @page: the page to be queried
diff --git a/endless/eospagemanager.h b/endless/eospagemanager.h
index 7ec4d97..d0dd8eb 100644
--- a/endless/eospagemanager.h
+++ b/endless/eospagemanager.h
@@ -112,24 +112,6 @@ void eos_page_manager_set_page_name (EosPageManage
const gchar *name);
EOS_SDK_ALL_API_VERSIONS
-gboolean eos_page_manager_get_page_actions (EosPageManager *self,
- GtkWidget *page);
-
-EOS_SDK_ALL_API_VERSIONS
-void eos_page_manager_set_page_actions (EosPageManager *self,
- GtkWidget *page,
- gboolean actions_visible);
-
-EOS_SDK_ALL_API_VERSIONS
-GtkWidget *eos_page_manager_get_page_custom_toolbox_widget (EosPageManager *self,
- GtkWidget *page);
-
-EOS_SDK_ALL_API_VERSIONS
-void eos_page_manager_set_page_custom_toolbox_widget (EosPageManager *self,
- GtkWidget *page,
- GtkWidget *custom_toolbox_widget);
-
-EOS_SDK_ALL_API_VERSIONS
GtkWidget *eos_page_manager_get_page_left_topbar_widget (EosPageManager *self,
GtkWidget *page);
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);
diff --git a/test/endless/test-page-manager.c b/test/endless/test-page-manager.c
index a39fb3f..3eadd67 100644
--- a/test/endless/test-page-manager.c
+++ b/test/endless/test-page-manager.c
@@ -38,7 +38,6 @@ typedef struct
GtkWidget *page1;
GtkWidget *page2;
GtkWidget *page3;
- GtkWidget *toolbox2;
} PageManagerFixture;
static void
@@ -49,7 +48,6 @@ pm_fixture_setup (PageManagerFixture *fixture,
fixture->page1 = gtk_label_new ("1");
fixture->page2 = gtk_label_new ("2");
fixture->page3 = gtk_label_new ("3");
- fixture->toolbox2 = gtk_label_new ("toolbox2");
gtk_container_add_with_properties (GTK_CONTAINER (fixture->pm),
fixture->page1,
"name", PAGE1_NAME,
@@ -60,7 +58,6 @@ pm_fixture_setup (PageManagerFixture *fixture,
gtk_container_add_with_properties (GTK_CONTAINER (fixture->pm),
fixture->page2,
"name", PAGE2_NAME,
- "custom-toolbox-widget", fixture->toolbox2,
"background-uri", PAGE2_PROP_STRING,
"background-size", PAGE2_PROP_STRING,
"background-position", PAGE2_PROP_STRING,
@@ -68,7 +65,6 @@ pm_fixture_setup (PageManagerFixture *fixture,
gtk_container_add_with_properties (GTK_CONTAINER (fixture->pm),
fixture->page3,
"name", PAGE3_NAME,
- "page-actions", TRUE,
"background-uri", PAGE3_PROP_STRING,
"background-size", PAGE3_PROP_STRING,
"background-position", PAGE3_PROP_STRING,
@@ -195,47 +191,6 @@ test_pm_child_prop_name (PageManagerFixture *fixture,
}
static void
-test_pm_get_set_page_actions (PageManagerFixture *fixture,
- gconstpointer unused)
-{
- gboolean actions;
- actions = eos_page_manager_get_page_actions (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page1);
- g_assert (actions == FALSE);
- actions = eos_page_manager_get_page_actions (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page3);
- g_assert (actions == TRUE);
- eos_page_manager_set_page_actions (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page3,
- FALSE);
- actions = eos_page_manager_get_page_actions (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page3);
- g_assert (actions == FALSE);
-}
-
-static void
-test_pm_child_prop_page_actions (PageManagerFixture *fixture,
- gconstpointer unused)
-{
- gboolean actions;
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page1,
- "page-actions", &actions,
- NULL);
- g_assert (actions == FALSE);
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page3,
- "page-actions", &actions,
- NULL);
- g_assert (actions == TRUE);
- gtk_container_child_set (GTK_CONTAINER (fixture->pm), fixture->page3,
- "page-actions", FALSE,
- NULL);
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page3,
- "page-actions", &actions,
- NULL);
- g_assert (actions == FALSE);
-}
-
-static void
test_pm_get_set_background_repeats (PageManagerFixture *fixture,
gconstpointer unused)
{
@@ -277,68 +232,6 @@ test_pm_child_prop_background_repeats (PageManagerFixture *fixture,
}
static void
-test_pm_get_set_page_custom_toolbox (PageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *new_tb = gtk_label_new ("Another toolbox");
- GtkWidget *tb;
-
- tb = eos_page_manager_get_page_custom_toolbox_widget (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page1);
- g_assert (tb == NULL);
- tb = eos_page_manager_get_page_custom_toolbox_widget (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page2);
- g_assert (tb == fixture->toolbox2);
-
- eos_page_manager_set_page_custom_toolbox_widget (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page1,
- new_tb);
- eos_page_manager_set_page_custom_toolbox_widget (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page2,
- new_tb);
-
- tb = eos_page_manager_get_page_custom_toolbox_widget (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page1);
- g_assert (tb == new_tb);
- tb = eos_page_manager_get_page_custom_toolbox_widget (EOS_PAGE_MANAGER (fixture->pm),
- fixture->page2);
- g_assert (tb == new_tb);
-}
-
-static void
-test_pm_child_prop_custom_toolbox (PageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *new_tb = gtk_label_new ("Another toolbox");
- GtkWidget *tb;
-
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page1,
- "custom-toolbox-widget", &tb,
- NULL);
- g_assert (tb == NULL);
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page2,
- "custom-toolbox-widget", &tb,
- NULL);
- g_assert (tb == fixture->toolbox2);
-
- gtk_container_child_set (GTK_CONTAINER (fixture->pm), fixture->page1,
- "custom-toolbox-widget", new_tb,
- NULL);
- gtk_container_child_set (GTK_CONTAINER (fixture->pm), fixture->page2,
- "custom-toolbox-widget", new_tb,
- NULL);
-
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page1,
- "custom-toolbox-widget", &tb,
- NULL);
- g_assert (tb == new_tb);
- gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page2,
- "custom-toolbox-widget", &tb,
- NULL);
- g_assert (tb == new_tb);
-}
-
-static void
test_pm_child_prop_string (PageManagerFixture *fixture,
gconstpointer data)
{
@@ -702,14 +595,6 @@ add_page_manager_tests (void)
test_pm_get_set_page_name);
ADD_PAGE_MANAGER_TEST ("/page-manager/child-prop-name",
test_pm_child_prop_name);
- ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-page-actions",
- test_pm_get_set_page_actions);
- ADD_PAGE_MANAGER_TEST ("/page-manager/child-prop-page-actions",
- test_pm_child_prop_page_actions);
- ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-page-custom-toolbox",
- test_pm_get_set_page_custom_toolbox);
- ADD_PAGE_MANAGER_TEST ("/page-manager/child-prop-custom-toolbox",
- test_pm_child_prop_custom_toolbox);
ADD_PAGE_MANAGER_TEST ("/page-manager/page-no-name", test_pm_page_no_name);
ADD_PAGE_MANAGER_TEST ("/page-manager/set-page-no-name",
test_pm_set_page_no_name);
diff --git a/test/endless/test-window.c b/test/endless/test-window.c
index 3e648d3..a6fc28a 100644
--- a/test/endless/test-window.c
+++ b/test/endless/test-window.c
@@ -4,7 +4,6 @@
#include <gtk/gtk.h>
#include <endless/endless.h>
#include "endless/eostopbar-private.h"
-#include "endless/eosmainarea-private.h"
#include "run-tests.h"
@@ -53,17 +52,6 @@ test_has_top_bar (GApplication *app)
}
static void
-test_has_main_area (GApplication *app)
-{
- GtkWidget *win = eos_window_new (EOS_APPLICATION (app));
- GtkWidget *main_area = container_find_descendant_with_type (GTK_CONTAINER (win), EOS_TYPE_MAIN_AREA);
- g_assert (main_area != NULL);
- g_assert (EOS_IS_MAIN_AREA (main_area));
-
- gtk_widget_destroy (win);
-}
-
-static void
test_has_default_page_manager (GApplication *app)
{
GtkWidget *win = eos_window_new (EOS_APPLICATION (app));
@@ -169,64 +157,6 @@ test_prop_page_manager (GApplication *app)
}
static void
-test_main_area_widgets_visibility (GApplication *app)
-{
- GtkWidget *win = eos_window_new (EOS_APPLICATION (app));
- EosPageManager *pm = eos_window_get_page_manager (EOS_WINDOW (win));
- GtkWidget *main_area = container_find_descendant_with_type (GTK_CONTAINER (win), EOS_TYPE_MAIN_AREA);
-
- GtkWidget *page0 = gtk_label_new ("no-no");
- GtkWidget *page1 = gtk_label_new ("yes-no");
- GtkWidget *page2 = gtk_label_new ("no-yes");
- GtkWidget *page3 = gtk_label_new ("yes-yes");
-
- GtkWidget *toolbox1 = gtk_label_new ("toolbox1");
- GtkWidget *toolbox3 = gtk_label_new ("toolbox3");
-
- gtk_container_add (GTK_CONTAINER (pm), page0);
- gtk_container_add_with_properties (GTK_CONTAINER (pm), page1,
- "custom-toolbox-widget", toolbox1,
- NULL);
- gtk_container_add_with_properties (GTK_CONTAINER (pm), page2,
- "page-actions", TRUE,
- NULL);
- gtk_container_add_with_properties (GTK_CONTAINER (pm), page3,
- "custom-toolbox-widget", toolbox3,
- "page-actions", TRUE,
- NULL);
-
- GtkWidget *tb;
- gboolean actions;
- EosMainArea *ma = EOS_MAIN_AREA (main_area);
-
- eos_page_manager_set_visible_page (pm, page0);
- tb = eos_main_area_get_toolbox (ma);
- actions = eos_main_area_get_actions (ma);
- g_assert (tb == NULL);
- g_assert (actions == FALSE);
-
- eos_page_manager_set_visible_page (pm, page1);
- tb = eos_main_area_get_toolbox (ma);
- actions = eos_main_area_get_actions (ma);
- g_assert (tb == toolbox1);
- g_assert (actions == FALSE);
-
- eos_page_manager_set_visible_page (pm, page2);
- tb = eos_main_area_get_toolbox (ma);
- actions = eos_main_area_get_actions (ma);
- g_assert (tb == NULL);
- g_assert (actions == TRUE);
-
- eos_page_manager_set_visible_page (pm, page3);
- tb = eos_main_area_get_toolbox (ma);
- actions = eos_main_area_get_actions (ma);
- g_assert (tb == toolbox3);
- g_assert (actions == TRUE);
-
- gtk_widget_destroy (win);
-}
-
-static void
test_internal_widget_visibility (GApplication *app) {
GtkWidget *win = eos_window_new (EOS_APPLICATION (app));
EosPageManager *pm = eos_window_get_page_manager (EOS_WINDOW (win));
@@ -252,7 +182,6 @@ add_window_tests (void)
ADD_APP_WINDOW_TEST ("/window/application-not-null",
test_application_not_null);
ADD_APP_WINDOW_TEST ("/window/has-top-bar", test_has_top_bar);
- ADD_APP_WINDOW_TEST ("/window/has-main-area", test_has_main_area);
ADD_APP_WINDOW_TEST ("/window/has-default-page-manager",
test_has_default_page_manager);
ADD_APP_WINDOW_TEST ("/window/get-set-page-manager",
@@ -266,8 +195,6 @@ add_window_tests (void)
ADD_APP_WINDOW_TEST ("/window/get-set-font-scaling-min-font-size",
test_get_set_font_scaling_min_font_size);
ADD_APP_WINDOW_TEST ("/window/prop-page-manager", test_prop_page_manager);
- ADD_APP_WINDOW_TEST ("/window/main-area-widgets-visibility",
- test_main_area_widgets_visibility);
ADD_APP_WINDOW_TEST ("/window/internal-widget-visibility",
test_internal_widget_visibility);
}