void ss__gth_catalog_read_metadata (GthCatalog *catalog, GthFileData *file_data) { if (g_file_info_get_attribute_status (file_data->info, "slideshow::personalize") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_boolean (catalog->attributes, "slideshow::personalize", g_file_info_get_attribute_boolean (file_data->info, "slideshow::personalize")); if (g_file_info_get_attribute_status (file_data->info, "slideshow::automatic") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_boolean (catalog->attributes, "slideshow::automatic", g_file_info_get_attribute_boolean (file_data->info, "slideshow::automatic")); if (g_file_info_get_attribute_status (file_data->info, "slideshow::wrap-around") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_boolean (catalog->attributes, "slideshow::wrap-around", g_file_info_get_attribute_boolean (file_data->info, "slideshow::wrap-around")); if (g_file_info_get_attribute_status (file_data->info, "slideshow::random-order") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_boolean (catalog->attributes, "slideshow::random-order", g_file_info_get_attribute_boolean (file_data->info, "slideshow::random-order")); if (g_file_info_get_attribute_status (file_data->info, "slideshow::delay") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_int (catalog->attributes, "slideshow::delay", g_file_info_get_attribute_int32 (file_data->info, "slideshow::delay")); if (g_file_info_get_attribute_status (file_data->info, "slideshow::transition") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_string (catalog->attributes, "slideshow::transition", g_file_info_get_attribute_string (file_data->info, "slideshow::transition")); if (g_file_info_get_attribute_status (file_data->info, "slideshow::playlist") == G_FILE_ATTRIBUTE_STATUS_SET) g_value_hash_set_stringv (catalog->attributes, "slideshow::playlist", g_file_info_get_attribute_stringv (file_data->info, "slideshow::playlist")); }
void gth_browser_activate_action_view_slideshow (GtkAction *action, GthBrowser *browser) { GList *items; GList *file_list; GthProjector *projector; GtkWidget *slideshow; GthFileData *location; char *transition_id; GList *transitions = NULL; items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser))); if ((items == NULL) || (items->next == NULL)) file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_browser_get_file_store (browser))); else file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items); projector = NULL; #ifdef HAVE_CLUTTER if (ClutterInitResult == CLUTTER_INIT_SUCCESS) projector = &clutter_projector; #endif /* HAVE_CLUTTER */ if (projector == NULL) projector = &default_projector; slideshow = gth_slideshow_new (projector, browser, file_list); location = gth_browser_get_location_data (browser); if (g_file_info_get_attribute_boolean (location->info, "slideshow::personalize")) { gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_int32 (location->info, "slideshow::delay")); gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::automatic")); gth_slideshow_set_wrap_around (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::wrap-around")); transition_id = g_strdup (g_file_info_get_attribute_string (location->info, "slideshow::transition")); } else { gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), (guint) (1000.0 * eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0))); gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_AUTOMATIC, TRUE)); gth_slideshow_set_wrap_around (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_WRAP_AROUND, FALSE)); transition_id = eel_gconf_get_string (PREF_SLIDESHOW_TRANSITION, DEFAULT_TRANSITION); } if (g_file_info_get_attribute_status (location->info, "slideshow::playlist") == G_FILE_ATTRIBUTE_STATUS_SET) gth_slideshow_set_playlist (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_stringv (location->info, "slideshow::playlist")); if (strcmp (transition_id, "random") == 0) { GList *scan; transitions = gth_main_get_registered_objects (GTH_TYPE_TRANSITION); for (scan = transitions; scan; scan = scan->next) { GthTransition *transition = scan->data; if (strcmp (gth_transition_get_id (transition), "none") == 0) { transitions = g_list_remove_link (transitions, scan); _g_object_list_unref (scan); break; } } } else { GthTransition *transition = gth_main_get_registered_object (GTH_TYPE_TRANSITION, transition_id); if (transition != NULL) transitions = g_list_append (NULL, transition); else transitions = NULL; } gth_slideshow_set_transitions (GTH_SLIDESHOW (slideshow), transitions); gtk_window_fullscreen (GTK_WINDOW (slideshow)); /*gtk_window_set_default_size (GTK_WINDOW (slideshow), 700, 700);*/ gtk_window_present (GTK_WINDOW (slideshow)); _g_object_list_unref (transitions); g_free (transition_id); _g_object_list_unref (file_list); _gtk_tree_path_list_free (items); }
char * gvfs_file_info_marshal (GFileInfo *info, gsize *size) { GOutputStream *memstream; GDataOutputStream *out; GFileAttributeType type; GFileAttributeStatus status; GObject *obj; char **attrs, *attr; char *data; int i; memstream = g_memory_output_stream_new (NULL, 0, g_realloc, NULL); out = g_data_output_stream_new (memstream); g_object_unref (memstream); attrs = g_file_info_list_attributes (info, NULL); g_data_output_stream_put_uint32 (out, g_strv_length (attrs), NULL, NULL); for (i = 0; attrs[i] != NULL; i++) { attr = attrs[i]; type = g_file_info_get_attribute_type (info, attr); status = g_file_info_get_attribute_status (info, attr); put_string (out, attr); g_data_output_stream_put_byte (out, type, NULL, NULL); g_data_output_stream_put_byte (out, status, NULL, NULL); switch (type) { case G_FILE_ATTRIBUTE_TYPE_STRING: put_string (out, g_file_info_get_attribute_string (info, attr)); break; case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: put_string (out, g_file_info_get_attribute_byte_string (info, attr)); break; case G_FILE_ATTRIBUTE_TYPE_STRINGV: put_stringv (out, g_file_info_get_attribute_stringv (info, attr)); break; case G_FILE_ATTRIBUTE_TYPE_BOOLEAN: g_data_output_stream_put_byte (out, g_file_info_get_attribute_boolean (info, attr), NULL, NULL); break; case G_FILE_ATTRIBUTE_TYPE_UINT32: g_data_output_stream_put_uint32 (out, g_file_info_get_attribute_uint32 (info, attr), NULL, NULL); break; case G_FILE_ATTRIBUTE_TYPE_INT32: g_data_output_stream_put_int32 (out, g_file_info_get_attribute_int32 (info, attr), NULL, NULL); break; case G_FILE_ATTRIBUTE_TYPE_UINT64: g_data_output_stream_put_uint64 (out, g_file_info_get_attribute_uint64 (info, attr), NULL, NULL); break; case G_FILE_ATTRIBUTE_TYPE_INT64: g_data_output_stream_put_int64 (out, g_file_info_get_attribute_int64 (info, attr), NULL, NULL); break; case G_FILE_ATTRIBUTE_TYPE_OBJECT: obj = g_file_info_get_attribute_object (info, attr); if (obj == NULL) { g_data_output_stream_put_byte (out, 0, NULL, NULL); } else if (G_IS_ICON (obj)) { char *icon_str; icon_str = g_icon_to_string (G_ICON (obj)); g_data_output_stream_put_byte (out, 1, NULL, NULL); put_string (out, icon_str); g_free (icon_str); } else { g_warning ("Unsupported GFileInfo object type %s\n", g_type_name_from_instance ((GTypeInstance *)obj)); g_data_output_stream_put_byte (out, 0, NULL, NULL); } break; case G_FILE_ATTRIBUTE_TYPE_INVALID: default: break; } } data = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (memstream)); *size = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (memstream)); g_object_unref (out); g_strfreev (attrs); return data; }