[gnome-panel] properties-dialog: add alignment setting



commit c00cbe0e2bf05a57959d8e7f502dd7a72fa5b3f8
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Apr 24 18:47:52 2021 +0300

    properties-dialog: add alignment setting

 gnome-panel/gp-properties-dialog.c  | 20 +++++++++++++++-
 gnome-panel/gp-properties-dialog.ui | 47 +++++++++++++++++++++++++++++++++++--
 2 files changed, 64 insertions(+), 3 deletions(-)
---
diff --git a/gnome-panel/gp-properties-dialog.c b/gnome-panel/gp-properties-dialog.c
index d0f11ba50..5e619b318 100644
--- a/gnome-panel/gp-properties-dialog.c
+++ b/gnome-panel/gp-properties-dialog.c
@@ -34,6 +34,7 @@ struct _GpPropertiesDialog
   GtkWidget *theme_writable;
 
   GtkWidget *orientation;
+  GtkWidget *alignment;
   GtkWidget *size;
   GtkWidget *expand;
   GtkWidget *auto_hide;
@@ -215,10 +216,26 @@ setup_toplevel_bindings (GpPropertiesDialog *dialog)
   gtk_combo_box_text_append (text, "left", NC_("Orientation", "Left"));
   gtk_combo_box_text_append (text, "right", NC_("Orientation", "Right"));
 
+  text = GTK_COMBO_BOX_TEXT (dialog->alignment);
+
+  gtk_combo_box_text_append (text, "start", NC_("Alignment", "Start"));
+  gtk_combo_box_text_append (text, "center", NC_("Alignment", "Center"));
+  gtk_combo_box_text_append (text, "end", NC_("Alignment", "End"));
+
+  g_object_bind_property (dialog->expand,
+                          "active",
+                          dialog->alignment,
+                          "sensitive",
+                          G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN);
+
   g_settings_bind (dialog->toplevel, "orientation",
                    dialog->orientation, "active-id",
                    G_SETTINGS_BIND_DEFAULT);
 
+  g_settings_bind (dialog->toplevel, "alignment",
+                   dialog->alignment, "active-id",
+                   G_SETTINGS_BIND_DEFAULT);
+
   g_settings_bind (dialog->toplevel, "size",
                    dialog->size, "value",
                    G_SETTINGS_BIND_DEFAULT);
@@ -326,7 +343,7 @@ toplevel_writable_change_event_cb (GSettings          *settings,
                                    GpPropertiesDialog *dialog)
 {
   const gchar *toplevel[] = {
-    "orientation", "size", "expand", "auto-hide",
+    "orientation", "alignment", "size", "expand", "auto-hide",
     "enable-buttons", "enable-arrows", NULL
   };
   gboolean writable;
@@ -472,6 +489,7 @@ bind_template (GtkWidgetClass *widget_class)
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, theme_writable);
 
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, orientation);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, alignment);
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, size);
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, expand);
   gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, auto_hide);
diff --git a/gnome-panel/gp-properties-dialog.ui b/gnome-panel/gp-properties-dialog.ui
index c0d810f2e..6ff17729d 100644
--- a/gnome-panel/gp-properties-dialog.ui
+++ b/gnome-panel/gp-properties-dialog.ui
@@ -108,6 +108,49 @@
                 <property name="position">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Alignment:</property>
+                    <property name="use-underline">True</property>
+                    <property name="mnemonic-widget">alignment</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBoxText" id="alignment">
+                    <property name="visible">True</property>
+                    <property name="can-focus">False</property>
+                    <property name="margin-start">6</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkBox">
                 <property name="visible">True</property>
@@ -174,7 +217,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
@@ -276,7 +319,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
           </object>


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