XfceIconTheme fixes

Brian J. Tarricone bjt23 at cornell.edu
Tue Sep 7 00:54:23 CEST 2004


jasper,

this patch looks good, except that there's no need to keep the theme 
name around or to compare it to a portion of the pathname (which could 
be error-prone, btw).  the XfceIcon struct has a "is_in_theme" boolean 
var that you can check.  could you rewrite your patch to use that 
instead?  if i'm totally missing the point of what you did, feel free to 
smack me ^_~.

    -brian

Jasper Huijsmans wrote:

>>
>>>
>>> jasper, remind me later that we need to dig in the UI plugin a bit, 
>>> in case i forget.
>>>
>>
>> I committed the fixes that set the Net/IconThemeName to the theme 
>> directory, like at least GNOME seems to expect. I'll let you handle 
>> the gtk_settings stuff.
>
>
> Grr, I'm a fool. This one actually works...
>
>     Jasper
>
>------------------------------------------------------------------------
>
>Index: xfce-icontheme.c
>===================================================================
>RCS file: /var/cvs/xfce/xfce4/libxfcegui4/libxfcegui4/xfce-icontheme.c,v
>retrieving revision 1.12
>diff -u -r1.12 xfce-icontheme.c
>--- xfce-icontheme.c	6 Sep 2004 03:18:52 -0000	1.12
>+++ xfce-icontheme.c	6 Sep 2004 20:42:02 -0000
>@@ -59,6 +59,8 @@
> 	
> 	GdkScreen *gscreen;
> 	
>+	gchar *theme_name;
>+	
> 	GHashTable *icons;
> 	
> 	GList *search_paths;
>@@ -279,7 +281,10 @@
> 	
> 	g_object_get(G_OBJECT(settings), "gtk-icon-theme-name", &theme_name, NULL);
> 	if(!theme_name)
>-		theme_name = DEFAULT_THEME;
>+		theme_name = g_strdup (DEFAULT_THEME);
>+	
>+	g_free (singleton->theme_name);
>+	singleton->theme_name = theme_name;
> 	
> 	if(singleton->icons) {
> 		g_hash_table_foreach(singleton->icons, icon_lists_free_ht, NULL);
>@@ -301,8 +306,6 @@
> 			theme_add_all(singleton, l->data, fallback_themes[i], FALSE);
> 	}
> 	
>-	if(theme_name != DEFAULT_THEME)
>-		g_free(theme_name);
> 	g_hash_table_destroy(singleton->hash_for_stupid_themes);
> }
> 
>@@ -680,17 +683,30 @@
> {
> 	XfceIconThemePriv *priv;
> 	GList *l;
>-	gchar *filename = NULL;
>+	gchar *filename = NULL, *fallback = NULL;
> 	
> 	g_return_val_if_fail(XFCE_IS_ICON_THEME(icon_theme) && icon_names, NULL);
> 	priv = icon_theme->priv;
> 	
> 	for(l = icon_names; l; l = l->next) {
> 		filename = xfce_icon_theme_lookup(icon_theme, (gchar *)l->data, icon_size);
>-		if(filename)
>-			break;
>+		if(filename) {
>+			if (strstr (filename, priv->singleton->theme_name))
>+				break;
>+			else if (!fallback)
>+				fallback = filename;
>+			else
>+				g_free (filename);
>+			
>+			filename = NULL;
>+		}
> 	}
> 	
>+	if (!filename && fallback)
>+		filename = fallback;
>+	else
>+		g_free (fallback);
>+
> 	return filename;
> }
> 
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Xfce4-dev mailing list
>Xfce4-dev at xfce.org
>http://lunar-linux.org/mailman/listinfo/xfce4-dev
>



More information about the Xfce4-dev mailing list