Re: User mime types not working in Nautilus 2.2 and 2.4 [#48494 back again]



On Wed, 2003-09-17 at 11:13, Alexander Larsson wrote:
> On Mon, 2003-09-15 at 22:53, Joe Marcus Clarke wrote:
> > On Mon, 2003-09-15 at 05:23, Alexander Larsson wrote:
> > > On Mon, 2003-09-15 at 04:19, Joe Marcus Clarke wrote:
> > > > I am seeing the exact problem described in #48494 in Nautilus 2.2.4 and
> > > > 2.4.0 on both FreeBSD and Slackware.  It looks like this bug might be
> > > > back.  I'm willing to take a deeper look into this.  I browsed a little
> > > > through libnautilus-private, and it looks like that's where I need to
> > > > be, but could someone fill me in on how the icon file name is obtained? 
> > > > Any ideas why user-defined icons would not be loaded even though the
> > > > mime-type and action is?  Note, mime-types in the system mime-info
> > > > directory are working correctly, and show the correct icons.  Thanks.
> > > 
> > > Sorry, I have no idea why it would work for the system data and not for
> > > the user one. I guess you have to trace down the code and compare the
> > > two 
> > 
> > Okay, I've delved into this further, and I think I've found the
> > pattern.  I'm wondering if you can test this for me, Alex?  Create a
> > MIME type, and have the icon point to a fully-qualified pathname outside
> > of the GNOME icon themes.  Then see if it shows up in Nautilus.
> > 
> > What I'm seeing is that MIME types that have fully-qualified non-icon
> > theme icons (regardless of whether or not they're system-defined or
> > user-defined), don't show up in Nautilus.  This is because
> > gnome_icon_lookup() only knows about customer icons if the custom icon
> > argument is non-NULL.  I believe Nautilus will only set this variable to
> > a value if a _Nautilus_ custom icon has been defined.  I'm curious to
> > know if this, in fact, the case.  If so, I'm not sure the best
> > solution.  Should libgnomeui be fixed, or should Nautilus peek at the
> > icon_filename gnome-vfs property, and pass it as a custom icon if the
> > first character is '/'?  Thanks.
> 
> This is a libgnomeui bug. It needs to handle absolute icon pathnames in
> mime data. Here is a patch:

Thank you!

Joe

> 
> Index: libgnomeui/gnome-icon-lookup.c
> ===================================================================
> RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-icon-lookup.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 gnome-icon-lookup.c
> --- libgnomeui/gnome-icon-lookup.c	2 Mar 2003 13:17:08 -0000	1.9
> +++ libgnomeui/gnome-icon-lookup.c	17 Sep 2003 15:11:31 -0000
> @@ -107,6 +107,10 @@ get_vfs_mime_name (const char *mime_type
>  
>    if (vfs_mime_name)
>      {
> +      /* Handle absolute files */
> +      if (vfs_mime_name[0] == '/')
> +	return g_strdup (vfs_mime_name);
> +      
>        p = strrchr(vfs_mime_name, '.');
>  
>        if (p)
> @@ -293,7 +297,9 @@ gnome_icon_lookup (GnomeIconTheme       
>    if (mime_type)
>      {
>        mime_name = get_vfs_mime_name (mime_type);
> -      if (mime_name && gnome_icon_theme_has_icon (icon_theme, mime_name))
> +      if (mime_name &&
> +	  ((mime_name[0] == '/' &&  g_file_test (mime_name, G_FILE_TEST_IS_REGULAR) ||
> +	    gnome_icon_theme_has_icon (icon_theme, mime_name))))
>  	return mime_name;
>        g_free (mime_name);
>        
> 
> Anders, is this ok to commit?
> 
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>  Alexander Larsson                                            Red Hat, Inc 
>                    alexl redhat com    alla lysator liu se 
> He's a bookish albino househusband on a mission from God. She's a 
> sharp-shooting wisecracking museum curator with only herself to blame. They 
> fight crime! 
-- 
Joe Marcus Clarke
FreeBSD GNOME Team	::	gnome FreeBSD org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]