[gnome-panel/wip-geiger-dialog: 13/14] solution with three list boxes



commit ab2801deda4be157b6dd8567d8dbe7802d02c0f0
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sat Apr 18 16:02:06 2020 +0200

    solution with three list boxes

 gnome-panel/gp-properties-dialog.c  | 47 ++++++++++++++++++++++--
 gnome-panel/gp-properties-dialog.ui | 72 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 116 insertions(+), 3 deletions(-)
---
diff --git a/gnome-panel/gp-properties-dialog.c b/gnome-panel/gp-properties-dialog.c
index c1ce06a4c..ecd0984b0 100644
--- a/gnome-panel/gp-properties-dialog.c
+++ b/gnome-panel/gp-properties-dialog.c
@@ -21,7 +21,6 @@
 
 #include "gp-properties-dialog.h"
 #include "panel-schemas.h"
-#include "applet.h"
 #include "panel-applets-manager.h"
 
 struct _GpPropertiesDialog
@@ -60,6 +59,9 @@ struct _GpPropertiesDialog
   GtkWidget *fg_color;
 
   GtkWidget *applet_box;
+  GtkWidget *applet_box_left;
+  GtkWidget *applet_box_center;
+  GtkWidget *applet_box_right;
 };
 
 enum
@@ -315,6 +317,16 @@ get_applet_iid (AppletInfo *applet) {
   return g_settings_get_string (applet->settings, PANEL_OBJECT_IID_KEY);
 }
 
+static PanelObjectPackType
+get_applet_pack_type (AppletInfo *applet) {
+  return g_settings_get_enum (applet->settings, PANEL_OBJECT_PACK_TYPE_KEY);
+}
+
+static int
+get_applet_pack_index (AppletInfo *applet) {
+  return g_settings_get_int (applet->settings, PANEL_OBJECT_PACK_INDEX_KEY);
+}
+
 static GtkWidget *
 create_applet_entry (GpPropertiesDialog *dialog, AppletInfo *info)
 {
@@ -369,6 +381,34 @@ create_applet_entry (GpPropertiesDialog *dialog, AppletInfo *info)
   return entry;
 }
 
+static void
+insert_applet_entry (GpPropertiesDialog *dialog, AppletInfo *info, GtkWidget *applet_entry)
+{
+  PanelObjectPackType pack_type;
+  int pack_index;
+
+  pack_type = get_applet_pack_type (info);
+  pack_index = get_applet_pack_index (info);
+
+  if (pack_type == PANEL_OBJECT_PACK_START)
+    {
+      gtk_container_add (GTK_CONTAINER (dialog->applet_box_left), applet_entry);
+    }
+
+
+  if (pack_type == PANEL_OBJECT_PACK_CENTER)
+    {
+      gtk_container_add (GTK_CONTAINER (dialog->applet_box_center), applet_entry);
+    }
+
+
+  if (pack_type == PANEL_OBJECT_PACK_END)
+    {
+      gtk_container_add (GTK_CONTAINER (dialog->applet_box_right), applet_entry);
+    }
+
+}
+
 static void
 setup_applet_box (GpPropertiesDialog  *dialog)
 {
@@ -398,7 +438,7 @@ setup_applet_box (GpPropertiesDialog  *dialog)
           continue;
         }
 
-      gtk_container_add (GTK_CONTAINER (dialog->applet_box), applet_entry);
+      insert_applet_entry (dialog, info, applet_entry);
     }
 
   gtk_widget_show_all(dialog->applet_box);
@@ -599,6 +639,9 @@ bind_template (GtkWidgetClass *widget_class)
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, fg_color);
 
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, applet_box);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, applet_box_left);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, applet_box_center);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, applet_box_right);
 }
 
 static void
diff --git a/gnome-panel/gp-properties-dialog.ui b/gnome-panel/gp-properties-dialog.ui
index 53200c220..c63543cc8 100644
--- a/gnome-panel/gp-properties-dialog.ui
+++ b/gnome-panel/gp-properties-dialog.ui
@@ -615,9 +615,79 @@
           </packing>
         </child>
         <child>
-          <object class="GtkListBox" id="applet_box">
+          <object class="GtkBox" id="applet_box">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Left</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkListBox" id="applet_box_left">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Center</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkListBox" id="applet_box_center">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Right</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkListBox" id="applet_box_right">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="position">2</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]