reduce the number if XCURSOR ifdefs and get rid of the special treatment
2007-10-27 Jens Granseuer <jensgr@gmx.net> * appearance-style.c: (cursor_size_scale_value_changed_cb), (update_cursor_size_scale), (cursor_theme_changed), (prepare_list): * appearance-themes.c: (theme_load_from_gconf): * theme-util.h: reduce the number if XCURSOR ifdefs and get rid of the special treatment for the default cursor theme 2007-10-27 Jens Granseuer <jensgr@gmx.net> * gnome-theme-info.c: (look_for_cursor_theme), (read_cursor_fonts), (gnome_theme_init): ensure we always have the "default" cursor theme in the list svn path=/trunk/; revision=8214
This commit is contained in:
parent
298d6fbf4f
commit
dbd00f0edd
6 changed files with 53 additions and 50 deletions
|
@ -370,10 +370,33 @@ cursor_size_changed_cb (int size, AppearanceData *data)
|
|||
gconf_client_set_int (data->client, CURSOR_SIZE_KEY, size, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
cursor_size_scale_value_changed_cb (GtkRange *range, AppearanceData *data)
|
||||
{
|
||||
GnomeThemeCursorInfo *theme;
|
||||
gchar *name;
|
||||
|
||||
name = gconf_client_get_string (data->client, CURSOR_THEME_KEY, NULL);
|
||||
if (name == NULL)
|
||||
return;
|
||||
|
||||
theme = gnome_theme_cursor_info_find (name);
|
||||
g_free (name);
|
||||
|
||||
if (theme) {
|
||||
gint size;
|
||||
|
||||
size = g_array_index (theme->sizes, gint, (int) gtk_range_get_value (range));
|
||||
cursor_size_changed_cb (size, data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
update_cursor_size_scale (GnomeThemeCursorInfo *theme,
|
||||
AppearanceData *data)
|
||||
{
|
||||
#ifdef HAVE_XCURSOR
|
||||
GtkWidget *cursor_size_scale;
|
||||
GtkWidget *cursor_size_label;
|
||||
GtkWidget *cursor_size_small_label;
|
||||
|
@ -441,8 +464,8 @@ update_cursor_size_scale (GnomeThemeCursorInfo *theme,
|
|||
|
||||
if (size != gconf_size)
|
||||
cursor_size_changed_cb (size, data);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
cursor_theme_changed (GConfPropertyEditor *peditor,
|
||||
|
@ -456,9 +479,7 @@ cursor_theme_changed (GConfPropertyEditor *peditor,
|
|||
if (value && (name = gconf_value_get_string (value)))
|
||||
theme = gnome_theme_cursor_info_find (name);
|
||||
|
||||
#ifdef HAVE_XCURSOR
|
||||
update_cursor_size_scale (theme, data);
|
||||
#endif
|
||||
|
||||
gtk_widget_set_sensitive (glade_xml_get_widget (data->xml, "cursor_themes_delete"),
|
||||
theme_is_writable (theme, THEME_TYPE_CURSOR));
|
||||
|
@ -526,29 +547,6 @@ cursor_theme_delete_cb (GtkWidget *button, AppearanceData *data)
|
|||
generic_theme_delete ("cursor_themes_list", THEME_TYPE_CURSOR, data);
|
||||
}
|
||||
|
||||
#ifdef HAVE_XCURSOR
|
||||
static void
|
||||
cursor_size_scale_value_changed_cb (GtkRange *range, AppearanceData *data)
|
||||
{
|
||||
GnomeThemeCursorInfo *theme;
|
||||
gchar *name;
|
||||
|
||||
name = gconf_client_get_string (data->client, CURSOR_THEME_KEY, NULL);
|
||||
if (name == NULL)
|
||||
return;
|
||||
|
||||
theme = gnome_theme_cursor_info_find (name);
|
||||
g_free (name);
|
||||
|
||||
if (theme) {
|
||||
gint size;
|
||||
|
||||
size = g_array_index (theme->sizes, gint, (int) gtk_range_get_value (range));
|
||||
cursor_size_changed_cb (size, data);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
add_to_treeview (const gchar *tv_name,
|
||||
const gchar *theme_name,
|
||||
|
@ -762,11 +760,7 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
|
|||
case THEME_TYPE_CURSOR:
|
||||
themes = gnome_theme_cursor_info_find_all ();
|
||||
thumbnail = NULL;
|
||||
#ifdef HAVE_XCURSOR
|
||||
key = CURSOR_THEME_KEY;
|
||||
#else
|
||||
key = CURSOR_FONT_KEY;
|
||||
#endif
|
||||
generator = NULL;
|
||||
thumb_cb = NULL;
|
||||
break;
|
||||
|
@ -816,17 +810,6 @@ prepare_list (AppearanceData *data, GtkWidget *list, ThemeType type, GCallback c
|
|||
}
|
||||
g_list_free (themes);
|
||||
|
||||
#ifdef HAVE_XCURSOR
|
||||
if (type == THEME_TYPE_CURSOR && !gnome_theme_cursor_info_find ("default")) {
|
||||
GtkTreeIter i;
|
||||
gtk_list_store_insert_with_values (store, &i, 0,
|
||||
COL_LABEL, _("Default Pointer"),
|
||||
COL_NAME, "default",
|
||||
COL_THUMBNAIL, NULL,
|
||||
-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (store));
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model),
|
||||
COL_LABEL, GTK_SORT_ASCENDING);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue