Skip to content
Snippets Groups Projects
Commit 3757427a authored by Guido Gunther's avatar Guido Gunther :zzz:
Browse files

phosh: Properly close menus

* Closes settings when favorites is clicked and vice verca
* Close menu when activated a second time
parent 476a9453
No related branches found
No related tags found
No related merge requests found
......@@ -196,6 +196,19 @@ lockscreen_unlock_cb (PhoshShell *self, PhoshLockscreen *window)
}
static void
close_menu (struct popup **popup)
{
if (*popup == NULL)
return;
gtk_window_close (GTK_WINDOW ((*popup)->window));
gtk_widget_destroy (GTK_WIDGET ((*popup)->window));
free (*popup);
*popup = NULL;
}
static void
app_launched_cb (PhoshShell *self,
PhoshFavorites *favorites)
......@@ -203,10 +216,7 @@ app_launched_cb (PhoshShell *self,
PhoshShellPrivate *priv = phosh_shell_get_instance_private (self);
g_return_if_fail (priv->favorites);
gtk_window_close (GTK_WINDOW (priv->favorites->window));
gtk_widget_destroy (GTK_WIDGET (priv->favorites->window));
free (priv->favorites);
priv->favorites = NULL;
close_menu (&priv->favorites);
}
......@@ -264,8 +274,11 @@ favorites_activated_cb (PhoshShell *self,
struct xdg_positioner *xdg_positioner;
gint width, height;
if (priv->favorites)
close_menu (&priv->settings);
if (priv->favorites) {
close_menu (&priv->favorites);
return;
}
favorites = calloc (1, sizeof *favorites);
favorites->window = phosh_favorites_new ();
......@@ -311,13 +324,10 @@ setting_done_cb (PhoshShell *self,
PhoshShellPrivate *priv = phosh_shell_get_instance_private (self);
g_return_if_fail (priv->settings);
gtk_window_close (GTK_WINDOW (priv->settings->window));
gtk_widget_destroy (GTK_WIDGET (priv->settings->window));
free (priv->settings);
priv->settings = NULL;
close_menu (&priv->settings);
}
static void
settings_activated_cb (PhoshShell *self,
PhoshPanel *window)
......@@ -329,8 +339,11 @@ settings_activated_cb (PhoshShell *self,
struct xdg_positioner *xdg_positioner;
gint width, height, panel_width;
if (priv->settings)
close_menu (&priv->favorites);
if (priv->settings) {
close_menu (&priv->settings);
return;
}
settings = calloc (1, sizeof *settings);
settings->window = phosh_settings_new ();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment