From ef660349a1282fc3089cfe8865d59e7238d36152 Mon Sep 17 00:00:00 2001 From: Sven Herzberg Date: Mon, 29 Aug 2005 22:44:42 +0000 Subject: [PATCH] listen to the XCURSOR_PATH environment variable (Closes: #312534). 2005-08-30 Sven Herzberg * gnome-mouse-properties.c: listen to the XCURSOR_PATH environment variable (Closes: #312534). --- capplets/mouse/ChangeLog | 5 +++++ capplets/mouse/gnome-mouse-properties.c | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/capplets/mouse/ChangeLog b/capplets/mouse/ChangeLog index fff0691a2..0e6b1c73a 100644 --- a/capplets/mouse/ChangeLog +++ b/capplets/mouse/ChangeLog @@ -1,3 +1,8 @@ +2005-08-30 Sven Herzberg + + * gnome-mouse-properties.c: listen to the XCURSOR_PATH environment + variable (Closes: #312534). + 2005-08-24 Kjartan Maraas * gnome-mouse-properties.c: (cursor_changed): Move the call to diff --git a/capplets/mouse/gnome-mouse-properties.c b/capplets/mouse/gnome-mouse-properties.c index 798ca27d4..5871abf14 100644 --- a/capplets/mouse/gnome-mouse-properties.c +++ b/capplets/mouse/gnome-mouse-properties.c @@ -648,14 +648,17 @@ static void populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) { #ifdef HAVE_XCURSOR // add the XCursor themes - paths taken from - const gchar* const paths[] = { + const gchar* const path_defs[] = { "%s/.icons/", "/usr/share/icons/", "/usr/share/pixmaps/", "/usr/X11R6/lib/X11/icons/", NULL }; - const gchar* const * iterator; + + gchar **iterator = NULL; + gchar **paths = NULL; + GConfClient* client = gconf_client_get_default(); GtkListStore* store = GTK_LIST_STORE(gtk_tree_model_sort_get_model(model)); gchar* current_theme = gconf_client_get_string(client, CURSOR_THEME_KEY, NULL); @@ -663,6 +666,14 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) { g_object_unref(client); client = NULL; + const gchar *xpaths = g_getenv ("XCURSOR_PATH"); + + if (xpaths != NULL) { + paths = g_strsplit (xpaths, ":", 0); + } else { + paths = g_strdupv ((gchar **) path_defs); + } + for(iterator = paths; *iterator; iterator++) { gchar* fname = NULL; GDir* folder = NULL; @@ -677,7 +688,7 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) { folder = g_dir_open(fname, 0, NULL); while(folder && (name = g_dir_read_name(folder))) { - gchar* cursor_dir = g_strdup_printf("%s%s/cursors/", fname, name); + gchar* cursor_dir = g_strdup_printf("%s/%s/cursors/", fname, name); XcursorImage* cursor; gint sizes[] = { 12, 16, 24, 32, 36, 48, 0 }; gint i; @@ -731,6 +742,10 @@ populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) { } g_free(current_theme); + + if (xpaths != NULL) { + g_strfreev (paths); + } #else /* !HAVE_XCURSOR */ gchar* cursor_font; static const gchar* builtins[][5] = {