[Xfce4-commits] [apps/xfce4-terminal] 01/01: Use g_file_* functions

noreply at xfce.org noreply at xfce.org
Mon Sep 17 20:58:29 CEST 2018


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-terminal.

commit e2f39d3c60c5c2d496b49223749229d4b1ba8bd2
Author: Igor <f2404 at yandex.ru>
Date:   Mon Sep 17 14:58:22 2018 -0400

    Use g_file_* functions
---
 terminal/terminal-preferences.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 3d01ebd..9c25447 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -31,9 +31,6 @@
 #ifdef HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 
 #include <terminal/terminal-enum-types.h>
 #include <terminal/terminal-preferences.h>
@@ -1674,15 +1671,20 @@ terminal_preferences_monitor_connect (TerminalPreferences *preferences,
   GError    *error = NULL;
   GFileInfo *info;
   GFile     *new_file;
-  gchar      buf[PATH_MAX] = {0};
-
-  /* filename could be a symlink: read the actual path to rc file then */
-  if (readlink (filename, buf, sizeof (buf)-1) != -1)
-    filename = buf;
 
   /* get new file location */
   new_file = g_file_new_for_path (filename);
 
+  /* filename could be a symlink: read the actual path to rc file then */
+  info = g_file_query_info (new_file, G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK","G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+                            G_FILE_QUERY_INFO_NONE, NULL, NULL);
+  if (g_file_info_get_is_symlink (info))
+    {
+      g_object_unref (new_file);
+      new_file = g_file_new_for_path (g_file_info_get_symlink_target (info));
+      g_object_unref (info);
+    }
+
   /* check if we need to start or update file monitoring */
   if (preferences->file == NULL
       || !g_file_equal (new_file, preferences->file))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list