[gnome-control-center/wip/carlosg/issue-238: 39/39] wacom: Align buttons/links to the left side



commit 67c8ef42d7f4547e17ca6d966cdd90d00351ee60
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 19 16:35:01 2018 +0100

    wacom: Align buttons/links to the left side
    
    Looks more natural this way. All buttons and links have been moved
    into the main grid so this is possible. The links additionally had
    to be removed all the padding so they actually align visually.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/238

 panels/wacom/cc-wacom-page.c           |  23 +++--
 panels/wacom/gnome-wacom-properties.ui | 184 ++++++++++++++++-----------------
 2 files changed, 103 insertions(+), 104 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-page.c b/panels/wacom/cc-wacom-page.c
index ca858c921..47fb59579 100644
--- a/panels/wacom/cc-wacom-page.c
+++ b/panels/wacom/cc-wacom-page.c
@@ -701,6 +701,19 @@ cc_wacom_page_class_init (CcWacomPageClass *klass)
        object_class->dispose = cc_wacom_page_dispose;
 }
 
+static void
+remove_link_padding (GtkWidget *widget)
+{
+       g_autoptr(GtkCssProvider) provider = NULL;
+
+       provider = gtk_css_provider_new ();
+       gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
+                                        ".link { padding: 0px; }", -1, NULL);
+       gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+                                       GTK_STYLE_PROVIDER (provider),
+                                       GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
 static void
 cc_wacom_page_init (CcWacomPage *page)
 {
@@ -750,9 +763,11 @@ cc_wacom_page_init (CcWacomPage *page)
 
        g_signal_connect (G_OBJECT (WID ("display-link")), "activate-link",
                          G_CALLBACK (display_clicked_cb), page);
+       remove_link_padding (WID ("display-link"));
 
        g_signal_connect (G_OBJECT (WID ("mouse-link")), "activate-link",
                          G_CALLBACK (mouse_clicked_cb), page);
+       remove_link_padding (WID ("mouse-link"));
 
        g_signal_connect (G_OBJECT (WID ("display-mapping-button")), "clicked",
                          G_CALLBACK (display_mapping_button_clicked_cb), page);
@@ -789,20 +804,12 @@ static void
 remove_display_link (CcWacomPage *page)
 {
        gtk_widget_destroy (WID ("display-link"));
-
-        gtk_container_child_set (CWID ("main-grid"),
-                                 WID ("tablet-buttons-box"),
-                                 "top_attach", 2, NULL);
 }
 
 static void
 remove_mouse_link (CcWacomPage *page)
 {
         gtk_widget_destroy (WID ("mouse-link"));
-
-        gtk_container_child_set (CWID ("main-grid"),
-                                 WID ("tablet-buttons-box"),
-                                 "top_attach", 2, NULL);
 }
 
 static gboolean
diff --git a/panels/wacom/gnome-wacom-properties.ui b/panels/wacom/gnome-wacom-properties.ui
index d6638f991..292c51978 100644
--- a/panels/wacom/gnome-wacom-properties.ui
+++ b/panels/wacom/gnome-wacom-properties.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkListStore" id="liststore-tabletmode">
@@ -219,98 +219,6 @@
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">1</property>
-                    <property name="height">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkBox" id="tablet-buttons-box">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="hexpand">True</property>
-                    <property name="spacing">10</property>
-                    <child>
-                      <object class="GtkButton" id="display-mapping-button">
-                        <property name="label" translatable="yes">Map to Monitor…</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="valign">center</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="map-buttons-button">
-                        <property name="label" translatable="yes">Map Buttons…</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="valign">center</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="button-calibrate">
-                        <property name="label" translatable="yes">Calibrate…</property>
-                        <property name="use_action_appearance">False</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="valign">center</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">2</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLinkButton" id="display-link">
-                    <property name="label" translatable="yes">Adjust display resolution</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="halign">end</property>
-                    <property name="valign">start</property>
-                    <property name="relief">none</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">3</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLinkButton" id="mouse-link">
-                    <property name="label" translatable="yes">Adjust mouse settings</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="halign">end</property>
-                    <property name="valign">start</property>
-                    <property name="relief">none</property>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">3</property>
                   </packing>
                 </child>
                 <child>
@@ -378,6 +286,93 @@
                         <property name="top_attach">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkBox" id="tablet-buttons-box">
+                        <property name="visible">True</property>
+                        <property name="halign">start</property>
+                        <property name="spacing">10</property>
+                        <child>
+                          <object class="GtkButton" id="display-mapping-button">
+                            <property name="label" translatable="yes">Map to Monitor…</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="pack_type">end</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="map-buttons-button">
+                            <property name="label" translatable="yes">Map Buttons…</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="pack_type">end</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkButton" id="button-calibrate">
+                            <property name="label" translatable="yes">Calibrate…</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                          </object>
+                          <packing>
+                            <property name="pack_type">end</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLinkButton" id="mouse-link">
+                        <property name="label" translatable="yes">Adjust mouse settings</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="halign">start</property>
+                        <property name="valign">start</property>
+                        <property name="relief">none</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLinkButton" id="display-link">
+                        <property name="label" translatable="yes">Adjust display resolution</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="halign">start</property>
+                        <property name="valign">start</property>
+                        <property name="relief">none</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -400,9 +395,6 @@
                     <property name="top_attach">0</property>
                   </packing>
                 </child>
-                <child>
-                  <placeholder/>
-                </child>
               </object>
               <packing>
                 <property name="position">1</property>


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