[gtk+] menubar: Ignore the shadow-type style property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] menubar: Ignore the shadow-type style property
- Date: Mon, 16 Nov 2015 12:22:42 +0000 (UTC)
commit 3aa9293258369db6a3ad6b4c5867d99386768f98
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Nov 16 06:14:54 2015 -0500
menubar: Ignore the shadow-type style property
The border can be controlled with regular CSS, so deprecate
and ignore this style property.
gtk/gtkmenubar.c | 69 ++++++++++++++++++++++--------------------------------
1 files changed, 28 insertions(+), 41 deletions(-)
---
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 6066b2e..5155783 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -105,8 +105,6 @@ static gint gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell);
static void gtk_menu_bar_move_current (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction);
-static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
-
G_DEFINE_TYPE_WITH_PRIVATE (GtkMenuBar, gtk_menu_bar, GTK_TYPE_MENU_SHELL)
static void
@@ -214,6 +212,14 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
+ /**
+ * GtkMenuBar:shadow-type:
+ *
+ * The style of the shadow around the menubar.
+ *
+ * Deprecated: 3.20: Use CSS to determine the shadow; the value of
+ * this style property is ignored.
+ */
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("shadow-type",
P_("Shadow type"),
@@ -398,20 +404,17 @@ gtk_menu_bar_size_request (GtkWidget *widget,
*minimum += border_width * 2;
*natural += border_width * 2;
- if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
- {
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- *minimum += border.left + border.right;
- *natural += border.left + border.right;
- }
- else
- {
- *minimum += border.top + border.bottom;
- *natural += border.top + border.bottom;
- }
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ *minimum += border.left + border.right;
+ *natural += border.left + border.right;
+ }
+ else
+ {
+ *minimum += border.top + border.bottom;
+ *natural += border.top + border.bottom;
}
}
@@ -495,16 +498,13 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
remaining_space.height = allocation->height -
2 * border_width - border.top - border.bottom;
- if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
- {
- gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+ gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
+
+ remaining_space.x += border.left;
+ remaining_space.y += border.top;
+ remaining_space.width -= border.left + border.right;
+ remaining_space.height -= border.top + border.bottom;
- remaining_space.x += border.left;
- remaining_space.y += border.top;
- remaining_space.width -= border.left + border.right;
- remaining_space.height -= border.top + border.bottom;
- }
-
requested_sizes = g_array_new (FALSE, FALSE, sizeof (GtkRequestedSize));
if (priv->pack_direction == GTK_PACK_DIRECTION_LTR ||
@@ -636,11 +636,10 @@ gtk_menu_bar_draw (GtkWidget *widget,
gtk_widget_get_allocated_width (widget) - border * 2,
gtk_widget_get_allocated_height (widget) - border * 2);
- if (get_shadow_type (GTK_MENU_BAR (widget)) != GTK_SHADOW_NONE)
- gtk_render_frame (context, cr,
- border, border,
- gtk_widget_get_allocated_width (widget) - border * 2,
- gtk_widget_get_allocated_height (widget) - border * 2);
+ gtk_render_frame (context, cr,
+ border, border,
+ gtk_widget_get_allocated_width (widget) - border * 2,
+ gtk_widget_get_allocated_height (widget) - border * 2);
GTK_WIDGET_CLASS (gtk_menu_bar_parent_class)->draw (widget, cr);
@@ -770,18 +769,6 @@ _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
g_signal_emit_by_name (to_activate, "activate_item");
}
-static GtkShadowType
-get_shadow_type (GtkMenuBar *menubar)
-{
- GtkShadowType shadow_type = GTK_SHADOW_OUT;
-
- gtk_widget_style_get (GTK_WIDGET (menubar),
- "shadow-type", &shadow_type,
- NULL);
-
- return shadow_type;
-}
-
static gint
gtk_menu_bar_get_popup_delay (GtkMenuShell *menu_shell)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]