+#include <cfg.h>
+#include <slog.h>
+#include <ui.h>
+#include <ui_appindicator.h>
+#include <ui_graph.h>
+#include <ui_pref.h>
+#include <ui_sensorlist.h>
+#include <ui_sensorpref.h>
+#include <ui_status.h>
+
+static GtkWidget *w_sensors_scrolled_tree;
+static GtkWidget *w_graph;
+static GtkContainer *w_sensor_box;
+static GtkContainer *w_main_box;
+
+static void update_layout(void)
+{
+ enum sensorlist_position sensorlist_pos;
+
+ g_object_ref(w_sensors_scrolled_tree);
+ g_object_ref(w_graph);
+
+ gtk_container_remove(w_sensor_box,
+ w_sensors_scrolled_tree);
+
+ gtk_container_remove(w_sensor_box, w_graph);
+
+ gtk_container_remove(w_main_box, GTK_WIDGET(w_sensor_box));
+
+ sensorlist_pos = config_get_sensorlist_position();
+ if (sensorlist_pos == SENSORLIST_POSITION_RIGHT
+ || sensorlist_pos == SENSORLIST_POSITION_LEFT)
+ w_sensor_box
+ = GTK_CONTAINER(gtk_paned_new
+ (GTK_ORIENTATION_HORIZONTAL));
+ else
+ w_sensor_box
+ = GTK_CONTAINER(gtk_paned_new
+ (GTK_ORIENTATION_VERTICAL));
+
+ gtk_box_pack_end(GTK_BOX(w_main_box),
+ GTK_WIDGET(w_sensor_box), TRUE, TRUE, 2);
+
+ if (sensorlist_pos == SENSORLIST_POSITION_RIGHT
+ || sensorlist_pos == SENSORLIST_POSITION_BOTTOM) {
+ gtk_paned_pack1(GTK_PANED(w_sensor_box), w_graph, TRUE, TRUE);
+ gtk_paned_pack2(GTK_PANED(w_sensor_box),
+ w_sensors_scrolled_tree,
+ FALSE,
+ TRUE);
+ } else {
+ gtk_paned_pack1(GTK_PANED(w_sensor_box),
+ w_sensors_scrolled_tree,
+ FALSE,
+ TRUE);
+ gtk_paned_pack2(GTK_PANED(w_sensor_box), w_graph, TRUE, TRUE);
+ }
+
+ g_object_unref(w_sensors_scrolled_tree);
+ g_object_unref(w_graph);
+
+ gtk_widget_show_all(GTK_WIDGET(w_sensor_box));
+}