[Xfce4-commits] <terminal:master> Use correct function to compare gfiles.

Nick Schermer noreply at xfce.org
Mon Dec 24 13:38:04 CET 2012


Updating branch refs/heads/master
         to 8b99bf7c602ff6ee652e12ed9e4a8033e72276cf (commit)
       from cde3f164f564224654ba985c80f23f892baf42f2 (commit)

commit 8b99bf7c602ff6ee652e12ed9e4a8033e72276cf
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Dec 24 13:27:02 2012 +0100

    Use correct function to compare gfiles.

 terminal/terminal-preferences.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 04701e1..5655798 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -1241,22 +1241,22 @@ terminal_preferences_monitor_connect (TerminalPreferences *preferences,
                                       const gchar         *filename,
                                       gboolean             update_mtime)
 {
-  gchar     *path = NULL;
   GError    *error = NULL;
   GFileInfo *info;
+  GFile     *new_file;
 
-  /* get the path of the file we monitor right now */
-  if (preferences->file != NULL)
-    path = g_file_get_path (preferences->file);
+  /* get new file location */
+  new_file = g_file_new_for_path (filename);
 
   /* check if we need to start or update file monitoring */
-  if (g_strcmp0 (path, filename) != 0)
+  if (preferences->file == NULL
+      || !g_file_equal (new_file, preferences->file))
     {
       /* disconnect old monitor */
       terminal_preferences_monitor_disconnect (preferences);
 
       /* create new local file */
-      preferences->file = g_file_new_for_path (filename);
+      preferences->file = g_object_ref (new_file);
 
       /* monitor the file */
       preferences->monitor = g_file_monitor_file (preferences->file,
@@ -1280,6 +1280,8 @@ terminal_preferences_monitor_connect (TerminalPreferences *preferences,
         }
     }
 
+  g_object_unref (new_file);
+
   preferences->last_mtime = 0;
 
   /* store the last known mtime */
@@ -1295,9 +1297,6 @@ terminal_preferences_monitor_connect (TerminalPreferences *preferences,
           g_object_unref (G_OBJECT (info));
         }
     }
-
-  /* cleanup */
-  g_free (path);
 }
 
 


More information about the Xfce4-commits mailing list