Commit 39534807 authored by Sebastian Krzyszkowiak's avatar Sebastian Krzyszkowiak Committed by Guido Gunther
Browse files

overview: Hide the list of activities when there are none

This allows the app launcher to take all available space.
parent 2bfc3974
Pipeline #31466 passed with stages
in 6 minutes and 19 seconds
......@@ -128,8 +128,14 @@ add_activity (PhoshOverview *self, PhoshToplevel *toplevel)
static void
get_running_activities (PhoshOverview *self)
{
PhoshOverviewPrivate *priv;
PhoshToplevelManager *toplevel_manager = phosh_shell_get_toplevel_manager (phosh_shell_get_default ());
guint toplevels_num = phosh_toplevel_manager_get_num_toplevels (toplevel_manager);
g_return_if_fail (PHOSH_IS_OVERVIEW (self));
priv = phosh_overview_get_instance_private (self);
if (toplevels_num == 0)
gtk_widget_hide (priv->evbox_running_activities);
for (guint i = 0; i < toplevels_num; i++) {
PhoshToplevel *toplevel = phosh_toplevel_manager_get_toplevel (toplevel_manager, i);
......@@ -148,6 +154,23 @@ toplevel_added_cb (PhoshOverview *self,
add_activity (self, toplevel);
}
static void
num_toplevels_cb (PhoshOverview *self,
GParamSpec *pspec,
PhoshToplevelManager *manager)
{
PhoshOverviewPrivate *priv;
g_return_if_fail (PHOSH_IS_OVERVIEW (self));
g_return_if_fail (PHOSH_IS_TOPLEVEL_MANAGER (manager));
priv = phosh_overview_get_instance_private (self);
if (phosh_toplevel_manager_get_num_toplevels (manager)) {
gtk_widget_show (priv->evbox_running_activities);
} else {
gtk_widget_hide (priv->evbox_running_activities);
}
}
static void
phosh_overview_size_allocate (GtkWidget *widget,
GtkAllocation *alloc)
......@@ -210,6 +233,11 @@ phosh_overview_constructed (GObject *object)
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (toplevel_manager, "notify::num-toplevels",
G_CALLBACK (num_toplevels_cb),
self,
G_CONNECT_SWAPPED);
get_running_activities (self);
g_signal_connect_swapped (priv->app_grid, "app-launched",
......
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