[gnome-applets/wip/segeiger/windowpicker: 4/8] windowpicker: extract get_applet_orientation
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-applets/wip/segeiger/windowpicker: 4/8] windowpicker: extract get_applet_orientation
- Date: Fri, 11 Oct 2019 20:43:14 +0000 (UTC)
commit 7bbf017a51c70c5c665e09f6d41b64daba455062
Author: Sebastian Geiger <sbastig gmx net>
Date: Tue Oct 8 22:34:24 2019 +0200
windowpicker: extract get_applet_orientation
windowpicker/src/task-list.c | 44 +++++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 13 deletions(-)
---
diff --git a/windowpicker/src/task-list.c b/windowpicker/src/task-list.c
index 9143012d4..aa5c3e4c6 100644
--- a/windowpicker/src/task-list.c
+++ b/windowpicker/src/task-list.c
@@ -36,6 +36,9 @@ G_DEFINE_TYPE (TaskList, task_list, GTK_TYPE_BOX);
static GSList *task_lists;
+static GtkOrientation
+get_applet_orientation (WpApplet *applet);
+
static TaskList *
get_task_list_for_monitor (TaskList *task_list,
GdkMonitor *monitor)
@@ -326,20 +329,10 @@ static void task_list_init (TaskList *list) {
}
GtkWidget *task_list_new (WpApplet *windowPickerApplet) {
- PanelAppletOrient panel_orientation = panel_applet_get_orient(PANEL_APPLET(windowPickerApplet));
+
GtkOrientation orientation;
- switch(panel_orientation) {
- case PANEL_APPLET_ORIENT_UP:
- case PANEL_APPLET_ORIENT_DOWN:
- orientation = GTK_ORIENTATION_HORIZONTAL;
- break;
- case PANEL_APPLET_ORIENT_LEFT:
- case PANEL_APPLET_ORIENT_RIGHT:
- orientation = GTK_ORIENTATION_VERTICAL;
- break;
- default:
- orientation = GTK_ORIENTATION_HORIZONTAL;
- }
+
+ orientation = get_applet_orientation (windowPickerApplet);
TaskList* taskList = g_object_new (TASK_TYPE_LIST,
"orientation", orientation,
@@ -379,3 +372,28 @@ task_list_get_monitor (TaskList *list)
return gdk_display_get_monitor_at_window (gdk_display,
gdk_window);
}
+
+static GtkOrientation
+get_applet_orientation (WpApplet *applet)
+{
+ PanelAppletOrient panel_orientation;
+ GtkOrientation orientation;
+
+ panel_orientation = panel_applet_get_orient(PANEL_APPLET(applet));
+
+ switch(panel_orientation)
+ {
+ case PANEL_APPLET_ORIENT_UP:
+ case PANEL_APPLET_ORIENT_DOWN:
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ break;
+ case PANEL_APPLET_ORIENT_LEFT:
+ case PANEL_APPLET_ORIENT_RIGHT:
+ orientation = GTK_ORIENTATION_VERTICAL;
+ break;
+ default:
+ orientation = GTK_ORIENTATION_HORIZONTAL;
+ }
+
+ return orientation;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]