static void do_finalize (GObject *self) { NautilusFileConflictDialogDetails *details = NAUTILUS_FILE_CONFLICT_DIALOG (self)->details; g_free (details->conflict_name); if (details->handle != NULL) { nautilus_file_list_cancel_call_when_ready (details->handle); } if (details->src_handler_id) { g_signal_handler_disconnect (details->source, details->src_handler_id); nautilus_file_monitor_remove (details->source, self); } if (details->dest_handler_id) { g_signal_handler_disconnect (details->destination, details->dest_handler_id); nautilus_file_monitor_remove (details->destination, self); } nautilus_file_unref (details->source); nautilus_file_unref (details->destination); nautilus_file_unref (details->dest_dir); G_OBJECT_CLASS (nautilus_file_conflict_dialog_parent_class)->finalize (self); }
static void reset_file_list (NautilusSearchDirectory *search) { GList *list, *monitor_list; NautilusFile *file; SearchMonitor *monitor; /* Remove file connections */ for (list = search->details->files; list != NULL; list = list->next) { file = list->data; /* Disconnect change handler */ g_signal_handlers_disconnect_by_func (file, file_changed, search); /* Remove monitors */ for (monitor_list = search->details->monitor_list; monitor_list; monitor_list = monitor_list->next) { monitor = monitor_list->data; nautilus_file_monitor_remove (file, monitor); } } nautilus_file_list_free (search->details->files); search->details->files = NULL; g_hash_table_remove_all (search->details->files_hash); }
static void monitor_destroy (gpointer data) { DesktopMonitor *monitor = data; nautilus_file_monitor_remove (NAUTILUS_FILE (monitor->desktop_file->details->real_dir_file), monitor); g_free (monitor); }
static void search_monitor_remove_file_monitors (SearchMonitor *monitor, NautilusSearchDirectory *search) { GList *list; NautilusFile *file; for (list = search->details->files; list != NULL; list = list->next) { file = list->data; nautilus_file_monitor_remove (file, monitor); } }
static void nautilus_canvas_view_container_stop_monitor_top_left (NautilusCanvasContainer *container, NautilusCanvasIconData *data, gconstpointer client) { NautilusFile *file; file = (NautilusFile *) data; g_assert (NAUTILUS_IS_FILE (file)); nautilus_file_monitor_remove (file, client); }
static void free_xdg_dir_cache (void) { int i; if (cached_xdg_dirs != NULL) { for (i = 0; cached_xdg_dirs[i].type != NULL; i++) { if (cached_xdg_dirs[i].file != NULL) { nautilus_file_monitor_remove (cached_xdg_dirs[i].file, &cached_xdg_dirs[i]); g_signal_handlers_disconnect_by_func (cached_xdg_dirs[i].file, G_CALLBACK (xdg_dir_changed), &cached_xdg_dirs[i]); nautilus_file_unref (cached_xdg_dirs[i].file); } g_free (cached_xdg_dirs[i].type); g_free (cached_xdg_dirs[i].path); } g_free (cached_xdg_dirs); } }
/* handle the background destroyed signal */ static void background_destroyed_callback (EelBackground *background, NautilusFile *file) { g_signal_handlers_disconnect_by_func (file, G_CALLBACK (saved_settings_changed_callback), background); nautilus_file_monitor_remove (file, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_file_background_theme_changed, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_BACKGROUND_SET, nautilus_file_background_theme_changed, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_BACKGROUND_COLOR, nautilus_file_background_theme_changed, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_BACKGROUND_FILENAME, nautilus_file_background_theme_changed, background); }
/* key routine that hooks up a background and location */ void nautilus_connect_background_to_file_metadata (GtkWidget *widget, NautilusFile *file, GdkDragAction default_drag_action) { EelBackground *background; gpointer old_file; /* Get at the background object we'll be connecting. */ background = eel_get_widget_background (widget); /* Check if it is already connected. */ old_file = g_object_get_data (G_OBJECT (background), "eel_background_file"); if (old_file == file) { return; } /* Disconnect old signal handlers. */ if (old_file != NULL) { g_assert (NAUTILUS_IS_FILE (old_file)); g_signal_handlers_disconnect_by_func (background, G_CALLBACK (background_changed_callback), old_file); g_signal_handlers_disconnect_by_func (background, G_CALLBACK (background_destroyed_callback), old_file); g_signal_handlers_disconnect_by_func (background, G_CALLBACK (background_reset_callback), old_file); g_signal_handlers_disconnect_by_func (old_file, G_CALLBACK (saved_settings_changed_callback), background); nautilus_file_monitor_remove (old_file, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_THEME, nautilus_file_background_theme_changed, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_BACKGROUND_SET, nautilus_file_background_theme_changed, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_BACKGROUND_COLOR, nautilus_file_background_theme_changed, background); eel_preferences_remove_callback (NAUTILUS_PREFERENCES_BACKGROUND_FILENAME, nautilus_file_background_theme_changed, background); } /* Attach the new directory. */ nautilus_file_ref (file); g_object_set_data_full (G_OBJECT (background), "eel_background_file", file, (GDestroyNotify) nautilus_file_unref); g_object_set_data (G_OBJECT (background), "default_drag_action", GINT_TO_POINTER (default_drag_action)); /* Connect new signal handlers. */ if (file != NULL) { g_signal_connect_object (background, "settings_changed", G_CALLBACK (background_changed_callback), file, 0); g_signal_connect_object (background, "destroy", G_CALLBACK (background_destroyed_callback), file, 0); g_signal_connect_object (background, "reset", G_CALLBACK (background_reset_callback), file, 0); g_signal_connect_object (file, "changed", G_CALLBACK (saved_settings_changed_callback), background, 0); /* arrange to receive file metadata */ nautilus_file_monitor_add (file, background, NAUTILUS_FILE_ATTRIBUTE_INFO); /* arrange for notification when the theme changes */ eel_preferences_add_callback (NAUTILUS_PREFERENCES_THEME, nautilus_file_background_theme_changed, background); eel_preferences_add_callback (NAUTILUS_PREFERENCES_BACKGROUND_SET, nautilus_file_background_theme_changed, background); eel_preferences_add_callback (NAUTILUS_PREFERENCES_BACKGROUND_COLOR, nautilus_file_background_theme_changed, background); eel_preferences_add_callback (NAUTILUS_PREFERENCES_BACKGROUND_FILENAME, nautilus_file_background_theme_changed, background); } /* Update the background based on the file metadata. */ initialize_background_from_settings (file, background); }
static gboolean run_file_conflict_dialog (gpointer user_data) { FileConflictDialogData *data = user_data; int response_id; GList *files = NULL; data->source = nautilus_file_get (data->source_name); data->destination = nautilus_file_get (data->destination_name); data->destination_directory = nautilus_file_get (data->destination_directory_name); data->dialog = nautilus_file_conflict_dialog_new (data->parent); files = g_list_prepend (files, data->source); files = g_list_prepend (files, data->destination); files = g_list_prepend (files, data->destination_directory); nautilus_file_list_call_when_ready (files, NAUTILUS_FILE_ATTRIBUTES_FOR_ICON, &data->handle, data->on_file_list_ready, data); response_id = gtk_dialog_run (GTK_DIALOG (data->dialog)); if (data->handle != NULL) { nautilus_file_list_cancel_call_when_ready (data->handle); } if (data->source_handler_id) { g_signal_handler_disconnect (data->source, data->source_handler_id); nautilus_file_monitor_remove (data->source, data); } if (data->destination_handler_id) { g_signal_handler_disconnect (data->destination, data->destination_handler_id); nautilus_file_monitor_remove (data->destination, data); } if (response_id == CONFLICT_RESPONSE_RENAME) { data->response->new_name = nautilus_file_conflict_dialog_get_new_name (data->dialog); } else if (response_id != GTK_RESPONSE_CANCEL || response_id != GTK_RESPONSE_NONE) { data->response->apply_to_all = nautilus_file_conflict_dialog_get_apply_to_all (data->dialog); } data->response->id = response_id; gtk_widget_destroy (GTK_WIDGET (data->dialog)); nautilus_file_unref (data->source); nautilus_file_unref (data->destination); nautilus_file_unref (data->destination_directory); g_list_free (files); return G_SOURCE_REMOVE; }