[Xfce4-commits] r29798 - in thunar/branches/migration-to-gio: . thunar
Jannis Pohlmann
jannis at xfce.org
Tue Apr 14 18:00:39 CEST 2009
Author: jannis
Date: 2009-04-14 16:00:38 +0000 (Tue, 14 Apr 2009)
New Revision: 29798
Modified:
thunar/branches/migration-to-gio/ChangeLog
thunar/branches/migration-to-gio/thunar/thunar-preferences.c
Log:
* thunar/thunar-preferences.c: Monitor thunarrc with GFileMonitor
instead of ThunarVfsMonitor. All ThunarVFS references removed from
the class.
Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog 2009-04-13 19:45:33 UTC (rev 29797)
+++ thunar/branches/migration-to-gio/ChangeLog 2009-04-14 16:00:38 UTC (rev 29798)
@@ -1,3 +1,9 @@
+2009-04-14 Jannis Pohlmann <jannis at xfce.org>
+
+ * thunar/thunar-preferences.c: Monitor thunarrc with GFileMonitor
+ instead of ThunarVfsMonitor. All ThunarVFS references removed from
+ the class.
+
2009-04-13 Jannis Pohlmann <jannis at xfce.org>
* thunar/thunar-sendto-model.c: Monitor sendto/ directories with
Modified: thunar/branches/migration-to-gio/thunar/thunar-preferences.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-preferences.c 2009-04-13 19:45:33 UTC (rev 29797)
+++ thunar/branches/migration-to-gio/thunar/thunar-preferences.c 2009-04-14 16:00:38 UTC (rev 29798)
@@ -37,8 +37,6 @@
#include <string.h>
#endif
-#include <thunar-vfs/thunar-vfs.h>
-
#include <thunar/thunar-enum-types.h>
#include <thunar/thunar-gobject-extensions.h>
#include <thunar/thunar-preferences.h>
@@ -102,11 +100,10 @@
GParamSpec *pspec);
static void thunar_preferences_resume_monitor (ThunarPreferences *preferences);
static void thunar_preferences_suspend_monitor (ThunarPreferences *preferences);
-static void thunar_preferences_monitor (ThunarVfsMonitor *monitor,
- ThunarVfsMonitorHandle *handle,
- ThunarVfsMonitorEvent event,
- ThunarVfsPath *handle_path,
- ThunarVfsPath *event_path,
+static void thunar_preferences_monitor (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
gpointer user_data);
static void thunar_preferences_queue_load (ThunarPreferences *preferences);
static void thunar_preferences_queue_store (ThunarPreferences *preferences);
@@ -126,15 +123,14 @@
{
GObject __parent__;
- ThunarVfsMonitorHandle *handle;
- ThunarVfsMonitor *monitor;
+ GFileMonitor *monitor;
- GValue values[N_PROPERTIES];
+ GValue values[N_PROPERTIES];
- gboolean loading_in_progress;
+ gboolean loading_in_progress;
- gint load_idle_id;
- gint store_idle_id;
+ gint load_idle_id;
+ gint store_idle_id;
};
@@ -671,8 +667,7 @@
static void
thunar_preferences_init (ThunarPreferences *preferences)
{
- /* grab a reference on the VFS monitor */
- preferences->monitor = thunar_vfs_monitor_get_default ();
+ preferences->monitor = NULL;
/* load the settings */
thunar_preferences_load_idle (preferences);
@@ -763,24 +758,21 @@
static void
thunar_preferences_resume_monitor (ThunarPreferences *preferences)
{
- ThunarVfsPath *path;
- gchar *filename;
+ GFile *file;
+ gchar *filename;
/* verify that the monitor is suspended */
- if (G_LIKELY (preferences->handle == NULL))
+ if (G_LIKELY (preferences->monitor == NULL))
{
/* determine the save location for thunarrc to monitor */
filename = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, "Thunar/thunarrc", TRUE);
if (G_LIKELY (filename != NULL))
{
- /* determine the VFS path for the filename */
- path = thunar_vfs_path_new (filename, NULL);
- if (G_LIKELY (path != NULL))
- {
- /* add the monitor handle for the file */
- preferences->handle = thunar_vfs_monitor_add_file (preferences->monitor, path, thunar_preferences_monitor, preferences);
- thunar_vfs_path_unref (path);
- }
+ /* monitor this file */
+ file = g_file_new_for_path (filename);
+ preferences->monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
+ g_signal_connect (preferences->monitor, "changed", G_CALLBACK (thunar_preferences_monitor), preferences);
+ g_object_unref (file);
/* release the filename */
g_free (filename);
@@ -794,22 +786,21 @@
thunar_preferences_suspend_monitor (ThunarPreferences *preferences)
{
/* verify that the monitor is active */
- if (G_LIKELY (preferences->handle != NULL))
+ if (G_LIKELY (preferences->monitor != NULL
+ && !g_file_monitor_is_cancelled (preferences->monitor)))
{
/* disconnect the handle from the monitor */
- thunar_vfs_monitor_remove (preferences->monitor, preferences->handle);
- preferences->handle = NULL;
+ g_file_monitor_cancel (preferences->monitor);
}
}
static void
-thunar_preferences_monitor (ThunarVfsMonitor *monitor,
- ThunarVfsMonitorHandle *handle,
- ThunarVfsMonitorEvent event,
- ThunarVfsPath *handle_path,
- ThunarVfsPath *event_path,
+thunar_preferences_monitor (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
gpointer user_data)
{
ThunarPreferences *preferences = THUNAR_PREFERENCES (user_data);
@@ -820,8 +811,11 @@
_thunar_return_if_fail (preferences->handle == handle);
/* schedule a reload whenever the file is created/changed */
- if (event == THUNAR_VFS_MONITOR_EVENT_CHANGED || event == THUNAR_VFS_MONITOR_EVENT_CREATED)
- thunar_preferences_queue_load (preferences);
+ if (event_type == G_FILE_MONITOR_EVENT_CHANGED
+ || event_type == G_FILE_MONITOR_EVENT_CREATED)
+ {
+ thunar_preferences_queue_load (preferences);
+ }
}
More information about the Xfce4-commits
mailing list