summaryrefslogtreecommitdiff
path: root/shell/gtk-shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/gtk-shell.c')
-rw-r--r--shell/gtk-shell.c137
1 files changed, 13 insertions, 124 deletions
diff --git a/shell/gtk-shell.c b/shell/gtk-shell.c
index 2c8aa3b..6cfd73b 100644
--- a/shell/gtk-shell.c
+++ b/shell/gtk-shell.c
@@ -13,7 +13,8 @@
#include "clock.h"
#include "favorites.h"
#include "launcher-grid.h"
-#include "sound-applet.h"
+#include "panel.h"
+#include "vertical-clock.h"
extern char **environ; /* defined by libc */
@@ -41,18 +42,6 @@ struct desktop {
guint initial_panel_timeout_id;
guint hide_panel_idle_id;
-
- /* revealers that show and hide the small clock that's only
- * visible when the panel is half-hidden. these should be
- * moved from here and should live in the panel's private
- * data. */
- GtkWidget *revealer_clock;
- GtkWidget *revealer_buttons;
-
- /* queue of widgets on which to connect to the
- * enter-notify-event signal so we know we're still on the
- * panel. */
- GQueue *panel_widgets;
};
/* TODO: guessed from the mockups, it'd be nice to have this in stone
@@ -82,11 +71,6 @@ connect_enter_leave_signals (gpointer data)
g_signal_connect (desktop->clock->window, "leave-notify-event",
G_CALLBACK (panel_window_leave_cb), desktop);
- for (l = desktop->panel_widgets->head; l != NULL; l = l->next) {
- g_signal_connect (l->data, "enter-notify-event",
- G_CALLBACK (panel_window_enter_cb), desktop);
- }
-
return FALSE;
}
@@ -181,38 +165,6 @@ launcher_grid_toggle (GtkWidget *widget, struct desktop *desktop)
}
static GtkWidget *
-small_clock_create (struct desktop *desktop)
-{
- GtkWidget *box;
- GtkWidget *label;
-
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-
- label = gtk_label_new ("");
- gtk_style_context_add_class (gtk_widget_get_style_context (label),
- "wgs-clock");
- gtk_widget_set_size_request (label, 31, -1);
- gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
-
- label = gtk_label_new ("");
- gtk_label_set_markup (GTK_LABEL (label), "<span font=\"Droid Sans 12\">11\n"
- ":\n"
- "47</span>");
- gtk_style_context_add_class (gtk_widget_get_style_context (label),
- "wgs-clock");
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
- gtk_widget_set_size_request (label, 25, -1);
- gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
-
- desktop->revealer_clock = gtk_revealer_new ();
- gtk_revealer_set_transition_type (GTK_REVEALER (desktop->revealer_clock),
- GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT);
- gtk_container_add (GTK_CONTAINER (desktop->revealer_clock), box);
-
- return desktop->revealer_clock;
-}
-
-static GtkWidget *
clock_create (struct desktop *desktop)
{
struct element *clock;
@@ -252,8 +204,8 @@ panel_window_enter_cb (GtkWidget *widget,
shell_helper_slide_surface_back(desktop->helper,
desktop->clock->surface);
- gtk_revealer_set_reveal_child (GTK_REVEALER (desktop->revealer_clock), FALSE);
- gtk_revealer_set_reveal_child (GTK_REVEALER (desktop->revealer_buttons), TRUE);
+ weston_gtk_panel_set_expand(WESTON_GTK_PANEL(desktop->panel->window),
+ TRUE);
return FALSE;
}
@@ -276,8 +228,8 @@ leave_panel_idle_cb (gpointer data)
desktop->clock->surface,
25 - 56 - width, 0);
- gtk_revealer_set_reveal_child (GTK_REVEALER (desktop->revealer_clock), TRUE);
- gtk_revealer_set_reveal_child (GTK_REVEALER (desktop->revealer_buttons), FALSE);
+ weston_gtk_panel_set_expand(WESTON_GTK_PANEL(desktop->panel->window),
+ FALSE);
return FALSE;
}
@@ -311,82 +263,19 @@ panel_hide_timeout_cb (gpointer data)
static void
panel_create(struct desktop *desktop)
{
- GdkWindow *gdk_window;
struct element *panel;
- GtkWidget *box1, *box2, *box3, *ebox, *button;
- GtkWidget *image; /* TODO */
+ GdkWindow *gdk_window;
panel = malloc(sizeof *panel);
memset(panel, 0, sizeof *panel);
- panel->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ panel->window = weston_gtk_panel_new();
- gtk_window_set_title(GTK_WINDOW(panel->window), "gtk shell");
- gtk_window_set_decorated(GTK_WINDOW(panel->window), FALSE);
- gtk_widget_realize(panel->window);
+ g_signal_connect(panel->window, "app-menu-toggled",
+ G_CALLBACK(launcher_grid_toggle), desktop);
- desktop->initial_panel_timeout_id = g_timeout_add_seconds(2,
- panel_hide_timeout_cb,
- desktop);
-
- gtk_style_context_add_class (gtk_widget_get_style_context (panel->window),
- "wgs-panel");
-
- box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (panel->window), box1);
-
- /* TODO: clock */
- clock_create(desktop);
-
- ebox = gtk_event_box_new ();
- gtk_box_pack_start (GTK_BOX (box1), ebox, FALSE, FALSE, 0);
-
- g_queue_push_tail (desktop->panel_widgets, ebox);
-
- box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (ebox), box2);
-
- desktop->revealer_buttons = gtk_revealer_new ();
- gtk_revealer_set_transition_type (GTK_REVEALER (desktop->revealer_buttons),
- GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
- gtk_revealer_set_reveal_child (GTK_REVEALER (desktop->revealer_buttons), TRUE);
- gtk_box_pack_start (GTK_BOX (box2), desktop->revealer_buttons, FALSE, FALSE, 0);
-
- box3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_container_add (GTK_CONTAINER (desktop->revealer_buttons), box3);
-
- /* TODO: wifi */
- image = gtk_image_new_from_icon_name ("network-wireless-signal-excellent-symbolic",
- GTK_ICON_SIZE_LARGE_TOOLBAR);
- gtk_style_context_add_class (gtk_widget_get_style_context (image),
- "wgs-wifi");
- gtk_box_pack_start (GTK_BOX (box3), image, FALSE, FALSE, 0);
-
- /* TODO: sound */
- image = gtk_image_new_from_icon_name ("audio-volume-high-symbolic",
- GTK_ICON_SIZE_LARGE_TOOLBAR);
- gtk_style_context_add_class (gtk_widget_get_style_context (image),
- "wgs-audio");
- gtk_box_pack_start (GTK_BOX (box3), image, FALSE, FALSE, 0);
-
- /* TODO: small clock */
- image = small_clock_create (desktop);
- gtk_box_pack_start (GTK_BOX (box2), image, FALSE, FALSE, 0);
-
- /* favourites */
- ebox = gtk_event_box_new ();
- gtk_box_pack_start (GTK_BOX (box1), ebox, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (ebox), weston_gtk_favorites_new ());
- g_queue_push_tail (desktop->panel_widgets, ebox);
-
- /* menu */
- ebox = gtk_event_box_new ();
- gtk_box_pack_end (GTK_BOX (box1), ebox, FALSE, FALSE, 0);
- button = weston_gtk_app_icon_new ("view-grid-symbolic");
- g_signal_connect (button, "clicked",
- G_CALLBACK (launcher_grid_toggle), desktop);
- gtk_container_add (GTK_CONTAINER (ebox), button);
- g_queue_push_tail (desktop->panel_widgets, ebox);
+ desktop->initial_panel_timeout_id =
+ g_timeout_add_seconds(2, panel_hide_timeout_cb, desktop);
/* set it up as the panel */
gdk_window = gtk_widget_get_window(panel->window);
@@ -535,7 +424,6 @@ main(int argc, char *argv[])
desktop->output = NULL;
desktop->shell = NULL;
desktop->helper = NULL;
- desktop->panel_widgets = g_queue_new ();
desktop->gdk_display = gdk_display_get_default();
desktop->display =
@@ -556,6 +444,7 @@ main(int argc, char *argv[])
css_setup(desktop);
panel_create(desktop);
+ clock_create(desktop);
launcher_grid_create (desktop);
background_create(desktop);