menu: Fix compiler warnings

Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
This commit is contained in:
Matthias Clasen 2015-05-30 21:27:45 -04:00
parent 9545c01764
commit a0dddbbafa
3 changed files with 16 additions and 21 deletions

View File

@ -2847,10 +2847,8 @@ gtk_menu_size_allocate (GtkWidget *widget,
x = border_width + padding.left;
y = border_width + padding.top;
width = allocation->width - (2 * border_width) -
padding.left - padding.right;
height = allocation->height - (2 * border_width) -
padding.top - padding.bottom;
width = allocation->width - (2 * border_width) - padding.left - padding.right;
height = allocation->height - (2 * border_width) - padding.top - padding.bottom;
if (menu_shell->priv->active)
gtk_menu_scroll_to (menu, priv->scroll_offset);
@ -2889,7 +2887,6 @@ gtk_menu_size_allocate (GtkWidget *widget,
if (gtk_widget_get_visible (child))
{
gint i;
gint l, r, t, b;
get_effective_child_attach (child, &l, &r, &t, &b);
@ -2926,15 +2923,14 @@ gtk_menu_size_allocate (GtkWidget *widget,
/* Resize the item window */
if (gtk_widget_get_realized (widget))
{
gint i;
gint width, height;
gint w, h;
height = 0;
h = 0;
for (i = 0; i < gtk_menu_get_n_rows (menu); i++)
height += priv->heights[i];
h += priv->heights[i];
width = gtk_menu_get_n_columns (menu) * base_width;
gdk_window_resize (priv->bin_window, width, height);
w = gtk_menu_get_n_columns (menu) * base_width;
gdk_window_resize (priv->bin_window, w, h);
}
if (priv->tearoff_active)

View File

@ -875,7 +875,6 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
if (child != NULL && gtk_widget_get_visible (child))
{
GtkMenuItemPrivate *priv = menu_item->priv;
gint child_min, child_nat;
gtk_widget_get_preferred_width (child, &child_min, &child_nat);

View File

@ -178,15 +178,15 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
if (subsection)
{
gboolean could_have_separator;
gboolean separator;
could_have_separator = (section->with_separators && n_items > 0) || subsection->separator_label;
separator = (section->with_separators && n_items > 0) || subsection->separator_label;
/* Only pass the parent_model and parent_index in case they may be used to create the separator. */
n_items += gtk_menu_tracker_section_sync_separators (subsection, tracker, offset + n_items,
could_have_separator,
could_have_separator ? section->model : NULL,
could_have_separator ? i : 0);
separator,
separator ? section->model : NULL,
separator ? i : 0);
}
else
n_items++;
@ -199,11 +199,11 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
if (should_have_separator > section->has_separator)
{
/* Add a separator */
GtkMenuTrackerItem *item;
GtkMenuTrackerItem *separator;
item = _gtk_menu_tracker_item_new (tracker->observable, parent_model, parent_index, FALSE, NULL, TRUE);
(* tracker->insert_func) (item, offset, tracker->user_data);
g_object_unref (item);
separator = _gtk_menu_tracker_item_new (tracker->observable, parent_model, parent_index, FALSE, NULL, TRUE);
(* tracker->insert_func) (separator, offset, tracker->user_data);
g_object_unref (separator);
section->has_separator = TRUE;
}