Commit d9fcc4c6 authored by Matthias Clasen's avatar Matthias Clasen

Silence new gcc warnings

gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
parent 94c4a312
This diff is collapsed.
......@@ -418,7 +418,6 @@ gtk_button_box_child_requisition (GtkWidget *widget,
gint **widths,
gint **heights)
{
GtkButtonBoxPrivate *priv;
GtkButtonBox *bbox;
GList *children, *list;
gint nchildren;
......@@ -439,7 +438,6 @@ gtk_button_box_child_requisition (GtkWidget *widget,
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
bbox = GTK_BUTTON_BOX (widget);
priv = bbox->priv;
homogeneous = gtk_box_get_homogeneous (GTK_BOX (widget));
......
......@@ -1566,7 +1566,6 @@ _gtk_button_paint (GtkButton *button,
gint focus_width;
gint focus_pad;
GtkAllocation allocation;
GdkWindow *window;
GtkStyleContext *context;
widget = GTK_WIDGET (button);
......@@ -1582,7 +1581,6 @@ _gtk_button_paint (GtkButton *button,
NULL);
gtk_widget_get_allocation (widget, &allocation);
window = gtk_widget_get_window (widget);
x = 0;
y = 0;
......
This diff is collapsed.
......@@ -3574,8 +3574,7 @@ gtk_cell_area_request_renderer (GtkCellArea *area,
gint *minimum_size,
gint *natural_size)
{
GtkCellAreaPrivate *priv;
gint focus_line_width;
gint focus_line_width;
g_return_if_fail (GTK_IS_CELL_AREA (area));
g_return_if_fail (GTK_IS_CELL_RENDERER (renderer));
......@@ -3583,8 +3582,6 @@ gtk_cell_area_request_renderer (GtkCellArea *area,
g_return_if_fail (minimum_size != NULL);
g_return_if_fail (natural_size != NULL);
priv = area->priv;
gtk_widget_style_get (widget, "focus-line-width", &focus_line_width, NULL);
focus_line_width *= 2;
......
......@@ -744,14 +744,12 @@ allocate_for_orientation (GtkCellAreaBoxContext *context,
GtkCellAreaBoxContextPrivate *priv = context->priv;
GtkCellAreaBoxAllocation *allocs;
GtkRequestedSize *sizes;
GArray *array;
gint n_expand_groups = 0;
gint i, n_groups, position, vis_position;
gint extra_size, extra_extra;
gint avail_size = size;
sizes = _gtk_cell_area_box_context_get_requests (context, area, orientation, for_size, &n_groups);
array = get_array (context, orientation, for_size);
n_expand_groups = count_expand_groups (context);
/* First start by naturally allocating space among groups */
......
......@@ -1113,7 +1113,7 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
*
* Checks whether the cell renderer can do something when activated.
*
* Returns: %TRUE if the cell renderer can do anything when activated.
* Returns: %TRUE if the cell renderer can do anything when activated
*
* Since: 3.0
*/
......@@ -1126,9 +1126,9 @@ gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
priv = cell->priv;
return (cell->priv->visible &&
(cell->priv->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
cell->priv->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE));
return (priv->visible &&
(priv->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
priv->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE));
}
......
......@@ -191,14 +191,12 @@ gtk_cell_renderer_spinner_update_size (GtkCellRendererSpinner *cell,
{
GtkCellRendererSpinnerPrivate *priv = cell->priv;
GdkScreen *screen;
GtkIconTheme *icon_theme;
GtkSettings *settings;
if (cell->priv->old_icon_size == cell->priv->icon_size)
if (priv->old_icon_size == priv->icon_size)
return;
screen = gtk_widget_get_screen (GTK_WIDGET (widget));
icon_theme = gtk_icon_theme_get_for_screen (screen);
settings = gtk_settings_get_for_screen (screen);
if (!gtk_icon_size_lookup_for_settings (settings, priv->icon_size, &priv->size, NULL))
......
......@@ -2109,14 +2109,14 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
gint *minimum_size,
gint *natural_size)
{
GtkCellRendererTextPrivate *priv;
GtkCellRendererTextPrivate *priv;
GtkCellRendererText *celltext;
GtkStyle *style;
PangoLayout *layout;
PangoContext *context;
PangoFontMetrics *metrics;
PangoRectangle rect;
gint char_width, digit_width, char_pixels, text_width, ellipsize_chars, xpad;
gint char_width, text_width, ellipsize_chars, xpad;
gint min_width, nat_width;
/* "width-chars" Hard-coded minimum width:
......@@ -2145,11 +2145,9 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
/* Fetch the average size of a charachter */
context = pango_layout_get_context (layout);
metrics = pango_context_get_metrics (context, style->font_desc,
pango_context_get_language (context));
pango_context_get_language (context));
char_width = pango_font_metrics_get_approximate_char_width (metrics);
digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
char_pixels = MAX (char_width, digit_width);
pango_font_metrics_unref (metrics);
g_object_unref (layout);
......@@ -2159,12 +2157,11 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
ellipsize_chars = 3;
else
ellipsize_chars = 0;
if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->width_chars > 0)
min_width =
xpad * 2 +
MIN (PANGO_PIXELS_CEIL (text_width),
(PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars)));
min_width = xpad * 2 +
MIN (PANGO_PIXELS_CEIL (text_width),
(PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars)));
/* If no width-chars set, minimum for wrapping text will be the wrap-width */
else if (priv->wrap_width > -1)
min_width = xpad * 2 + rect.x + MIN (PANGO_PIXELS_CEIL (text_width), priv->wrap_width);
......@@ -2172,14 +2169,13 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
min_width = xpad * 2 + rect.x + PANGO_PIXELS_CEIL (text_width);
if (priv->width_chars > 0)
nat_width = xpad * 2 +
nat_width = xpad * 2 +
MAX ((PANGO_PIXELS (char_width) * priv->width_chars), PANGO_PIXELS_CEIL (text_width));
else
nat_width = xpad * 2 + PANGO_PIXELS_CEIL (text_width);
nat_width = MAX (nat_width, min_width);
if (priv->max_width_chars > 0)
{
gint max_width = xpad * 2 + PANGO_PIXELS (char_width) * priv->max_width_chars;
......@@ -2202,14 +2198,12 @@ gtk_cell_renderer_text_get_preferred_height_for_width (GtkCellRenderer *cell,
gint *minimum_height,
gint *natural_height)
{
GtkCellRendererTextPrivate *priv;
GtkCellRendererText *celltext;
PangoLayout *layout;
gint text_height, xpad, ypad;
GtkCellRendererText *celltext;
PangoLayout *layout;
gint text_height, xpad, ypad;
celltext = GTK_CELL_RENDERER_TEXT (cell);
priv = celltext->priv;
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
......
......@@ -506,9 +506,6 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item,
priv->always_show_toggle ||
(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_PRELIGHT))
{
GdkWindow *window;
window = gtk_widget_get_window (widget);
gtk_style_context_save (context);
if (priv->inconsistent)
......
This diff is collapsed.
This diff is collapsed.
......@@ -1323,14 +1323,12 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
GtkWidgetPath *path)
{
GtkCssProvider *css_provider;
GtkCssProviderPrivate *priv;
GtkStyleProperties *props;
GArray *priority_info;
guint i;
css_provider = GTK_CSS_PROVIDER (provider);
props = gtk_style_properties_new ();
priv = css_provider->priv;
css_provider_dump_symbolic_colors (css_provider, props);
priority_info = css_provider_get_selectors (css_provider, path);
......
......@@ -245,10 +245,8 @@ static void
gtk_custom_paper_unix_dialog_class_init (GtkCustomPaperUnixDialogClass *class)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
object_class->finalize = gtk_custom_paper_unix_dialog_finalize;
......
......@@ -3933,7 +3933,6 @@ gtk_entry_motion_notify (GtkWidget *widget,
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = NULL;
GdkDragContext *context;
gint tmp_pos;
gint i;
......@@ -3956,11 +3955,11 @@ gtk_entry_motion_notify (GtkWidget *widget,
{
icon_info->in_drag = TRUE;
icon_info->pressed = FALSE;
context = gtk_drag_begin (widget,
icon_info->target_list,
icon_info->actions,
1,
(GdkEvent*)event);
gtk_drag_begin (widget,
icon_info->target_list,
icon_info->actions,
1,
(GdkEvent*)event);
}
return TRUE;
......@@ -3970,7 +3969,7 @@ gtk_entry_motion_notify (GtkWidget *widget,
if (priv->mouse_cursor_obscured)
{
GdkCursor *cursor;
cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_XTERM);
gdk_window_set_cursor (priv->text_area, cursor);
g_object_unref (cursor);
......
......@@ -1723,21 +1723,19 @@ model_add_special (GtkFileChooserButton *button)
static void
model_add_volumes (GtkFileChooserButton *button,
GSList *volumes)
GSList *volumes)
{
GtkListStore *store;
gint pos;
gboolean local_only;
GtkFileSystem *file_system;
GSList *l;
if (!volumes)
return;
store = GTK_LIST_STORE (button->priv->model);
pos = model_get_type_position (button, ROW_TYPE_VOLUME);
local_only = gtk_file_chooser_get_local_only (GTK_FILE_CHOOSER (button->priv->dialog));
file_system = button->priv->fs;
for (l = volumes; l; l = l->next)
{
......@@ -1749,13 +1747,13 @@ model_add_volumes (GtkFileChooserButton *button,
volume = l->data;
if (local_only)
{
if (_gtk_file_system_volume_is_mounted (volume))
{
GFile *base_file;
{
if (_gtk_file_system_volume_is_mounted (volume))
{
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
if (base_file != NULL)
base_file = _gtk_file_system_volume_get_root (volume);
if (base_file != NULL)
{
if (!g_file_is_native (base_file))
{
......@@ -1765,26 +1763,26 @@ model_add_volumes (GtkFileChooserButton *button,
else
g_object_unref (base_file);
}
}
}
}
}
pixbuf = _gtk_file_system_volume_render_icon (volume,
GTK_WIDGET (button),
button->priv->icon_size,
NULL);
GTK_WIDGET (button),
button->priv->icon_size,
NULL);
display_name = _gtk_file_system_volume_get_display_name (volume);
gtk_list_store_insert (store, &iter, pos);
gtk_list_store_set (store, &iter,
ICON_COLUMN, pixbuf,
DISPLAY_NAME_COLUMN, display_name,
TYPE_COLUMN, ROW_TYPE_VOLUME,
DATA_COLUMN, _gtk_file_system_volume_ref (volume),
IS_FOLDER_COLUMN, TRUE,
-1);
ICON_COLUMN, pixbuf,
DISPLAY_NAME_COLUMN, display_name,
TYPE_COLUMN, ROW_TYPE_VOLUME,
DATA_COLUMN, _gtk_file_system_volume_ref (volume),
IS_FOLDER_COLUMN, TRUE,
-1);
if (pixbuf)
g_object_unref (pixbuf);
g_object_unref (pixbuf);
g_free (display_name);
button->priv->n_volumes++;
......@@ -2278,13 +2276,11 @@ static void
update_label_and_image (GtkFileChooserButton *button)
{
GtkFileChooserButtonPrivate *priv = button->priv;
GdkPixbuf *pixbuf;
gchar *label_text;
GSList *files;
files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (priv->dialog));
label_text = NULL;
pixbuf = NULL;
if (priv->update_button_cancellable)
{
......@@ -2301,51 +2297,53 @@ update_label_and_image (GtkFileChooserButton *button)
volume = _gtk_file_system_get_volume_for_file (priv->fs, file);
if (volume)
{
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
if (base_file && g_file_equal (base_file, file))
{
label_text = _gtk_file_system_volume_get_display_name (volume);
pixbuf = _gtk_file_system_volume_render_icon (volume,
GTK_WIDGET (button),
priv->icon_size,
NULL);
}
if (base_file)
g_object_unref (base_file);
_gtk_file_system_volume_unref (volume);
if (label_text)
goto out;
}
{
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
if (base_file && g_file_equal (base_file, file))
{
GdkPixbuf *pixbuf;
label_text = _gtk_file_system_volume_get_display_name (volume);
pixbuf = _gtk_file_system_volume_render_icon (volume,
GTK_WIDGET (button),
priv->icon_size,
NULL);
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
if (pixbuf)
g_object_unref (pixbuf);
}
if (base_file)
g_object_unref (base_file);
_gtk_file_system_volume_unref (volume);
if (label_text)
goto out;
}
if (g_file_is_native (file))
{
priv->update_button_cancellable =
_gtk_file_system_get_info (priv->fs, file,
"standard::icon,standard::display-name",
update_label_get_info_cb,
g_object_ref (button));
}
{
priv->update_button_cancellable =
_gtk_file_system_get_info (priv->fs, file,
"standard::icon,standard::display-name",
update_label_get_info_cb,
g_object_ref (button));
}
else
{
GdkPixbuf *pixbuf;
label_text = _gtk_file_system_get_bookmark_label (button->priv->fs, file);
pixbuf = gtk_icon_theme_load_icon (get_icon_theme (GTK_WIDGET (priv->image)),
"text-x-generic",
priv->icon_size, 0, NULL);
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
if (pixbuf)
g_object_unref (pixbuf);
}
{
GdkPixbuf *pixbuf;
label_text = _gtk_file_system_get_bookmark_label (button->priv->fs, file);
pixbuf = gtk_icon_theme_load_icon (get_icon_theme (GTK_WIDGET (priv->image)),
"text-x-generic",
priv->icon_size, 0, NULL);
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
if (pixbuf)
g_object_unref (pixbuf);
}
}
out:
g_slist_foreach (files, (GFunc) g_object_unref, NULL);
......
This diff is collapsed.
......@@ -667,11 +667,13 @@ typedef enum {
COMPLETE_BUT_NOT_UNIQUE /* completion inserted, it is a complete name but not unique */
} CommonPrefixResult;
/* Finds a common prefix based on the contents of the entry and mandatorily appends it */
/* Finds a common prefix based on the contents of the entry
* and mandatorily appends it
*/
static CommonPrefixResult
append_common_prefix (GtkFileChooserEntry *chooser_entry,
gboolean highlight,
gboolean show_errors)
gboolean highlight,
gboolean show_errors)
{
gchar *common_prefix;
GFile *unique_file;
......@@ -689,16 +691,16 @@ append_common_prefix (GtkFileChooserEntry *chooser_entry,
error = NULL;
if (!find_common_prefix (chooser_entry, &common_prefix, &unique_file, &is_complete_not_unique, &prefix_expands_the_file_part, &error))
{
/* If the user types an incomplete hostname ("http://foo" without a slash
* after that), it's not an error. We just don't want to pop up a
* meaningless completion window in that state.
/* If the user types an incomplete hostname ("http://foo" without
* a slash after that), it's not an error. We just don't want to
* pop up a meaningless completion window in that state.
*/
if (!g_error_matches (error, GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR_INCOMPLETE_HOSTNAME)
&& show_errors)
{
beep (chooser_entry);
pop_up_completion_feedback (chooser_entry, _("Invalid path"));
}
&& show_errors)
{
beep (chooser_entry);
pop_up_completion_feedback (chooser_entry, _("Invalid path"));
}
g_error_free (error);
......@@ -710,85 +712,84 @@ append_common_prefix (GtkFileChooserEntry *chooser_entry,
if (unique_file)
{
if (!char_after_cursor_is_directory_separator (chooser_entry))
{
gboolean appended;
common_prefix = maybe_append_separator_to_file (chooser_entry,
unique_file,
common_prefix,
&appended);
if (appended)
prefix_expands_the_file_part = TRUE;
}
{
gboolean appended;
common_prefix = maybe_append_separator_to_file (chooser_entry,
unique_file,
common_prefix,
&appended);
if (appended)
prefix_expands_the_file_part = TRUE;
}
g_object_unref (unique_file);
if (prefix_expands_the_file_part)
result = COMPLETED_UNIQUE;
result = COMPLETED_UNIQUE;
else
result = NOTHING_INSERTED_UNIQUE;
result = NOTHING_INSERTED_UNIQUE;
have_result = TRUE;
}
else
{
if (is_complete_not_unique)
{
result = COMPLETE_BUT_NOT_UNIQUE;
have_result = TRUE;
}
{
result = COMPLETE_BUT_NOT_UNIQUE;
have_result = TRUE;
}
}
if (common_prefix)
{
gint cursor_pos;
gint common_prefix_len;
gint pos;
cursor_pos = gtk_editable_get_position (GTK_EDITABLE (chooser_entry));
common_prefix_len = g_utf8_strlen (common_prefix, -1);
pos = chooser_entry->file_part_pos;
if (prefix_expands_the_file_part)
{
chooser_entry->in_change = TRUE;
gtk_editable_delete_text (GTK_EDITABLE (chooser_entry),
pos, cursor_pos);
gtk_editable_insert_text (GTK_EDITABLE (chooser_entry),
common_prefix, -1,
&pos);
chooser_entry->in_change = FALSE;
if (highlight)
{
gtk_editable_select_region (GTK_EDITABLE (chooser_entry),
cursor_pos,
pos); /* equivalent to cursor_pos + common_prefix_len); */
chooser_entry->has_completion = TRUE;
}
else
gtk_editable_set_position (GTK_EDITABLE (chooser_entry), pos);
}
{
chooser_entry->in_change = TRUE;
gtk_editable_delete_text (GTK_EDITABLE (chooser_entry),
pos, cursor_pos);
gtk_editable_insert_text (GTK_EDITABLE (chooser_entry),
common_prefix, -1,
&pos);
chooser_entry->in_change = FALSE;
if (highlight)
{
/* equivalent to cursor_pos + common_prefix_len); */
gtk_editable_select_region (GTK_EDITABLE (chooser_entry),
cursor_pos,
pos);
chooser_entry->has_completion = TRUE;
}
else
gtk_editable_set_position (GTK_EDITABLE (chooser_entry), pos);
}
else if (!have_result)
{
result = NOTHING_INSERTED_COMPLETE;
have_result = TRUE;
}
{
result = NOTHING_INSERTED_COMPLETE;
have_result = TRUE;
}
g_free (common_prefix);
if (have_result)
return result;
return result;
else
return COMPLETED;
return COMPLETED;
}
else
{
if (have_result)
return result;
return result;
else
return NO_MATCH;
return NO_MATCH;
}
}
......
......@@ -1150,17 +1150,18 @@ gtk_font_selection_get_font_description (GtkFontSelection *fontsel)
return font_desc;
}
/* This sets the font in the preview entry to the selected font, and tries to
make sure that the preview entry is a reasonable size, i.e. so that the
text can be seen with a bit of space to spare. But it tries to avoid
resizing the entry every time the font changes.
This also used to shrink the preview if the font size was decreased, but
that made it awkward if the user wanted to resize the window themself. */
/* This sets the font in the preview entry to the selected font,
* and tries to make sure that the preview entry is a reasonable
* size, i.e. so that the text can be seen with a bit of space to
* spare. But it tries to avoid resizing the entry every time the
* font changes. This also used to shrink the preview if the font
* size was decreased, but that made it awkward if the user wanted
* to resize the window themself.
*/
static void
gtk_font_selection_update_preview (GtkFontSelection *fontsel)
{
GtkFontSelectionPrivate *priv = fontsel->priv;
GtkStyleContext *context;
gint new_height;
GtkRequisition old_requisition, new_requisition;
GtkWidget *preview_entry = priv->preview_entry;
......@@ -1168,18 +1169,17 @@ gtk_font_selection_update_preview (GtkFontSelection *fontsel)
gtk_widget_get_preferred_size (preview_entry, &old_requisition, NULL);
context = gtk_widget_get_style_context (preview_entry);
gtk_widget_override_font (preview_entry,
gtk_font_selection_get_font_description (fontsel));
gtk_widget_get_preferred_size (preview_entry, &new_requisition, NULL);
/* We don't ever want to be over MAX_PREVIEW_HEIGHT pixels high. */
new_height = CLAMP (new_requisition.height, INITIAL_PREVIEW_HEIGHT, MAX_PREVIEW_HEIGHT);
if (new_height > old_requisition.height || new_height < old_requisition.height - 30)
gtk_widget_set_size_request (preview_entry, -1, new_height);
/* This sets the preview text, if it hasn't been set already. */
text = gtk_entry_get_text (GTK_ENTRY (preview_entry));
if (strlen (text) == 0)
......
This diff is collapsed.
......@@ -795,8 +795,7 @@ gtk_hsv_motion (GtkWidget *widget,
{
GtkHSV *hsv = GTK_HSV (widget);
GtkHSVPrivate *priv = hsv->priv;
GdkModifierType mods;
double x, y;
gdouble x, y;
if (priv->mode == DRAG_NONE)
return FALSE;
......@@ -804,7 +803,6 @@ gtk_hsv_motion (GtkWidget *widget,
gdk_event_request_motions (event);
x = event->x;
y = event->y;
mods = event->state;
if (priv->mode == DRAG_H)
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -187,11 +187,7 @@ gtk_info_bar_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GtkInfoBar *info_bar;
GtkInfoBarPrivate *priv;
info_bar = GTK_INFO_BAR (object);
priv = info_bar->priv;
GtkInfoBar *info_bar = GTK_INFO_BAR (object);
switch (prop_id)
{
......@@ -210,11 +206,7 @@ gtk_info_bar_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GtkInfoBar *info_bar;