Bug 322934 – Replace menu's proxy icons with empty space hiding icons

* gtk/gtkmenu.c (gtk_menu_size_request): Use consistent padding
        regardless of imagees or checks being in the menu. Also add
        padding on the right edge.
        Proposal by Luca Ferretti, patch by Jon McCann

svn path=/trunk/; revision=21745
This commit is contained in:
Matthias Clasen
2008-11-01 04:32:40 +00:00
parent 4f8f288163
commit d1c6982eaa
2 changed files with 28 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
2008-11-01 Matthias Clasen <mclasen@redhat.com>
Bug 322934 Replace menu's proxy icons with empty space hiding icons
* gtk/gtkmenu.c (gtk_menu_size_request): Use consistent padding
regardless of imagees or checks being in the menu. Also add
padding on the right edge.
Proposal by Luca Ferretti, patch by Jon McCann
2008-11-01 Matthias Clasen <mclasen@redhat.com>
Bug 412134 Add API to query style properties from the style

View File

@@ -31,6 +31,8 @@
#include "gtkaccellabel.h"
#include "gtkaccelmap.h"
#include "gtkbindings.h"
#include "gtkcheckmenuitem.h"
#include <gobject/gvaluecollector.h>
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenu.h"
@@ -2429,10 +2431,26 @@ gtk_menu_size_request (GtkWidget *widget,
priv->heights[t] = MAX (priv->heights[t], part);
}
/* if the menu doesn't include any images or check items
* reserve the space so that all menus are consistent */
if (max_toggle_size == 0)
{
guint toggle_spacing;
guint indicator_size;
gtk_style_get (widget->style,
GTK_TYPE_CHECK_MENU_ITEM,
"toggle-spacing", &toggle_spacing,
"indicator-size", &indicator_size,
NULL);
max_toggle_size = indicator_size + toggle_spacing;
}
for (i = 0; i < gtk_menu_get_n_rows (menu); i++)
requisition->height += priv->heights[i];
requisition->width += max_toggle_size + max_accel_width;
requisition->width += 2 * max_toggle_size + max_accel_width;
requisition->width *= gtk_menu_get_n_columns (menu);
gtk_widget_style_get (GTK_WIDGET (menu),