[libdazzle] menu-button: use CSS to tweak image margins



commit fb65a501540b67e1a8b4bc11f1ae7ff12991d838
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 9 18:52:31 2017 -0700

    menu-button: use CSS to tweak image margins

 data/themes/shared/shared-menus.css |    7 +++++++
 src/menus/dzl-menu-button.c         |    6 ------
 src/menus/dzl-menu-button.ui        |    6 ++++++
 3 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/data/themes/shared/shared-menus.css b/data/themes/shared/shared-menus.css
index d0d6f8e..f0a5f9b 100644
--- a/data/themes/shared/shared-menus.css
+++ b/data/themes/shared/shared-menus.css
@@ -1,3 +1,10 @@
+button.dzlmenubutton > box {
+  margin-left: 3px;
+  margin-right: 3px;
+}
+button.dzlmenubutton > box > image.arrow {
+  margin-left: 3px;
+}
 popover.dzlmenubutton > box {
   margin: 18px 15px 15px 12px;
 }
diff --git a/src/menus/dzl-menu-button.c b/src/menus/dzl-menu-button.c
index e024cb8..c900f6c 100644
--- a/src/menus/dzl-menu-button.c
+++ b/src/menus/dzl-menu-button.c
@@ -452,15 +452,9 @@ dzl_menu_button_set_show_arrow (DzlMenuButton *self,
                                 gboolean       show_arrow)
 {
   DzlMenuButtonPrivate *priv = dzl_menu_button_get_instance_private (self);
-  GtkWidget *child;
 
   g_return_if_fail (DZL_IS_MENU_BUTTON (self));
 
-  child = gtk_bin_get_child (GTK_BIN (self));
-  g_object_set (child,
-                "margin-start", show_arrow ? 3 : 0,
-                "margin-end", show_arrow ? 3 : 0,
-                NULL);
   gtk_widget_set_visible (GTK_WIDGET (priv->pan_down_image), show_arrow);
   g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SHOW_ARROW]);
 }
diff --git a/src/menus/dzl-menu-button.ui b/src/menus/dzl-menu-button.ui
index a159ff5..51f3975 100644
--- a/src/menus/dzl-menu-button.ui
+++ b/src/menus/dzl-menu-button.ui
@@ -13,6 +13,9 @@
   </object>
   <template class="DzlMenuButton" parent="GtkMenuButton">
     <property name="popover">popover</property>
+    <style>
+      <class name="dzlmenubutton"/>
+    </style>
     <child>
       <object class="GtkBox">
         <property name="halign">center</property>
@@ -30,6 +33,9 @@
         <child>
           <object class="GtkImage" id="pan_down_image">
             <property name="icon-name">pan-down-symbolic</property>
+            <style>
+              <class name="arrow"/>
+            </style>
           </object>
         </child>
       </object>


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