[gtk+] menuitem: deprecate arrow-scaling style property



commit 7959c3fb6ea7f4e7b360a5832b717926c2574fb0
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 10a0168..e1192ed 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 d1a965a..db608cd 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 b6b081e..9d8ecad 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.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/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index 64eba19..ecfed3e 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -2132,7 +2132,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]