Re: [Patch] fix bug #8487: read-only status not shown in title bar

From: joe joe <joegsoc2013_at_gmail.com>
Date: Sun Apr 07 2013 - 15:06:28 CEST

http://bugzilla.abisource.com/show_bug.cgi?id=8487
------- Comment #14 From joe 2013-04-07 14:48:48 [reply] -------
(In reply to comment #13)
> The idea looks good, but if you look closely to ut_go_file.cpp, ideally the
> case #elif ! defined (G_OS_WIN32) should just be a #else and file_stat should
> just be a GStatBuf as per the documentation. and it would be equivalent.
>

Hi Hub,

If we would like to merge the code together, should like the Patch in
the attachment.
Because the following code can't merge together since:
1. the Macro definition of "S_IRUSR" && "S_IREAD" are not same in different OS.
2. the file attributions are not the same. in windows, there are not Group
Permissions & Other Permissions

Joe

On Sat, Apr 6, 2013 at 11:43 PM, joe joe <joegsoc2013@gmail.com> wrote:
> Hi,
>
> I have fixed bug #8487: read-only status not shown in title bar
> http://bugzilla.abisource.com/show_bug.cgi?id=8487
>
> Patch and fix screenshot are attached on that bug. Can someone help me
> to have a review? thanks
>
> Investigation:
> Only Windows don't show read-only status in title bar. the reason
> is that in Window, there is not function to read user-permission.
>
> Solution:
> I add some code to read user-permission and fix it.
>
> Index: af/util/xp/ut_go_file.cpp
> ===================================================================
> --- af/util/xp/ut_go_file.cpp (revision 32831)
> +++ af/util/xp/ut_go_file.cpp (working copy)
> @@ -1478,6 +1478,19 @@
> file_permissions->others_write = ((file_stat.st_mode & S_IWOTH) != 0);
> file_permissions->others_execute = ((file_stat.st_mode & S_IXOTH) != 0);
> }
> +#elif defined (G_OS_WIN32)
> + //fix bug #8487: read-only status not shown in title bar
> + GStatBuf file_stat;
> + char *filename = UT_go_filename_from_uri (uri);
> + int result = filename ? g_stat (filename, &file_stat) : -1;
> + g_free (filename);
> + if (result == 0) {
> + file_permissions = g_new0 (UT_GOFilePermissions, 1);
> + /* Owner Permissions */
> + file_permissions->owner_read = ((file_stat.st_mode & S_IREAD) != 0);
> + file_permissions->owner_write = ((file_stat.st_mode & S_IWRITE) != 0);
> + file_permissions->owner_execute = ((file_stat.st_mode & S_IEXEC) != 0);
> + }
> #endif
> return file_permissions;
> }
>
>
>
>
> Joe

Received on Sun Apr 7 15:06:42 2013

This archive was generated by hypermail 2.1.8 : Sun Apr 07 2013 - 15:06:42 CEST