[gnome-applets/wip/segeiger/window-picker-in-process: 3/8] windowpicker/applet.c: Replace grid with box
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/window-picker-in-process: 3/8] windowpicker/applet.c: Replace grid with box
- Date: Sat, 11 Jul 2015 23:13:17 +0000 (UTC)
commit a155f6601cce50493073529f221e14b8805f2187
Author: Sebastian Geiger <sbastig gmx net>
Date: Mon Jun 8 21:10:27 2015 +0200
windowpicker/applet.c: Replace grid with box
This fixes a problem on vertically aligned panels, that
caused the task list to remain horizontal.
This registers a callback to handle orientation changes of the panel.
We also consider the orientation of the panel in the size allocation
of the TaskItems.
windowpicker/src/applet.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/windowpicker/src/applet.c b/windowpicker/src/applet.c
index bf1f3f0..941dc43 100644
--- a/windowpicker/src/applet.c
+++ b/windowpicker/src/applet.c
@@ -44,6 +44,7 @@
#define KEY_EXPAND_TASK_LIST "expand-task-list"
struct _WindowPickerAppletPrivate {
+ GtkWidget *outer_box;
GtkWidget *tasks;
GtkWidget *title; /* a pointer to the window title widget */
GSettings *settings;
@@ -132,6 +133,17 @@ setupPanelContextMenu (WindowPickerApplet *windowPickerApplet)
g_object_unref (action_group);
}
+static void
+on_applet_orientation_changed (PanelApplet *applet,
+ PanelAppletOrient orient)
+{
+ WindowPickerApplet *windowPickerApplet = WINDOW_PICKER_APPLET (applet);
+ WindowPickerAppletPrivate *priv = windowPickerApplet->priv;
+
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->outer_box), panel_applet_get_gtk_orientation
(applet));
+ gtk_widget_queue_resize (GTK_WIDGET (applet));
+}
+
static gboolean
load_window_picker (PanelApplet *applet) {
WindowPickerApplet *windowPickerApplet = WINDOW_PICKER_APPLET(applet);
@@ -139,19 +151,18 @@ load_window_picker (PanelApplet *applet) {
GSettings *settings = windowPickerApplet->priv->settings
= panel_applet_settings_new(applet, SETTINGS_SCHEMA);
- GtkWidget *grid = gtk_grid_new ();
- gtk_grid_set_row_spacing (GTK_GRID(grid), 10);
- gtk_container_add (GTK_CONTAINER (applet), grid);
+ GtkWidget *outer_box = priv->outer_box = gtk_box_new (panel_applet_get_gtk_orientation (applet), 0);
+ gtk_container_add (GTK_CONTAINER (applet), outer_box);
gtk_container_set_border_width (GTK_CONTAINER (applet), 0);
- gtk_container_set_border_width (GTK_CONTAINER (grid), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (outer_box), 0);
priv->tasks = task_list_new (windowPickerApplet);
gtk_widget_set_vexpand (priv->tasks, TRUE);
- gtk_grid_attach (GTK_GRID(grid), priv->tasks, 0, 0, 1, 1);
+ gtk_box_pack_start (GTK_BOX (outer_box), priv->tasks, TRUE, TRUE, 0);
priv->title = task_title_new (windowPickerApplet);
gtk_widget_set_hexpand (priv->title, TRUE);
- gtk_grid_attach (GTK_GRID(grid), priv->title, 1, 0, 1, 1);
+ gtk_box_pack_start (GTK_BOX (outer_box), priv->title, TRUE, TRUE, 0);
priv->show_all_windows = g_settings_get_boolean (settings, KEY_SHOW_ALL_WINDOWS);
g_settings_bind (settings, KEY_SHOW_ALL_WINDOWS,
@@ -394,9 +405,11 @@ static void
window_picker_applet_class_init (WindowPickerAppletClass *class)
{
GObjectClass *obj_class = G_OBJECT_CLASS (class);
+ PanelAppletClass *applet_class = PANEL_APPLET_CLASS (class);
obj_class->dispose = window_picker_dispose;
obj_class->set_property = window_picker_set_property;
obj_class->get_property = window_picker_get_property;
+ applet_class->change_orient = on_applet_orientation_changed;
g_object_class_install_property (obj_class, PROP_SHOW_ALL_WINDOWS,
g_param_spec_boolean ("show-all-windows",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]