[gtk+] GtkModelButton: Remove some margins



commit 0b96b8a1eef68a6110ceac10208a2c29b807cd56
Author: Timm Bäder <mail baedert org>
Date:   Thu Jan 7 18:27:11 2016 +0100

    GtkModelButton: Remove some margins
    
    Now that we can use margins from css for this, remove the margins we set
    in code and use css instead.

 gtk/gtkmenusectionbox.c                  |   12 ------------
 gtk/gtkmodelbutton.c                     |    5 -----
 gtk/theme/Adwaita/_common.scss           |   20 +++++++++++++++-----
 gtk/theme/Adwaita/gtk-contained-dark.css |   22 +++++++++++++++++-----
 gtk/theme/Adwaita/gtk-contained.css      |   22 +++++++++++++++++-----
 5 files changed, 49 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index 0557bc9..2de27da 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -496,12 +496,6 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
       box->separator = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
       g_object_ref_sink (box->separator);
 
-      g_object_set (box->separator,
-                    "margin-start", 12,
-                    "margin-end", 12,
-                    "margin-top", 6,
-                    "margin-bottom", 3,
-                    NULL);
       gtk_container_add (GTK_CONTAINER (box->separator), title);
       gtk_container_add (GTK_CONTAINER (box->separator), separator);
       gtk_widget_show_all (box->separator);
@@ -511,12 +505,6 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
       box->separator = separator;
       g_object_ref_sink (box->separator);
 
-      g_object_set (box->separator,
-                    "margin-start", 12,
-                    "margin-end", 12,
-                    "margin-top", 3,
-                    "margin-bottom", 3,
-                    NULL);
       gtk_widget_show (box->separator);
     }
 
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index 50db414..adeac69 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -1209,15 +1209,10 @@ gtk_model_button_init (GtkModelButton *button)
   button->role = GTK_BUTTON_ROLE_NORMAL;
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   button->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_widget_set_margin_start (button->box, 12);
-  gtk_widget_set_margin_end (button->box, 12);
-  gtk_widget_set_margin_top (button->box, 3);
-  gtk_widget_set_margin_bottom (button->box, 3);
   gtk_widget_set_halign (button->box, GTK_ALIGN_FILL);
   gtk_widget_show (button->box);
   button->image = gtk_image_new ();
   gtk_widget_set_no_show_all (button->image, TRUE);
-  g_object_set (button->image, "margin", 4, NULL);
   button->label = gtk_label_new ("");
   gtk_widget_set_no_show_all (button->label, TRUE);
   gtk_container_add (GTK_CONTAINER (button->box), button->image);
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 74db834..d408f5c 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -728,13 +728,25 @@ toolbar.inline-toolbar toolbutton:backdrop {
 /* menu buttons */
 modelbutton.flat,
 .menuitem.button.flat {
+  min-height: 26px;
+  padding-left: 5px;
+  padding-right: 5px;
+  border-radius: 3px;
+  outline-offset: -2px;
+
   @extend %undecorated_button;
-  outline-offset: -1px;
   &:hover { background-color: mix($fg_color, $bg_color, 10%); }
   &:selected { @extend %selected_items; }
   &:backdrop, &:backdrop:hover {
     @extend %undecorated_button;
   }
+
+  // FIXME: remove the following when the checks/radios rewrite lands
+  check:last-child,
+  radio:last-child { margin-left: 8px; }
+
+  check:first-child,
+  radio:first-child { margin-right: 8px; }
 }
 
 modelbutton.flat arrow {
@@ -1630,10 +1642,6 @@ popover.background {
     transition: none;
   }
 
-  button.model.image-button {
-    padding: 0px;
-  }
-
   .csd &, & {
     &.touch-selection,
     &.magnifier {
@@ -1644,6 +1652,8 @@ popover.background {
 
     &.osd { @extend %osd; }
   }
+
+  separator { margin: 3px; }
 }
 
 /*************
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index a105948..4878937 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -1227,10 +1227,24 @@ notebook tab .titlebar button.titlebutton,
 /* menu buttons */
 modelbutton.flat,
 .menuitem.button.flat {
-  outline-offset: -1px; }
+  min-height: 26px;
+  padding-left: 5px;
+  padding-right: 5px;
+  border-radius: 3px;
+  outline-offset: -2px; }
   modelbutton.flat:hover,
   .menuitem.button.flat:hover {
     background-color: #4b5150; }
+  modelbutton.flat check:last-child,
+  modelbutton.flat radio:last-child,
+  .menuitem.button.flat check:last-child,
+  .menuitem.button.flat radio:last-child {
+    margin-left: 8px; }
+  modelbutton.flat check:first-child,
+  modelbutton.flat radio:first-child,
+  .menuitem.button.flat check:first-child,
+  .menuitem.button.flat radio:first-child {
+    margin-right: 8px; }
 
 modelbutton.flat arrow {
   background: none; }
@@ -2216,12 +2230,10 @@ popover.background {
   .titlebar popover.background button.titlebutton:hover {
     text-shadow: none;
     transition: none; }
-  popover.background button.model.image-button, popover.background headerbar button.model.titlebutton, 
headerbar popover.background button.model.titlebutton,
-  popover.background .titlebar button.model.titlebutton,
-  .titlebar popover.background button.model.titlebutton {
-    padding: 0px; }
   .csd popover.background.touch-selection, .csd popover.background.magnifier, 
popover.background.touch-selection, popover.background.magnifier {
     border: 1px solid rgba(255, 255, 255, 0.1); }
+  popover.background separator {
+    margin: 3px; }
 
 /*************
  * Notebooks *
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index b2b2302..c075f6c 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -1227,10 +1227,24 @@ notebook tab .titlebar button.titlebutton,
 /* menu buttons */
 modelbutton.flat,
 .menuitem.button.flat {
-  outline-offset: -1px; }
+  min-height: 26px;
+  padding-left: 5px;
+  padding-right: 5px;
+  border-radius: 3px;
+  outline-offset: -2px; }
   modelbutton.flat:hover,
   .menuitem.button.flat:hover {
     background-color: #d5d6d5; }
+  modelbutton.flat check:last-child,
+  modelbutton.flat radio:last-child,
+  .menuitem.button.flat check:last-child,
+  .menuitem.button.flat radio:last-child {
+    margin-left: 8px; }
+  modelbutton.flat check:first-child,
+  modelbutton.flat radio:first-child,
+  .menuitem.button.flat check:first-child,
+  .menuitem.button.flat radio:first-child {
+    margin-right: 8px; }
 
 modelbutton.flat arrow {
   background: none; }
@@ -2222,12 +2236,10 @@ popover.background {
   .titlebar popover.background button.titlebutton:hover {
     text-shadow: none;
     transition: none; }
-  popover.background button.model.image-button, popover.background headerbar button.model.titlebutton, 
headerbar popover.background button.model.titlebutton,
-  popover.background .titlebar button.model.titlebutton,
-  .titlebar popover.background button.model.titlebutton {
-    padding: 0px; }
   .csd popover.background.touch-selection, .csd popover.background.magnifier, 
popover.background.touch-selection, popover.background.magnifier {
     border: 1px solid rgba(255, 255, 255, 0.1); }
+  popover.background separator {
+    margin: 3px; }
 
 /*************
  * Notebooks *


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