simplify some more code, and fix a crash when the cursor theme in GConf is

2007-10-29  Jens Granseuer  <jensgr@gmx.net>

	* appearance-style.c: (gtk_theme_changed), (window_theme_changed),
	(icon_theme_changed), (update_cursor_size_scale),
	(cursor_theme_changed):
	* appearance-themes.c: (theme_selection_changed_cb):
	* theme-util.c: (theme_is_writable):
	* theme-util.h: simplify some more code, and fix a crash when the
	cursor theme in GConf is unset that I introduced in r8212

svn path=/trunk/; revision=8228
This commit is contained in:
Jens Granseuer 2007-10-28 23:01:09 +00:00 committed by Jens Granseuer
parent 194de56db9
commit 286cdd1fcd
5 changed files with 18 additions and 9 deletions

View file

@ -1,3 +1,13 @@
2007-10-29 Jens Granseuer <jensgr@gmx.net>
* appearance-style.c: (gtk_theme_changed), (window_theme_changed),
(icon_theme_changed), (update_cursor_size_scale),
(cursor_theme_changed):
* appearance-themes.c: (theme_selection_changed_cb):
* theme-util.c: (theme_is_writable):
* theme-util.h: simplify some more code, and fix a crash when the
cursor theme in GConf is unset that I introduced in r8212
2007-10-28 Jens Granseuer <jensgr@gmx.net> 2007-10-28 Jens Granseuer <jensgr@gmx.net>
* appearance-style.c: (prepare_list): * appearance-style.c: (prepare_list):

View file

@ -328,7 +328,7 @@ gtk_theme_changed (GConfPropertyEditor *peditor,
} }
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "gtk_themes_delete"), gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "gtk_themes_delete"),
theme_is_writable (theme, THEME_TYPE_GTK)); theme_is_writable (theme));
} }
static void static void
@ -344,7 +344,7 @@ window_theme_changed (GConfPropertyEditor *peditor,
theme = gnome_theme_info_find (name); theme = gnome_theme_info_find (name);
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "window_themes_delete"), gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "window_themes_delete"),
theme_is_writable (theme, THEME_TYPE_WINDOW)); theme_is_writable (theme));
} }
static void static void
@ -360,7 +360,7 @@ icon_theme_changed (GConfPropertyEditor *peditor,
theme = gnome_theme_icon_info_find (name); theme = gnome_theme_icon_info_find (name);
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "icon_themes_delete"), gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "icon_themes_delete"),
theme_is_writable (theme, THEME_TYPE_ICON)); theme_is_writable (theme));
} }
#ifdef HAVE_XCURSOR #ifdef HAVE_XCURSOR
@ -456,7 +456,7 @@ update_cursor_size_scale (GnomeThemeCursorInfo *theme,
size = g_array_index (theme->sizes, gint, index); size = g_array_index (theme->sizes, gint, index);
} else { } else {
if (theme->sizes->len > 0) if (theme && theme->sizes->len > 0)
size = g_array_index (theme->sizes, gint, 0); size = g_array_index (theme->sizes, gint, 0);
else else
size = 18; size = 18;
@ -482,7 +482,7 @@ cursor_theme_changed (GConfPropertyEditor *peditor,
update_cursor_size_scale (theme, data); update_cursor_size_scale (theme, data);
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "cursor_themes_delete"), gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "cursor_themes_delete"),
theme_is_writable (theme, THEME_TYPE_CURSOR)); theme_is_writable (theme));
} }

View file

@ -594,7 +594,7 @@ theme_selection_changed_cb (GtkWidget *icon_view, AppearanceData *data)
} }
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "theme_delete"), gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "theme_delete"),
theme_is_writable (theme, THEME_TYPE_META)); theme_is_writable (theme));
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "theme_save"), is_custom); gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "theme_save"), is_custom);
} }

View file

@ -26,12 +26,11 @@
#include <string.h> #include <string.h>
gboolean gboolean
theme_is_writable (const gpointer theme, ThemeType type) theme_is_writable (const gpointer theme)
{ {
GnomeThemeCommonInfo *info = theme; GnomeThemeCommonInfo *info = theme;
GnomeVFSResult vfs_result; GnomeVFSResult vfs_result;
GnomeVFSFileInfo *vfs_info; GnomeVFSFileInfo *vfs_info;
const gchar *theme_path;
gboolean writable; gboolean writable;
if (info == NULL || info->path == NULL) if (info == NULL || info->path == NULL)

View file

@ -50,7 +50,7 @@ typedef enum {
THEME_TYPE_CURSOR THEME_TYPE_CURSOR
} ThemeType; } ThemeType;
gboolean theme_is_writable (const gpointer theme, ThemeType type); gboolean theme_is_writable (const gpointer theme);
gboolean theme_delete (const gchar *name, ThemeType type); gboolean theme_delete (const gchar *name, ThemeType type);
gboolean theme_model_iter_last (GtkTreeModel *model, GtkTreeIter *iter); gboolean theme_model_iter_last (GtkTreeModel *model, GtkTreeIter *iter);