void nautilus_directory_schedule_position_set (GList *position_setting_list) { GList *p; const NautilusFileChangesQueuePosition *item; NautilusFile *file; char str[64]; time_t now; time (&now); for (p = position_setting_list; p != NULL; p = p->next) { item = (NautilusFileChangesQueuePosition *) p->data; file = nautilus_file_get (item->location); if (item->set) { g_snprintf (str, sizeof (str), "%d,%d", item->point.x, item->point.y); } else { str[0] = 0; } nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_ICON_POSITION, NULL, str); if (item->set) { nautilus_file_set_time_metadata (file, NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP, now); } else { nautilus_file_set_time_metadata (file, NAUTILUS_METADATA_KEY_ICON_POSITION_TIMESTAMP, UNDEFINED_TIME); } if (item->set) { g_snprintf (str, sizeof (str), "%d", item->screen); } else { str[0] = 0; } nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_SCREEN, NULL, str); nautilus_file_unref (file); } }
/* handle the background reset signal by setting values from the current theme */ static void background_reset_callback (EelBackground *background, NautilusFile *file) { char *color; char *image; if (eel_background_is_desktop (background)) { nautilus_file_background_write_desktop_default_settings (); } else { /* Block the other handler while we are writing metadata so it doesn't * try to change the background. */ g_signal_handlers_block_by_func ( file, G_CALLBACK (saved_settings_changed_callback), background); color = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR, NULL); image = nautilus_file_get_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_IMAGE, NULL); if (!color && !image) { eel_preferences_set_boolean (NAUTILUS_PREFERENCES_BACKGROUND_SET, FALSE); } else { /* reset the metadata */ nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR, NULL, NULL); nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_IMAGE, NULL, NULL); } g_free (color); g_free (image); /* Unblock the handler. */ g_signal_handlers_unblock_by_func ( file, G_CALLBACK (saved_settings_changed_callback), background); } saved_settings_changed_callback (file, background); }
/* handle the background changed signal */ static void background_changed_callback (EelBackground *background, GdkDragAction action, NautilusFile *file) { char *color; char *image; g_assert (EEL_IS_BACKGROUND (background)); g_assert (NAUTILUS_IS_FILE (file)); g_assert (g_object_get_data (G_OBJECT (background), "eel_background_file") == file); color = eel_background_get_color (background); image = eel_background_get_image_uri (background); if (eel_background_is_desktop (background)) { eel_background_save_to_gconf (background); } else { /* Block the other handler while we are writing metadata so it doesn't * try to change the background. */ g_signal_handlers_block_by_func ( file, G_CALLBACK (saved_settings_changed_callback), background); if (action != NAUTILUS_DND_ACTION_SET_AS_FOLDER_BACKGROUND && action != NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND) { GdkDragAction default_drag_action; default_drag_action = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (background), "default_drag_action")); action = default_drag_action; } if (action == NAUTILUS_DND_ACTION_SET_AS_GLOBAL_BACKGROUND) { nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR, NULL, NULL); nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_IMAGE, NULL, NULL); eel_preferences_set (NAUTILUS_PREFERENCES_BACKGROUND_COLOR, color ? color : ""); eel_preferences_set (NAUTILUS_PREFERENCES_BACKGROUND_FILENAME, image ? image : ""); eel_preferences_set_boolean (NAUTILUS_PREFERENCES_BACKGROUND_SET, TRUE); } else { nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_COLOR, NULL, color); nautilus_file_set_metadata (file, NAUTILUS_METADATA_KEY_LOCATION_BACKGROUND_IMAGE, NULL, image); } /* Unblock the handler. */ g_signal_handlers_unblock_by_func ( file, G_CALLBACK (saved_settings_changed_callback), background); } g_free (color); g_free (image); }