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

From: joe joe <joegsoc2013_at_gmail.com>
Date: Sat Apr 06 2013 - 17:43:52 CEST

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 Sat Apr 6 17:44:04 2013

This archive was generated by hypermail 2.1.8 : Sat Apr 06 2013 - 17:44:04 CEST