Index: libxfcegui4/xfce-icontheme.c =================================================================== --- libxfcegui4/xfce-icontheme.c (revision 22569) +++ libxfcegui4/xfce-icontheme.c (working copy) @@ -28,6 +28,7 @@ #include "icons.h" #include "xfce-icontheme.h" +#define XFCE_ICON_THEME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFCE_TYPE_ICON_THEME, XfceIconThemePriv)) struct _XfceIconThemePriv { @@ -35,8 +36,8 @@ }; enum { - XFCEIC_SIG_CHANGED, - XFCEIC_N_SIGNALS + XFCEIC_SIG_CHANGED, + XFCEIC_N_SIGNALS }; static void xfce_icon_theme_class_init(XfceIconThemeClass *klass); @@ -57,38 +58,40 @@ GType xfce_icon_theme_get_type() { - static GType icon_theme_type = 0; - - if(!icon_theme_type) { - static const GTypeInfo icon_theme_info = { - sizeof(XfceIconThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)xfce_icon_theme_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(XfceIconTheme), - 0, /* n_preallocs */ - (GInstanceInitFunc)xfce_icon_theme_init, - NULL /* value_table */ - }; - - icon_theme_type = g_type_register_static(G_TYPE_OBJECT, - "XfceIconTheme", &icon_theme_info, 0); - } - - return icon_theme_type; + static GType icon_theme_type = 0; + + if(!icon_theme_type) { + static const GTypeInfo icon_theme_info = { + sizeof(XfceIconThemeClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)xfce_icon_theme_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof(XfceIconTheme), + 0, /* n_preallocs */ + (GInstanceInitFunc)xfce_icon_theme_init, + NULL /* value_table */ + }; + + icon_theme_type = g_type_register_static(G_TYPE_OBJECT, + "XfceIconTheme", &icon_theme_info, 0); + } + + return icon_theme_type; } static void xfce_icon_theme_class_init(XfceIconThemeClass *klass) { - GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - - parent_class = g_type_class_peek_parent(klass); - - gobject_class->finalize = xfce_icon_theme_finalize; - + GObjectClass *gobject_class = G_OBJECT_CLASS(klass); + + g_type_class_add_private (klass, sizeof (XfceIconThemePriv)); + + parent_class = g_type_class_peek_parent(klass); + + gobject_class->finalize = xfce_icon_theme_finalize; + /** * XfceIconTheme::changed * @icon_theme: the icon theme @@ -98,31 +101,29 @@ * * Since 4.1 **/ - icon_theme_signals[XFCEIC_SIG_CHANGED] = g_signal_new("changed", - G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(XfceIconThemeClass, changed), NULL, NULL, - g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + icon_theme_signals[XFCEIC_SIG_CHANGED] = g_signal_new("changed", + G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(XfceIconThemeClass, changed), NULL, NULL, + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); } static void xfce_icon_theme_init(XfceIconTheme *icon_theme) { - icon_theme->priv = g_new0(XfceIconThemePriv, 1); + icon_theme->priv = XFCE_ICON_THEME_GET_PRIVATE (icon_theme); } static void xfce_icon_theme_finalize(GObject *object) { - XfceIconTheme *icon_theme = XFCE_ICON_THEME(object); + XfceIconTheme *icon_theme = XFCE_ICON_THEME(object); g_signal_handlers_disconnect_by_func(G_OBJECT(icon_theme->priv->icon_theme), G_CALLBACK(xfce_icon_theme_changed_cb), icon_theme); - g_free(icon_theme->priv); - - G_OBJECT_CLASS(parent_class)->finalize(object); + G_OBJECT_CLASS(parent_class)->finalize(object); } /** @@ -169,9 +170,9 @@ **/ gchar * xfce_icon_theme_lookup(XfceIconTheme *icon_theme, const gchar *icon_name, - gint icon_size) + gint icon_size) { - return xfce_themed_icon_lookup(icon_name, icon_size); + return xfce_themed_icon_lookup(icon_name, icon_size); } /** @@ -191,9 +192,9 @@ **/ gchar * xfce_icon_theme_lookup_list(XfceIconTheme *icon_theme, GList *icon_names, - gint icon_size) + gint icon_size) { - return xfce_themed_icon_lookup_list(icon_names, icon_size); + return xfce_themed_icon_lookup_list(icon_names, icon_size); } /** @@ -215,9 +216,9 @@ **/ gchar * xfce_icon_theme_lookup_category(XfceIconTheme *icon_theme, - XfceIconThemeCategory category, gint icon_size) + XfceIconThemeCategory category, gint icon_size) { - return xfce_themed_icon_lookup_category(category, icon_size); + return xfce_themed_icon_lookup_category(category, icon_size); } /** @@ -237,9 +238,9 @@ **/ GdkPixbuf * xfce_icon_theme_load(XfceIconTheme *icon_theme, const gchar *icon_name, - gint icon_size) + gint icon_size) { - return xfce_themed_icon_load(icon_name, icon_size); + return xfce_themed_icon_load(icon_name, icon_size); } /** @@ -259,9 +260,9 @@ **/ GdkPixbuf * xfce_icon_theme_load_list(XfceIconTheme *icon_theme, GList *icon_names, - gint icon_size) + gint icon_size) { - return xfce_themed_icon_load_list(icon_names, icon_size); + return xfce_themed_icon_load_list(icon_names, icon_size); } /** @@ -283,9 +284,9 @@ **/ GdkPixbuf * xfce_icon_theme_load_category(XfceIconTheme *icon_theme, - XfceIconThemeCategory category, gint icon_size) + XfceIconThemeCategory category, gint icon_size) { - return xfce_themed_icon_load_category(category, icon_size); + return xfce_themed_icon_load_category(category, icon_size); } /** @@ -301,21 +302,21 @@ GList * xfce_icon_theme_get_search_path(XfceIconTheme *icon_theme) { - GList *new_list = NULL; + GList *new_list = NULL; gchar **path = NULL; gint n_elements = 0, i; - - g_return_val_if_fail(XFCE_IS_ICON_THEME(icon_theme), NULL); - + + g_return_val_if_fail(XFCE_IS_ICON_THEME(icon_theme), NULL); + gtk_icon_theme_get_search_path(icon_theme->priv->icon_theme, &path, &n_elements); - + for(i = 0; i < n_elements; ++i) new_list = g_list_prepend(new_list, path[i]); - + g_free(path); - return g_list_reverse(new_list); + return g_list_reverse(new_list); } /** @@ -333,9 +334,9 @@ { gchar **path = NULL; gint i, n_elements; - + g_return_if_fail(XFCE_IS_ICON_THEME(icon_theme)); - + n_elements = g_list_length(search_paths); path = g_new(gchar *, n_elements + 1); @@ -360,10 +361,10 @@ **/ void xfce_icon_theme_prepend_search_path(XfceIconTheme *icon_theme, - const gchar *search_path) + const gchar *search_path) { - g_return_if_fail(XFCE_IS_ICON_THEME(icon_theme) && search_path); - + g_return_if_fail(XFCE_IS_ICON_THEME(icon_theme) && search_path); + gtk_icon_theme_prepend_search_path(icon_theme->priv->icon_theme, search_path); } @@ -379,10 +380,10 @@ **/ void xfce_icon_theme_append_search_path(XfceIconTheme *icon_theme, - const gchar *search_path) + const gchar *search_path) { - g_return_if_fail(XFCE_IS_ICON_THEME(icon_theme) && search_path); - + g_return_if_fail(XFCE_IS_ICON_THEME(icon_theme) && search_path); + gtk_icon_theme_append_search_path(icon_theme->priv->icon_theme, search_path); } @@ -401,9 +402,9 @@ **/ XfceIconThemeCategory xfce_icon_theme_register_category(XfceIconTheme *icon_theme, GList *icon_names) -{ - g_return_val_if_fail(XFCE_IS_ICON_THEME(icon_theme) && icon_names, -1); - +{ + g_return_val_if_fail(XFCE_IS_ICON_THEME(icon_theme) && icon_names, -1); + g_warning("xfce_icon_theme_register_category() is deprecated and no longer " \ "does anything useful. Use xfce_themed_icon_load/lookup_list() instead."); @@ -424,7 +425,7 @@ **/ void xfce_icon_theme_unregister_category(XfceIconTheme *icon_theme, - XfceIconThemeCategory category) + XfceIconThemeCategory category) { /* no-op */ } @@ -442,7 +443,7 @@ void xfce_icon_theme_set_use_svg(XfceIconTheme *icon_theme, gboolean use_svg) { - g_warning("xfce_icon_theme_set_use_svg() is deprecated and no longer " \ + g_warning("xfce_icon_theme_set_use_svg() is deprecated and no longer " \ "does anything useful. Use GtkIconTheme directly to avoid " \ "searching for SVG icons."); } @@ -458,6 +459,6 @@ gboolean xfce_icon_theme_get_use_svg(XfceIconTheme *icon_theme) { - /* no-op */ + /* no-op */ return TRUE; }