Re: [Patch] fix bug #8487: read-only status not shown in title bar
joe joe <[email protected]> Mon, 8 Apr 2013 10:44:37 +0800
| Newsgroups | gmane.editors.abiword.devel |
|---|---|
| Message-ID | <CAKBgNKqnCpwJFa=8xinDja5cAQk-iQG76oxk-wvnXZg4wmi3Gw@mail.gmail.com> |
Hi Hub, I saw your reply on the bug: http://bugzilla.abisource.com/show_bug.cgi?id=8487 Are there more changes only to be done before commit? thanks ------- Comment #17 From Hubert Figuière 2013-04-08 02:37:25 [reply] ------- (From update of attachment 5654 [details]) That's better Joe On Sun, Apr 7, 2013 at 9:06 PM, joe joe <[email protected]> wrote: > 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 <[email protected]> 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