[gtk+/wip/cosimoc/menuitem-gadget: 11/21] menuitem: deprecate width-chars style property
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cosimoc/menuitem-gadget: 11/21] menuitem: deprecate width-chars style property
- Date: Sat, 19 Dec 2015 02:01:00 +0000 (UTC)
commit 9f470446c04a459695bb39f75437acf954bcd854
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Dec 17 19:24:24 2015 -0800
menuitem: deprecate width-chars style property
Instead, we can just set min-width.
gtk/gtkmenuitem.c | 30 ++++--------------------------
gtk/theme/Adwaita/_common.scss | 1 +
gtk/theme/Adwaita/gtk-contained-dark.css | 3 ++-
gtk/theme/Adwaita/gtk-contained.css | 3 ++-
gtk/theme/HighContrast/_common.scss | 6 ++++--
gtk/theme/HighContrast/gtk.css | 3 +++
6 files changed, 16 insertions(+), 30 deletions(-)
---
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 97d98f3..0d19be6 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -506,29 +506,6 @@ gtk_menu_item_accel_width_foreach (GtkWidget *widget,
data);
}
-static gint
-get_minimum_width (GtkWidget *widget)
-{
- PangoContext *context;
- PangoFontMetrics *metrics;
- gint width;
- gint width_chars;
-
- context = gtk_widget_get_pango_context (widget);
-
- metrics = pango_context_get_metrics (context,
- pango_context_get_font_description (context),
- pango_context_get_language (context));
-
- width = pango_font_metrics_get_approximate_char_width (metrics);
-
- pango_font_metrics_unref (metrics);
-
- gtk_widget_style_get (widget, "width-chars", &width_chars, NULL);
-
- return PANGO_PIXELS (width_chars * width);
-}
-
static void
gtk_menu_item_real_get_width (GtkWidget *widget,
gint *minimum_size,
@@ -560,8 +537,6 @@ gtk_menu_item_real_get_width (GtkWidget *widget,
min_width += arrow_size;
min_width += arrow_spacing;
-
- min_width = MAX (min_width, get_minimum_width (widget));
nat_width = min_width;
}
@@ -982,13 +957,16 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
* The minimum desired width of the menu item in characters.
*
* Since: 2.14
+ *
+ * Deprecated: 3.20: Use the standard CSS property min-width; the value of
+ * this style property is ignored.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("width-chars",
P_("Width in Characters"),
P_("The minimum desired width of the menu item
in characters"),
0, G_MAXINT, 12,
- GTK_PARAM_READABLE));
+ GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_MENU_ITEM_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, "menuitem");
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index c6e2a02..1032e3c 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1500,6 +1500,7 @@ menu,
& menuitem {
text-shadow: none;
padding: 4px;
+ min-width: 40px;
&:hover {
color: $selected_fg_color;
background-color: $selected_bg_color;
diff --git a/gtk/theme/Adwaita/gtk-contained-dark.css b/gtk/theme/Adwaita/gtk-contained-dark.css
index 182f2b5..b304fde 100644
--- a/gtk/theme/Adwaita/gtk-contained-dark.css
+++ b/gtk/theme/Adwaita/gtk-contained-dark.css
@@ -2100,7 +2100,8 @@ menu,
menu menuitem,
.menu menuitem {
text-shadow: none;
- padding: 4px; }
+ padding: 4px;
+ min-width: 40px; }
menu menuitem:hover,
.menu menuitem:hover {
color: #ffffff;
diff --git a/gtk/theme/Adwaita/gtk-contained.css b/gtk/theme/Adwaita/gtk-contained.css
index 6c8c539..0902716 100644
--- a/gtk/theme/Adwaita/gtk-contained.css
+++ b/gtk/theme/Adwaita/gtk-contained.css
@@ -2106,7 +2106,8 @@ menu,
menu menuitem,
.menu menuitem {
text-shadow: none;
- padding: 4px; }
+ padding: 4px;
+ min-width: 40px; }
menu menuitem:hover,
.menu menuitem:hover {
color: #ffffff;
diff --git a/gtk/theme/HighContrast/_common.scss b/gtk/theme/HighContrast/_common.scss
index 28f9e7a..9e243cb 100644
--- a/gtk/theme/HighContrast/_common.scss
+++ b/gtk/theme/HighContrast/_common.scss
@@ -1173,9 +1173,11 @@ menu,
&.arrow { -gtk-icon-source: -gtk-icontheme('pan-end-symbolic'); }
&.arrow:dir(rtl) { -gtk-icon-source: -gtk-icontheme('pan-end-symbolic-rtl'); }
}
-}
-
+ menuitem {
+ min-width: 40px;
+ }
+}
/***************
* Popovers *
diff --git a/gtk/theme/HighContrast/gtk.css b/gtk/theme/HighContrast/gtk.css
index fe5145e..7744f91 100644
--- a/gtk/theme/HighContrast/gtk.css
+++ b/gtk/theme/HighContrast/gtk.css
@@ -1301,6 +1301,9 @@ menu,
menu .menuitem.arrow:dir(rtl),
.menu .menuitem.arrow:dir(rtl) {
-gtk-icon-source: -gtk-icontheme("pan-end-symbolic-rtl"); }
+ menu menuitem,
+ .menu menuitem {
+ min-width: 40px; }
/***************
* Popovers *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]