Read a cursor theme's name from it's index.theme file if it has one.

2007-07-28  Denis Washington  <denisw@svn.gnome.org>

	* common/gnome-theme-info.h:
	* common/gnome-theme-info.c: (look_in_cursor_theme),
	(gnome_theme_cursor_info_free):
	Read a cursor theme's name from it's index.theme file if it has one.

	* appearance/appearance-style.c: (prepare_list):
	Show readable_name in cursor theme list instead of name.

svn path=/trunk/; revision=7914
This commit is contained in:
Denis Washington 2007-07-28 13:53:15 +00:00 committed by Denis Washington
parent b608a53acb
commit 2834baf127
5 changed files with 38 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2007-07-28 Denis Washington <denisw@svn.gnome.org>
* appearance-style.c: (prepare_list):
Show readable_name in cursor theme list instead of name.
2007-07-28 Thomas Wood <thos@gnome.org> 2007-07-28 Thomas Wood <thos@gnome.org>
* wp-cellrenderer.c: (cell_renderer_wallpaper_render): Don't draw the * wp-cellrenderer.c: (cell_renderer_wallpaper_render): Don't draw the

View file

@ -774,9 +774,7 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
label = ((GnomeThemeIconInfo *) l->data)->readable_name; label = ((GnomeThemeIconInfo *) l->data)->readable_name;
} else if (type == THEME_TYPE_CURSOR) { } else if (type == THEME_TYPE_CURSOR) {
name = ((GnomeThemeCursorInfo *) l->data)->name; name = ((GnomeThemeCursorInfo *) l->data)->name;
#ifndef HAVE_XCURSOR label = ((GnomeThemeCursorInfo *) l->data)->readable_name;
label = ((GnomeThemeCursorInfo *) l->data)->label;
#endif
} }
if (!name) if (!name)

View file

@ -1,3 +1,10 @@
2007-07-28 Denis Washington <denisw@svn.gnome.org>
* gnome-theme-info.h:
* gnome-theme-info.c: (look_in_cursor_theme),
(gnome_theme_cursor_info_free):
Read a cursor theme's name from it's index.theme file if it has one.
2007-07-28 Denis Washington <denisw@svn.gnome.org> 2007-07-28 Denis Washington <denisw@svn.gnome.org>
* gnome-theme-info.c: (read_icon_theme): * gnome-theme-info.c: (read_icon_theme):

View file

@ -1003,6 +1003,8 @@ static void
look_for_cursor_theme (const gchar *theme_dir) look_for_cursor_theme (const gchar *theme_dir)
{ {
gchar *cursors_dir; gchar *cursors_dir;
gchar *cursor_theme_file;
GnomeDesktopItem *cursor_theme_ditem;
cursors_dir = g_build_filename (theme_dir, "cursors", NULL); cursors_dir = g_build_filename (theme_dir, "cursors", NULL);
@ -1050,6 +1052,25 @@ look_for_cursor_theme (const gchar *theme_dir)
cursor_theme_info->thumbnail = thumbnail; cursor_theme_info->thumbnail = thumbnail;
cursor_theme_info->priority = 0; cursor_theme_info->priority = 0;
cursor_theme_file = g_build_filename (theme_dir, "index.theme", NULL);
cursor_theme_ditem = gnome_desktop_item_new_from_file (cursor_theme_file, 0, NULL);
g_free (cursor_theme_file);
if (cursor_theme_ditem) {
const gchar *readable_name;
readable_name = (gchar *) gnome_desktop_item_get_string (cursor_theme_ditem, "Icon Theme/Name");
if (readable_name)
cursor_theme_info->readable_name = g_strdup (readable_name);
else
cursor_theme_info->readable_name = g_strdup (name);
gnome_desktop_item_unref (cursor_theme_ditem);
} else {
cursor_theme_info->readable_name = g_strdup (name);
}
g_hash_table_insert (cursor_theme_hash_by_uri, cursor_theme_info->path, cursor_theme_info); g_hash_table_insert (cursor_theme_hash_by_uri, cursor_theme_info->path, cursor_theme_info);
add_data_to_hash_by_name (cursor_theme_hash_by_name, name, cursor_theme_info); add_data_to_hash_by_name (cursor_theme_hash_by_name, name, cursor_theme_info);
} }
@ -1478,6 +1499,7 @@ void
gnome_theme_cursor_info_free (GnomeThemeCursorInfo *cursor_theme_info) gnome_theme_cursor_info_free (GnomeThemeCursorInfo *cursor_theme_info)
{ {
g_free (cursor_theme_info->name); g_free (cursor_theme_info->name);
g_free (cursor_theme_info->readable_name);
g_free (cursor_theme_info->path); g_free (cursor_theme_info->path);
g_array_free (cursor_theme_info->sizes, TRUE); g_array_free (cursor_theme_info->sizes, TRUE);
g_object_unref (cursor_theme_info->thumbnail); g_object_unref (cursor_theme_info->thumbnail);
@ -1811,9 +1833,9 @@ read_cursor_fonts (void)
theme_info->name = theme_info->path = g_build_filename (GNOMECC_DATA_DIR, builtins[i][0], NULL); theme_info->name = theme_info->path = g_build_filename (GNOMECC_DATA_DIR, builtins[i][0], NULL);
if (!strcmp (theme_info->path, cursor_font)) if (!strcmp (theme_info->path, cursor_font))
theme_info->label = g_strdup (builtins[i][2]); theme_info->readable_name = g_strdup (builtins[i][2]);
else else
theme_info->label = g_strdup (builtins[i][1]); theme_info->readable_name = g_strdup (builtins[i][1]);
g_hash_table_insert (cursor_theme_hash_by_uri, theme_info->path, theme_info); g_hash_table_insert (cursor_theme_hash_by_uri, theme_info->path, theme_info);
add_data_to_hash_by_name (cursor_theme_hash_by_name, theme_info->name, theme_info); add_data_to_hash_by_name (cursor_theme_hash_by_name, theme_info->name, theme_info);

View file

@ -75,12 +75,10 @@ typedef struct _GnomeThemeCursorInfo GnomeThemeCursorInfo;
struct _GnomeThemeCursorInfo { struct _GnomeThemeCursorInfo {
gchar *path; gchar *path;
gchar *name; gchar *name;
gchar *readable_name;
gint priority; gint priority;
GArray *sizes; GArray *sizes;
GdkPixbuf *thumbnail; GdkPixbuf *thumbnail;
#ifndef HAVE_XCURSOR
gchar *label;
#endif
}; };
typedef struct _GnomeThemeMetaInfo GnomeThemeMetaInfo; typedef struct _GnomeThemeMetaInfo GnomeThemeMetaInfo;