Commit c1f7b4d3 authored by Jonny Lamb's avatar Jonny Lamb
Browse files

panel: hide when a favorite is loaded

parent dea55fa3
......@@ -30,8 +30,10 @@
#include "app-icon.h"
enum {
PROP_0,
APP_LAUNCHED,
N_SIGNALS
};
static guint signals[N_SIGNALS] = { 0 };
struct MaynardFavoritesPrivate {
GSettings *settings;
......@@ -54,6 +56,8 @@ favorite_clicked (GtkButton *button,
error->message);
g_clear_error (&error);
}
g_signal_emit (self, signals[APP_LAUNCHED], 0);
}
static void
......@@ -140,6 +144,10 @@ maynard_favorites_class_init (MaynardFavoritesClass *klass)
object_class->dispose = maynard_favorites_dispose;
signals[APP_LAUNCHED] = g_signal_new ("app-launched",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
g_type_class_add_private (object_class, sizeof (MaynardFavoritesPrivate));
}
......
......@@ -388,6 +388,17 @@ panel_hide_timeout_cb (gpointer data)
return G_SOURCE_REMOVE;
}
static void
favorite_launched_cb (MaynardPanel *panel,
struct desktop *desktop)
{
if (desktop->grid_visible) {
launcher_grid_toggle (desktop->launcher_grid->window, desktop);
}
panel_window_leave_cb (NULL, NULL, desktop);
}
static void
panel_create(struct desktop *desktop)
{
......@@ -405,6 +416,8 @@ panel_create(struct desktop *desktop)
G_CALLBACK(system_toggled_cb), desktop);
g_signal_connect(panel->window, "volume-toggled",
G_CALLBACK(volume_toggled_cb), desktop);
g_signal_connect(panel->window, "favorite-launched",
G_CALLBACK(favorite_launched_cb), desktop);
desktop->initial_panel_timeout_id =
g_timeout_add_seconds(2, panel_hide_timeout_cb, desktop);
......
......@@ -31,6 +31,7 @@ enum {
APP_MENU_TOGGLED,
SYSTEM_TOGGLED,
VOLUME_TOGGLED,
FAVORITE_LAUNCHED,
N_SIGNALS
};
static guint signals[N_SIGNALS] = { 0 };
......@@ -99,6 +100,13 @@ volume_button_clicked_cb (GtkButton *button,
g_signal_emit (self, signals[VOLUME_TOGGLED], 0);
}
static void
favorite_launched_cb (MaynardFavorites *favorites,
MaynardPanel *self)
{
g_signal_emit (self, signals[FAVORITE_LAUNCHED], 0);
}
static void
maynard_panel_constructed (GObject *object)
{
......@@ -107,6 +115,7 @@ maynard_panel_constructed (GObject *object)
GtkWidget *ebox;
GtkWidget *image;
GtkWidget *button;
GtkWidget *favorites;
G_OBJECT_CLASS (maynard_panel_parent_class)->constructed (object);
......@@ -208,9 +217,13 @@ maynard_panel_constructed (GObject *object)
/* favorites */
ebox = gtk_event_box_new ();
gtk_box_pack_start (GTK_BOX (main_box), ebox, FALSE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (ebox), maynard_favorites_new ());
favorites = maynard_favorites_new ();
gtk_container_add (GTK_CONTAINER (ebox), favorites);
widget_connect_enter_signal (self, ebox);
g_signal_connect (favorites, "app-launched",
G_CALLBACK (favorite_launched_cb), self);
/* bottom app menu button */
ebox = gtk_event_box_new ();
gtk_box_pack_end (GTK_BOX (main_box), ebox, FALSE, FALSE, 0);
......@@ -257,6 +270,10 @@ maynard_panel_class_init (MaynardPanelClass *klass)
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
signals[FAVORITE_LAUNCHED] = g_signal_new ("favorite-launched",
G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL,
NULL, G_TYPE_NONE, 0);
g_type_class_add_private (object_class, sizeof (MaynardPanelPrivate));
}
......
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