From aa3b51ce2805ee3e6c468fda4a93915032b02b69 Mon Sep 17 00:00:00 2001 From: Alexander Schwinn Date: Sat, 12 Jan 2019 21:46:45 +0100 Subject: [PATCH] WIP fix --- thunar/thunar-device-monitor.c | 58 ++++++++++++++++++++++++++++++++++++++++-- thunar/thunar-device.c | 3 +++ thunar/thunar-file.c | 3 +++ thunar/thunar-standard-view.c | 3 +++ 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/thunar/thunar-device-monitor.c b/thunar/thunar-device-monitor.c index 0e4da606..78c50f49 100644 --- a/thunar/thunar-device-monitor.c +++ b/thunar/thunar-device-monitor.c @@ -192,6 +192,7 @@ thunar_device_monitor_class_init (ThunarDeviceMonitorClass *klass) static void thunar_device_monitor_init (ThunarDeviceMonitor *monitor) { + GList *list; GList *lp; @@ -407,6 +408,7 @@ thunar_device_monitor_volume_added (GVolumeMonitor *volume_monitor, _thunar_return_if_fail (monitor->volume_monitor == volume_monitor); _thunar_return_if_fail (G_IS_VOLUME (volume)); + printf("thunar_device_monitor_volume_added start\n"); /* check that the volume is not in the internal list already */ if (g_list_find (monitor->hidden_volumes, volume) != NULL) return; @@ -420,6 +422,7 @@ thunar_device_monitor_volume_added (GVolumeMonitor *volume_monitor, /* change visibility in changed */ thunar_device_monitor_volume_changed (volume_monitor, volume, monitor); + printf("thunar_device_monitor_volume_added end\n"); } @@ -429,6 +432,7 @@ thunar_device_monitor_volume_removed (GVolumeMonitor *volume_monitor, GVolume *volume, ThunarDeviceMonitor *monitor) { + printf("thunar_device_monitor_volume_removed start\n"); ThunarDevice *device; GList *lp; @@ -463,6 +467,7 @@ thunar_device_monitor_volume_removed (GVolumeMonitor *volume_monitor, /* drop it */ g_hash_table_remove (monitor->devices, volume); } + printf("thunar_device_monitor_volume_removed end\n"); } @@ -476,6 +481,7 @@ thunar_device_monitor_volume_changed (GVolumeMonitor *volume_monitor, ThunarDevice *device; gchar *id; + printf("thunar_device_monitor_volume_changed start\n"); _thunar_return_if_fail (G_IS_VOLUME_MONITOR (volume_monitor)); _thunar_return_if_fail (THUNAR_IS_DEVICE_MONITOR (monitor)); _thunar_return_if_fail (monitor->volume_monitor == volume_monitor); @@ -484,9 +490,11 @@ thunar_device_monitor_volume_changed (GVolumeMonitor *volume_monitor, lp = g_list_find (monitor->hidden_volumes, volume); if (lp != NULL) { + printf("thunar_device_monitor_volume_changed not found\n"); /* check if the volume should be visible again */ if (thunar_device_monitor_volume_is_visible (volume)) { + printf("thunar_device_monitor_volume_changed not found 1\n"); /* remove from the hidden list */ monitor->hidden_volumes = g_list_delete_link (monitor->hidden_volumes, lp); @@ -512,16 +520,18 @@ thunar_device_monitor_volume_changed (GVolumeMonitor *volume_monitor, } else { + printf("thunar_device_monitor_volume_changed found 1\n"); /* find device */ device = g_hash_table_lookup (monitor->devices, volume); - + printf("thunar_device_monitor_volume_changed found 2\n"); /* meh */ _thunar_return_if_fail (THUNAR_IS_DEVICE (device)); if (G_UNLIKELY (device == NULL)) return; - + printf("thunar_device_monitor_volume_changed found 3\n"); if (!thunar_device_monitor_volume_is_visible (volume)) { + printf("thunar_device_monitor_volume_changed found 3.1\n"); /* remove from table */ g_hash_table_steal (monitor->devices, volume); @@ -536,10 +546,29 @@ thunar_device_monitor_volume_changed (GVolumeMonitor *volume_monitor, } else { + printf("thunar_device_monitor_volume_changed found 3.2\n"); /* the device changed */ g_signal_emit (G_OBJECT (monitor), device_monitor_signals[DEVICE_CHANGED], 0, device); } } + + // TODO: Introduce method thunar_Device_reload ? + ThunarFile *file; + GFile *mount_point; + mount_point = thunar_device_get_root (device); + if (mount_point != NULL) + { + /* try to determine the file for the mount point */ + file = thunar_file_get (mount_point, NULL); + if (file != NULL) + { + /* reload file information */ + thunar_file_reload_idle_unref (file); + //g_signal_emit (G_OBJECT (monitor), device_monitor_signals[DEVICE_CHANGED], 0, device); + } + } + + printf("thunar_device_monitor_volume_changed end\n"); } @@ -549,6 +578,7 @@ thunar_device_monitor_mount_added (GVolumeMonitor *volume_monitor, GMount *mount, ThunarDeviceMonitor *monitor) { + printf("thunar_device_monitor_mount_added start\n"); ThunarDevice *device; GFile *location; ThunarDeviceKind kind = THUNAR_DEVICE_KIND_MOUNT_LOCAL; @@ -622,6 +652,24 @@ thunar_device_monitor_mount_added (GVolumeMonitor *volume_monitor, g_object_unref (volume); } + printf("thunar_device_monitor_mount_added end\n"); + + // TODO: Introduce method thunar_Device_reload ? + ThunarFile *file; + GFile *mount_point; + mount_point = thunar_device_get_root (device); + if (mount_point != NULL) + { + /* try to determine the file for the mount point */ + file = thunar_file_get (mount_point, NULL); + if (file != NULL) + { + /* reload file information */ + thunar_file_reload_idle_unref (file); + //g_signal_emit (G_OBJECT (monitor), device_monitor_signals[DEVICE_CHANGED], 0, device); + } + } + } @@ -631,6 +679,7 @@ thunar_device_monitor_mount_removed (GVolumeMonitor *volume_monitor, GMount *mount, ThunarDeviceMonitor *monitor) { + printf("thunar_device_monitor_mount_removed start\n"); ThunarDevice *device; GVolume *volume; GFile *root_file; @@ -670,6 +719,7 @@ thunar_device_monitor_mount_removed (GVolumeMonitor *volume_monitor, g_object_unref (volume); } } + printf("thunar_device_monitor_mount_removed end\n"); } @@ -679,6 +729,7 @@ thunar_device_monitor_mount_changed (GVolumeMonitor *volume_monitor, GMount *mount, ThunarDeviceMonitor *monitor) { + printf("thunar_device_monitor_mount_changed start\n"); ThunarDevice *device; _thunar_return_if_fail (G_IS_VOLUME_MONITOR (volume_monitor)); @@ -693,6 +744,7 @@ thunar_device_monitor_mount_changed (GVolumeMonitor *volume_monitor, /* notify */ g_signal_emit (G_OBJECT (monitor), device_monitor_signals[DEVICE_CHANGED], 0, device); } + printf("thunar_device_monitor_mount_changed end\n"); } @@ -702,6 +754,7 @@ thunar_device_monitor_mount_pre_unmount (GVolumeMonitor *volume_monitor, GMount *mount, ThunarDeviceMonitor *monitor) { + printf("thunar_device_monitor_mount_pre_unmount start\n"); ThunarDevice *device; GVolume *volume; GFile *root_file; @@ -733,6 +786,7 @@ thunar_device_monitor_mount_pre_unmount (GVolumeMonitor *volume_monitor, 0, device, root_file); g_object_unref (root_file); } + printf("thunar_device_monitor_mount_pre_unmount end\n"); } diff --git a/thunar/thunar-device.c b/thunar/thunar-device.c index a3109123..394d1269 100644 --- a/thunar/thunar-device.c +++ b/thunar/thunar-device.c @@ -603,6 +603,7 @@ thunar_device_mount (ThunarDevice *device, { ThunarDeviceOperation *op; + printf("thunar_device_mount\n"); _thunar_return_if_fail (THUNAR_IS_DEVICE (device)); _thunar_return_if_fail (G_IS_MOUNT_OPERATION (mount_operation)); _thunar_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); @@ -635,6 +636,7 @@ thunar_device_unmount (ThunarDevice *device, ThunarDeviceCallback callback, gpointer user_data) { + printf("thunar_device_unmount\n"); ThunarDeviceOperation *op; GMount *mount; @@ -689,6 +691,7 @@ thunar_device_eject (ThunarDevice *device, ThunarDeviceCallback callback, gpointer user_data) { + printf("thunar_device_eject\n"); ThunarDeviceOperation *op; GMount *mount = NULL; GVolume *volume; diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 5194b664..4e5ee7da 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -3000,7 +3000,10 @@ thunar_file_is_writable (const ThunarFile *file) _thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE); if (file->info == NULL) + { + printf("thunar_file_is_writable - is NULL\n"); return FALSE; + } if (!g_file_info_has_attribute (file->info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)) return TRUE; diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index 95898231..e6f6db07 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -3087,12 +3087,15 @@ thunar_standard_view_button_release_event (GtkWidget *view, _thunar_return_val_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view), FALSE); _thunar_return_val_if_fail (standard_view->priv->drag_timer_id != 0, FALSE); + printf("thunar_standard_view_button_release_event start \n"); /* cancel the pending drag timer */ g_source_remove (standard_view->priv->drag_timer_id); /* fire up the context menu */ thunar_standard_view_context_menu (standard_view); + printf("thunar_standard_view_button_release_event end \n"); + return TRUE; } -- 2.11.0