Skip to content
Snippets Groups Projects
Commit 4a3941df authored by Benedikt Meurer's avatar Benedikt Meurer
Browse files

2006-07-28 Benedikt Meurer <benny@xfce.org>

	* thunar/thunar-dbus-service.c, thunar/thunar-tree-model.c: Monitor
	  the trash bin for changes.




(Old svn revision: 22546)
parent c1bbdcdb
No related branches found
No related tags found
No related merge requests found
2006-07-28 Benedikt Meurer <benny@xfce.org>
* thunar/thunar-dbus-service.c, thunar/thunar-tree-model.c: Monitor
the trash bin for changes.
2006-07-28 Benedikt Meurer <benny@xfce.org>
* thunar/thunar-tree-model.c(thunar_tree_model_node_drop_dummy): We
......
......@@ -225,9 +225,13 @@ thunar_dbus_service_finalize (GObject *object)
if (G_LIKELY (dbus_service->connection != NULL))
dbus_g_connection_unref (dbus_service->connection);
/* release the trash bin object */
/* check if we are connected to the trash bin */
if (G_LIKELY (dbus_service->trash_bin != NULL))
{
/* unwatch the trash bin */
thunar_file_unwatch (dbus_service->trash_bin);
/* release the trash bin */
g_signal_handlers_disconnect_by_func (G_OBJECT (dbus_service->trash_bin), thunar_dbus_service_trash_bin_changed, dbus_service);
g_object_unref (G_OBJECT (dbus_service->trash_bin));
}
......@@ -251,6 +255,9 @@ thunar_dbus_service_connect_trash_bin (ThunarDBusService *dbus_service,
dbus_service->trash_bin = thunar_file_get_for_path (trash_bin_path, error);
if (G_LIKELY (dbus_service->trash_bin != NULL))
{
/* watch the trash bin for changes */
thunar_file_watch (dbus_service->trash_bin);
/* stay informed about changes to the trash bin */
g_signal_connect_swapped (G_OBJECT (dbus_service->trash_bin), "changed",
G_CALLBACK (thunar_dbus_service_trash_bin_changed),
......
......@@ -317,6 +317,10 @@ thunar_tree_model_init (ThunarTreeModel *model)
file = thunar_file_get_for_path (system_path_list[n], NULL);
if (G_LIKELY (file != NULL))
{
/* watch the trash bin for changes */
if (thunar_file_is_trashed (file) && thunar_file_is_root (file))
thunar_file_watch (file);
/* create and append the new node */
item = thunar_tree_model_item_new_with_file (model, file);
node = g_node_append_data (model->root, item);
......@@ -1233,6 +1237,11 @@ thunar_tree_model_item_reset (ThunarTreeModelItem *item)
/* disconnect from the file */
if (G_LIKELY (item->file != NULL))
{
/* unwatch the trash bin */
if (thunar_file_is_trashed (item->file) && thunar_file_is_root (item->file))
thunar_file_unwatch (item->file);
/* release and reset the file */
g_object_unref (G_OBJECT (item->file));
item->file = NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment