menubar: deprecate internal-padding style property

https://bugzilla.gnome.org/show_bug.cgi?id=689168
This commit is contained in:
Cosimo Cecchi 2012-11-27 09:54:42 -05:00
parent 1a79ee4d3e
commit ea415cd350

View File

@ -51,9 +51,6 @@
#include "gtkprivate.h" #include "gtkprivate.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#define BORDER_SPACING 0
#define DEFAULT_IPADDING 1
/* Properties */ /* Properties */
enum { enum {
PROP_0, PROP_0,
@ -219,14 +216,24 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
GTK_SHADOW_OUT, GTK_SHADOW_OUT,
GTK_PARAM_READABLE)); GTK_PARAM_READABLE));
/**
* GtkMenuBar:internal-padding:
*
* Amount of border space between the menubar shadow and the menu items
*
* Deprecated: 3.8: use the standard padding CSS property (through objects
* like #GtkStyleContext and #GtkCssProvider); the value of this style
* property is ignored.
*/
gtk_widget_class_install_style_property (widget_class, gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("internal-padding", g_param_spec_int ("internal-padding",
P_("Internal padding"), P_("Internal padding"),
P_("Amount of border space between the menubar shadow and the menu items"), P_("Amount of border space between the menubar shadow and the menu items"),
0, 0,
G_MAXINT, G_MAXINT,
DEFAULT_IPADDING, 0,
GTK_PARAM_READABLE)); GTK_PARAM_READABLE |
G_PARAM_DEPRECATED));
g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate)); g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
} }
@ -332,7 +339,6 @@ gtk_menu_bar_size_request (GtkWidget *widget,
GtkMenuShell *menu_shell; GtkMenuShell *menu_shell;
GtkWidget *child; GtkWidget *child;
GList *children; GList *children;
gint ipadding;
guint border_width; guint border_width;
gboolean use_toggle_size, use_maximize; gboolean use_toggle_size, use_maximize;
gint child_minimum, child_natural; gint child_minimum, child_natural;
@ -409,10 +415,9 @@ gtk_menu_bar_size_request (GtkWidget *widget,
*natural += border.top + border.bottom; *natural += border.top + border.bottom;
} }
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar)); border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
*minimum += (border_width + ipadding + BORDER_SPACING) * 2; *minimum += border_width * 2;
*natural += (border_width + ipadding + BORDER_SPACING) * 2; *natural += border_width * 2;
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE) if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
{ {
@ -475,7 +480,6 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
GtkWidget *child; GtkWidget *child;
GList *children; GList *children;
GtkAllocation remaining_space; GtkAllocation remaining_space;
gint ipadding;
guint border_width; guint border_width;
GArray *requested_sizes; GArray *requested_sizes;
gint toggle_size; gint toggle_size;
@ -505,23 +509,14 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
flags = gtk_widget_get_state_flags (widget); flags = gtk_widget_get_state_flags (widget);
gtk_style_context_get_padding (context, flags, &border); gtk_style_context_get_padding (context, flags, &border);
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar)); border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
remaining_space.x = (border_width + remaining_space.x = (border_width + border.left);
ipadding + remaining_space.y = (border_width + border.top);
BORDER_SPACING +
border.left);
remaining_space.y = (border_width +
ipadding +
BORDER_SPACING +
border.top);
remaining_space.width = allocation->width - remaining_space.width = allocation->width -
2 * (border_width + ipadding + BORDER_SPACING) - 2 * (border_width) - border.left - border.right;
border.left - border.right;
remaining_space.height = allocation->height - remaining_space.height = allocation->height -
2 * (border_width + ipadding + BORDER_SPACING) - 2 * (border_width) - border.top - border.bottom;
border.top - border.bottom;
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE) if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
{ {