Commit 6eefb97d authored by Guido Gunther's avatar Guido Gunther
Browse files

HACK: home: show/hide splash screen

This needs proper toplevel tracking
parent 9e45fdfd
Pipeline #63774 canceled with stages
in 15 seconds
......@@ -13,6 +13,7 @@
#include "overview.h"
#include "home.h"
#include "shell.h"
#include "splash.h"
#include "phosh-enums.h"
#include "osk/osk-button.h"
......@@ -72,6 +73,10 @@ struct _PhoshHome
/* osk button */
gboolean osk_enabled;
/* launch splash: TODO: move to object */
GHashTable *launching_apps;
GtkWidget *splash;
};
G_DEFINE_TYPE(PhoshHome, phosh_home, PHOSH_TYPE_LAYER_SURFACE);
......@@ -292,6 +297,35 @@ on_keybindings_changed (PhoshHome *self,
}
static void
on_activity_launched (PhoshHome *self,
GAppInfo *info,
PhoshOverview *overview)
{
g_return_if_fail (PHOSH_IS_HOME (self));
g_return_if_fail (G_IS_APP_INFO (info));
g_return_if_fail (PHOSH_IS_OVERVIEW (overview));
self->splash = phosh_splash_new (info);
gtk_widget_show_all (self->splash);
fold_cb (self, overview);
}
static void
on_activity_up (PhoshHome *self)
{
g_return_if_fail (PHOSH_IS_HOME (self));
g_debug ("Activity is up");
/* TODO: match on app-id */
gtk_widget_hide (self->splash);
gtk_widget_destroy (self->splash);
self->splash = NULL;
}
static gboolean
on_idle (PhoshOskButton *self)
{
......@@ -327,6 +361,7 @@ phosh_home_constructed (GObject *object)
"swapped-signal::changed::" KEYBINDING_KEY_TOGGLE_APPLICATION_VIEW,
on_keybindings_changed, self,
NULL);
add_keybindings (self);
phosh_connect_feedback (self->btn_home);
......@@ -399,6 +434,8 @@ phosh_home_class_init (PhoshHomeClass *klass)
gtk_widget_class_bind_template_child (widget_class, PhoshHome, btn_osk);
gtk_widget_class_bind_template_child (widget_class, PhoshHome, overview);
gtk_widget_class_bind_template_child (widget_class, PhoshHome, rev_home);
gtk_widget_class_bind_template_callback (widget_class, on_activity_launched);
gtk_widget_class_bind_template_callback (widget_class, on_activity_up);
gtk_widget_class_bind_template_callback (widget_class, fold_cb);
gtk_widget_class_bind_template_callback (widget_class, home_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, on_has_activities_changed);
......
......@@ -42,6 +42,7 @@ enum {
ACTIVITY_LAUNCHED,
ACTIVITY_RAISED,
ACTIVITY_CLOSED,
ACTIVITY_UP,
SELECTION_ABORTED,
N_SIGNALS
};
......@@ -316,6 +317,10 @@ toplevel_added_cb (PhoshOverview *self,
g_return_if_fail (PHOSH_IS_TOPLEVEL (toplevel));
g_return_if_fail (PHOSH_IS_TOPLEVEL_MANAGER (manager));
add_activity (self, toplevel);
/* TODO: only for initial window */
g_debug("app is up");
g_signal_emit (self, signals[ACTIVITY_UP], 0);
}
......@@ -390,9 +395,10 @@ app_launched_cb (PhoshOverview *self,
GAppInfo *info,
GtkWidget *widget)
{
g_return_if_fail (PHOSH_IS_OVERVIEW (self));
/* TODO: only pass info we don't already have a matching toplevel */
g_debug("Launched %s", g_app_info_get_id (info));
g_signal_emit (self, signals[ACTIVITY_LAUNCHED], 0);
g_signal_emit (self, signals[ACTIVITY_LAUNCHED], 0, info);
}
......@@ -458,7 +464,7 @@ phosh_overview_class_init (PhoshOverviewClass *klass)
signals[ACTIVITY_LAUNCHED] = g_signal_new ("activity-launched",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
NULL, G_TYPE_NONE, 1, G_TYPE_APP_INFO);
signals[ACTIVITY_RAISED] = g_signal_new ("activity-raised",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
......@@ -468,6 +474,9 @@ phosh_overview_class_init (PhoshOverviewClass *klass)
signals[ACTIVITY_CLOSED] = g_signal_new ("activity-closed",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
signals[ACTIVITY_UP] = g_signal_new ("activity-up",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
gtk_widget_class_set_css_name (widget_class, "phosh-overview");
}
......
......@@ -78,7 +78,8 @@
<object class="PhoshOverview" id="overview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="activity-launched" handler="fold_cb" swapped="true"/>
<signal name="activity-launched" handler="on_activity_launched" swapped="true"/>
<signal name="activity-up" handler="on_activity_up" swapped="true"/>
<signal name="activity-raised" handler="fold_cb" swapped="true"/>
<signal name="notify::has-activities" handler="on_has_activities_changed" swapped="true"/>
<signal name="selection-aborted" handler="fold_cb" swapped="true"/>
......
Markdown is supported
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