[gtk+/wip/cosimoc/menuitem-gadget: 13/21] menuitem: deprecate arrow-scaling style property



commit 5c3dd8358d1cbeb98ce0f0c75aaf8eacb12ee570
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Dec 17 21:54:46 2015 -0800

    menuitem: deprecate arrow-scaling style property
    
    With this, we can also remove the custom measure function of the arrow
    gadget.

 gtk/gtkmenuitem.c                        |   48 +++++++-----------------------
 gtk/theme/Adwaita/_common.scss           |    2 +
 gtk/theme/Adwaita/gtk-contained-dark.css |    4 ++-
 gtk/theme/Adwaita/gtk-contained.css      |    4 ++-
 gtk/theme/HighContrast/_common.scss      |    2 +
 gtk/theme/HighContrast/gtk.css           |    4 ++-
 6 files changed, 24 insertions(+), 40 deletions(-)
---
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 6a51c12..fb86a82 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -309,41 +309,6 @@ gtk_menu_item_render_arrow (GtkCssGadget *gadget,
   return FALSE;
 }
 
-static void
-gtk_menu_item_measure_arrow (GtkCssGadget   *gadget,
-                             GtkOrientation  orientation,
-                             int             for_size,
-                             int            *minimum,
-                             int            *natural,
-                             int            *minimum_baseline,
-                             int            *natural_baseline,
-                             gpointer        data)
-{
-  GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
-  PangoContext *context;
-  PangoFontMetrics *metrics;
-  gfloat arrow_scaling;
-  gint size;
-
-  gtk_widget_style_get (widget,
-                        "arrow-scaling", &arrow_scaling,
-                        NULL);
-
-  context = gtk_widget_get_pango_context (widget);
-
-  metrics = pango_context_get_metrics (context,
-                                       pango_context_get_font_description (context),
-                                       pango_context_get_language (context));
-
-  size = arrow_scaling *
-    (PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
-                   pango_font_metrics_get_descent (metrics)));
-
-  pango_font_metrics_unref (metrics);
-
-  *minimum = *natural = size;
-}
-
 static gboolean
 gtk_menu_item_render (GtkCssGadget *gadget,
                       cairo_t      *cr,
@@ -995,12 +960,21 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
                                                              10,
                                                              GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
 
+  /**
+   * GtkMenuItem:arrow-scaling:
+   *
+   * Amount of space used up by the arrow, relative to the menu item's font
+   * size.
+   *
+   * Deprecated: 3.20: use the standard min-width/min-height CSS properties;
+   * the value of this style property is ignored.
+   */
   gtk_widget_class_install_style_property (widget_class,
                                            g_param_spec_float ("arrow-scaling",
                                                                P_("Arrow Scaling"),
                                                                P_("Amount of space used up by arrow, 
relative to the menu item's font size"),
                                                                0.0, 2.0, 0.8,
-                                                               GTK_PARAM_READABLE));
+                                                               GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
 
   /**
    * GtkMenuItem:width-chars:
@@ -1628,7 +1602,7 @@ gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
               priv->arrow_gadget =
                 gtk_css_custom_gadget_new_for_node (priv->arrow_node,
                                                     GTK_WIDGET (menu_item),
-                                                    gtk_menu_item_measure_arrow,
+                                                    NULL,
                                                     NULL,
                                                     gtk_menu_item_render_arrow,
                                                     NULL, NULL);
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index a70aa1a..a8f1a27 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1517,6 +1517,8 @@ menu,
     & arrow {
       -gtk-icon-source: -gtk-icontheme('pan-end-symbolic');
       margin-left: 10px;
+      min-height: 16px;
+      min-width: 16px;
     }
     & arrow:dir(rtl) {
       -gtk-icon-source:-gtk-icontheme('pan-end-symbolic-rtl');
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 839682b..9f13de6 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -2120,7 +2120,9 @@ menu,
     menu menuitem arrow,
     .menu menuitem arrow {
       -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
-      margin-left: 10px; }
+      margin-left: 10px;
+      min-height: 16px;
+      min-width: 16px; }
     menu menuitem arrow:dir(rtl),
     .menu menuitem arrow:dir(rtl) {
       -gtk-icon-source: -gtk-icontheme("pan-end-symbolic-rtl");
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index db985f4..b1fa942 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -2126,7 +2126,9 @@ menu,
     menu menuitem arrow,
     .menu menuitem arrow {
       -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
-      margin-left: 10px; }
+      margin-left: 10px;
+      min-height: 16px;
+      min-width: 16px; }
     menu menuitem arrow:dir(rtl),
     .menu menuitem arrow:dir(rtl) {
       -gtk-icon-source: -gtk-icontheme("pan-end-symbolic-rtl");
diff --git a/gtk/theme/HighContrast/_common.scss b/gtk/theme/HighContrast/_common.scss
index fa2aece..257fd82 100644
--- a/gtk/theme/HighContrast/_common.scss
+++ b/gtk/theme/HighContrast/_common.scss
@@ -1178,6 +1178,8 @@ menu,
     min-width: 40px;
     & arrow {
       margin-left: 10px;
+      min-height: 16px;
+      min-width: 16px;
     }
     & arrow:dir(rtl) {
       margin-right: 10px;
diff --git a/gtk/theme/HighContrast/gtk.css b/gtk/theme/HighContrast/gtk.css
index 10fa379..3b6ef36 100644
--- a/gtk/theme/HighContrast/gtk.css
+++ b/gtk/theme/HighContrast/gtk.css
@@ -1306,7 +1306,9 @@ menu,
     min-width: 40px; }
     menu menuitem arrow,
     .menu menuitem arrow {
-      margin-left: 10px; }
+      margin-left: 10px;
+      min-height: 16px;
+      min-width: 16px; }
     menu menuitem arrow:dir(rtl),
     .menu menuitem arrow:dir(rtl) {
       margin-right: 10px; }


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