gcmd-devel
[Top][All Lists]
Advanced

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

Re: [gcmd-dev] [PATCH] Switching to mounted device with mount point cont


From: Piotr Eljasiak
Subject: Re: [gcmd-dev] [PATCH] Switching to mounted device with mount point containing spaces
Date: Thu, 08 Nov 2007 23:13:10 +0100

> One small fix for switching device, which is mounted to path with 
> spaces. This is case with memory cards formatted in digital cameras, 
> where the name of device is name of camera - for example "NIKON D40", 
> which mounts in GNOME to "/media/NIKON D40" and in mtab is  
> "/media/NIKON\040D40" with escape character. This should be converted to 
> normal string with g_strcompress, so the function is_mounted in 
> gnome-cmd-con-device.cc line 67 will contain:
> 
> -------------------------------------
>     while ((s = fgets (tmp, sizeof(tmp), fd)))
>     {
>         char **v = g_strsplit (s, " ", 3);
> 
>         if (v[1])
>         {
>             gchar *dir = g_strcompress(v[1]);
>             if (strcmp (dir, dev_con->priv->mountp) == 0)
>                 ret = TRUE;
>             g_free(dir);
>         }
> 
>         g_strfreev (v);
> 
>         if (ret) break;
>     }
> -------------------------------------

Thanks, applied. Works like a charm. I've slightly rearranged the code,
and fixed the missing fclose(fd) 

> May be, the same should be aplied to mounting in do_mount_thread_func? 
> May be not - i have not checked.

No, rather not, for do_mount_thread_func doesn't deal directly with
mtab.

> Also fix in gnome_cmd_con_device_get_type function automatic conversion 
> of constant string "GnomeCmdConDevice" to (gchar*)"GnomeCmdConDevice" - 
> this is deprecated from gcc4.2 and it will remove warning with gcc4.2. 
> This is case with many other source files in gnome-commander and should 
> be (slowly) fixed in future.

Applied, although it's a hack only. IMHO the right solution is to use
G_DEFINE_TYPE() 
http://library.gnome.org/devel/gobject/unstable/gobject-Type-Information.html#G-DEFINE-TYPE:CAPS

to define gnome_cmd_..._get_type() functions in all gcmd files. But, of
course, this requires LOTS of work that will only kill some build
warnings...



Piotr





reply via email to

[Prev in Thread] Current Thread [Next in Thread]