listen to the XCURSOR_PATH environment variable (Closes: #312534).

2005-08-30  Sven Herzberg  <herzi@gnome-de.org>

        * gnome-mouse-properties.c: listen to the XCURSOR_PATH environment
        variable (Closes: #312534).
This commit is contained in:
Sven Herzberg 2005-08-29 22:44:42 +00:00 committed by Sven Herzberg
parent 9833c4364b
commit ef660349a1
2 changed files with 23 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2005-08-30 Sven Herzberg <herzi@gnome-de.org>
* gnome-mouse-properties.c: listen to the XCURSOR_PATH environment
variable (Closes: #312534).
2005-08-24 Kjartan Maraas <kmaraas@gnome.org>
* gnome-mouse-properties.c: (cursor_changed): Move the call to

View file

@ -648,14 +648,17 @@ static void
populate_tree_model(GtkTreeModelSort* model, GtkTreeSelection* selection) {
#ifdef HAVE_XCURSOR
// add the XCursor themes - paths taken from <xc/lib/Xcursor.library.c>
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] = {