[gnome-applets/wip/segeiger/window-picker/task-title: 3/5] windowpicker: fix panel alignment
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/window-picker/task-title: 3/5] windowpicker: fix panel alignment
- Date: Tue, 9 Feb 2016 00:38:32 +0000 (UTC)
commit d58c6ffdec53c1d6e9e90ac7fe20581bc43f8684
Author: Sebastian Geiger <sbastig gmx net>
Date: Mon Feb 8 15:37:34 2016 +0100
windowpicker: fix panel alignment
We also need set panel alignment on init and after the orientation has changed.
It is also necessary to set the alignment of the applet itself or else
the widget will use excessive space even if its containing widgets are smaller.
windowpicker/src/wp-applet.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/windowpicker/src/wp-applet.c b/windowpicker/src/wp-applet.c
index f9cbc09..e8db8fc 100644
--- a/windowpicker/src/wp-applet.c
+++ b/windowpicker/src/wp-applet.c
@@ -357,6 +357,26 @@ wp_applet_get_property (GObject *object,
}
static void
+update_panel_orientation (WpApplet *applet,
+ GtkOrientation orientation)
+{
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ gtk_widget_set_valign (GTK_WIDGET (applet), GTK_ALIGN_FILL);
+ gtk_widget_set_halign (GTK_WIDGET (applet), GTK_ALIGN_START);
+ gtk_widget_set_halign (applet->container, GTK_ALIGN_START);
+ gtk_widget_set_valign (applet->container, GTK_ALIGN_FILL);
+ }
+ else
+ {
+ gtk_widget_set_valign (GTK_WIDGET (applet), GTK_ALIGN_START);
+ gtk_widget_set_halign (GTK_WIDGET (applet), GTK_ALIGN_FILL);
+ gtk_widget_set_halign (applet->container, GTK_ALIGN_FILL);
+ gtk_widget_set_valign (applet->container, GTK_ALIGN_START);
+ }
+}
+
+static void
wp_applet_change_orient (PanelApplet *panel_applet,
PanelAppletOrient orient)
{
@@ -369,16 +389,7 @@ wp_applet_change_orient (PanelApplet *panel_applet,
gtk_orientable_set_orientation (GTK_ORIENTABLE (applet->container),
orientation);
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- gtk_widget_set_halign (applet->container, GTK_ALIGN_START);
- gtk_widget_set_valign (applet->container, GTK_ALIGN_FILL);
- }
- else
- {
- gtk_widget_set_halign (applet->container, GTK_ALIGN_FILL);
- gtk_widget_set_valign (applet->container, GTK_ALIGN_START);
- }
+ update_panel_orientation (applet, orientation);
gtk_widget_queue_resize (GTK_WIDGET (applet));
}
@@ -439,6 +450,8 @@ wp_applet_init (WpApplet *applet)
applet->container = gtk_box_new (orientation, 10);
gtk_container_add (GTK_CONTAINER (applet), applet->container);
+ update_panel_orientation (applet, orientation);
+
wp_applet_setup_list (applet);
wp_applet_setup_title (applet);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]