Adding theme directories via XDG_DATA_DIRS in control-panel 2.10?
- From: Albert Chin <gnomecc-list mlists thewrittenword com>
- To: gnomecc-list gnome org
- Subject: Adding theme directories via XDG_DATA_DIRS in control-panel 2.10?
- Date: Sat, 5 Nov 2005 09:39:08 -0600
We have GTK+ 2.6.8 installed to /opt/libgtk+26 and GNOME 2.10 to
/opt/gnome210. I'd like control-center's gnome-theme-manager to pick
up /opt/libgtk+26/share/themes and /opt/gnome210/share/themes. So, I
made the change below to pick up the theme directories from
XDG_DATA_DIRS. However, while the themes from multiple directories
_are_ displayed, selecting them does nothing. If I set
GTK_DATA_PREFIX=/opt/gnome210, then the GNOME themes are displayed and
selecting them changes to the theme. Why doesn't the code below work?
--
albert chin (china thewrittenword com)
-- snip snip
--- capplets/common/gnome-theme-info.c.orig 2005-10-05 08:17:34.000000000 -0500
+++ capplets/common/gnome-theme-info.c 2005-10-07 15:44:37.000000000 -0500
@@ -1591,6 +1591,8 @@
static gboolean initted = FALSE;
GnomeVFSResult result;
const gchar *gtk_data_dir;
+ const gchar * const *xdg_data_dirs;
+ int i;
if (initted)
return;
@@ -1604,14 +1606,26 @@
theme_hash_by_name = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- /* Add all the toplevel theme dirs. */
- /* $datadir/themes */
+ /* Add the default GTK+ theme dirs. */
+ /* $gtk_data_dir/themes */
top_theme_dir_string = gtk_rc_get_theme_dir ();
top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
result = add_top_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 1, NULL);
g_free (top_theme_dir_string);
gnome_vfs_uri_unref (top_theme_dir_uri);
+ /* Add the themes under XDG_DATA_DIRS */
+ xdg_data_dirs = g_get_system_data_dirs ();
+ for (i = 0; xdg_data_dirs[i]; i++)
+ {
+ top_theme_dir_string = g_build_filename (xdg_data_dirs[i], "themes", NULL);
+ top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
+ if (gnome_vfs_uri_exists (top_theme_dir_uri))
+ result = add_top_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 1, NULL);
+ gnome_vfs_uri_unref (top_theme_dir_uri);
+ g_free (top_theme_dir_string);
+ }
+
/* ~/.themes */
top_theme_dir_string = g_build_filename (g_get_home_dir (), ".themes", NULL);
top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
@@ -1646,6 +1660,16 @@
result = add_top_icon_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 1, NULL);
gnome_vfs_uri_unref (top_theme_dir_uri);
+ for (i = 0; xdg_data_dirs[i]; i++)
+ {
+ top_theme_dir_string = g_build_filename (xdg_data_dirs[i], "icons", NULL);
+ top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
+ g_free (top_theme_dir_string);
+ if (gnome_vfs_uri_exists (top_theme_dir_uri))
+ result = add_top_icon_theme_dir_monitor (top_theme_dir_uri, &real_monitor_not_added, 2, NULL);
+ gnome_vfs_uri_unref (top_theme_dir_uri);
+ }
+
/* ~/.icons */
top_theme_dir_string = g_build_filename (g_get_home_dir (), ".icons", NULL);
top_theme_dir_uri = gnome_vfs_uri_new (top_theme_dir_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]