[gtk+] menu: Fix compiler warnings
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] menu: Fix compiler warnings
- Date: Tue, 2 Jun 2015 13:11:15 +0000 (UTC)
commit a0dddbbafae2d99fa0d4672d8582414b3a186e1a
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 30 21:27:45 2015 -0400
menu: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
gtk/gtkmenu.c | 18 +++++++-----------
gtk/gtkmenuitem.c | 1 -
gtk/gtkmenutracker.c | 18 +++++++++---------
3 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 6862ca9..7219953 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -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)
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 773f170..d025125 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -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);
diff --git a/gtk/gtkmenutracker.c b/gtk/gtkmenutracker.c
index c7125b7..2d39319 100644
--- a/gtk/gtkmenutracker.c
+++ b/gtk/gtkmenutracker.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]