summaryrefslogtreecommitdiff
path: root/endless
diff options
context:
space:
mode:
authorMatt Watson <mattdangerw@gmail.com>2013-06-03 20:00:22 -0700
committerMatt Watson <mattdangerw@gmail.com>2013-06-12 12:28:59 -0700
commit12ce681e88ac6399a38aa1b3265759466ba133bd (patch)
tree38d18551e78813b73122daf7fe8e8f621f1a2a89 /endless
parent9231460b3960e703a10da458f7020de51022004d (diff)
Private page manager API to get internal pstack transition type
EosWindow will always use this type when transitioning the background. [endlessm/eos-sdk#88]
Diffstat (limited to 'endless')
-rw-r--r--endless/Makefile.am2
-rw-r--r--endless/eospagemanager-private.h19
-rw-r--r--endless/eospagemanager.c33
-rw-r--r--endless/eospagemanager.h2
-rw-r--r--endless/eoswindow.c21
5 files changed, 47 insertions, 30 deletions
diff --git a/endless/Makefile.am b/endless/Makefile.am
index 4dc9042..3619a97 100644
--- a/endless/Makefile.am
+++ b/endless/Makefile.am
@@ -17,7 +17,7 @@ endless_library_sources = \
endless/eosapplication.c \
endless/eoshello.c \
endless/eosinit.c endless/eosinit-private.h \
- endless/eospagemanager.c \
+ endless/eospagemanager.c endless/eospagemanager-private.h \
endless/eosmainarea.c endless/eosmainarea-private.h \
endless/eossplashpagemanager.c \
endless/eostopbar.c endless/eostopbar-private.h \
diff --git a/endless/eospagemanager-private.h b/endless/eospagemanager-private.h
new file mode 100644
index 0000000..5a01637
--- /dev/null
+++ b/endless/eospagemanager-private.h
@@ -0,0 +1,19 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#ifndef EOS_PAGE_MANAGER_PRIVATE_H
+#define EOS_PAGE_MANAGER_PRIVATE_H
+
+#include "eostypes.h"
+
+#include "eospagemanager.h"
+
+#include <gtk/gtk.h>
+#include <pstack.h>
+
+G_BEGIN_DECLS
+
+PStackTransitionType eos_page_manager_get_pstack_transition_type (EosPageManager *self);
+
+G_END_DECLS
+
+#endif /* EOS_PAGE_MANAGER_PRIVATE_H */
diff --git a/endless/eospagemanager.c b/endless/eospagemanager.c
index bd8d32f..c4508a6 100644
--- a/endless/eospagemanager.c
+++ b/endless/eospagemanager.c
@@ -2,6 +2,7 @@
#include "config.h"
#include "eospagemanager.h"
+#include "eospagemanager-private.h"
#include <gtk/gtk.h>
#include <pstack.h>
@@ -109,6 +110,7 @@ struct _EosPageManagerPrivate
GHashTable *pages_by_name; /* GHashTable<gchar *, EosPageManagerPageInfo *> */
GHashTable *pages_by_widget; /* GHashTable<GtkWidget *, EosPageManagerPageInfo *> */
EosPageManagerPageInfo *visible_page_info;
+ EosPageManagerTransitionType transition_type;
};
GType
@@ -1210,26 +1212,27 @@ eos_page_manager_get_transition_type (EosPageManager *self)
{
g_return_val_if_fail (EOS_IS_PAGE_MANAGER (self), EOS_PAGE_MANAGER_TRANSITION_TYPE_NONE);
- return p_stack_get_transition_type (P_STACK (self->priv->stack));
+ return self->priv->transition_type;
}
/**
* eos_page_manager_set_transition_type:
* @self: the page manager
- * @transition: the type of page transitions
+ * @transition_type: the type of page transitions
*
* Sets the animation type of page transitions. See
* #EosPageManager:transition-type for more information.
*/
void
eos_page_manager_set_transition_type (EosPageManager *self,
- EosPageManagerTransitionType transition)
+ EosPageManagerTransitionType transition_type)
{
g_return_if_fail (EOS_IS_PAGE_MANAGER (self));
- PStackTransitionType type;
- switch (transition)
+ self->priv->transition_type = transition_type;
+ PStackTransitionType pstack_transition;
+ switch (transition_type)
{
case EOS_PAGE_MANAGER_TRANSITION_TYPE_NONE:
case EOS_PAGE_MANAGER_TRANSITION_TYPE_CROSSFADE:
@@ -1237,13 +1240,25 @@ eos_page_manager_set_transition_type (EosPageManager *self,
case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_LEFT:
case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_UP:
case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_DOWN:
- type = (PStackTransitionType)transition;
+ pstack_transition = (PStackTransitionType)self->priv->transition_type;
break;
default:
- type = P_STACK_TRANSITION_TYPE_NONE;
+ pstack_transition = P_STACK_TRANSITION_TYPE_NONE;
break;
}
- p_stack_set_transition_type (P_STACK (self->priv->stack), type);
-
+ p_stack_set_transition_type (P_STACK (self->priv->stack),
+ pstack_transition);
g_object_notify (G_OBJECT (self), "transition-type");
}
+
+/*
+ * eos_page_manager_get_pstack_transition_type:
+ * @self: the page manager
+ *
+ * Gets the internal pstack transition type used to animate the page manager.
+ */
+PStackTransitionType
+eos_page_manager_get_pstack_transition_type (EosPageManager *self)
+{
+ return p_stack_get_transition_type (P_STACK (self->priv->stack));
+}
diff --git a/endless/eospagemanager.h b/endless/eospagemanager.h
index b1ffbe1..7814b24 100644
--- a/endless/eospagemanager.h
+++ b/endless/eospagemanager.h
@@ -141,7 +141,7 @@ guint eos_page_manager_get_transition_duration (EosPageManage
EOS_SDK_ALL_API_VERSIONS
void eos_page_manager_set_transition_type (EosPageManager *self,
- EosPageManagerTransitionType transition);
+ EosPageManagerTransitionType transition_type);
EOS_SDK_ALL_API_VERSIONS
EosPageManagerTransitionType eos_page_manager_get_transition_type (EosPageManager *self);
diff --git a/endless/eoswindow.c b/endless/eoswindow.c
index dadfe97..d726c53 100644
--- a/endless/eoswindow.c
+++ b/endless/eoswindow.c
@@ -6,6 +6,7 @@
#include "eosapplication.h"
#include "eospagemanager.h"
+#include "eospagemanager-private.h"
#include "eostopbar-private.h"
#include "eosmainarea-private.h"
@@ -133,26 +134,8 @@ static void
sync_stack_animation (EosWindow *self)
{
EosPageManager *pm = EOS_PAGE_MANAGER (self->priv->page_manager);
- // TODO: Same code in two places... Should we make a private to sdk function
- EosPageManagerTransitionType pm_transtion = eos_page_manager_get_transition_type (pm);
- PStackTransitionType pstack_transition;
- switch (pm_transtion)
- {
- case EOS_PAGE_MANAGER_TRANSITION_TYPE_NONE:
- case EOS_PAGE_MANAGER_TRANSITION_TYPE_CROSSFADE:
- case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_RIGHT:
- case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_LEFT:
- case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_UP:
- case EOS_PAGE_MANAGER_TRANSITION_TYPE_SLIDE_DOWN:
- pstack_transition = (PStackTransitionType)pm_transtion;
- break;
- default:
- pstack_transition = P_STACK_TRANSITION_TYPE_NONE;
- break;
- }
- // Set up p_stack animation...
p_stack_set_transition_type (P_STACK (self->priv->background_stack),
- pstack_transition);
+ eos_page_manager_get_pstack_transition_type (pm));
p_stack_set_transition_duration (P_STACK (self->priv->background_stack),
eos_page_manager_get_transition_duration (pm));
}