From 508a44a0df2e3c5a4e470bb9384c7108aced8a9c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 20 Sep 2009 22:53:58 -0400 Subject: [PATCH] Whitespace fixes --- gtk/gtkiconfactory.c | 474 +++++++++++++++++++++---------------------- 1 file changed, 230 insertions(+), 244 deletions(-) diff --git a/gtk/gtkiconfactory.c b/gtk/gtkiconfactory.c index 6578da8615..e0f7f1bf32 100644 --- a/gtk/gtkiconfactory.c +++ b/gtk/gtkiconfactory.c @@ -21,7 +21,7 @@ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * file for a list of people on the GTK+ Team. See the ChangeLog * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ #include "config.h" @@ -54,7 +54,7 @@ typedef enum { struct _GtkIconSource { GtkIconSourceType type; - + union { gchar *icon_name; gchar *filename; @@ -126,7 +126,7 @@ static void gtk_icon_factory_class_init (GtkIconFactoryClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - + object_class->finalize = gtk_icon_factory_finalize; } @@ -150,11 +150,11 @@ gtk_icon_factory_finalize (GObject *object) GtkIconFactory *factory = GTK_ICON_FACTORY (object); all_icon_factories = g_slist_remove (all_icon_factories, factory); - + g_hash_table_foreach (factory->icons, free_icon_set, NULL); - + g_hash_table_destroy (factory->icons); - + G_OBJECT_CLASS (gtk_icon_factory_parent_class)->finalize (object); } @@ -174,9 +174,9 @@ gtk_icon_factory_finalize (GObject *object) * gtk_icon_factory_remove_default(). Applications with icons should * add a default icon factory with their icons, which will allow * themes to override the icons for the application. - * + * * Return value: a new #GtkIconFactory - **/ + */ GtkIconFactory* gtk_icon_factory_new (void) { @@ -199,8 +199,7 @@ gtk_icon_factory_new (void) * override your application's default icons. If an icon already * existed in @factory for @stock_id, it is unreferenced and replaced * with the new @icon_set. - * - **/ + */ void gtk_icon_factory_add (GtkIconFactory *factory, const gchar *stock_id, @@ -211,14 +210,14 @@ gtk_icon_factory_add (GtkIconFactory *factory, g_return_if_fail (GTK_IS_ICON_FACTORY (factory)); g_return_if_fail (stock_id != NULL); - g_return_if_fail (icon_set != NULL); + g_return_if_fail (icon_set != NULL); g_hash_table_lookup_extended (factory->icons, stock_id, &old_key, &old_value); if (old_value == icon_set) return; - + gtk_icon_set_ref (icon_set); /* GHashTable key memory management is so fantastically broken. */ @@ -235,22 +234,22 @@ gtk_icon_factory_add (GtkIconFactory *factory, * gtk_icon_factory_lookup: * @factory: a #GtkIconFactory * @stock_id: an icon name - * + * * Looks up @stock_id in the icon factory, returning an icon set * if found, otherwise %NULL. For display to the user, you should * use gtk_style_lookup_icon_set() on the #GtkStyle for the * widget that will display the icon, instead of using this * function directly, so that themes are taken into account. - * + * * Return value: icon set of @stock_id. - **/ + */ GtkIconSet * gtk_icon_factory_lookup (GtkIconFactory *factory, const gchar *stock_id) { g_return_val_if_fail (GTK_IS_ICON_FACTORY (factory), NULL); g_return_val_if_fail (stock_id != NULL, NULL); - + return g_hash_table_lookup (factory->icons, stock_id); } @@ -260,22 +259,21 @@ static GSList *default_factories = NULL; /** * gtk_icon_factory_add_default: * @factory: a #GtkIconFactory - * + * * Adds an icon factory to the list of icon factories searched by * gtk_style_lookup_icon_set(). This means that, for example, * gtk_image_new_from_stock() will be able to find icons in @factory. * There will normally be an icon factory added for each library or * application that comes with icons. The default icon factories * can be overridden by themes. - * - **/ + */ void gtk_icon_factory_add_default (GtkIconFactory *factory) { g_return_if_fail (GTK_IS_ICON_FACTORY (factory)); g_object_ref (factory); - + default_factories = g_slist_prepend (default_factories, factory); } @@ -286,8 +284,7 @@ gtk_icon_factory_add_default (GtkIconFactory *factory) * Removes an icon factory from the list of default icon * factories. Not normally used; you might use it for a library that * can be unloaded or shut down. - * - **/ + */ void gtk_icon_factory_remove_default (GtkIconFactory *factory) { @@ -318,17 +315,16 @@ _gtk_icon_factory_ensure_default_icons (void) * the #GtkStyle for the widget that will display the icon, instead of * using this function directly, so that themes are taken into * account. - * - * + * * Return value: a #GtkIconSet, or %NULL - **/ + */ GtkIconSet * gtk_icon_factory_lookup_default (const gchar *stock_id) { GSList *tmp_list; g_return_val_if_fail (stock_id != NULL, NULL); - + tmp_list = default_factories; while (tmp_list != NULL) { @@ -338,12 +334,12 @@ gtk_icon_factory_lookup_default (const gchar *stock_id) if (icon_set) return icon_set; - + tmp_list = g_slist_next (tmp_list); } _gtk_icon_factory_ensure_default_icons (); - + return gtk_icon_factory_lookup (gtk_default_icons, stock_id); } @@ -357,7 +353,7 @@ register_stock_icon (GtkIconFactory *factory, source.type = GTK_ICON_SOURCE_STATIC_ICON_NAME; source.source.icon_name = (gchar *)stock_id; gtk_icon_set_add_source (set, &source); - + gtk_icon_factory_add (factory, stock_id, set); gtk_icon_set_unref (set); } @@ -375,12 +371,12 @@ register_bidi_stock_icon (GtkIconFactory *factory, source.source.icon_name = (gchar *)stock_id_ltr; source.direction = GTK_TEXT_DIR_LTR; gtk_icon_set_add_source (set, &source); - + source.type = GTK_ICON_SOURCE_STATIC_ICON_NAME; source.source.icon_name = (gchar *)stock_id_rtl; source.direction = GTK_TEXT_DIR_RTL; gtk_icon_set_add_source (set, &source); - + gtk_icon_factory_add (factory, stock_id, set); gtk_icon_set_unref (set); } @@ -416,9 +412,9 @@ get_default_icons (GtkIconFactory *factory) register_stock_icon (factory, GTK_STOCK_GO_DOWN); register_stock_icon (factory, GTK_STOCK_EXECUTE); register_stock_icon (factory, GTK_STOCK_QUIT); - register_bidi_stock_icon (factory, - GTK_STOCK_GOTO_FIRST, - GTK_STOCK_GOTO_FIRST "-ltr", + register_bidi_stock_icon (factory, + GTK_STOCK_GOTO_FIRST, + GTK_STOCK_GOTO_FIRST "-ltr", GTK_STOCK_GOTO_FIRST "-rtl"); register_stock_icon (factory, GTK_STOCK_SELECT_FONT); register_stock_icon (factory, GTK_STOCK_FULLSCREEN); @@ -427,15 +423,15 @@ get_default_icons (GtkIconFactory *factory) register_stock_icon (factory, GTK_STOCK_HELP); register_stock_icon (factory, GTK_STOCK_HOME); register_stock_icon (factory, GTK_STOCK_INFO); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_JUMP_TO, GTK_STOCK_JUMP_TO "-ltr", GTK_STOCK_JUMP_TO "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_GOTO_LAST, GTK_STOCK_GOTO_LAST "-ltr", GTK_STOCK_GOTO_LAST "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_GO_BACK, GTK_STOCK_GO_BACK "-ltr", GTK_STOCK_GO_BACK "-rtl"); @@ -457,17 +453,17 @@ get_default_icons (GtkIconFactory *factory) register_stock_icon (factory, GTK_STOCK_PRINT_REPORT); register_stock_icon (factory, GTK_STOCK_PRINT_WARNING); register_stock_icon (factory, GTK_STOCK_PROPERTIES); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_REDO, GTK_STOCK_REDO "-ltr", GTK_STOCK_REDO "-rtl"); register_stock_icon (factory, GTK_STOCK_REMOVE); register_stock_icon (factory, GTK_STOCK_REFRESH); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_REVERT_TO_SAVED, GTK_STOCK_REVERT_TO_SAVED "-ltr", GTK_STOCK_REVERT_TO_SAVED "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_GO_FORWARD, GTK_STOCK_GO_FORWARD "-ltr", GTK_STOCK_GO_FORWARD "-rtl"); @@ -484,21 +480,21 @@ get_default_icons (GtkIconFactory *factory) register_stock_icon (factory, GTK_STOCK_ITALIC); register_stock_icon (factory, GTK_STOCK_STRIKETHROUGH); register_stock_icon (factory, GTK_STOCK_UNDERLINE); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_INDENT, GTK_STOCK_INDENT "-ltr", GTK_STOCK_INDENT "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_UNINDENT, GTK_STOCK_UNINDENT "-ltr", GTK_STOCK_UNINDENT "-rtl"); register_stock_icon (factory, GTK_STOCK_GOTO_TOP); register_stock_icon (factory, GTK_STOCK_DELETE); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_UNDELETE, GTK_STOCK_UNDELETE "-ltr", GTK_STOCK_UNDELETE "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_UNDO, GTK_STOCK_UNDO "-ltr", GTK_STOCK_UNDO "-rtl"); @@ -510,25 +506,25 @@ get_default_icons (GtkIconFactory *factory) register_stock_icon (factory, GTK_STOCK_DISCONNECT); register_stock_icon (factory, GTK_STOCK_EDIT); register_stock_icon (factory, GTK_STOCK_CAPS_LOCK_WARNING); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_MEDIA_FORWARD, GTK_STOCK_MEDIA_FORWARD "-ltr", GTK_STOCK_MEDIA_FORWARD "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_MEDIA_NEXT, GTK_STOCK_MEDIA_NEXT "-ltr", GTK_STOCK_MEDIA_NEXT "-rtl"); register_stock_icon (factory, GTK_STOCK_MEDIA_PAUSE); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_MEDIA_PLAY, GTK_STOCK_MEDIA_PLAY "-ltr", GTK_STOCK_MEDIA_PLAY "-rtl"); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_MEDIA_PREVIOUS, GTK_STOCK_MEDIA_PREVIOUS "-ltr", GTK_STOCK_MEDIA_PREVIOUS "-rtl"); register_stock_icon (factory, GTK_STOCK_MEDIA_RECORD); - register_bidi_stock_icon (factory, + register_bidi_stock_icon (factory, GTK_STOCK_MEDIA_REWIND, GTK_STOCK_MEDIA_REWIND "-ltr", GTK_STOCK_MEDIA_REWIND "-rtl"); @@ -554,7 +550,7 @@ struct _IconSize { gint size; gchar *name; - + gint width; gint height; }; @@ -589,7 +585,7 @@ init_icon_sizes (void) gint i; icon_aliases = g_hash_table_new (g_str_hash, g_str_equal); - + icon_sizes = g_new (IconSize, NUM_BUILTIN_SIZES); icon_sizes_allocated = NUM_BUILTIN_SIZES; icon_sizes_used = NUM_BUILTIN_SIZES; @@ -604,7 +600,7 @@ init_icon_sizes (void) * Even if we did I suppose removing the builtin sizes would be * disallowed. */ - + icon_sizes[GTK_ICON_SIZE_MENU].size = GTK_ICON_SIZE_MENU; icon_sizes[GTK_ICON_SIZE_MENU].name = "gtk-menu"; icon_sizes[GTK_ICON_SIZE_MENU].width = 16; @@ -619,7 +615,7 @@ init_icon_sizes (void) icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].name = "gtk-small-toolbar"; icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].width = 18; icon_sizes[GTK_ICON_SIZE_SMALL_TOOLBAR].height = 18; - + icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].size = GTK_ICON_SIZE_LARGE_TOOLBAR; icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].name = "gtk-large-toolbar"; icon_sizes[GTK_ICON_SIZE_LARGE_TOOLBAR].width = 24; @@ -642,10 +638,10 @@ init_icon_sizes (void) while (i < NUM_BUILTIN_SIZES) { gtk_icon_size_register_alias (icon_sizes[i].name, icon_sizes[i].size); - + ++i; } - + #undef NUM_BUILTIN_SIZES } } @@ -695,7 +691,7 @@ icon_size_set_for_settings (GtkSettings *settings, if (size == GTK_ICON_SIZE_INVALID) /* Reserve a place */ size = icon_size_register_intern (size_name, -1, -1); - + settings_sizes = get_settings_sizes (settings, NULL); if (size >= settings_sizes->len) { @@ -707,7 +703,7 @@ icon_size_set_for_settings (GtkSettings *settings, } settings_size = &g_array_index (settings_sizes, SettingsIconSize, size); - + settings_size->width = width; settings_size->height = height; } @@ -721,7 +717,7 @@ scan_icon_size_name (const char **pos, GString *out) while (g_ascii_isspace (*p)) p++; - + if (!((*p >= 'A' && *p <= 'Z') || (*p >= 'a' && *p <= 'z') || *p == '_' || *p == '-')) @@ -755,7 +751,7 @@ icon_size_setting_parse (GtkSettings *settings, while (pango_skip_space (&p)) { gint width, height; - + if (!scan_icon_size_name (&p, name_buf)) goto err; @@ -845,10 +841,10 @@ icon_sizes_init_for_settings (GtkSettings *settings) "notify::gtk-icon-sizes", G_CALLBACK (icon_size_settings_changed), NULL); - + icon_size_set_all_from_settings (settings); } - + static gboolean icon_size_lookup_intern (GtkSettings *settings, GtkIconSize size, @@ -858,7 +854,7 @@ icon_size_lookup_intern (GtkSettings *settings, GArray *settings_sizes; gint width_for_settings = -1; gint height_for_settings = -1; - + init_icon_sizes (); if (size == (GtkIconSize)-1) @@ -873,17 +869,16 @@ icon_size_lookup_intern (GtkSettings *settings, if (settings) { gboolean initial = FALSE; - - settings_sizes = get_settings_sizes (settings, &initial); + if (initial) icon_sizes_init_for_settings (settings); - + if (size < settings_sizes->len) { SettingsIconSize *settings_size; - + settings_size = &g_array_index (settings_sizes, SettingsIconSize, size); - + width_for_settings = settings_size->width; height_for_settings = settings_size->height; } @@ -907,7 +902,7 @@ icon_size_lookup_intern (GtkSettings *settings, * @height: location to store icon height * * Obtains the pixel size of a semantic icon size, possibly - * modified by user preferences for a particular + * modified by user preferences for a particular * #GtkSettings. Normally @size would be * #GTK_ICON_SIZE_MENU, #GTK_ICON_SIZE_BUTTON, etc. This function * isn't normally needed, gtk_widget_render_icon() is the usual @@ -916,11 +911,11 @@ icon_size_lookup_intern (GtkSettings *settings, * the width/height returned by gtk_icon_size_lookup(), because themes * are free to render the pixbuf however they like, including changing * the usual size. - * + * * Return value: %TRUE if @size was a valid size * * Since: 2.2 - **/ + */ gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings, GtkIconSize size, @@ -949,9 +944,9 @@ gtk_icon_size_lookup_for_settings (GtkSettings *settings, * the width/height returned by gtk_icon_size_lookup(), because themes * are free to render the pixbuf however they like, including changing * the usual size. - * + * * Return value: %TRUE if @size was a valid size - **/ + */ gboolean gtk_icon_size_lookup (GtkIconSize size, gint *widthp, @@ -971,7 +966,7 @@ icon_size_register_intern (const gchar *name, { IconAlias *old_alias; GtkIconSize size; - + init_icon_sizes (); old_alias = g_hash_table_lookup (icon_aliases, name); @@ -1018,8 +1013,7 @@ icon_size_register_intern (const gchar *name, * etc. Returns the integer value for the size. * * Returns: integer value representing the size - * - **/ + */ GtkIconSize gtk_icon_size_register (const gchar *name, gint width, @@ -1028,7 +1022,7 @@ gtk_icon_size_register (const gchar *name, g_return_val_if_fail (name != NULL, 0); g_return_val_if_fail (width > 0, 0); g_return_val_if_fail (height > 0, 0); - + return icon_size_register_intern (name, width, height); } @@ -1040,14 +1034,13 @@ gtk_icon_size_register (const gchar *name, * Registers @alias as another name for @target. * So calling gtk_icon_size_from_name() with @alias as argument * will return @target. - * - **/ + */ void gtk_icon_size_register_alias (const gchar *alias, GtkIconSize target) { IconAlias *ia; - + g_return_if_fail (alias != NULL); init_icon_sizes (); @@ -1077,20 +1070,20 @@ gtk_icon_size_register_alias (const gchar *alias, } } -/** +/** * gtk_icon_size_from_name: * @name: the name to look up. * @returns: the icon size with the given name. - * + * * Looks up the icon size associated with @name. - **/ + */ GtkIconSize gtk_icon_size_from_name (const gchar *name) { IconAlias *ia; init_icon_sizes (); - + ia = g_hash_table_lookup (icon_aliases, name); if (ia && icon_sizes[ia->target].width > 0) @@ -1103,10 +1096,10 @@ gtk_icon_size_from_name (const gchar *name) * gtk_icon_size_get_name: * @size: a #GtkIconSize. * @returns: the name of the given icon size. - * - * Gets the canonical name of the given icon size. The returned string + * + * Gets the canonical name of the given icon size. The returned string * is statically allocated and should not be freed. - **/ + */ G_CONST_RETURN gchar* gtk_icon_size_get_name (GtkIconSize size) { @@ -1164,7 +1157,7 @@ static guint cache_serial = 0; /** * gtk_icon_set_new: - * + * * Creates a new #GtkIconSet. A #GtkIconSet represents a single icon * in various sizes and widget states. It can provide a #GdkPixbuf * for a given size and state on request, and automatically caches @@ -1174,9 +1167,9 @@ static guint cache_serial = 0; * using #GtkIconSet directly. The one case where you'd use * #GtkIconSet is to create application-specific icon sets to place in * a #GtkIconFactory. - * + * * Return value: a new #GtkIconSet - **/ + */ GtkIconSet* gtk_icon_set_new (void) { @@ -1189,22 +1182,22 @@ gtk_icon_set_new (void) icon_set->cache = NULL; icon_set->cache_size = 0; icon_set->cache_serial = cache_serial; - + return icon_set; } /** * gtk_icon_set_new_from_pixbuf: * @pixbuf: a #GdkPixbuf - * + * * Creates a new #GtkIconSet with @pixbuf as the default/fallback * source image. If you don't add any additional #GtkIconSource to the * icon set, all variants of the icon will be created from @pixbuf, * using scaling, pixelation, etc. as required to adjust the icon size * or make the icon look insensitive/prelighted. - * + * * Return value: a new #GtkIconSet - **/ + */ GtkIconSet * gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf) { @@ -1219,7 +1212,7 @@ gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf) gtk_icon_source_set_pixbuf (&source, pixbuf); gtk_icon_set_add_source (set, &source); gtk_icon_source_set_pixbuf (&source, NULL); - + return set; } @@ -1227,11 +1220,11 @@ gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf) /** * gtk_icon_set_ref: * @icon_set: a #GtkIconSet. - * + * * Increments the reference count on @icon_set. - * + * * Return value: @icon_set. - **/ + */ GtkIconSet* gtk_icon_set_ref (GtkIconSet *icon_set) { @@ -1246,10 +1239,10 @@ gtk_icon_set_ref (GtkIconSet *icon_set) /** * gtk_icon_set_unref: * @icon_set: a #GtkIconSet - * + * * Decrements the reference count on @icon_set, and frees memory * if the reference count reaches 0. - **/ + */ void gtk_icon_set_unref (GtkIconSet *icon_set) { @@ -1279,7 +1272,7 @@ GType gtk_icon_set_get_type (void) { static GType our_type = 0; - + if (our_type == 0) our_type = g_boxed_type_register_static (I_("GtkIconSet"), (GBoxedCopyFunc) gtk_icon_set_ref, @@ -1291,9 +1284,9 @@ gtk_icon_set_get_type (void) /** * gtk_icon_set_copy: * @icon_set: a #GtkIconSet - * - * Copies @icon_set by value. - * + * + * Copies @icon_set by value. + * * Return value: a new #GtkIconSet identical to the first. **/ GtkIconSet* @@ -1301,7 +1294,7 @@ gtk_icon_set_copy (GtkIconSet *icon_set) { GtkIconSet *copy; GSList *tmp_list; - + copy = gtk_icon_set_new (); tmp_list = icon_set->sources; @@ -1318,7 +1311,7 @@ gtk_icon_set_copy (GtkIconSet *icon_set) copy->cache = copy_cache (icon_set, copy); copy->cache_size = icon_set->cache_size; copy->cache_serial = icon_set->cache_serial; - + return copy; } @@ -1334,8 +1327,8 @@ sizes_equivalent (GtkIconSize lhs, */ #if 1 return lhs == rhs; -#else - +#else + gint r_w, r_h, l_w, l_h; icon_size_lookup_intern (NULL, rhs, &r_w, &r_h); @@ -1354,7 +1347,7 @@ find_best_matching_source (GtkIconSet *icon_set, { GtkIconSource *source; GSList *tmp_list; - + /* We need to find the best icon source. Direction matters more * than state, state matters more than size. icon_set->sources * is sorted according to wildness, so if we take the first @@ -1362,13 +1355,13 @@ find_best_matching_source (GtkIconSet *icon_set, * multiple matches for a given "wildness" then the RC file contained * dumb stuff, and we end up with an arbitrary matching source) */ - + source = NULL; tmp_list = icon_set->sources; while (tmp_list != NULL) { GtkIconSource *s = tmp_list->data; - + if ((s->any_direction || (s->direction == direction)) && (s->any_state || (s->state == state)) && (s->any_size || size == (GtkIconSize)-1 || (sizes_equivalent (size, s->size)))) @@ -1379,13 +1372,13 @@ find_best_matching_source (GtkIconSet *icon_set, break; } } - + tmp_list = g_slist_next (tmp_list); } return source; } - + static gboolean ensure_filename_pixbuf (GtkIconSet *icon_set, GtkIconSource *source) @@ -1393,9 +1386,9 @@ ensure_filename_pixbuf (GtkIconSet *icon_set, if (source->filename_pixbuf == NULL) { GError *error = NULL; - + source->filename_pixbuf = gdk_pixbuf_new_from_file (source->source.filename, &error); - + if (source->filename_pixbuf == NULL) { /* Remove this icon source so we don't keep trying to @@ -1403,18 +1396,18 @@ ensure_filename_pixbuf (GtkIconSet *icon_set, */ g_warning (_("Error loading icon: %s"), error->message); g_error_free (error); - + icon_set->sources = g_slist_remove (icon_set->sources, source); - + gtk_icon_source_free (source); return FALSE; } } - + return TRUE; } - + static GdkPixbuf * render_icon_name_pixbuf (GtkIconSource *icon_source, GtkStyle *style, @@ -1433,7 +1426,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source, gint width, height, pixel_size; gint *sizes, *s, dist; GError *error = NULL; - + if (widget && gtk_widget_has_screen (widget)) screen = gtk_widget_get_screen (widget); else if (style && style->colormap) @@ -1452,8 +1445,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source, { if (size == (GtkIconSize)-1) { - /* Find an available size close to 48 - */ + /* Find an available size close to 48 */ sizes = gtk_icon_theme_get_icon_sizes (icon_theme, icon_source->source.icon_name); dist = 1000; width = height = 48; @@ -1472,7 +1464,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source, dist = 48 - *s; } } - else + else { if (*s - 48 < dist) { @@ -1481,7 +1473,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source, } } } - + g_free (sizes); } else @@ -1506,7 +1498,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source, g_error_free (error); return NULL; } - + tmp_source = *icon_source; tmp_source.type = GTK_ICON_SOURCE_PIXBUF; tmp_source.source.pixbuf = tmp_pixbuf; @@ -1548,7 +1540,7 @@ find_and_render_icon_source (GtkIconSet *icon_set, while (pixbuf == NULL) { GtkIconSource *source = find_best_matching_source (icon_set, direction, state, size, failed); - + if (source == NULL) break; @@ -1613,7 +1605,7 @@ render_fallback_image (GtkStyle *style, gtk_icon_source_set_pixbuf (&fallback_source, pixbuf); g_object_unref (pixbuf); } - + return gtk_style_render_icon (style, &fallback_source, direction, @@ -1637,16 +1629,16 @@ render_fallback_image (GtkStyle *style, * @detail: detail to pass to the theme engine, or %NULL. * Note that passing a detail of anything but %NULL * will disable caching. - * + * * Renders an icon using gtk_style_render_icon(). In most cases, * gtk_widget_render_icon() is better, since it automatically provides * most of the arguments from the current widget settings. This * function never returns %NULL; if the icon can't be rendered * (perhaps because an image file fails to load), a default "missing * image" icon will be returned instead. - * + * * Return value: a #GdkPixbuf to be displayed - **/ + */ GdkPixbuf* gtk_icon_set_render_icon (GtkIconSet *icon_set, GtkStyle *style, @@ -1657,7 +1649,7 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set, const char *detail) { GdkPixbuf *icon; - + g_return_val_if_fail (icon_set != NULL, NULL); g_return_val_if_fail (style == NULL || GTK_IS_STYLE (style), NULL); @@ -1668,7 +1660,7 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set, { icon = find_in_cache (icon_set, style, direction, state, size); - + if (icon) { g_object_ref (icon); @@ -1685,7 +1677,7 @@ gtk_icon_set_render_icon (GtkIconSet *icon_set, if (detail == NULL) add_to_cache (icon_set, style, direction, state, size, icon); - + return icon; } @@ -1727,7 +1719,7 @@ icon_source_compare (gconstpointer ap, gconstpointer bp) * gtk_icon_set_render_icon(), but #GtkIconSet needs base images to * work with. The base images and when to use them are described by * a #GtkIconSource. - * + * * This function copies @source, so you can reuse the same source immediately * without affecting the icon set. * @@ -1746,10 +1738,9 @@ icon_source_compare (gconstpointer ap, gconstpointer bp) * * gtk_icon_set_new_from_pixbuf() creates a new icon set with a * default icon source based on the given pixbuf. - * - **/ + */ void -gtk_icon_set_add_source (GtkIconSet *icon_set, +gtk_icon_set_add_source (GtkIconSet *icon_set, const GtkIconSource *source) { g_return_if_fail (icon_set != NULL); @@ -1760,7 +1751,7 @@ gtk_icon_set_add_source (GtkIconSet *icon_set, g_warning ("Useless empty GtkIconSource"); return; } - + icon_set->sources = g_slist_insert_sorted (icon_set->sources, gtk_icon_source_copy (source), icon_source_compare); @@ -1774,8 +1765,7 @@ gtk_icon_set_add_source (GtkIconSet *icon_set, * * Obtains a list of icon sizes this icon set can render. The returned * array must be freed with g_free(). - * - **/ + */ void gtk_icon_set_get_sizes (GtkIconSet *icon_set, GtkIconSize **sizes, @@ -1784,11 +1774,11 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, GSList *tmp_list; gboolean all_sizes = FALSE; GSList *specifics = NULL; - + g_return_if_fail (icon_set != NULL); g_return_if_fail (sizes != NULL); g_return_if_fail (n_sizes != NULL); - + tmp_list = icon_set->sources; while (tmp_list != NULL) { @@ -1803,7 +1793,7 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, } else specifics = g_slist_prepend (specifics, GINT_TO_POINTER (source->size)); - + tmp_list = g_slist_next (tmp_list); } @@ -1813,11 +1803,11 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, gint i; init_icon_sizes (); - + *sizes = g_new (GtkIconSize, icon_sizes_used); *n_sizes = icon_sizes_used - 1; - - i = 1; + + i = 1; while (i < icon_sizes_used) { (*sizes)[i - 1] = icon_sizes[i].size; @@ -1827,7 +1817,7 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, else { gint i; - + *n_sizes = g_slist_length (specifics); *sizes = g_new (GtkIconSize, *n_sizes); @@ -1848,21 +1838,21 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, /** * gtk_icon_source_new: - * + * * Creates a new #GtkIconSource. A #GtkIconSource contains a #GdkPixbuf (or * image filename) that serves as the base image for one or more of the * icons in a #GtkIconSet, along with a specification for which icons in the * icon set will be based on that pixbuf or image file. An icon set contains * a set of icons that represent "the same" logical concept in different states, * different global text directions, and different sizes. - * + * * So for example a web browser's "Back to Previous Page" icon might * point in a different direction in Hebrew and in English; it might * look different when insensitive; and it might change size depending * on toolbar mode (small/large icons). So a single icon set would * contain all those variants of the icon. #GtkIconSet contains a list * of #GtkIconSource from which it can derive specific icon variants in - * the set. + * the set. * * In the simplest case, #GtkIconSet contains one source pixbuf from * which it derives all variants. The convenience function @@ -1877,46 +1867,46 @@ gtk_icon_set_get_sizes (GtkIconSet *icon_set, * By default, the icon source has all parameters wildcarded. That is, * the icon source will be used as the base icon for any desired text * direction, widget state, or icon size. - * + * * Return value: a new #GtkIconSource - **/ + */ GtkIconSource* gtk_icon_source_new (void) { GtkIconSource *src; - + src = g_new0 (GtkIconSource, 1); src->direction = GTK_TEXT_DIR_NONE; src->size = GTK_ICON_SIZE_INVALID; src->state = GTK_STATE_NORMAL; - + src->any_direction = TRUE; src->any_state = TRUE; src->any_size = TRUE; - + return src; } /** * gtk_icon_source_copy: * @source: a #GtkIconSource - * + * * Creates a copy of @source; mostly useful for language bindings. - * + * * Return value: a new #GtkIconSource - **/ + */ GtkIconSource* gtk_icon_source_copy (const GtkIconSource *source) { GtkIconSource *copy; - + g_return_val_if_fail (source != NULL, NULL); copy = g_new (GtkIconSource, 1); *copy = *source; - + switch (copy->type) { case GTK_ICON_SOURCE_EMPTY: @@ -1946,10 +1936,10 @@ gtk_icon_source_copy (const GtkIconSource *source) /** * gtk_icon_source_free: * @source: a #GtkIconSource - * + * * Frees a dynamically-allocated icon source, along with its * filename, size, and pixbuf fields if those are not %NULL. - **/ + */ void gtk_icon_source_free (GtkIconSource *source) { @@ -1963,7 +1953,7 @@ GType gtk_icon_source_get_type (void) { static GType our_type = 0; - + if (our_type == 0) our_type = g_boxed_type_register_static (I_("GtkIconSource"), (GBoxedCopyFunc) gtk_icon_source_copy, @@ -2013,8 +2003,8 @@ icon_source_clear (GtkIconSource *source) * @filename: image file to use * * Sets the name of an image file to use as a base image when creating - * icon variants for #GtkIconSet. The filename must be absolute. - **/ + * icon variants for #GtkIconSet. The filename must be absolute. + */ void gtk_icon_source_set_filename (GtkIconSource *source, const gchar *filename) @@ -2025,9 +2015,9 @@ gtk_icon_source_set_filename (GtkIconSource *source, if (source->type == GTK_ICON_SOURCE_FILENAME && source->source.filename == filename) return; - + icon_source_clear (source); - + if (filename != NULL) { source->type = GTK_ICON_SOURCE_FILENAME; @@ -2045,7 +2035,7 @@ gtk_icon_source_set_filename (GtkIconSource *source, * * Sets the name of an icon to look up in the current icon theme * to use as a base image when creating icon variants for #GtkIconSet. - **/ + */ void gtk_icon_source_set_icon_name (GtkIconSource *source, const gchar *icon_name) @@ -2057,7 +2047,7 @@ gtk_icon_source_set_icon_name (GtkIconSource *source, return; icon_source_clear (source); - + if (icon_name != NULL) { source->type = GTK_ICON_SOURCE_ICON_NAME; @@ -2072,20 +2062,20 @@ gtk_icon_source_set_icon_name (GtkIconSource *source, * * Sets a pixbuf to use as a base image when creating icon variants * for #GtkIconSet. - **/ + */ void gtk_icon_source_set_pixbuf (GtkIconSource *source, GdkPixbuf *pixbuf) { g_return_if_fail (source != NULL); g_return_if_fail (pixbuf == NULL || GDK_IS_PIXBUF (pixbuf)); - + if (source->type == GTK_ICON_SOURCE_PIXBUF && source->source.pixbuf == pixbuf) return; icon_source_clear (source); - + if (pixbuf != NULL) { source->type = GTK_ICON_SOURCE_PIXBUF; @@ -2096,14 +2086,14 @@ gtk_icon_source_set_pixbuf (GtkIconSource *source, /** * gtk_icon_source_get_filename: * @source: a #GtkIconSource - * + * * Retrieves the source filename, or %NULL if none is set. The * filename is not a copy, and should not be modified or expected to * persist beyond the lifetime of the icon source. - * + * * Return value: image filename. This string must not be modified * or freed. - **/ + */ G_CONST_RETURN gchar* gtk_icon_source_get_filename (const GtkIconSource *source) { @@ -2118,13 +2108,13 @@ gtk_icon_source_get_filename (const GtkIconSource *source) /** * gtk_icon_source_get_icon_name: * @source: a #GtkIconSource - * + * * Retrieves the source icon name, or %NULL if none is set. The * icon_name is not a copy, and should not be modified or expected to * persist beyond the lifetime of the icon source. - * + * * Return value: icon name. This string must not be modified or freed. - **/ + */ G_CONST_RETURN gchar* gtk_icon_source_get_icon_name (const GtkIconSource *source) { @@ -2140,7 +2130,7 @@ gtk_icon_source_get_icon_name (const GtkIconSource *source) /** * gtk_icon_source_get_pixbuf: * @source: a #GtkIconSource - * + * * Retrieves the source pixbuf, or %NULL if none is set. * In addition, if a filename source is in use, this * function in some cases will return the pixbuf from @@ -2148,14 +2138,14 @@ gtk_icon_source_get_icon_name (const GtkIconSource *source) * for the GtkIconSource passed to the GtkStyle::render_icon() * virtual function. The reference count on the pixbuf is * not incremented. - * + * * Return value: source pixbuf - **/ + */ GdkPixbuf* gtk_icon_source_get_pixbuf (const GtkIconSource *source) { g_return_val_if_fail (source != NULL, NULL); - + if (source->type == GTK_ICON_SOURCE_PIXBUF) return source->source.pixbuf; else if (source->type == GTK_ICON_SOURCE_FILENAME) @@ -2178,8 +2168,7 @@ gtk_icon_source_get_pixbuf (const GtkIconSource *source) * * #GtkIconSet prefers non-wildcarded sources (exact matches) over * wildcarded sources, and will use an exact match when possible. - * - **/ + */ void gtk_icon_source_set_direction_wildcarded (GtkIconSource *source, gboolean setting) @@ -2207,7 +2196,7 @@ gtk_icon_source_set_direction_wildcarded (GtkIconSource *source, * produce an appropriate icon for a given state, for example * lightening an image on prelight, but will not modify source images * that match exactly. - **/ + */ void gtk_icon_source_set_state_wildcarded (GtkIconSource *source, gboolean setting) @@ -2235,40 +2224,40 @@ gtk_icon_source_set_state_wildcarded (GtkIconSource *source, * #GtkIconSet will normally scale wildcarded source images to produce * an appropriate icon at a given size, but will not change the size * of source images that match exactly. - **/ + */ void gtk_icon_source_set_size_wildcarded (GtkIconSource *source, gboolean setting) { g_return_if_fail (source != NULL); - source->any_size = setting != FALSE; + source->any_size = setting != FALSE; } /** * gtk_icon_source_get_size_wildcarded: * @source: a #GtkIconSource - * + * * Gets the value set by gtk_icon_source_set_size_wildcarded(). - * + * * Return value: %TRUE if this icon source is a base for any icon size variant - **/ + */ gboolean gtk_icon_source_get_size_wildcarded (const GtkIconSource *source) { g_return_val_if_fail (source != NULL, TRUE); - + return source->any_size; } /** * gtk_icon_source_get_state_wildcarded: * @source: a #GtkIconSource - * + * * Gets the value set by gtk_icon_source_set_state_wildcarded(). - * + * * Return value: %TRUE if this icon source is a base for any widget state variant - **/ + */ gboolean gtk_icon_source_get_state_wildcarded (const GtkIconSource *source) { @@ -2280,11 +2269,11 @@ gtk_icon_source_get_state_wildcarded (const GtkIconSource *source) /** * gtk_icon_source_get_direction_wildcarded: * @source: a #GtkIconSource - * + * * Gets the value set by gtk_icon_source_set_direction_wildcarded(). - * + * * Return value: %TRUE if this icon source is a base for any text direction variant - **/ + */ gboolean gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source) { @@ -2300,13 +2289,12 @@ gtk_icon_source_get_direction_wildcarded (const GtkIconSource *source) * * Sets the text direction this icon source is intended to be used * with. - * + * * Setting the text direction on an icon source makes no difference * if the text direction is wildcarded. Therefore, you should usually * call gtk_icon_source_set_direction_wildcarded() to un-wildcard it * in addition to calling this function. - * - **/ + */ void gtk_icon_source_set_direction (GtkIconSource *source, GtkTextDirection direction) @@ -2323,13 +2311,12 @@ gtk_icon_source_set_direction (GtkIconSource *source, * * Sets the widget state this icon source is intended to be used * with. - * + * * Setting the widget state on an icon source makes no difference * if the state is wildcarded. Therefore, you should usually * call gtk_icon_source_set_state_wildcarded() to un-wildcard it * in addition to calling this function. - * - **/ + */ void gtk_icon_source_set_state (GtkIconSource *source, GtkStateType state) @@ -2346,13 +2333,12 @@ gtk_icon_source_set_state (GtkIconSource *source, * * Sets the icon size this icon source is intended to be used * with. - * + * * Setting the icon size on an icon source makes no difference * if the size is wildcarded. Therefore, you should usually * call gtk_icon_source_set_size_wildcarded() to un-wildcard it * in addition to calling this function. - * - **/ + */ void gtk_icon_source_set_size (GtkIconSource *source, GtkIconSize size) @@ -2365,13 +2351,13 @@ gtk_icon_source_set_size (GtkIconSource *source, /** * gtk_icon_source_get_direction: * @source: a #GtkIconSource - * + * * Obtains the text direction this icon source applies to. The return - * value is only useful/meaningful if the text direction is not + * value is only useful/meaningful if the text direction is not * wildcarded. - * + * * Return value: text direction this source matches - **/ + */ GtkTextDirection gtk_icon_source_get_direction (const GtkIconSource *source) { @@ -2383,13 +2369,13 @@ gtk_icon_source_get_direction (const GtkIconSource *source) /** * gtk_icon_source_get_state: * @source: a #GtkIconSource - * + * * Obtains the widget state this icon source applies to. The return * value is only useful/meaningful if the widget state is not * wildcarded. - * + * * Return value: widget state this source matches - **/ + */ GtkStateType gtk_icon_source_get_state (const GtkIconSource *source) { @@ -2401,12 +2387,12 @@ gtk_icon_source_get_state (const GtkIconSource *source) /** * gtk_icon_source_get_size: * @source: a #GtkIconSource - * + * * Obtains the icon size this source applies to. The return value * is only useful/meaningful if the icon size is not wildcarded. - * + * * Return value: icon size this source matches. - **/ + */ GtkIconSize gtk_icon_source_get_size (const GtkIconSource *source) { @@ -2464,7 +2450,7 @@ find_in_cache (GtkIconSet *icon_set, GSList *prev; ensure_cache_up_to_date (icon_set); - + prev = NULL; tmp_list = icon_set->cache; while (tmp_list != NULL) @@ -2483,10 +2469,10 @@ find_in_cache (GtkIconSet *icon_set, tmp_list->next = icon_set->cache; icon_set->cache = tmp_list; } - + return icon->pixbuf; } - + prev = tmp_list; tmp_list = g_slist_next (tmp_list); } @@ -2512,7 +2498,7 @@ add_to_cache (GtkIconSet *icon_set, * its address could be reused by another style, creating a * really weird bug */ - + if (style) g_object_ref (style); @@ -2528,12 +2514,12 @@ add_to_cache (GtkIconSet *icon_set, if (icon->style) attach_to_style (icon_set, icon->style); - + if (icon_set->cache_size >= NUM_CACHED_ICONS) { /* Remove oldest item in the cache */ GSList *tmp_list; - + tmp_list = icon_set->cache; /* Find next-to-last link */ @@ -2583,9 +2569,9 @@ clear_cache (GtkIconSet *icon_set, last_style = icon->style; } } - - cached_icon_free (icon); - + + cached_icon_free (icon); + tmp_list = g_slist_next (tmp_list); } @@ -2600,7 +2586,7 @@ copy_cache (GtkIconSet *icon_set, GSList *copy = NULL; ensure_cache_up_to_date (icon_set); - + tmp_list = icon_set->cache; while (tmp_list != NULL) { @@ -2614,13 +2600,13 @@ copy_cache (GtkIconSet *icon_set, attach_to_style (copy_recipient, icon_copy->style); g_object_ref (icon_copy->style); } - + g_object_ref (icon_copy->pixbuf); icon_copy->size = icon->size; - - copy = g_slist_prepend (copy, icon_copy); - + + copy = g_slist_prepend (copy, icon_copy); + tmp_list = g_slist_next (tmp_list); } @@ -2674,7 +2660,7 @@ iconsets_foreach (gpointer key, * time all cache entries will have the same style, * so this is faster anyway. */ - + clear_cache (icon_set, FALSE); } @@ -2682,7 +2668,7 @@ static void style_dnotify (gpointer data) { GHashTable *table = data; - + g_hash_table_foreach (table, iconsets_foreach, NULL); g_hash_table_destroy (table); @@ -2697,13 +2683,13 @@ _gtk_icon_set_invalidate_caches (void) /** * _gtk_icon_factory_list_ids: - * + * * Gets all known IDs stored in an existing icon factory. * The strings in the returned list aren't copied. * The list itself should be freed. - * + * * Return value: List of ids in icon factories - **/ + */ GList* _gtk_icon_factory_list_ids (void) { @@ -2713,18 +2699,18 @@ _gtk_icon_factory_list_ids (void) ids = NULL; _gtk_icon_factory_ensure_default_icons (); - + tmp_list = all_icon_factories; while (tmp_list != NULL) { GList *these_ids; - + GtkIconFactory *factory = GTK_ICON_FACTORY (tmp_list->data); these_ids = g_hash_table_get_keys (factory->icons); - + ids = g_list_concat (ids, these_ids); - + tmp_list = g_slist_next (tmp_list); } @@ -2734,7 +2720,7 @@ _gtk_icon_factory_list_ids (void) typedef struct { GSList *sources; gboolean in_source; - + } IconFactoryParserData; typedef struct { @@ -2765,7 +2751,7 @@ icon_source_start_element (GMarkupParseContext *context, IconSourceParserData *source_data; gchar *error_msg; GQuark error_domain; - + parser_data = (IconFactoryParserData*)user_data; if (!parser_data->in_source) @@ -2788,7 +2774,7 @@ icon_source_start_element (GMarkupParseContext *context, goto error; } } - + for (i = 0; names[i]; i++) { if (strcmp (names[i], "stock-id") == 0) @@ -2852,7 +2838,7 @@ icon_source_start_element (GMarkupParseContext *context, { gchar *tmp; gint line_number, char_number; - + g_markup_parse_context_get_position (context, &line_number, &char_number); @@ -2866,7 +2852,7 @@ icon_source_start_element (GMarkupParseContext *context, tmp); #else g_warning ("%s", tmp); -#endif +#endif g_free (tmp); g_free (stock_id); g_free (filename); @@ -2910,7 +2896,7 @@ gtk_icon_factory_buildable_custom_tag_end (GtkBuildable *buildable, gpointer *user_data) { GtkIconFactory *icon_factory; - + icon_factory = GTK_ICON_FACTORY (buildable); if (strcmp (tagname, "sources") == 0)