eog r4466 - in trunk: . src
- From: friemann svn gnome org
- To: svn-commits-list gnome org
- Subject: eog r4466 - in trunk: . src
- Date: Fri, 14 Mar 2008 20:56:07 +0000 (GMT)
Author: friemann
Date: Fri Mar 14 20:56:06 2008
New Revision: 4466
URL: http://svn.gnome.org/viewvc/eog?rev=4466&view=rev
Log:
2008-03-14 Felix Riemann <friemann svn gnome org>
* configure.ac:
* src/eog-application.c: (eog_application_get_file_window),
(eog_application_open_file_list), (eog_application_open_uri_list),
(eog_application_open_uris):
* src/eog-application.h:
* src/eog-error-message-area.c:
(eog_no_images_error_message_area_new):
* src/eog-error-message-area.h:
* src/eog-file-chooser.c: (save_response_cb), (set_preview_pixbuf),
(update_preview_cb):
* src/eog-image-jpeg.c: (_save_jpeg_as_jpeg), (_save_any_as_jpeg):
* src/eog-image-private.h:
* src/eog-image-save-info.c: (eog_image_save_info_dispose),
(is_local_file), (get_save_file_type_by_file),
(eog_image_save_info_from_image), (eog_image_save_info_from_uri),
(eog_image_save_info_from_file):
* src/eog-image-save-info.h:
* src/eog-image.c: (eog_image_dispose), (eog_image_init),
(eog_image_new), (eog_image_new_file), (eog_image_get_file_info),
(eog_image_real_load), (tmp_file_get), (transfer_progress_cb),
(tmp_file_move_to_uri), (tmp_file_delete),
(eog_image_link_with_target), (eog_image_save_by_info),
(eog_image_copy_file), (eog_image_save_as_by_info),
(eog_image_get_caption), (eog_image_get_file),
(eog_image_get_uri_for_display):
* src/eog-image.h:
* src/eog-jobs.c: (eog_job_model_new), (filter_files),
(eog_job_model_run), (eog_job_save_as_dispose),
(eog_job_save_as_new), (eog_job_save_as_real_run):
* src/eog-jobs.h:
* src/eog-list-store.c: (foreach_monitors_free),
(is_file_in_list_store), (is_file_in_list_store_file),
(eog_job_thumbnail_cb), (eog_list_store_append_image_from_file),
(file_monitor_changed_cb), (directory_visit),
(eog_list_store_append_directory), (eog_list_store_add_files),
(eog_list_store_remove_image), (eog_list_store_get_pos_by_image):
* src/eog-list-store.h:
* src/eog-pixbuf-util.c: (get_suffix_from_basename),
(eog_pixbuf_get_format):
* src/eog-pixbuf-util.h:
* src/eog-properties-dialog.c: (pd_update_general_tab):
* src/eog-save-as-dialog-helper.c: (set_default_values),
(eog_save_as_dialog_new), (eog_save_as_dialog_get_converter):
* src/eog-save-as-dialog-helper.h:
* src/eog-thumb-view.c: (tb_on_drag_data_get_cb),
(tb_on_query_tooltip_cb):
* src/eog-thumbnail.c: (set_vfs_error), (eog_thumb_data_new),
(eog_thumbnail_load):
* src/eog-uri-converter.c: (eog_uri_converter_dispose),
(eog_uri_converter_new), (get_file_directory), (split_filename),
(append_filename), (build_absolute_file), (eog_uri_converter_do),
(eog_uri_converter_preview), (eog_uri_converter_check):
* src/eog-uri-converter.h:
* src/eog-util.c: (eog_util_parse_uri_string_list_to_file_list),
(eog_util_string_list_to_file_list),
(eog_util_strings_to_file_list), (eog_util_string_array_to_list),
(eog_util_string_array_make_absolute):
* src/eog-util.h:
* src/eog-window.c: (update_status_bar),
(add_file_to_recent_files), (eog_window_display_image),
(open_with_launch_application_cb),
(eog_window_update_openwith_menu),
(eog_window_retrieve_save_as_file), (eog_window_cmd_save_as),
(move_to_trash_real), (eog_window_update_recent_files_menu),
(eog_window_drag_data_received), (eog_window_dispose),
(eog_job_model_cb), (eog_window_open_file_list):
* src/eog-window.h:
* src/test-eog-tb.c: (make_file), (string_array_to_list), (main):
Stop using GnomeVFS. Use GIO instead from now on.
Fixes bugs #509239 and #343061 (Cosimo Cecchi, Felix Riemann).
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/src/eog-application.c
trunk/src/eog-application.h
trunk/src/eog-error-message-area.c
trunk/src/eog-error-message-area.h
trunk/src/eog-file-chooser.c
trunk/src/eog-image-jpeg.c
trunk/src/eog-image-private.h
trunk/src/eog-image-save-info.c
trunk/src/eog-image-save-info.h
trunk/src/eog-image.c
trunk/src/eog-image.h
trunk/src/eog-jobs.c
trunk/src/eog-jobs.h
trunk/src/eog-list-store.c
trunk/src/eog-list-store.h
trunk/src/eog-pixbuf-util.c
trunk/src/eog-pixbuf-util.h
trunk/src/eog-properties-dialog.c
trunk/src/eog-save-as-dialog-helper.c
trunk/src/eog-save-as-dialog-helper.h
trunk/src/eog-thumb-view.c
trunk/src/eog-thumbnail.c
trunk/src/eog-uri-converter.c
trunk/src/eog-uri-converter.h
trunk/src/eog-util.c
trunk/src/eog-util.h
trunk/src/eog-window.c
trunk/src/eog-window.h
trunk/src/test-eog-tb.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Mar 14 20:56:06 2008
@@ -79,7 +79,6 @@
GTK_REQUIRED=2.11.6
GLIB_REQUIRED=2.15.3
-GNOME_VFS_REQUIRED=2.10.0
LIBGNOMEUI_REQUIRED=2.6.0
LIBGLADE_REQUIRED=2.3.6
GDKPIXBUF_REQUIRED=2.4.0
@@ -94,7 +93,6 @@
EOG_MODULES="gtk+-2.0 >= $GTK_REQUIRED \
glib-2.0 >= $GLIB_REQUIRED \
- gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED \
gio-2.0 >= $GLIB_REQUIRED \
libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED \
libglade-2.0 >= $LIBGLADE_REQUIRED \
Modified: trunk/src/eog-application.c
==============================================================================
--- trunk/src/eog-application.c (original)
+++ trunk/src/eog-application.c Fri Mar 14 20:56:06 2008
@@ -202,13 +202,13 @@
}
static EogWindow *
-eog_application_get_uri_window (EogApplication *application, GnomeVFSURI *uri)
+eog_application_get_file_window (EogApplication *application, GFile *file)
{
- EogWindow *uri_window = NULL;
+ EogWindow *file_window = NULL;
GList *windows;
GList *l;
- g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (EOG_IS_APPLICATION (application), NULL);
windows = gtk_window_list_toplevels ();
@@ -219,11 +219,11 @@
if (!eog_window_is_empty (window)) {
EogImage *image = eog_window_get_image (window);
- GnomeVFSURI *window_uri;
+ GFile *window_file;
- window_uri = eog_image_get_uri (image);
- if (gnome_vfs_uri_equal (window_uri, uri)) {
- uri_window = window;
+ window_file = eog_image_get_file (image);
+ if (g_file_equal (window_file, file)) {
+ file_window = window;
break;
}
}
@@ -232,7 +232,7 @@
g_list_free (windows);
- return uri_window;
+ return file_window;
}
static void
@@ -246,18 +246,18 @@
gdk_threads_leave ();
}
-static gboolean
-eog_application_real_open_uri_list (EogApplication *application,
- GSList *uri_list,
- guint timestamp,
- EogStartupFlags flags,
- GError **error)
+gboolean
+eog_application_open_file_list (EogApplication *application,
+ GSList *file_list,
+ guint timestamp,
+ EogStartupFlags flags,
+ GError **error)
{
EogWindow *new_window = NULL;
- if (uri_list != NULL)
- new_window = eog_application_get_uri_window (application,
- (GnomeVFSURI *) uri_list->data);
+ if (file_list != NULL)
+ new_window = eog_application_get_file_window (application,
+ (GFile *) file_list->data);
if (new_window != NULL) {
gtk_window_present_with_time (GTK_WINDOW (new_window),
@@ -276,7 +276,7 @@
G_CALLBACK (eog_application_show_window),
GUINT_TO_POINTER (timestamp));
- eog_window_open_uri_list (new_window, uri_list);
+ eog_window_open_file_list (new_window, file_list);
return TRUE;
}
@@ -288,17 +288,17 @@
EogStartupFlags flags,
GError **error)
{
- GSList *uri_list = NULL;
+ GSList *file_list = NULL;
g_return_val_if_fail (EOG_IS_APPLICATION (application), FALSE);
- uri_list = eog_util_string_list_to_uri_list (files);
+ file_list = eog_util_string_list_to_file_list (files);
- return eog_application_real_open_uri_list (application,
- uri_list,
- timestamp,
- flags,
- error);
+ return eog_application_open_file_list (application,
+ file_list,
+ timestamp,
+ flags,
+ error);
}
#ifdef HAVE_DBUS
@@ -309,12 +309,12 @@
EogStartupFlags flags,
GError **error)
{
- GSList *uri_list = NULL;
+ GSList *file_list = NULL;
- uri_list = eog_util_strings_to_uri_list (uris);
+ file_list = eog_util_strings_to_file_list (uris);
- return eog_application_real_open_uri_list (application, uri_list, timestamp,
- flags, error);
+ return eog_application_open_file_list (application, file_list, timestamp,
+ flags, error);
}
#endif
Modified: trunk/src/eog-application.h
==============================================================================
--- trunk/src/eog-application.h (original)
+++ trunk/src/eog-application.h Fri Mar 14 20:56:06 2008
@@ -79,11 +79,17 @@
EogStartupFlags flags,
GError **error);
-gboolean eog_application_open_uri_list (EogApplication *application,
- GSList *uri_list,
- guint timestamp,
- EogStartupFlags flags,
- GError **error);
+gboolean eog_application_open_uri_list (EogApplication *application,
+ GSList *uri_list,
+ guint timestamp,
+ EogStartupFlags flags,
+ GError **error);
+
+gboolean eog_application_open_file_list (EogApplication *application,
+ GSList *file_list,
+ guint timestamp,
+ EogStartupFlags flags,
+ GError **error);
#ifdef HAVE_DBUS
gboolean eog_application_open_uris (EogApplication *application,
Modified: trunk/src/eog-error-message-area.c
==============================================================================
--- trunk/src/eog-error-message-area.c (original)
+++ trunk/src/eog-error-message-area.c Fri Mar 14 20:56:06 2008
@@ -147,20 +147,22 @@
}
GtkWidget *
-eog_no_images_error_message_area_new (const GnomeVFSURI *uri)
+eog_no_images_error_message_area_new (GFile *file)
{
GtkWidget *message_area;
gchar *error_message = NULL;
- if (uri != NULL) {
- gchar *uri_str;
+ if (file != NULL) {
+ gchar *uri_str, *unescaped_str;
- uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
+ uri_str = g_file_get_uri (file);
+ unescaped_str = g_uri_unescape_string (uri_str, NULL);
error_message = g_strdup_printf (_("No images found in '%s'."),
- gnome_vfs_format_uri_for_display (uri_str));
+ unescaped_str);
g_free (uri_str);
+ g_free (unescaped_str);
} else {
error_message = g_strdup (_("The given locations contain no images."));
}
Modified: trunk/src/eog-error-message-area.h
==============================================================================
--- trunk/src/eog-error-message-area.h (original)
+++ trunk/src/eog-error-message-area.h Fri Mar 14 20:56:06 2008
@@ -27,11 +27,11 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
GtkWidget *eog_image_load_error_message_area_new (const gchar *caption,
const GError *error);
-GtkWidget *eog_no_images_error_message_area_new (const GnomeVFSURI *uri);
+GtkWidget *eog_no_images_error_message_area_new (GFile *file);
#endif /* __EOG_ERROR_MESSAGE_AREA__ */
Modified: trunk/src/eog-file-chooser.c
==============================================================================
--- trunk/src/eog-file-chooser.c (original)
+++ trunk/src/eog-file-chooser.c Fri Mar 14 20:56:06 2008
@@ -27,8 +27,8 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libgnomeui/gnome-thumbnail.h>
#include <gconf/gconf-client.h>
@@ -102,14 +102,18 @@
save_response_cb (GtkDialog *dlg, gint id, gpointer data)
{
gchar *filename;
+ GFile *file;
GdkPixbufFormat *format;
if (id != GTK_RESPONSE_OK)
return;
filename = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dlg));
- format = eog_pixbuf_get_format_by_uri (filename);
+ file = g_file_new_for_uri (filename);
+ format = eog_pixbuf_get_format (file);
g_free (filename);
+ g_object_unref (file);
+
if (!format || !gdk_pixbuf_format_is_writable (format)) {
GtkWidget *msg_dialog;
@@ -242,7 +246,7 @@
* further information according to the thumbnail spec.
*/
static void
-set_preview_pixbuf (EogFileChooser *chooser, GdkPixbuf *pixbuf, GnomeVFSFileInfo *info)
+set_preview_pixbuf (EogFileChooser *chooser, GdkPixbuf *pixbuf, goffset size)
{
EogFileChooserPrivate *priv;
int bytes;
@@ -265,10 +269,10 @@
bytes_str = gdk_pixbuf_get_option (pixbuf, "tEXt::Thumb::Size");
if (bytes_str != NULL) {
bytes = atoi (bytes_str);
- size_str = gnome_vfs_format_file_size_for_display (bytes);
+ size_str = g_format_size_for_display (bytes);
}
else {
- size_str = gnome_vfs_format_file_size_for_display (info->size);
+ size_str = g_format_size_for_display (size);
}
/* try to read image dimensions */
@@ -315,10 +319,10 @@
EogFileChooserPrivate *priv;
char *uri;
char *thumb_path = NULL;
+ GFile *file;
+ GFileInfo *file_info;
GdkPixbuf *pixbuf = NULL;
gboolean have_preview = FALSE;
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
priv = EOG_FILE_CHOOSER (file_chooser)->priv;
@@ -328,16 +332,24 @@
return;
}
- info = gnome_vfs_file_info_new ();
+ file = g_file_new_for_uri (uri);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED ","
+ G_FILE_ATTRIBUTE_STANDARD_SIZE,
+ 0, NULL, NULL);
+ g_object_unref (file);
+
+ if ((file_info != NULL) && (priv->thumb_factory != NULL)) {
+ guint64 mtime;
- result = gnome_vfs_get_file_info (uri, info, GNOME_VFS_FILE_INFO_DEFAULT);
- if ((result == GNOME_VFS_OK) && (priv->thumb_factory != NULL)) {
+ mtime = g_file_info_get_attribute_uint64 (file_info,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED);
thumb_path = gnome_thumbnail_factory_lookup (priv->thumb_factory,
uri,
- info->mtime);
+ mtime);
if (thumb_path == NULL) {
/* read files smaller than 100kb directly */
- if (info->size <= 100000) {
+ if (g_file_info_get_size (file_info) <= 100000) {
/* FIXME: we should then output also the image dimensions */
thumb_path = gtk_file_chooser_get_preview_filename (file_chooser);
}
@@ -349,7 +361,8 @@
have_preview = (pixbuf != NULL);
- set_preview_pixbuf (EOG_FILE_CHOOSER (file_chooser), pixbuf, info);
+ set_preview_pixbuf (EOG_FILE_CHOOSER (file_chooser), pixbuf,
+ g_file_info_get_size (file_info));
if (pixbuf != NULL) {
g_object_unref (pixbuf);
@@ -362,7 +375,7 @@
}
g_free (uri);
- gnome_vfs_file_info_unref (info);
+ g_object_unref (file_info);
gtk_file_chooser_set_preview_widget_active (file_chooser, have_preview);
}
Modified: trunk/src/eog-image-jpeg.c
==============================================================================
--- trunk/src/eog-image-jpeg.c (original)
+++ trunk/src/eog-image-jpeg.c Fri Mar 14 20:56:06 2008
@@ -49,7 +49,6 @@
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs.h>
#if HAVE_EXIF
#include <libexif/exif-data.h>
#endif
@@ -71,7 +70,7 @@
struct jpeg_error_mgr pub;
sigjmp_buf setjmp_buffer;
GError **error;
- const char *filename;
+ char *filename;
};
@@ -180,7 +179,7 @@
gchar *infile_uri;
g_return_val_if_fail (EOG_IS_IMAGE (image), FALSE);
- g_return_val_if_fail (EOG_IMAGE (image)->priv->uri != NULL, FALSE);
+ g_return_val_if_fail (EOG_IMAGE (image)->priv->file != NULL, FALSE);
priv = image->priv;
@@ -188,7 +187,7 @@
/* Initialize the JPEG decompression object with default error
* handling. */
- jsrcerr.filename = gnome_vfs_uri_get_path (priv->uri);
+ jsrcerr.filename = g_file_get_path (priv->file);
srcinfo.err = jpeg_std_error (&(jsrcerr.pub));
jsrcerr.pub.error_exit = fatal_error_handler;
jsrcerr.pub.output_message = output_message_handler;
@@ -198,7 +197,7 @@
/* Initialize the JPEG compression object with default error
* handling. */
- jdsterr.filename = file;
+ jdsterr.filename = (char *) file;
dstinfo.err = jpeg_std_error (&(jdsterr.pub));
jdsterr.pub.error_exit = fatal_error_handler;
jdsterr.pub.output_message = output_message_handler;
@@ -214,11 +213,12 @@
srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use;
/* Open the output file. */
- /* FIXME: Make this a GnomeVFSURI aware input manager */
- infile_uri = gnome_vfs_unescape_string (gnome_vfs_uri_get_path (priv->uri), NULL);
+ /* FIXME: Make this a GIO aware input manager */
+ infile_uri = g_file_get_path (priv->file);
input_file = fopen (infile_uri, "rb");
if (input_file == NULL) {
g_warning ("Input file not openable: %s\n", infile_uri);
+ g_free (jsrcerr.filename);
g_free (infile_uri);
return FALSE;
}
@@ -228,6 +228,7 @@
if (output_file == NULL) {
g_warning ("Output file not openable: %s\n", file);
fclose (input_file);
+ g_free (jsrcerr.filename);
return FALSE;
}
@@ -236,6 +237,7 @@
fclose (input_file);
jpeg_destroy_compress (&dstinfo);
jpeg_destroy_decompress (&srcinfo);
+ g_free (jsrcerr.filename);
return FALSE;
}
@@ -244,6 +246,7 @@
fclose (input_file);
jpeg_destroy_compress (&dstinfo);
jpeg_destroy_decompress (&srcinfo);
+ g_free (jsrcerr.filename);
return FALSE;
}
@@ -316,6 +319,7 @@
jpeg_destroy_compress (&dstinfo);
(void) jpeg_finish_decompress (&srcinfo);
jpeg_destroy_decompress (&srcinfo);
+ g_free (jsrcerr.filename);
/* Close files */
fclose (input_file);
@@ -378,7 +382,7 @@
}
/* set up error handling */
- jerr.filename = file;
+ jerr.filename = (char *) file;
cinfo.err = jpeg_std_error (&(jerr.pub));
jerr.pub.error_exit = fatal_error_handler;
jerr.pub.output_message = output_message_handler;
Modified: trunk/src/eog-image-private.h
==============================================================================
--- trunk/src/eog-image-private.h (original)
+++ trunk/src/eog-image-private.h Fri Mar 14 20:56:06 2008
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
struct _EogImagePrivate {
- GnomeVFSURI *uri;
+ GFile *file;
EogImageStatus status;
EogImageStatus prev_status;
@@ -39,7 +39,7 @@
gint width;
gint height;
- GnomeVFSFileSize bytes;
+ goffset bytes;
gchar *file_type;
gboolean threadsafe_format;
Modified: trunk/src/eog-image-save-info.c
==============================================================================
--- trunk/src/eog-image-save-info.c (original)
+++ trunk/src/eog-image-save-info.c Fri Mar 14 20:56:06 2008
@@ -3,7 +3,6 @@
#endif
#include <string.h>
-#include <libgnomevfs/gnome-vfs.h>
#include "eog-image-save-info.h"
#include "eog-image-private.h"
#include "eog-pixbuf-util.h"
@@ -16,9 +15,9 @@
{
EogImageSaveInfo *info = EOG_IMAGE_SAVE_INFO (object);
- if (info->uri != NULL) {
- gnome_vfs_uri_unref (info->uri);
- info->uri = NULL;
+ if (info->file != NULL) {
+ g_object_unref (info->file);
+ info->file = NULL;
}
if (info->format != NULL) {
@@ -51,23 +50,27 @@
* filesystem calls.
*/
static gboolean
-is_local_uri (const GnomeVFSURI* uri)
+is_local_file (GFile *file)
{
- const char *scheme;
+ char *scheme;
+ gboolean ret;
- g_return_val_if_fail (uri != NULL, FALSE);
+ g_return_val_if_fail (file != NULL, FALSE);
- scheme = gnome_vfs_uri_get_scheme (uri);
- return (g_ascii_strcasecmp (scheme, "file") == 0);
+ scheme = g_file_get_uri_scheme (file);
+
+ ret = (g_ascii_strcasecmp (scheme, "file") == 0);
+ g_free (scheme);
+ return ret;
}
static char*
-get_save_file_type_by_uri (const GnomeVFSURI *uri)
+get_save_file_type_by_file (GFile *file)
{
GdkPixbufFormat *format;
char *type = NULL;
- format = eog_pixbuf_get_format_by_vfs_uri (uri);
+ format = eog_pixbuf_get_format (file);
if (format != NULL) {
type = gdk_pixbuf_format_get_name (format);
}
@@ -87,10 +90,10 @@
info = g_object_new (EOG_TYPE_IMAGE_SAVE_INFO, NULL);
- info->uri = eog_image_get_uri (image);
+ info->file = eog_image_get_file (image);
info->format = g_strdup (image->priv->file_type);
- info->exists = gnome_vfs_uri_exists (info->uri);
- info->local = is_local_uri (info->uri);
+ info->exists = g_file_query_exists (info->file, NULL);
+ info->local = is_local_file (info->file);
info->has_metadata = eog_image_has_data (image, EOG_IMAGE_DATA_EXIF);
info->modified = eog_image_is_modified (image);
info->overwrite = FALSE;
@@ -103,38 +106,38 @@
EogImageSaveInfo*
eog_image_save_info_from_uri (const char *txt_uri, GdkPixbufFormat *format)
{
- GnomeVFSURI *uri;
+ GFile *file;
EogImageSaveInfo *info;
g_return_val_if_fail (txt_uri != NULL, NULL);
- uri = gnome_vfs_uri_new (txt_uri);
+ file = g_file_new_for_uri (txt_uri);
- info = eog_image_save_info_from_vfs_uri (uri, format);
+ info = eog_image_save_info_from_file (file, format);
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
return info;
}
EogImageSaveInfo*
-eog_image_save_info_from_vfs_uri (GnomeVFSURI *uri, GdkPixbufFormat *format)
+eog_image_save_info_from_file (GFile *file, GdkPixbufFormat *format)
{
EogImageSaveInfo *info;
- g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (file != NULL, NULL);
info = g_object_new (EOG_TYPE_IMAGE_SAVE_INFO, NULL);
- info->uri = gnome_vfs_uri_ref (uri);
+ info->file = g_object_ref (file);
if (format == NULL) {
- info->format = get_save_file_type_by_uri (info->uri);
+ info->format = get_save_file_type_by_file (info->file);
}
else {
info->format = gdk_pixbuf_format_get_name (format);
}
- info->exists = gnome_vfs_uri_exists (info->uri);
- info->local = is_local_uri (info->uri);
+ info->exists = g_file_query_exists (file, NULL);
+ info->local = is_local_file (file);
info->has_metadata = FALSE;
info->modified = FALSE;
info->overwrite = FALSE;
Modified: trunk/src/eog-image-save-info.h
==============================================================================
--- trunk/src/eog-image-save-info.h (original)
+++ trunk/src/eog-image-save-info.h Fri Mar 14 20:56:06 2008
@@ -2,6 +2,7 @@
#define _EOG_IMAGE_SAVE_INFO_H_
#include <glib-object.h>
+#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
@@ -21,7 +22,7 @@
struct _EogImageSaveInfo {
GObject parent;
- GnomeVFSURI *uri;
+ GFile *file;
char *format;
gboolean exists;
gboolean local;
@@ -45,7 +46,7 @@
EogImageSaveInfo *eog_image_save_info_from_uri (const char *uri,
GdkPixbufFormat *format);
-EogImageSaveInfo *eog_image_save_info_from_vfs_uri (GnomeVFSURI *uri,
+EogImageSaveInfo *eog_image_save_info_from_file (GFile *file,
GdkPixbufFormat *format);
G_END_DECLS
Modified: trunk/src/eog-image.c
==============================================================================
--- trunk/src/eog-image.c (original)
+++ trunk/src/eog-image.c Fri Mar 14 20:56:06 2008
@@ -49,7 +49,6 @@
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-io.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <libgnomeui/gnome-thumbnail.h>
#ifdef HAVE_EXIF
@@ -140,9 +139,9 @@
eog_image_free_mem_private (EOG_IMAGE (object));
- if (priv->uri) {
- gnome_vfs_uri_unref (priv->uri);
- priv->uri = NULL;
+ if (priv->file) {
+ g_object_unref (priv->file);
+ priv->file = NULL;
}
if (priv->caption) {
@@ -238,7 +237,7 @@
{
img->priv = EOG_IMAGE_GET_PRIVATE (img);
- img->priv->uri = NULL;
+ img->priv->file = NULL;
img->priv->image = NULL;
img->priv->thumbnail = NULL;
img->priv->width = -1;
@@ -272,19 +271,19 @@
img = EOG_IMAGE (g_object_new (EOG_TYPE_IMAGE, NULL));
- img->priv->uri = gnome_vfs_uri_new (txt_uri);
+ img->priv->file = g_file_new_for_uri (txt_uri);
return img;
}
EogImage *
-eog_image_new_uri (GnomeVFSURI *uri)
+eog_image_new_file (GFile *file)
{
EogImage *img;
img = EOG_IMAGE (g_object_new (EOG_TYPE_IMAGE, NULL));
- img->priv->uri = gnome_vfs_uri_ref (uri);
+ img->priv->file = g_object_ref (file);
return img;
}
@@ -562,24 +561,18 @@
static void
eog_image_get_file_info (EogImage *img,
- GnomeVFSFileSize *bytes,
+ goffset *bytes,
gchar **mime_type,
GError **error)
{
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
+ GFileInfo *file_info;
- info = gnome_vfs_file_info_new ();
+ file_info = g_file_query_info (img->priv->file,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE ","
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, error);
- result = gnome_vfs_get_file_info_uri (img->priv->uri,
- info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
-
- if ((result != GNOME_VFS_OK) ||
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) == 0 ||
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) == 0) {
+ if (file_info == NULL) {
if (bytes)
*bytes = 0;
@@ -589,16 +582,15 @@
g_set_error (error,
EOG_IMAGE_ERROR,
EOG_IMAGE_ERROR_VFS,
- gnome_vfs_result_to_string (result));
+ "Error in getting image file info");
} else {
if (bytes)
- *bytes = info->size;
+ *bytes = g_file_info_get_size (file_info);
if (mime_type)
- *mime_type = g_strdup (info->mime_type);
+ *mime_type = g_strdup (g_file_info_get_content_type (file_info));
+ g_object_unref (file_info);
}
-
- gnome_vfs_file_info_unref (info);
}
#ifdef HAVE_LCMS
@@ -933,15 +925,13 @@
GError **error)
{
EogImagePrivate *priv;
- GnomeVFSHandle *handle;
- GnomeVFSFileSize bytes_read;
- GnomeVFSFileSize bytes_read_total = 0;
- GnomeVFSResult result;
+ GFileInputStream *input_stream;
EogMetadataReader *md_reader = NULL;
GdkPixbufFormat *format;
gchar *mime_type;
GdkPixbufLoader *loader = NULL;
guchar *buffer;
+ goffset bytes_read, bytes_read_total = 0;
gboolean failed = FALSE;
gboolean first_run = TRUE;
gboolean set_metadata = TRUE;
@@ -984,16 +974,17 @@
}
}
- result = gnome_vfs_open_uri (&handle, priv->uri, GNOME_VFS_OPEN_READ);
+ input_stream = g_file_read (priv->file, NULL, error);
- if (result != GNOME_VFS_OK) {
+ if (input_stream == NULL) {
g_free (mime_type);
- g_set_error (error,
- EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_VFS,
- gnome_vfs_result_to_string (result));
-
+ if (error != NULL) {
+ g_set_error (error,
+ EOG_IMAGE_ERROR,
+ EOG_IMAGE_ERROR_VFS,
+ "Failed to open input stream for file");
+ }
return FALSE;
}
@@ -1033,20 +1024,22 @@
g_free (mime_type);
while (!priv->cancel_loading) {
- result = gnome_vfs_read (handle,
- buffer,
- EOG_IMAGE_READ_BUFFER_SIZE,
- &bytes_read);
+ /* FIXME: make this async */
+ bytes_read = g_input_stream_read (G_INPUT_STREAM (input_stream),
+ buffer,
+ EOG_IMAGE_READ_BUFFER_SIZE,
+ NULL, error);
- if (result == GNOME_VFS_ERROR_EOF || bytes_read == 0) {
+ if (bytes_read == 0) {
+ /* End of the file */
break;
- } else if (result != GNOME_VFS_OK) {
+ } else if (bytes_read == -1) {
failed = TRUE;
g_set_error (error,
EOG_IMAGE_ERROR,
EOG_IMAGE_ERROR_VFS,
- gnome_vfs_result_to_string (result));
+ "Failed to read from input stream");
break;
}
@@ -1129,7 +1122,7 @@
g_free (buffer);
- gnome_vfs_close (handle);
+ g_object_unref (G_OBJECT (input_stream));
failed = (failed ||
priv->cancel_loading ||
@@ -1405,128 +1398,101 @@
priv->modified = (priv->undo_stack != NULL);
}
-static gchar *
-tmp_file_get_path (void)
+static GFile *
+tmp_file_get (void)
{
- gchar *tmp_file;
+ GFile *tmp_file;
+ char *tmp_file_path;
gint fd;
- tmp_file = g_build_filename (g_get_tmp_dir (), "eog-save-XXXXXX", NULL);
-
- fd = g_mkstemp (tmp_file);
-
+ tmp_file_path = g_build_filename (g_get_tmp_dir (), "eog-save-XXXXXX", NULL);
+ fd = g_mkstemp (tmp_file_path);
if (fd == -1) {
- g_free (tmp_file);
- tmp_file = NULL;
- } else {
- close (fd);
+ g_free (tmp_file_path);
+ return NULL;
+ }
+ else {
+ tmp_file = g_file_new_for_path (tmp_file_path);
+ g_free (tmp_file_path);
+ return tmp_file;
}
-
- return tmp_file;
}
-static gint
-handle_xfer_status (GnomeVFSXferProgressInfo *info, gpointer user_data)
+static void
+transfer_progress_cb (goffset cur_bytes,
+ goffset total_bytes,
+ gpointer user_data)
{
EogImage *image = EOG_IMAGE (user_data);
- g_assert (info->status == GNOME_VFS_XFER_PROGRESS_STATUS_OK);
-
- if (info->phase >= GNOME_VFS_XFER_PHASE_COPYING && info->bytes_copied > 0)
+ if (cur_bytes > 0) {
g_signal_emit (G_OBJECT(image),
signals[SIGNAL_SAVE_PROGRESS],
0,
- (gfloat) (info->bytes_copied) / (gfloat) info->file_size);
-
- return TRUE;
+ (gfloat) cur_bytes / (gfloat) total_bytes);
+ }
}
static gboolean
tmp_file_move_to_uri (EogImage *image,
- const char* tmpfile,
- const GnomeVFSURI *uri,
+ GFile *tmpfile,
+ GFile *file,
gboolean overwrite,
GError **error)
{
- GnomeVFSResult result;
- GnomeVFSURI *source_uri;
- GnomeVFSFileInfo *info;
- GnomeVFSXferOverwriteMode overwrt_mode = GNOME_VFS_XFER_OVERWRITE_MODE_ABORT;
-
- if (!overwrite && gnome_vfs_uri_exists ((GnomeVFSURI*) uri))
- {
- /* Explicit check if uri exists, seems that gnome_vfs_xfer_uri, doesn't
- * work as expected */
- g_set_error (error, EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_FILE_EXISTS,
- _("File exists"));
- return FALSE;
- }
-
- info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri ((GnomeVFSURI*) uri, info, GNOME_VFS_FILE_INFO_DEFAULT);
- if (result != GNOME_VFS_OK) {
- /* We don't propagate the error here, because if we get a
- * fatal error, the xfer_uri will fail too and then
- * handled. */
- gnome_vfs_file_info_unref (info);
- info = NULL;
- }
-
- if (overwrite == TRUE) {
- overwrt_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
- }
- source_uri = gnome_vfs_uri_new (tmpfile);
-
- result = gnome_vfs_xfer_uri (source_uri,
- uri,
- GNOME_VFS_XFER_DELETE_ITEMS, /* delete source file */
- GNOME_VFS_XFER_ERROR_MODE_ABORT, /* abort on all errors */
- overwrt_mode,
- handle_xfer_status, /* no progress callback */
- image);
-
- gnome_vfs_uri_unref (source_uri);
-
- if (result == GNOME_VFS_ERROR_FILE_EXISTS) {
- g_set_error (error, EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_FILE_EXISTS,
- gnome_vfs_result_to_string (result));
- } else if (result != GNOME_VFS_OK) {
+ gboolean result;
+ GError **ioerror = NULL;
+
+ result = g_file_move (tmpfile,
+ file,
+ (overwrite ? G_FILE_COPY_OVERWRITE : 0) |
+ G_FILE_COPY_ALL_METADATA,
+ NULL,
+ (GFileProgressCallback) transfer_progress_cb,
+ image,
+ ioerror);
+
+ if (result == FALSE) {
+ if (g_error_matches (*ioerror, G_IO_ERROR,
+ G_IO_ERROR_EXISTS)) {
+ g_set_error (error, EOG_IMAGE_ERROR,
+ EOG_IMAGE_ERROR_FILE_EXISTS,
+ "File exists");
+ } else {
g_set_error (error, EOG_IMAGE_ERROR,
EOG_IMAGE_ERROR_VFS,
- gnome_vfs_result_to_string (result));
- } else if (info != NULL) {
- /* reset file permissions/owner to the original ones */
- GnomeVFSSetFileInfoMask mask =
- GNOME_VFS_SET_FILE_INFO_PERMISSIONS | GNOME_VFS_SET_FILE_INFO_OWNER;
- gnome_vfs_set_file_info_uri ((GnomeVFSURI*) uri, info, mask);
- }
-
- if (info != NULL) {
- gnome_vfs_file_info_unref (info);
- }
+ "VFS error moving the temp file");
+ }
+ g_error_free (*ioerror);
+ }
- return (result == GNOME_VFS_OK);
+ return result;
}
static gboolean
-tmp_file_delete (char *tmpfile)
+tmp_file_delete (GFile *tmpfile)
{
- if (tmpfile == NULL) return FALSE;
-
- if (g_file_test (tmpfile, G_FILE_TEST_EXISTS)) {
- int result;
+ gboolean result;
+ GError *err = NULL;
- result = unlink (tmpfile);
+ if (tmpfile == NULL) return FALSE;
- if (result == -1) {
- g_warning ("Couldn't delete temporary file: %s", tmpfile);
- return FALSE;
+ result = g_file_delete (tmpfile, NULL, &err);
+ if (result == FALSE) {
+ char *tmpfile_path;
+ if (err != NULL) {
+ if (err->code == G_IO_ERROR_NOT_FOUND) {
+ g_error_free (err);
+ return TRUE;
+ }
+ g_error_free (err);
}
+ tmpfile_path = g_file_get_path (tmpfile);
+ g_warning ("Couldn't delete temporary file: %s", tmpfile_path);
+ g_free (tmpfile_path);
}
- return TRUE;
+ return result;
}
static void
@@ -1566,10 +1532,10 @@
priv = image->priv;
/* update file location */
- if (priv->uri != NULL) {
- gnome_vfs_uri_unref (priv->uri);
+ if (priv->file != NULL) {
+ g_object_unref (priv->file);
}
- priv->uri = gnome_vfs_uri_ref (target->uri);
+ priv->file = g_object_ref (target->file);
/* Clear caption and caption key, these will be
* updated on next eog_image_get_caption call.
@@ -1595,7 +1561,8 @@
{
EogImagePrivate *priv;
gboolean success = FALSE;
- char *tmpfile;
+ GFile *tmp_file;
+ char *tmp_file_path;
g_return_val_if_fail (EOG_IS_IMAGE (img), FALSE);
g_return_val_if_fail (EOG_IS_IMAGE_SAVE_INFO (source), FALSE);
@@ -1626,40 +1593,44 @@
return FALSE;
}
- /* generate temporary file name */
- tmpfile = tmp_file_get_path ();
- if (tmpfile == NULL) {
+ /* generate temporary file */
+ tmp_file = tmp_file_get ();
+
+ if (tmp_file == NULL) {
g_set_error (error, EOG_IMAGE_ERROR,
EOG_IMAGE_ERROR_TMP_FILE_FAILED,
_("Temporary file creation failed."));
return FALSE;
- }
+ }
+
+ tmp_file_path = g_file_get_path (tmp_file);
#ifdef HAVE_JPEG
/* determine kind of saving */
if ((g_ascii_strcasecmp (source->format, EOG_FILE_FORMAT_JPEG) == 0) &&
source->exists && source->modified)
{
- success = eog_image_jpeg_save_file (img, tmpfile, source, NULL, error);
+ success = eog_image_jpeg_save_file (img, tmp_file_path, source, NULL, error);
}
#endif
if (!success && (*error == NULL)) {
- success = gdk_pixbuf_save (priv->image, tmpfile, source->format, error, NULL);
+ success = gdk_pixbuf_save (priv->image, tmp_file_path, source->format, error, NULL);
}
if (success) {
/* try to move result file to target uri */
- success = tmp_file_move_to_uri (img, tmpfile, priv->uri, TRUE /*overwrite*/, error);
+ success = tmp_file_move_to_uri (img, tmp_file, priv->file, TRUE /*overwrite*/, error);
}
if (success) {
eog_image_reset_modifications (img);
}
- tmp_file_delete (tmpfile);
+ tmp_file_delete (tmp_file);
- g_free (tmpfile);
+ g_free (tmp_file_path);
+ g_object_unref (tmp_file);
/* Restore previous status only if is not monitored image */
if (!priv->is_monitored) {
@@ -1672,69 +1643,38 @@
static gboolean
eog_image_copy_file (EogImageSaveInfo *source, EogImageSaveInfo *target, GError **error)
{
- GnomeVFSResult result;
- GnomeVFSFileInfo *info;
- GnomeVFSXferOverwriteMode overwrt_mode = GNOME_VFS_XFER_OVERWRITE_MODE_ABORT;
+ char *target_file_path;
+ gboolean result;
+ GError *ioerror;
g_return_val_if_fail (EOG_IS_IMAGE_SAVE_INFO (source), FALSE);
g_return_val_if_fail (EOG_IS_IMAGE_SAVE_INFO (target), FALSE);
-
- if (target->overwrite != TRUE &&
- gnome_vfs_uri_exists (target->uri))
- {
- /* explicit check if uri exists, seems that gnome_vfs_xfer_uri, doesn't
- * work as expected
- */
- g_set_error (error,
- EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_FILE_EXISTS,
- _("File exists"));
-
- return FALSE;
- } else if (target->overwrite == TRUE) {
- overwrt_mode = GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE;
- }
-
- info = gnome_vfs_file_info_new ();
-
- result = gnome_vfs_get_file_info_uri ((GnomeVFSURI*) target->uri, info, GNOME_VFS_FILE_INFO_DEFAULT);
- if (result != GNOME_VFS_OK) {
- /* we don't propagate the error here, because if we get a
- * fatal error, the xfer_uri will fail too and then
- * handled.
- */
- gnome_vfs_file_info_unref (info);
- info = NULL;
- }
-
- result = gnome_vfs_xfer_uri (source->uri,
- target->uri,
- GNOME_VFS_XFER_DEFAULT, /* copy the data */
- GNOME_VFS_XFER_ERROR_MODE_ABORT, /* abort on all errors */
- overwrt_mode,
- NULL, /* no progress callback */
- NULL);
-
- if (result == GNOME_VFS_ERROR_FILE_EXISTS) {
- g_set_error (error, EOG_IMAGE_ERROR,
- EOG_IMAGE_ERROR_FILE_EXISTS,
- gnome_vfs_result_to_string (result));
- } else if (result != GNOME_VFS_OK) {
+
+ target_file_path = g_file_get_path (target->file);
+
+ result = g_file_copy (source->file,
+ target->file,
+ (target->overwrite ? G_FILE_COPY_OVERWRITE : 0) |
+ G_FILE_COPY_ALL_METADATA,
+ NULL,
+ NULL, /* no progress callback */
+ NULL,
+ &ioerror);
+
+ if (result == FALSE) {
+ if (ioerror->code == G_IO_ERROR_EXISTS) {
+ g_set_error (error, EOG_IMAGE_ERROR,
+ EOG_IMAGE_ERROR_FILE_EXISTS,
+ ioerror->message);
+ } else {
g_set_error (error, EOG_IMAGE_ERROR,
EOG_IMAGE_ERROR_VFS,
- gnome_vfs_result_to_string (result));
- } else if (info != NULL) {
- /* reset file permissions/owner to the original ones */
- GnomeVFSSetFileInfoMask mask =
- GNOME_VFS_SET_FILE_INFO_PERMISSIONS | GNOME_VFS_SET_FILE_INFO_OWNER;
- gnome_vfs_set_file_info_uri (target->uri, info, mask);
- }
-
- if (info != NULL) {
- gnome_vfs_file_info_unref (info);
+ ioerror->message);
+ }
+ g_error_free (ioerror);
}
- return (result == GNOME_VFS_OK);
+ return result;
}
gboolean
@@ -1742,7 +1682,8 @@
{
EogImagePrivate *priv;
gboolean success = FALSE;
- char *tmpfile;
+ char *tmp_file_path;
+ GFile *tmp_file;
gboolean direct_copy = FALSE;
g_return_val_if_fail (EOG_IS_IMAGE (img), FALSE);
@@ -1764,9 +1705,9 @@
}
/* generate temporary file name */
- tmpfile = tmp_file_get_path ();
+ tmp_file = tmp_file_get ();
- if (tmpfile == NULL) {
+ if (tmp_file == NULL) {
g_set_error (error,
EOG_IMAGE_ERROR,
EOG_IMAGE_ERROR_TMP_FILE_FAILED,
@@ -1774,6 +1715,7 @@
return FALSE;
}
+ tmp_file_path = g_file_get_path (tmp_file);
/* determine kind of saving */
if (g_ascii_strcasecmp (source->format, target->format) == 0 && !source->modified) {
@@ -1785,17 +1727,17 @@
else if ((g_ascii_strcasecmp (source->format, EOG_FILE_FORMAT_JPEG) == 0 && source->exists) ||
(g_ascii_strcasecmp (target->format, EOG_FILE_FORMAT_JPEG) == 0))
{
- success = eog_image_jpeg_save_file (img, tmpfile, source, target, error);
+ success = eog_image_jpeg_save_file (img, tmp_file_path, source, target, error);
}
#endif
if (!success && (*error == NULL)) {
- success = gdk_pixbuf_save (priv->image, tmpfile, target->format, error, NULL);
+ success = gdk_pixbuf_save (priv->image, tmp_file_path, target->format, error, NULL);
}
if (success && !direct_copy) { /* not required if we alredy copied the file directly */
/* try to move result file to target uri */
- success = tmp_file_move_to_uri (img, tmpfile, target->uri, target->overwrite, error);
+ success = tmp_file_move_to_uri (img, tmp_file, target->file, target->overwrite, error);
}
if (success) {
@@ -1804,8 +1746,9 @@
eog_image_link_with_target (img, target);
}
- tmp_file_delete (tmpfile);
- g_free (tmpfile);
+ tmp_file_delete (tmp_file);
+ g_object_unref (tmp_file);
+ g_free (tmp_file_path);
/* Restore previous status only if is not monitored image */
if (!priv->is_monitored) {
@@ -1851,6 +1794,7 @@
EogImagePrivate *priv;
char *name;
char *utf8_name;
+ char *scheme;
gboolean validated = FALSE;
gboolean broken_filenames;
@@ -1858,15 +1802,16 @@
priv = img->priv;
- if (priv->uri == NULL) return NULL;
+ if (priv->file == NULL) return NULL;
if (priv->caption != NULL)
/* Use cached caption string */
return priv->caption;
- name = gnome_vfs_uri_extract_short_name (priv->uri);
+ name = g_file_get_basename (priv->file);
+ scheme = g_file_get_uri_scheme (priv->file);
- if (name != NULL && g_ascii_strcasecmp (priv->uri->method_string, "file") == 0) {
+ if (name != NULL && g_ascii_strcasecmp (scheme, "file") == 0) {
/* Support the G_BROKEN_FILENAMES feature of
* glib by using g_filename_to_utf8 to convert
* local filenames to UTF-8. Also do the same
@@ -1904,7 +1849,7 @@
if (priv->caption == NULL) {
char *short_str;
- short_str = gnome_vfs_uri_extract_short_name (priv->uri);
+ short_str = g_file_get_basename (priv->file);
if (g_utf8_validate (short_str, -1, NULL)) {
priv->caption = g_strdup (short_str);
} else {
@@ -1912,6 +1857,7 @@
}
g_free (short_str);
}
+ g_free (scheme);
return priv->caption;
}
@@ -1997,12 +1943,12 @@
}
-GnomeVFSURI *
-eog_image_get_uri (EogImage *img)
+GFile *
+eog_image_get_file (EogImage *img)
{
g_return_val_if_fail (EOG_IS_IMAGE (img), NULL);
- return gnome_vfs_uri_ref (img->priv->uri);
+ return g_object_ref (img->priv->file);
}
gboolean
@@ -2013,7 +1959,7 @@
return img->priv->modified;
}
-GnomeVFSFileSize
+goffset
eog_image_get_bytes (EogImage *img)
{
g_return_val_if_fail (EOG_IS_IMAGE (img), 0);
@@ -2040,11 +1986,11 @@
priv = img->priv;
- if (priv->uri != NULL) {
- uri_str = gnome_vfs_uri_to_string (priv->uri, GNOME_VFS_URI_HIDE_NONE);
+ if (priv->file != NULL) {
+ uri_str = g_file_get_uri (priv->file);
if (uri_str != NULL) {
- str = gnome_vfs_format_uri_for_display (uri_str);
+ str = g_uri_unescape_string (uri_str, NULL);
g_free (uri_str);
}
}
Modified: trunk/src/eog-image.h
==============================================================================
--- trunk/src/eog-image.h (original)
+++ trunk/src/eog-image.h Fri Mar 14 20:56:06 2008
@@ -29,7 +29,6 @@
#include <glib.h>
#include <glib-object.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#ifdef HAVE_EXIF
@@ -119,7 +118,7 @@
EogImage *eog_image_new (const char *txt_uri);
-EogImage *eog_image_new_uri (GnomeVFSURI *uri);
+EogImage *eog_image_new_file (GFile *file);
gboolean eog_image_load (EogImage *img,
EogImageData data2read,
@@ -155,7 +154,7 @@
gint *width,
gint *height);
-GnomeVFSFileSize eog_image_get_bytes (EogImage *img);
+goffset eog_image_get_bytes (EogImage *img);
gboolean eog_image_is_modified (EogImage *img);
@@ -169,7 +168,7 @@
gpointer eog_image_get_xmp_info (EogImage *img);
-GnomeVFSURI* eog_image_get_uri (EogImage *img);
+GFile* eog_image_get_file (EogImage *img);
gchar* eog_image_get_uri_for_display (EogImage *img);
Modified: trunk/src/eog-jobs.c
==============================================================================
--- trunk/src/eog-jobs.c (original)
+++ trunk/src/eog-jobs.c Fri Mar 14 20:56:06 2008
@@ -317,93 +317,75 @@
}
EogJob *
-eog_job_model_new (GSList *uri_list)
+eog_job_model_new (GSList *file_list)
{
EogJobModel *job;
job = g_object_new (EOG_TYPE_JOB_MODEL, NULL);
- job->uri_list = uri_list;
+ job->file_list = file_list;
return EOG_JOB (job);
}
-static GnomeVFSFileType
-check_uri_file_type (GnomeVFSURI *uri, GnomeVFSFileInfo *info)
-{
- GnomeVFSResult result;
- GnomeVFSFileType type = GNOME_VFS_FILE_TYPE_UNKNOWN;
-
- g_return_val_if_fail (uri != NULL, GNOME_VFS_FILE_TYPE_UNKNOWN);
- g_return_val_if_fail (info != NULL, GNOME_VFS_FILE_TYPE_UNKNOWN);
-
- gnome_vfs_file_info_clear (info);
-
- result = gnome_vfs_get_file_info_uri (uri, info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
-
- if (result == GNOME_VFS_OK &&
- (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) != 0) {
- type = info->type;
- }
-
- return type;
-}
-
static void
filter_files (GSList *files, GList **file_list, GList **error_list)
{
GSList *it;
- GnomeVFSFileInfo *info;
-
- info = gnome_vfs_file_info_new ();
+ GFileInfo *file_info;
for (it = files; it != NULL; it = it->next) {
- GnomeVFSURI *uri;
- GnomeVFSFileType type = GNOME_VFS_FILE_TYPE_UNKNOWN;
+ GFile *file;
+ GFileType type = G_FILE_TYPE_UNKNOWN;
- uri = (GnomeVFSURI *) it->data;
+ file = (GFile *) it->data;
- if (uri != NULL) {
- type = check_uri_file_type (uri, info);
+ if (file != NULL) {
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL) {
+ type = G_FILE_TYPE_UNKNOWN;
+ } else {
+ type = g_file_info_get_file_type (file_info);
+ g_object_unref (file_info);
+ }
}
switch (type) {
- case GNOME_VFS_FILE_TYPE_REGULAR:
- case GNOME_VFS_FILE_TYPE_DIRECTORY:
- *file_list = g_list_prepend (*file_list, gnome_vfs_uri_ref (uri));
+ case G_FILE_TYPE_REGULAR:
+ case G_FILE_TYPE_DIRECTORY:
+ *file_list = g_list_prepend (*file_list, g_object_ref (file));
break;
default:
*error_list = g_list_prepend (*error_list,
- gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE));
+ g_file_get_uri (file));
break;
}
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
}
*file_list = g_list_reverse (*file_list);
*error_list = g_list_reverse (*error_list);
-
- gnome_vfs_file_info_unref (info);
}
void
eog_job_model_run (EogJobModel *job)
{
- GList *file_list = NULL;
+ GList *filtered_list = NULL;
GList *error_list = NULL;
g_return_if_fail (EOG_IS_JOB_MODEL (job));
- filter_files (job->uri_list, &file_list, &error_list);
+ filter_files (job->file_list, &filtered_list, &error_list);
job->store = EOG_LIST_STORE (eog_list_store_new ());
- eog_list_store_add_uris (job->store, file_list);
+ eog_list_store_add_files (job->store, filtered_list);
- gnome_vfs_uri_list_free (file_list);
+ g_list_foreach (filtered_list, (GFunc) g_object_unref, NULL);
+ g_list_free (filtered_list);
EOG_JOB (job)->finished = TRUE;
}
@@ -614,9 +596,9 @@
job->converter = NULL;
}
- if (job->uri != NULL) {
- gnome_vfs_uri_unref (job->uri);
- job->uri = NULL;
+ if (job->file != NULL) {
+ g_object_unref (job->file);
+ job->file = NULL;
}
(* G_OBJECT_CLASS (eog_job_save_as_parent_class)->dispose) (object);
@@ -630,7 +612,7 @@
}
EogJob *
-eog_job_save_as_new (GList *images, EogURIConverter *converter, GnomeVFSURI *uri)
+eog_job_save_as_new (GList *images, EogURIConverter *converter, GFile *file)
{
EogJobSaveAs *job;
@@ -641,7 +623,7 @@
EOG_JOB_SAVE(job)->images = images;
job->converter = converter ? g_object_ref (converter) : NULL;
- job->uri = uri ? gnome_vfs_uri_ref (uri) : NULL;
+ job->file = file ? g_object_ref (file) : NULL;
return EOG_JOB (job);
}
@@ -689,31 +671,31 @@
src_info = eog_image_save_info_from_image (image);
if (n_images == 1) {
- g_assert (saveas_job->uri != NULL);
+ g_assert (saveas_job->file != NULL);
- format = eog_pixbuf_get_format_by_vfs_uri (saveas_job->uri);
+ format = eog_pixbuf_get_format (saveas_job->file);
- dest_info = eog_image_save_info_from_vfs_uri (saveas_job->uri,
- format);
+ dest_info = eog_image_save_info_from_file (saveas_job->file,
+ format);
/* SaveAsDialog has already secured permission to overwrite */
if (dest_info->exists) {
dest_info->overwrite = TRUE;
}
} else {
- GnomeVFSURI *dest_uri;
+ GFile *dest_file;
gboolean result;
result = eog_uri_converter_do (saveas_job->converter,
image,
- &dest_uri,
+ &dest_file,
&format,
NULL);
g_assert (result);
- dest_info = eog_image_save_info_from_vfs_uri (dest_uri,
- format);
+ dest_info = eog_image_save_info_from_file (dest_file,
+ format);
}
success = eog_image_save_as_by_info (image,
Modified: trunk/src/eog-jobs.h
==============================================================================
--- trunk/src/eog-jobs.h (original)
+++ trunk/src/eog-jobs.h Fri Mar 14 20:56:06 2008
@@ -29,6 +29,7 @@
#include "eog-transform.h"
#include <glib.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -149,7 +150,7 @@
{
EogJob parent;
EogListStore *store;
- GSList *uri_list;
+ GSList *file_list;
};
struct _EogJobModelClass
@@ -198,7 +199,7 @@
{
EogJobSave parent;
EogURIConverter *converter;
- GnomeVFSURI *uri;
+ GFile *file;
};
struct _EogJobSaveAsClass
@@ -224,7 +225,7 @@
/* EogJobModel */
GType eog_job_model_get_type (void) G_GNUC_CONST;
-EogJob *eog_job_model_new (GSList *uri_list);
+EogJob *eog_job_model_new (GSList *file_list);
void eog_job_model_run (EogJobModel *model);
/* EogJobTransform */
@@ -242,7 +243,7 @@
GType eog_job_save_as_get_type (void) G_GNUC_CONST;
EogJob *eog_job_save_as_new (GList *images,
EogURIConverter *converter,
- GnomeVFSURI *uri);
+ GFile *file);
G_END_DECLS
Modified: trunk/src/eog-list-store.c
==============================================================================
--- trunk/src/eog-list-store.c (original)
+++ trunk/src/eog-list-store.c Fri Mar 14 20:56:06 2008
@@ -34,17 +34,6 @@
G_DEFINE_TYPE (EogListStore, eog_list_store, GTK_TYPE_LIST_STORE);
-typedef struct {
- EogListStore *store;
- GnomeVFSURI *uri;
- GnomeVFSFileInfo *info;
-} DirLoadingContext;
-
-typedef struct {
- GnomeVFSMonitorHandle *handle;
- const gchar *text_uri;
-} MonitorHandleContext;
-
struct _EogListStorePrivate {
GList *monitors; /* Monitors for the directories */
gint initial_image; /* The image that should be selected firstly by the view. */
@@ -68,12 +57,8 @@
static void
foreach_monitors_free (gpointer data, gpointer user_data)
-{
- MonitorHandleContext *hctx = data;
-
- gnome_vfs_monitor_cancel (hctx->handle);
-
- g_free (data);
+{
+ g_file_monitor_cancel (G_FILE_MONITOR (data));
}
static void
@@ -217,7 +202,7 @@
{
gboolean found = FALSE;
EogImage *image;
- GnomeVFSURI *uri;
+ GFile *file;
gchar *str;
GtkTreeIter iter;
@@ -232,12 +217,12 @@
if (!image)
continue;
- uri = eog_image_get_uri (image);
- str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+ file = eog_image_get_file (image);
+ str = g_file_get_uri (file);
found = (strcmp (str, info_uri) == 0)? TRUE : FALSE;
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
g_free (str);
g_object_unref (G_OBJECT (image));
@@ -252,14 +237,14 @@
}
static gboolean
-is_file_in_list_store_uri (EogListStore *store,
- const GnomeVFSURI *uri,
+is_file_in_list_store_file (EogListStore *store,
+ GFile *file,
GtkTreeIter *iter_found)
{
gchar *uri_str;
gboolean result;
- uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+ uri_str = g_file_get_uri (file);
result = is_file_in_list_store (store, uri_str, iter_found);
@@ -275,15 +260,15 @@
GtkTreeIter iter;
EogImage *image;
GdkPixbuf *thumbnail;
- GnomeVFSURI *uri;
+ GFile *file;
g_return_if_fail (EOG_IS_LIST_STORE (data));
store = EOG_LIST_STORE (data);
- uri = eog_image_get_uri (job->image);
+ file = eog_image_get_file (job->image);
- if (is_file_in_list_store_uri (store, uri, &iter)) {
+ if (is_file_in_list_store_file (store, file, &iter)) {
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
EOG_LIST_STORE_EOG_IMAGE, &image,
-1);
@@ -307,7 +292,7 @@
g_object_unref (thumbnail);
}
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
}
static void
@@ -358,15 +343,15 @@
}
static void
-eog_list_store_append_image_from_uri (EogListStore *store,
- GnomeVFSURI *uri_entry,
- gboolean is_monitored)
+eog_list_store_append_image_from_file (EogListStore *store,
+ GFile *file,
+ gboolean is_monitored)
{
EogImage *image;
g_return_if_fail (EOG_IS_LIST_STORE (store));
- image = eog_image_new_uri (uri_entry);
+ image = eog_image_new_file (file);
eog_image_set_is_monitored (image, is_monitored);
@@ -374,22 +359,27 @@
}
static void
-vfs_monitor_dir_cb (GnomeVFSMonitorHandle *handle,
- const gchar *monitor_uri,
- const gchar *info_uri,
- GnomeVFSMonitorEventType event_type,
- gpointer user_data)
+file_monitor_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event,
+ EogListStore *store)
{
- EogListStore *store = EOG_LIST_STORE (user_data);
- GnomeVFSURI *uri = NULL;
+ const char *mimetype;
+ GFileInfo *file_info;
GtkTreeIter iter;
- gchar *mimetype;
-
- switch (event_type) {
- case GNOME_VFS_MONITOR_EVENT_CHANGED:
- mimetype = gnome_vfs_get_mime_type (info_uri);
- if (is_file_in_list_store (store, info_uri, &iter)) {
+ switch (event) {
+ case G_FILE_MONITOR_EVENT_CHANGED:
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL) {
+ break;
+ }
+ mimetype = g_file_info_get_content_type (file_info);
+
+ if (is_file_in_list_store_file (store, file, &iter)) {
if (eog_image_is_supported_mime_type (mimetype)) {
eog_list_store_thumbnail_refresh (store, &iter);
} else {
@@ -397,17 +387,13 @@
}
} else {
if (eog_image_is_supported_mime_type (mimetype)) {
- uri = gnome_vfs_uri_new (info_uri);
- eog_list_store_append_image_from_uri (store, uri, TRUE);
- gnome_vfs_uri_unref (uri);
+ eog_list_store_append_image_from_file (store, file, TRUE);
}
}
-
- g_free (mimetype);
+ g_object_unref (file_info);
break;
-
- case GNOME_VFS_MONITOR_EVENT_DELETED:
- if (is_file_in_list_store (store, info_uri, &iter)) {
+ case G_FILE_MONITOR_EVENT_DELETED:
+ if (is_file_in_list_store_file (store, file, &iter)) {
EogImage *image;
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
@@ -421,30 +407,39 @@
}
}
break;
+ case G_FILE_MONITOR_EVENT_CREATED:
+ if (!is_file_in_list_store_file (store, file, NULL)) {
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL) {
+ break;
+ }
+ mimetype = g_file_info_get_content_type (file_info);
- case GNOME_VFS_MONITOR_EVENT_CREATED:
- if (!is_file_in_list_store (store, info_uri, NULL)) {
- mimetype = gnome_vfs_get_mime_type (info_uri);
if (eog_image_is_supported_mime_type (mimetype)) {
- uri = gnome_vfs_uri_new (info_uri);
- eog_list_store_append_image_from_uri (store, uri, TRUE);
- gnome_vfs_uri_unref (uri);
+ eog_list_store_append_image_from_file (store, file, TRUE);
}
- g_free (mimetype);
+ g_object_unref (file_info);
}
break;
-
- case GNOME_VFS_MONITOR_EVENT_METADATA_CHANGED:
- mimetype = gnome_vfs_get_mime_type (info_uri);
- if (is_file_in_list_store (store, info_uri, &iter) &&
+ case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED:
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL) {
+ break;
+ }
+ mimetype = g_file_info_get_content_type (file_info);
+ if (is_file_in_list_store_file (store, file, &iter) &&
eog_image_is_supported_mime_type (mimetype)) {
eog_list_store_thumbnail_refresh (store, &iter);
}
- g_free (mimetype);
+ g_object_unref (file_info);
break;
-
- case GNOME_VFS_MONITOR_EVENT_STARTEXECUTING:
- case GNOME_VFS_MONITOR_EVENT_STOPEXECUTING:
+ case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
+ case G_FILE_MONITOR_EVENT_PRE_UNMOUNT:
+ case G_FILE_MONITOR_EVENT_UNMOUNTED:
break;
}
}
@@ -454,154 +449,133 @@
* sort of image. If so, it creates an image object and adds it to the
* list.
*/
-static gboolean
-directory_visit_cb (const gchar *rel_uri,
- GnomeVFSFileInfo *info,
- gboolean recursing_will_loop,
- gpointer data,
- gboolean *recurse)
+static void
+directory_visit (GFile *directory,
+ GFileInfo *children_info,
+ EogListStore *store)
{
- GnomeVFSURI *uri;
- EogListStore *store;
+ GFile *child;
gboolean load_uri = FALSE;
- DirLoadingContext *ctx;
+ const char *mime_type, *name;
- ctx = (DirLoadingContext*) data;
- store = ctx->store;
+ mime_type = g_file_info_get_content_type (children_info);
+ name = g_file_info_get_name (children_info);
- if ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) > 0 &&
- !g_str_has_prefix (info->name, ".")) {
- if (eog_image_is_supported_mime_type (info->mime_type)) {
+ if (!g_str_has_prefix (name, ".")) {
+ if (eog_image_is_supported_mime_type (mime_type)) {
load_uri = TRUE;
}
}
if (load_uri) {
- uri = gnome_vfs_uri_append_file_name (ctx->uri, rel_uri);
- eog_list_store_append_image_from_uri (store, uri, TRUE);
+ child = g_file_get_child (directory, name);
+ eog_list_store_append_image_from_file (store, child, TRUE);
}
-
- return TRUE;
}
static void
eog_list_store_append_directory (EogListStore *store,
- GnomeVFSURI *uri,
- GnomeVFSFileInfo *info)
+ GFile *file,
+ GFileType file_type)
{
- DirLoadingContext ctx;
- MonitorHandleContext *hctx = g_new0(MonitorHandleContext, 1);
-
- hctx->text_uri = gnome_vfs_uri_get_path (uri);
-
- g_return_if_fail (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY);
-
- ctx.uri = uri;
- ctx.store = store;
- ctx.info = info;
-
- gnome_vfs_monitor_add (&hctx->handle, hctx->text_uri,
- GNOME_VFS_MONITOR_DIRECTORY,
- vfs_monitor_dir_cb,
- store);
+ GFileMonitor *file_monitor;
+ GFileEnumerator *file_enumerator;
+ GFileInfo *file_info;
+
+ g_return_if_fail (file_type == G_FILE_TYPE_DIRECTORY);
+
+ file_monitor = g_file_monitor_directory (file,
+ 0, NULL, NULL);
+ g_signal_connect (file_monitor, "changed",
+ G_CALLBACK (file_monitor_changed_cb), store);
/* prepend seems more efficient to me, we don't need this list
to be sorted */
- store->priv->monitors = g_list_prepend (store->priv->monitors, hctx);
-
- /* Forcing slow MIME type checking, so we don't need to make
- workarounds for files with strange extensions (#333551) */
- gnome_vfs_directory_visit_uri (uri,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE,
- GNOME_VFS_DIRECTORY_VISIT_DEFAULT,
- directory_visit_cb,
- &ctx);
-}
-
-static gboolean
-get_uri_info (GnomeVFSURI *uri, GnomeVFSFileInfo *info)
-{
- GnomeVFSResult result;
-
- g_return_val_if_fail (uri != NULL, FALSE);
- g_return_val_if_fail (info != NULL, FALSE);
+ store->priv->monitors = g_list_prepend (store->priv->monitors, file_monitor);
- gnome_vfs_file_info_clear (info);
-
- result = gnome_vfs_get_file_info_uri (uri, info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
-
- return (result == GNOME_VFS_OK);
+ file_enumerator = g_file_enumerate_children (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_STANDARD_NAME,
+ 0, NULL, NULL);
+ file_info = g_file_enumerator_next_file (file_enumerator, NULL, NULL);
+
+ while (file_info != NULL)
+ {
+ directory_visit (file, file_info, store);
+ g_object_unref (file_info);
+ file_info = g_file_enumerator_next_file (file_enumerator, NULL, NULL);
+ }
+ g_object_unref (file_enumerator);
}
void
-eog_list_store_add_uris (EogListStore *store, GList *uri_list)
+eog_list_store_add_files (EogListStore *store, GList *file_list)
{
GList *it;
- GnomeVFSFileInfo *info;
- GnomeVFSURI *initial_uri = NULL;
+ GFileInfo *file_info;
+ GFileType file_type;
+ GFile *initial_file = NULL;
GtkTreeIter iter;
- if (uri_list == NULL) {
+ if (file_list == NULL) {
return;
}
-
- info = gnome_vfs_file_info_new ();
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
- for (it = uri_list; it != NULL; it = it->next) {
- GnomeVFSURI *uri = (GnomeVFSURI *) it->data;
-
- if (!get_uri_info (uri, info))
+ for (it = file_list; it != NULL; it = it->next) {
+ GFile *file = (GFile *) it->data;
+
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL) {
continue;
+ }
+ file_type = g_file_info_get_file_type (file_info);
+ g_object_unref (file_info);
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
- eog_list_store_append_directory (store, uri, info);
- } else if (info->type == GNOME_VFS_FILE_TYPE_REGULAR &&
- g_list_length (uri_list) == 1) {
-
- initial_uri = gnome_vfs_uri_dup (uri);
-
- uri = gnome_vfs_uri_get_parent (uri);
-
- if (!get_uri_info (uri, info))
- continue;
-
- if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
- eog_list_store_append_directory (store, uri, info);
-
- if (!is_file_in_list_store_uri (store,
- initial_uri,
- &iter)) {
- eog_list_store_append_image_from_uri (store, initial_uri, TRUE);
+ if (file_type == G_FILE_TYPE_DIRECTORY) {
+ eog_list_store_append_directory (store, file, file_type);
+ } else if (file_type == G_FILE_TYPE_REGULAR &&
+ g_list_length (file_list) == 1) {
+
+ initial_file = g_file_dup (file);
+
+ file = g_file_get_parent (file);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_TYPE,
+ 0, NULL, NULL);
+ file_type = g_file_info_get_file_type (file_info);
+ g_object_unref (file_info);
+
+ if (file_type == G_FILE_TYPE_DIRECTORY) {
+ eog_list_store_append_directory (store, file, file_type);
+
+ if (!is_file_in_list_store_file (store,
+ initial_file,
+ &iter)) {
+ eog_list_store_append_image_from_file (store, initial_file, TRUE);
}
} else {
- eog_list_store_append_image_from_uri (store, initial_uri, FALSE);
+ eog_list_store_append_image_from_file (store, initial_file, FALSE);
}
- } else if (info->type == GNOME_VFS_FILE_TYPE_REGULAR &&
- g_list_length (uri_list) > 1) {
- eog_list_store_append_image_from_uri (store, uri, FALSE);
+ } else if (file_type == G_FILE_TYPE_REGULAR &&
+ g_list_length (file_list) > 1) {
+ eog_list_store_append_image_from_file (store, file, FALSE);
}
}
- gnome_vfs_file_info_unref (info);
-
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
- if (initial_uri &&
- is_file_in_list_store_uri (store, initial_uri, &iter)) {
+ if (initial_file &&
+ is_file_in_list_store_file (store, initial_file, &iter)) {
store->priv->initial_image = eog_list_store_get_pos_by_iter (store, &iter);
- gnome_vfs_uri_unref (initial_uri);
+ g_object_unref (initial_file);
} else {
store->priv->initial_image = 0;
}
@@ -611,17 +585,17 @@
eog_list_store_remove_image (EogListStore *store, EogImage *image)
{
GtkTreeIter iter;
- GnomeVFSURI *uri;
+ GFile *file;
g_return_if_fail (EOG_IS_LIST_STORE (store));
g_return_if_fail (EOG_IS_IMAGE (image));
- uri = eog_image_get_uri (image);
+ file = eog_image_get_file (image);
- if (is_file_in_list_store_uri (store, uri, &iter)) {
+ if (is_file_in_list_store_file (store, file, &iter)) {
eog_list_store_remove (store, &iter);
}
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
}
GtkListStore *
@@ -644,18 +618,18 @@
{
GtkTreeIter iter;
gint pos = -1;
- GnomeVFSURI *uri;
+ GFile *file;
g_return_val_if_fail (EOG_IS_LIST_STORE (store), -1);
g_return_val_if_fail (EOG_IS_IMAGE (image), -1);
- uri = eog_image_get_uri (image);
+ file = eog_image_get_file (image);
- if (is_file_in_list_store_uri (store, uri, &iter)) {
+ if (is_file_in_list_store_file (store, file, &iter)) {
pos = eog_list_store_get_pos_by_iter (store, &iter);
}
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
return pos;
}
Modified: trunk/src/eog-list-store.h
==============================================================================
--- trunk/src/eog-list-store.h (original)
+++ trunk/src/eog-list-store.h Fri Mar 14 20:56:06 2008
@@ -26,7 +26,7 @@
#include <gtk/gtk.h>
#include <glib-object.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -80,8 +80,8 @@
void eog_list_store_append_image (EogListStore *store,
EogImage *image);
-void eog_list_store_add_uris (EogListStore *store,
- GList *uri_list);
+void eog_list_store_add_files (EogListStore *store,
+ GList *file_list);
void eog_list_store_remove_image (EogListStore *store,
EogImage *image);
Modified: trunk/src/eog-pixbuf-util.c
==============================================================================
--- trunk/src/eog-pixbuf-util.c (original)
+++ trunk/src/eog-pixbuf-util.c Fri Mar 14 20:56:06 2008
@@ -94,52 +94,43 @@
return result;
}
-GdkPixbufFormat*
-eog_pixbuf_get_format_by_vfs_uri (const GnomeVFSURI *uri)
+static char*
+get_suffix_from_basename (const char *basename)
{
char *suffix;
- char *short_name;
char *suffix_start;
guint len;
- GdkPixbufFormat *format;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- /* get unescaped string */
- short_name = gnome_vfs_uri_extract_short_name (uri);
/* FIXME: does this work for all locales? */
- suffix_start = g_utf8_strrchr (short_name, -1, '.');
+ suffix_start = g_utf8_strrchr (basename, -1, '.');
if (suffix_start == NULL)
return NULL;
len = strlen (suffix_start) - 1;
suffix = g_strndup (suffix_start+1, len);
-
- format = eog_pixbuf_get_format_by_suffix (suffix);
-
- g_free (short_name);
- g_free (suffix);
- return format;
+ return suffix;
}
-GdkPixbufFormat*
-eog_pixbuf_get_format_by_uri (const char *txt_uri)
+GdkPixbufFormat *
+eog_pixbuf_get_format (GFile *file)
{
- GnomeVFSURI *uri;
GdkPixbufFormat *format;
-
- g_return_val_if_fail (txt_uri != NULL, NULL);
-
- uri = gnome_vfs_uri_new (txt_uri);
-
- format = eog_pixbuf_get_format_by_vfs_uri (uri);
-
- gnome_vfs_uri_unref (uri);
-
+ char *path, *basename, *suffix;
+ g_return_val_if_fail (file != NULL, NULL);
+
+ path = g_file_get_path (file);
+ basename = g_path_get_basename (path);
+ suffix = get_suffix_from_basename (basename);
+
+ format = eog_pixbuf_get_format_by_suffix (suffix);
+
+ g_free (path);
+ g_free (basename);
+ g_free (suffix);
+
return format;
}
Modified: trunk/src/eog-pixbuf-util.h
==============================================================================
--- trunk/src/eog-pixbuf-util.h (original)
+++ trunk/src/eog-pixbuf-util.h Fri Mar 14 20:56:06 2008
@@ -2,14 +2,13 @@
#define _EOG_PIXBUF_UTIL_H_
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
+#include <gio/gio.h>
GSList* eog_pixbuf_get_savable_formats (void);
GdkPixbufFormat* eog_pixbuf_get_format_by_suffix (const char *suffix);
-GdkPixbufFormat* eog_pixbuf_get_format_by_uri (const char *txt_uri);
-GdkPixbufFormat* eog_pixbuf_get_format_by_vfs_uri (const GnomeVFSURI *uri);
+GdkPixbufFormat* eog_pixbuf_get_format (GFile *file);
char* eog_pixbuf_get_common_suffix (GdkPixbufFormat *format);
Modified: trunk/src/eog-properties-dialog.c
==============================================================================
--- trunk/src/eog-properties-dialog.c (original)
+++ trunk/src/eog-properties-dialog.c Fri Mar 14 20:56:06 2008
@@ -36,10 +36,9 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#if HAVE_EXEMPI
#include <exempi/xmp.h>
@@ -113,12 +112,14 @@
pd_update_general_tab (EogPropertiesDialog *prop_dlg,
EogImage *image)
{
- gchar *bytes_str, *dir_str, *mime_str, *uri_str;
+ gchar *bytes_str, *dir_str, *uri_str;
gchar *width_str, *height_str;
- const gchar *type_str;
- gint width, height, bytes;
-
- uri_str = eog_image_get_uri_for_display (image);
+ GFile *file;
+ GFileInfo *file_info;
+ const char *mime_str;
+ char *type_str;
+ gint width, height;
+ goffset bytes;
g_object_set (G_OBJECT (prop_dlg->priv->thumbnail_image),
"pixbuf", eog_image_get_thumbnail (image),
@@ -141,25 +142,36 @@
g_free (height_str);
g_free (width_str);
-
- mime_str = gnome_vfs_get_mime_type (uri_str);
- type_str = gnome_vfs_mime_get_description (mime_str);
+
+ file = eog_image_get_file (image);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL) {
+ mime_str = _("Unknown");
+ type_str = g_strdup (_("Unknown"));
+ } else {
+ mime_str = g_file_info_get_content_type (file_info);
+ type_str = g_content_type_get_description (mime_str);
+ g_object_unref (file_info);
+ }
gtk_label_set_text (GTK_LABEL (prop_dlg->priv->type_label), type_str);
bytes = eog_image_get_bytes (image);
- bytes_str = gnome_vfs_format_file_size_for_display (bytes);
+ bytes_str = g_format_size_for_display (bytes);
gtk_label_set_text (GTK_LABEL (prop_dlg->priv->bytes_label), bytes_str);
+ uri_str = eog_image_get_uri_for_display (image);
dir_str = g_path_get_dirname (uri_str);
gtk_label_set_text (GTK_LABEL (prop_dlg->priv->location_label),
dir_str);
- g_free (uri_str);
- g_free (mime_str);
+ g_free (type_str);
g_free (bytes_str);
g_free (dir_str);
+ g_free (uri_str);
}
#if HAVE_EXIF
Modified: trunk/src/eog-save-as-dialog-helper.c
==============================================================================
--- trunk/src/eog-save-as-dialog-helper.c (original)
+++ trunk/src/eog-save-as-dialog-helper.c Fri Mar 14 20:56:06 2008
@@ -178,7 +178,7 @@
}
static void
-set_default_values (GtkWidget *dlg, GnomeVFSURI *base_uri)
+set_default_values (GtkWidget *dlg, GFile *base_file)
{
SaveAsData *sd;
@@ -187,10 +187,10 @@
gtk_spin_button_set_value (GTK_SPIN_BUTTON (sd->counter_spin), 0.0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sd->replace_spaces_check),
FALSE);
- if (base_uri != NULL) {
+ if (base_file != NULL) {
char *uri_str;
- uri_str = gnome_vfs_uri_to_string (base_uri, GNOME_VFS_URI_HIDE_NONE);
+ uri_str = g_file_get_uri (base_file);
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (sd->dir_chooser), uri_str);
g_free (uri_str);
}
@@ -201,7 +201,7 @@
}
GtkWidget*
-eog_save_as_dialog_new (GtkWindow *main, GList *images, GnomeVFSURI *base_uri)
+eog_save_as_dialog_new (GtkWindow *main, GList *images, GFile *base_file)
{
char *filepath;
GladeXML *xml;
@@ -256,7 +256,7 @@
prepare_format_combobox (data);
- set_default_values (dlg, base_uri);
+ set_default_values (dlg, base_file);
return dlg;
}
@@ -271,7 +271,7 @@
gboolean convert_spaces;
gulong counter_start;
GdkPixbufFormat *format;
- GnomeVFSURI *base_uri;
+ GFile *base_file;
const char *base_uri_str;
data = g_object_get_data (G_OBJECT (dlg), "data");
@@ -289,10 +289,10 @@
format = get_selected_format (GTK_COMBO_BOX (data->format_combobox));
base_uri_str = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (data->dir_chooser));
- base_uri = gnome_vfs_uri_new (base_uri_str);
+ base_file = g_file_new_for_uri (base_uri_str);
/* create converter object */
- conv = eog_uri_converter_new (base_uri, format, format_str);
+ conv = eog_uri_converter_new (base_file, format, format_str);
/* set other properties */
g_object_set (G_OBJECT (conv),
@@ -302,7 +302,7 @@
"n-images", data->n_images,
NULL);
- gnome_vfs_uri_unref (base_uri);
+ g_object_unref (base_file);
return conv;
}
Modified: trunk/src/eog-save-as-dialog-helper.h
==============================================================================
--- trunk/src/eog-save-as-dialog-helper.h (original)
+++ trunk/src/eog-save-as-dialog-helper.h Fri Mar 14 20:56:06 2008
@@ -2,14 +2,14 @@
#define _EOG_SAVE_AS_DIALOG_HELPER_H_
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
+#include <gio/gio.h>
#include "eog-uri-converter.h"
G_BEGIN_DECLS
-GtkWidget* eog_save_as_dialog_new (GtkWindow *main, GList *images, GnomeVFSURI *base_uri);
+GtkWidget* eog_save_as_dialog_new (GtkWindow *main, GList *images, GFile *base_file);
EogURIConverter* eog_save_as_dialog_get_converter (GtkWidget *dlg);
Modified: trunk/src/eog-thumb-view.c
==============================================================================
--- trunk/src/eog-thumb-view.c (original)
+++ trunk/src/eog-thumb-view.c Fri Mar 14 20:56:06 2008
@@ -36,8 +36,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <string.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#define EOG_THUMB_VIEW_SPACING 0
@@ -319,7 +317,7 @@
GList *list;
GList *node;
EogImage *image;
- GnomeVFSURI *uri;
+ GFile *file;
gchar *str;
gchar *uris = NULL;
gchar *tmp_str;
@@ -328,10 +326,10 @@
for (node = list; node != NULL; node = node->next) {
image = EOG_IMAGE (node->data);
- uri = eog_image_get_uri (image);
- str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+ file = eog_image_get_file (image);
+ str = g_file_get_uri (file);
g_object_unref (image);
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
/* build the "text/uri-list" string */
if (uris) {
@@ -364,10 +362,11 @@
gchar *tooltip_string;
gchar *bytes;
gint width, height;
- gchar *uri_str, *mime_str;
- const gchar *type_str;
+ char *type_str;
+ const char *mime_str;
GError *error = NULL;
- GnomeVFSURI *uri;
+ GFile *file;
+ GFileInfo *file_info;
#ifdef HAVE_EXIF
ExifData *exif_data;
#endif
@@ -407,18 +406,22 @@
&error);
}
- bytes = gnome_vfs_format_file_size_for_display (eog_image_get_bytes (image));
+ bytes = g_format_size_for_display (eog_image_get_bytes (image));
eog_image_get_size (image, &width, &height);
- uri = eog_image_get_uri (image);
- uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- gnome_vfs_uri_unref (uri);
+ file = eog_image_get_file (image);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ g_object_unref (file);
+ if (file_info == NULL) {
+ return FALSE;
+ }
- mime_str = gnome_vfs_get_mime_type (uri_str);
+ mime_str = g_file_info_get_content_type (file_info);
if (G_UNLIKELY (mime_str == NULL)) {
- g_free (uri_str);
g_free (bytes);
#ifdef HAVE_EXIF
exif_data_unref (exif_data);
@@ -427,7 +430,7 @@
return FALSE;
}
- type_str = gnome_vfs_mime_get_description (mime_str);
+ type_str = g_content_type_get_description (mime_str);
tooltip_string = g_markup_printf_escaped ("<b><big>%s</big></b>\n"
"%i x %i %s\n"
@@ -467,8 +470,7 @@
gtk_tooltip_set_markup (tooltip, tooltip_string);
- g_free (uri_str);
- g_free (mime_str);
+ g_free (type_str);
g_free (bytes);
g_free (tooltip_string);
g_object_unref (image);
Modified: trunk/src/eog-thumbnail.c
==============================================================================
--- trunk/src/eog-thumbnail.c (original)
+++ trunk/src/eog-thumbnail.c Fri Mar 14 20:56:06 2008
@@ -62,12 +62,12 @@
}
static void
-set_vfs_error (GError **error, GnomeVFSResult result)
+set_vfs_error (GError **error, GError *ioerror)
{
g_set_error (error,
EOG_THUMB_ERROR,
EOG_THUMB_ERROR_VFS,
- gnome_vfs_result_to_string (result));
+ (ioerror ? ioerror->message : "VFS error making a thumbnail"));
}
static void
@@ -173,46 +173,43 @@
}
static EogThumbData*
-eog_thumb_data_new (GnomeVFSURI *uri, GError **error)
+eog_thumb_data_new (GFile *file, GError **error)
{
EogThumbData *data;
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
+ GFileInfo *file_info;
+ GError *ioerror;
- g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (error != NULL && *error == NULL, NULL);
data = g_new0 (EogThumbData, 1);
- data->uri_str = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+ data->uri_str = g_file_get_uri (file);
data->thumb_path = gnome_thumbnail_path_for_uri (data->uri_str, GNOME_THUMBNAIL_SIZE_NORMAL);
- info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info_uri (uri, info,
- GNOME_VFS_FILE_INFO_DEFAULT |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS |
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
-
- if (result != GNOME_VFS_OK) {
- set_vfs_error (error, result);
- }
- else if (((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MTIME) == 0) ||
- ((info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE) == 0)) {
- /* check required info fields */
- set_thumb_error (error, EOG_THUMB_ERROR_GENERIC, "MTime or mime type not available");
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
+ 0, NULL, &ioerror);
+ if (file_info == NULL)
+ {
+ set_vfs_error (error, ioerror);
+ g_error_free (ioerror);
}
-
+
if (*error == NULL) {
/* if available, copy data */
- data->mtime = info->mtime;
- data->mime_type = g_strdup (info->mime_type);
+ data->mtime = g_file_info_get_attribute_uint64 (file_info,
+ G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ data->mime_type = g_strdup (g_file_info_get_content_type (file_info));
}
else {
eog_thumb_data_free (data);
data = NULL;
+ g_error_free (ioerror);
}
- gnome_vfs_file_info_unref (info);
+ g_object_unref (file_info);
return data;
}
@@ -473,16 +470,16 @@
eog_thumbnail_load (EogImage *image, GError **error)
{
GdkPixbuf *thumb = NULL;
- GnomeVFSURI *uri;
+ GFile *file;
EogThumbData *data;
GdkPixbuf *pixbuf;
g_return_val_if_fail (image != NULL, NULL);
g_return_val_if_fail (error != NULL && *error == NULL, NULL);
- uri = eog_image_get_uri (image);
- data = eog_thumb_data_new (uri, error);
- gnome_vfs_uri_unref (uri);
+ file = eog_image_get_file (image);
+ data = eog_thumb_data_new (file, error);
+ g_object_unref (file);
if (data == NULL)
return NULL;
Modified: trunk/src/eog-uri-converter.c
==============================================================================
--- trunk/src/eog-uri-converter.c (original)
+++ trunk/src/eog-uri-converter.c Fri Mar 14 20:56:06 2008
@@ -28,7 +28,7 @@
struct _EogURIConverterPrivate {
- GnomeVFSURI *base_uri;
+ GFile *base_file;
GList *token_list;
char *suffix;
GdkPixbufFormat *img_format;
@@ -77,9 +77,9 @@
priv = instance->priv;
- if (priv->base_uri) {
- gnome_vfs_uri_unref (priv->base_uri);
- priv->base_uri = NULL;
+ if (priv->base_file) {
+ g_object_unref (priv->base_file);
+ priv->base_file = NULL;
}
if (priv->token_list) {
@@ -530,7 +530,7 @@
EogURIConverter*
-eog_uri_converter_new (GnomeVFSURI *base_uri, GdkPixbufFormat *img_format, const char *format_str)
+eog_uri_converter_new (GFile *base_file, GdkPixbufFormat *img_format, const char *format_str)
{
EogURIConverter *conv;
@@ -538,11 +538,11 @@
conv = g_object_new (EOG_TYPE_URI_CONVERTER, NULL);
- if (base_uri != NULL) {
- conv->priv->base_uri = gnome_vfs_uri_ref (base_uri);
+ if (base_file != NULL) {
+ conv->priv->base_file = g_object_ref (base_file);
}
else {
- conv->priv->base_uri = NULL;
+ conv->priv->base_file = NULL;
}
conv->priv->img_format = img_format;
conv->priv->token_list = eog_uri_converter_parse_string (conv, format_str);
@@ -550,10 +550,10 @@
return conv;
}
-static GnomeVFSURI*
-get_uri_directory (EogURIConverter *conv, EogImage *image)
+static GFile*
+get_file_directory (EogURIConverter *conv, EogImage *image)
{
- GnomeVFSURI *uri = NULL;
+ GFile *file = NULL;
EogURIConverterPrivate *priv;
g_return_val_if_fail (EOG_IS_URI_CONVERTER (conv), NULL);
@@ -561,29 +561,27 @@
priv = conv->priv;
- if (priv->base_uri != NULL) {
- uri = gnome_vfs_uri_ref (priv->base_uri);
+ if (priv->base_file != NULL) {
+ file = g_object_ref (priv->base_file);
}
else {
- GnomeVFSURI *img_uri;
+ GFile *img_file;
- img_uri = eog_image_get_uri (image);
- g_assert (img_uri != NULL);
-
- if (gnome_vfs_uri_has_parent (img_uri)) {
- uri = gnome_vfs_uri_get_parent (img_uri);
- }
-
- gnome_vfs_uri_unref (img_uri);
+ img_file = eog_image_get_file (image);
+ g_assert (img_file != NULL);
+
+ file = g_file_get_parent (img_file);
+
+ g_object_unref (img_file);
}
- return uri;
+ return file;
}
static void
-split_filename (GnomeVFSURI *uri, char **name, char **suffix)
+split_filename (GFile *file, char **name, char **suffix)
{
- char *short_name;
+ char *basename;
char *suffix_start;
guint len;
@@ -591,23 +589,23 @@
*suffix = NULL;
/* get unescaped string */
- short_name = gnome_vfs_uri_extract_short_name (uri);
+ basename = g_file_get_basename (file);
/* FIXME: does this work for all locales? */
- suffix_start = g_utf8_strrchr (short_name, -1, '.');
+ suffix_start = g_utf8_strrchr (basename, -1, '.');
if (suffix_start == NULL) { /* no suffix found */
- *name = g_strdup (short_name);
+ *name = g_strdup (basename);
}
else {
- len = (suffix_start - short_name);
- *name = g_strndup (short_name, len);
+ len = (suffix_start - basename);
+ *name = g_strndup (basename, len);
- len = strlen (short_name) - len - 1;
+ len = strlen (basename) - len - 1;
*suffix = g_strndup (suffix_start+1, len);
}
- g_free (short_name);
+ g_free (basename);
}
static GString*
@@ -615,20 +613,20 @@
{
/* appends the name of the original file without
filetype suffix */
- GnomeVFSURI *img_uri;
+ GFile *img_file;
char *name;
char *suffix;
GString *result;
- img_uri = eog_image_get_uri (img);
- split_filename (img_uri, &name, &suffix);
+ img_file = eog_image_get_file (img);
+ split_filename (img_file, &name, &suffix);
result = g_string_append (str, name);
g_free (name);
g_free (suffix);
- gnome_vfs_uri_unref (img_uri);
+ g_object_unref (img_file);
return result;
}
@@ -651,34 +649,34 @@
static void
-build_absolute_uri (EogURIConverter *conv, EogImage *image, GString *str, /* input */
- GnomeVFSURI **uri, GdkPixbufFormat **format) /* output */
+build_absolute_file (EogURIConverter *conv, EogImage *image, GString *str, /* input */
+ GFile **file, GdkPixbufFormat **format) /* output */
{
- GnomeVFSURI *dir_uri;
+ GFile *dir_file;
EogURIConverterPrivate *priv;
- *uri = NULL;
+ *file = NULL;
if (format != NULL)
*format = NULL;
g_return_if_fail (EOG_IS_URI_CONVERTER (conv));
g_return_if_fail (EOG_IS_IMAGE (image));
- g_return_if_fail (uri != NULL);
+ g_return_if_fail (file != NULL);
g_return_if_fail (str != NULL);
priv = conv->priv;
- dir_uri = get_uri_directory (conv, image);
- g_assert (dir_uri != NULL);
+ dir_file = get_file_directory (conv, image);
+ g_assert (dir_file != NULL);
if (priv->img_format == NULL) {
/* use same file type/suffix */
char *name;
char *old_suffix;
- GnomeVFSURI *img_uri;
+ GFile *img_file;
- img_uri = eog_image_get_uri (image);
- split_filename (img_uri, &name, &old_suffix);
+ img_file = eog_image_get_file (image);
+ split_filename (img_file, &name, &old_suffix);
g_assert (old_suffix != NULL);
@@ -688,7 +686,7 @@
if (format != NULL)
*format = eog_pixbuf_get_format_by_suffix (old_suffix);
- gnome_vfs_uri_unref (img_uri);
+ g_object_unref (img_file);
} else {
if (priv->suffix == NULL)
priv->suffix = eog_pixbuf_get_common_suffix (priv->img_format);
@@ -700,9 +698,9 @@
*format = priv->img_format;
}
- *uri = gnome_vfs_uri_append_file_name (dir_uri, str->str);
+ *file = g_file_get_child (dir_file, str->str);
- gnome_vfs_uri_unref (dir_uri);
+ g_object_unref (dir_file);
}
@@ -753,7 +751,7 @@
*/
gboolean
eog_uri_converter_do (EogURIConverter *conv, EogImage *image,
- GnomeVFSURI **uri, GdkPixbufFormat **format, GError **error)
+ GFile **file, GdkPixbufFormat **format, GError **error)
{
EogURIConverterPrivate *priv;
GList *it;
@@ -764,7 +762,7 @@
priv = conv->priv;
- *uri = NULL;
+ *file = NULL;
if (format != NULL)
*format = NULL;
@@ -829,14 +827,14 @@
repl_str = replace_remove_chars (str, priv->convert_spaces, priv->space_character);
if (repl_str->len > 0) {
- build_absolute_uri (conv, image, repl_str, uri, format);
+ build_absolute_file (conv, image, repl_str, file, format);
}
g_string_free (repl_str, TRUE);
g_string_free (str, TRUE);
- return (*uri != NULL);
+ return (*file != NULL);
}
@@ -934,10 +932,10 @@
/* use same file type/suffix */
char *name;
char *old_suffix;
- GnomeVFSURI *img_uri;
+ GFile *img_file;
- img_uri = eog_image_get_uri (img);
- split_filename (img_uri, &name, &old_suffix);
+ img_file = eog_image_get_file (img);
+ split_filename (img_file, &name, &old_suffix);
g_assert (old_suffix != NULL);
@@ -946,7 +944,7 @@
g_free (old_suffix);
g_free (name);
- gnome_vfs_uri_unref (img_uri);
+ g_object_unref (img_file);
}
else {
char *suffix = eog_pixbuf_get_common_suffix (format);
@@ -978,7 +976,7 @@
eog_uri_converter_check (EogURIConverter *converter, GList *img_list, GError **error)
{
GList *it;
- GList *uri_list = NULL;
+ GList *file_list = NULL;
gboolean all_different = TRUE;
g_return_val_if_fail (EOG_IS_URI_CONVERTER (converter), FALSE);
@@ -986,26 +984,26 @@
/* convert all image uris */
for (it = img_list; it != NULL; it = it->next) {
gboolean result;
- GnomeVFSURI *uri;
+ GFile *file;
GError *conv_error = NULL;
result = eog_uri_converter_do (converter, EOG_IMAGE (it->data),
- &uri, NULL, &conv_error);
+ &file, NULL, &conv_error);
if (result) {
- uri_list = g_list_prepend (uri_list, uri);
+ file_list = g_list_prepend (file_list, file);
}
}
/* check for all different uris */
- for (it = uri_list; it != NULL && all_different; it = it->next) {
+ for (it = file_list; it != NULL && all_different; it = it->next) {
GList *p;
- GnomeVFSURI *uri;
+ GFile *file;
- uri = (GnomeVFSURI*) it->data;
+ file = (GFile*) it->data;
for (p = it->next; p != NULL && all_different; p = p->next) {
- all_different = !gnome_vfs_uri_equal (uri, (GnomeVFSURI*) p->data);
+ all_different = !g_file_equal (file, (GFile*) p->data);
}
}
Modified: trunk/src/eog-uri-converter.h
==============================================================================
--- trunk/src/eog-uri-converter.h (original)
+++ trunk/src/eog-uri-converter.h Fri Mar 14 20:56:06 2008
@@ -66,7 +66,7 @@
GType eog_uri_converter_get_type (void) G_GNUC_CONST;
GQuark eog_uc_error_quark (void);
-EogURIConverter* eog_uri_converter_new (GnomeVFSURI *base_uri,
+EogURIConverter* eog_uri_converter_new (GFile *base_file,
GdkPixbufFormat *img_format,
const char *format_string);
@@ -78,7 +78,7 @@
gboolean eog_uri_converter_do (EogURIConverter *converter,
EogImage *image,
- GnomeVFSURI **uri,
+ GFile **file,
GdkPixbufFormat **format,
GError **error);
Modified: trunk/src/eog-util.c
==============================================================================
--- trunk/src/eog-util.c (original)
+++ trunk/src/eog-util.c Fri Mar 14 20:56:06 2008
@@ -40,11 +40,11 @@
#include <glib/gprintf.h>
#include <glib/gstdio.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <glib/gi18n.h>
#include <libgnome/gnome-help.h>
#include <libgnome/gnome-init.h>
#include <libgnome/gnome-desktop-item.h>
-#include <libgnomevfs/gnome-vfs.h>
void
eog_util_show_help (const gchar *section, GtkWindow *parent)
@@ -116,36 +116,61 @@
}
GSList*
-eog_util_string_list_to_uri_list (GSList *string_list)
+eog_util_parse_uri_string_list_to_file_list (const gchar *uri_list)
+{
+ GSList* file_list = NULL;
+ const char *start, *end;
+ char *uri;
+
+ start = uri_list;
+ end = strchr (uri_list, '\r');
+ uri = g_strndup (start, end - start);
+ file_list = g_slist_append (file_list, g_file_new_for_uri (uri));
+ g_free (uri);
+
+ while (strlen (end) > 2)
+ {
+ start = (end + 2);
+ end = strchr (start, '\r');
+ uri = g_strndup (start, end - start);
+ file_list = g_slist_append (file_list, g_file_new_for_uri (uri));
+ g_free (uri);
+ }
+
+ return file_list;
+}
+
+GSList*
+eog_util_string_list_to_file_list (GSList *string_list)
{
GSList *it = NULL;
- GSList *uri_list = NULL;
+ GSList *file_list = NULL;
for (it = string_list; it != NULL; it = it->next) {
char *uri_str;
uri_str = (gchar *) it->data;
- uri_list = g_slist_prepend (uri_list,
- gnome_vfs_uri_new (uri_str));
+ file_list = g_slist_prepend (file_list,
+ g_file_new_for_uri (uri_str));
}
- return g_slist_reverse (uri_list);
+ return g_slist_reverse (file_list);
}
#ifdef HAVE_DBUS
GSList*
-eog_util_strings_to_uri_list (gchar **strings)
+eog_util_strings_to_file_list (gchar **strings)
{
int i;
- GSList *uri_list = NULL;
+ GSList *file_list = NULL;
for (i = 0; strings[i]; i++) {
- uri_list = g_slist_prepend (uri_list,
- gnome_vfs_uri_new (strings[i]));
+ file_list = g_slist_prepend (file_list,
+ g_file_new_for_uri (strings[i]));
}
- return g_slist_reverse (uri_list);
+ return g_slist_reverse (file_list);
}
#endif
@@ -161,8 +186,12 @@
char *str;
if (create_uri) {
- str = gnome_vfs_make_uri_from_input_with_dirs (files[i],
- GNOME_VFS_MAKE_URI_DIR_CURRENT);
+ GFile *file;
+
+ file = g_file_new_for_commandline_arg (files[i]);
+ str = g_file_get_uri (file);
+
+ g_object_unref (file);
} else {
str = g_strdup (files[i]);
}
@@ -182,6 +211,7 @@
int i;
int size;
gchar **abs_files;
+ GFile *file;
if (files == NULL)
return NULL;
@@ -192,8 +222,10 @@
abs_files = g_new0 (gchar *, size+1);
for (i = 0; i < size; i++) {
- abs_files[i] = gnome_vfs_make_uri_from_input_with_dirs (files[i],
- GNOME_VFS_MAKE_URI_DIR_CURRENT);
+ file = g_file_new_for_commandline_arg (files[i]);
+ abs_files[i] = g_file_get_uri (file);
+
+ g_object_unref (file);
}
return abs_files;
Modified: trunk/src/eog-util.h
==============================================================================
--- trunk/src/eog-util.h (original)
+++ trunk/src/eog-util.h Fri Mar 14 20:56:06 2008
@@ -34,10 +34,12 @@
gchar *eog_util_make_valid_utf8 (const gchar *name);
-GSList *eog_util_string_list_to_uri_list (GSList *string_list);
+GSList *eog_util_parse_uri_string_list_to_file_list (const gchar *uri_list);
+
+GSList *eog_util_string_list_to_file_list (GSList *string_list);
#ifdef HAVE_DBUS
-GSList *eog_util_strings_to_uri_list (gchar **strings);
+GSList *eog_util_strings_to_file_list (gchar **strings);
#endif
GSList *eog_util_string_array_to_list (const gchar **files,
Modified: trunk/src/eog-window.c
==============================================================================
--- trunk/src/eog-window.c (original)
+++ trunk/src/eog-window.c Fri Mar 14 20:56:06 2008
@@ -64,8 +64,6 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <gtk/gtkprintunixdialog.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gconf/gconf-client.h>
#if HAVE_LCMS
@@ -178,7 +176,7 @@
guint tip_message_cid;
EogStartupFlags flags;
- GSList *uri_list;
+ GSList *file_list;
gint collection_position;
gboolean collection_resizable;
@@ -687,7 +685,7 @@
if (priv->image != NULL &&
eog_image_has_data (priv->image, EOG_IMAGE_DATA_ALL)) {
int zoom, width, height;
- GnomeVFSFileSize bytes = 0;
+ goffset bytes = 0;
zoom = floor (100 * eog_scroll_view_get_zoom (EOG_SCROLL_VIEW (priv->view)) + 0.5);
@@ -698,7 +696,7 @@
if ((width > 0) && (height > 0)) {
char *size_string;
- size_string = gnome_vfs_format_file_size_for_display (bytes);
+ size_string = g_format_size_for_display (bytes);
/* [image width] x [image height] pixels [bytes] [zoom in percent] */
str = g_strdup_printf ("%i x %i %s %s %i%%",
@@ -910,27 +908,34 @@
}
static gboolean
-add_uri_to_recent_files (GnomeVFSURI *uri)
+add_file_to_recent_files (GFile *file)
{
gchar *text_uri;
+ GFileInfo *file_info;
GtkRecentData *recent_data;
static gchar *groups[2] = { EOG_RECENT_FILES_GROUP , NULL };
- if (uri == NULL) return FALSE;
+ if (file == NULL) return FALSE;
/* The password gets stripped here because ~/.recently-used.xbel is
* readable by everyone (chmod 644). It also makes the workaround
* for the bug with gtk_recent_info_get_uri_display() easier
* (see the comment in eog_window_update_recent_files_menu()). */
- text_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
+ text_uri = g_file_get_uri (file);
if (text_uri == NULL)
return FALSE;
+
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
+ if (file_info == NULL)
+ return FALSE;
recent_data = g_slice_new (GtkRecentData);
recent_data->display_name = NULL;
recent_data->description = NULL;
- recent_data->mime_type = (gchar *) gnome_vfs_get_mime_type_from_uri (uri);
+ recent_data->mime_type = (gchar *) g_file_info_get_content_type (file_info);
recent_data->app_name = (gchar *) g_get_application_name ();
recent_data->app_exec = g_strjoin(" ", g_get_prgname (), "%u", NULL);
recent_data->groups = groups;
@@ -942,6 +947,7 @@
g_free (recent_data->app_exec);
g_free (text_uri);
+ g_object_unref (file_info);
g_slice_free (GtkRecentData, recent_data);
@@ -986,7 +992,7 @@
eog_window_display_image (EogWindow *window, EogImage *image)
{
EogWindowPrivate *priv;
- GnomeVFSURI *uri;
+ GFile *file;
g_return_if_fail (EOG_IS_WINDOW (window));
g_return_if_fail (EOG_IS_IMAGE (image));
@@ -1012,40 +1018,43 @@
update_status_bar (window);
- uri = eog_image_get_uri (image);
+ file = eog_image_get_file (image);
g_idle_add_full (G_PRIORITY_LOW,
- (GSourceFunc) add_uri_to_recent_files,
- uri,
- (GDestroyNotify) gnome_vfs_uri_unref);
+ (GSourceFunc) add_file_to_recent_files,
+ file,
+ (GDestroyNotify) g_object_unref);
eog_window_update_openwith_menu (window, image);
}
static void
-open_with_launch_application_cb (GtkAction *action, gpointer data){
+open_with_launch_application_cb (GtkAction *action, gpointer data) {
EogImage *image;
- GnomeVFSMimeApplication *app;
- GnomeVFSURI *uri;
- gchar *uri_string;
- GList *uris = NULL;
+ GAppInfo *app;
+ GFile *file;
+ GList *files = NULL;
image = EOG_IMAGE (data);
- uri = eog_image_get_uri (image);
- uri_string = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- uris = g_list_prepend (NULL, uri_string);
+ file = eog_image_get_file (image);
+
app = g_object_get_data (G_OBJECT (action), "app");
- gnome_vfs_mime_application_launch (app, uris);
- gnome_vfs_uri_unref (uri);
- g_free (uri_string);
- g_list_free (uris);
+ files = g_list_append (files, file);
+ g_app_info_launch (app,
+ files,
+ NULL, NULL);
+
+ g_object_unref (file);
+ g_list_free (files);
}
static void
eog_window_update_openwith_menu (EogWindow *window, EogImage *image)
{
- GnomeVFSURI *uri;
+ GFile *file;
+ GFileInfo *file_info;
GList *iter;
- gchar *label, *tip, *string_uri, *mime_type;
+ gchar *label, *tip;
+ const gchar *mime_type;
GtkAction *action;
EogWindowPrivate *priv;
GList *apps;
@@ -1053,13 +1062,17 @@
priv = window->priv;
- uri = eog_image_get_uri (image);
-
- string_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
- mime_type = gnome_vfs_get_mime_type (string_uri);
+ file = eog_image_get_file (image);
+ file_info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0, NULL, NULL);
- gnome_vfs_uri_unref (uri);
- g_free (string_uri);
+ if (file_info == NULL)
+ return;
+ else {
+ mime_type = g_file_info_get_content_type (file_info);
+ g_object_unref (file_info);
+ }
if (priv->open_with_menu_id != 0) {
gtk_ui_manager_remove_ui (priv->ui_mgr, priv->open_with_menu_id);
@@ -1074,9 +1087,7 @@
if (mime_type == NULL)
return;
- apps = gnome_vfs_mime_get_all_applications (mime_type);
-
- g_free (mime_type);
+ apps = g_app_info_get_all_for_type (mime_type);
if (!apps)
return;
@@ -1087,27 +1098,27 @@
priv->open_with_menu_id = gtk_ui_manager_new_merge_id (priv->ui_mgr);
for (iter = apps; iter; iter = iter->next) {
- GnomeVFSMimeApplication *app = iter->data;
+ GAppInfo *app = iter->data;
gchar name[64];
/* Do not include eog itself */
- if (g_ascii_strcasecmp (gnome_vfs_mime_application_get_binary_name (app),
+ if (g_ascii_strcasecmp (g_app_info_get_executable (app),
g_get_prgname ()) == 0) {
- gnome_vfs_mime_application_free (app);
+ g_object_unref (app);
continue;
}
g_snprintf (name, sizeof (name), "OpenWith%u", action_id++);
- label = g_strdup_printf (_("Open with \"%s\""), app->name);
- tip = g_strdup_printf (_("Use \"%s\" to open the selected image"), app->name);
+ label = g_strdup_printf (_("Open with \"%s\""), g_app_info_get_name (app));
+ tip = g_strdup_printf (_("Use \"%s\" to open the selected image"), g_app_info_get_name (app));
action = gtk_action_new (name, label, tip, NULL);
g_free (label);
g_free (tip);
g_object_set_data_full (G_OBJECT (action), "app", app,
- (GDestroyNotify) gnome_vfs_mime_application_free);
+ (GDestroyNotify) g_object_unref);
g_signal_connect (action,
"activate",
@@ -2739,23 +2750,23 @@
eog_job_queue_add_job (priv->save_job);
}
-static GnomeVFSURI*
-eog_window_retrieve_save_as_uri (EogWindow *window, EogImage *image)
+static GFile*
+eog_window_retrieve_save_as_file (EogWindow *window, EogImage *image)
{
GtkWidget *dialog;
- GnomeVFSURI *save_uri = NULL;
- GnomeVFSURI *parent_uri;
- GnomeVFSURI *image_uri;
+ GFile *save_file = NULL;
+ GFile *parent_file;
+ GFile *image_file;
gchar *folder_uri;
gint response;
g_assert (image != NULL);
- image_uri = eog_image_get_uri (image);
- parent_uri = gnome_vfs_uri_get_parent (image_uri);
- folder_uri = gnome_vfs_uri_to_string (parent_uri, GNOME_VFS_URI_HIDE_NONE);
- gnome_vfs_uri_unref (parent_uri);
- gnome_vfs_uri_unref (image_uri);
+ image_file = eog_image_get_file (image);
+ parent_file = g_file_get_parent (image_file);
+ folder_uri = g_file_get_uri (parent_file);
+ g_object_unref (parent_file);
+ g_object_unref (image_file);
dialog = eog_file_chooser_new (GTK_FILE_CHOOSER_ACTION_SAVE);
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog),
@@ -2770,13 +2781,13 @@
g_assert (new_uri != NULL);
- save_uri = gnome_vfs_uri_new (new_uri);
+ save_file = g_file_new_for_uri (new_uri);
g_free (new_uri);
}
gtk_widget_destroy (dialog);
g_free (folder_uri);
- return save_uri;
+ return save_file;
}
static void
@@ -2797,36 +2808,36 @@
n_images = g_list_length (images);
if (n_images == 1) {
- GnomeVFSURI *uri;
+ GFile *file;
- uri = eog_window_retrieve_save_as_uri (window, images->data);
+ file = eog_window_retrieve_save_as_file (window, images->data);
- if (!uri) {
+ if (!file) {
g_list_free (images);
return;
}
- priv->save_job = eog_job_save_as_new (images, NULL, uri);
+ priv->save_job = eog_job_save_as_new (images, NULL, file);
- gnome_vfs_uri_unref (uri);
+ g_object_unref (file);
} else if (n_images > 1) {
- GnomeVFSURI *baseuri;
+ GFile *base_file;
GtkWidget *dialog;
gchar *basedir;
EogURIConverter *converter;
basedir = g_get_current_dir ();
- baseuri = gnome_vfs_uri_new (basedir);
+ base_file = g_file_new_for_uri (basedir);
g_free (basedir);
dialog = eog_save_as_dialog_new (GTK_WINDOW (window),
images,
- baseuri);
+ base_file);
gtk_widget_show_all (dialog);
if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) {
- gnome_vfs_uri_unref (baseuri);
+ g_object_unref (base_file);
g_list_free (images);
gtk_widget_destroy (dialog);
@@ -2842,7 +2853,7 @@
gtk_widget_destroy (dialog);
g_object_unref (converter);
- gnome_vfs_uri_unref (baseuri);
+ g_object_unref (base_file);
} else {
/* n_images = 0 -- No Image selected */
return;
@@ -3030,19 +3041,12 @@
move_to_trash_real (EogImage *image, GError **error)
{
GFile *file;
- GnomeVFSURI *uri;
- char *string_uri;
GFileInfo *file_info;
gboolean can_trash, result;
g_return_val_if_fail (EOG_IS_IMAGE (image), FALSE);
- uri = eog_image_get_uri (image);
- string_uri = gnome_vfs_uri_to_string (uri,
- GNOME_VFS_URI_HIDE_USER_NAME |
- GNOME_VFS_URI_HIDE_PASSWORD);
- file = g_file_new_for_uri (string_uri);
- g_free (string_uri);
+ file = eog_image_get_file (image);
file_info = g_file_query_info (file,
G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH,
0, NULL, NULL);
@@ -3645,7 +3649,7 @@
* since the password gets stripped when adding the
* file to the recently used list. */
if (tip == NULL)
- tip = gnome_vfs_format_uri_for_display (gtk_recent_info_get_uri (info));
+ tip = g_uri_unescape_string (gtk_recent_info_get_uri (info), NULL);
action = gtk_action_new (action_name, label, tip, NULL);
@@ -3690,9 +3694,7 @@
GtkSelectionData *selection_data,
guint info, guint time)
{
- GList *uri_list;
- GSList *str_list = NULL;
- GList *it;
+ GSList *file_list;
EogWindow *window;
if (info != EOG_WINDOW_TARGET_URI_LIST)
@@ -3701,24 +3703,9 @@
if (context->suggested_action == GDK_ACTION_COPY) {
window = EOG_WINDOW (widget);
- uri_list = gnome_vfs_uri_list_parse ((gchar *) selection_data->data);
-
- for (it = uri_list; it != NULL; it = it->next) {
- gchar *filename =
- gnome_vfs_uri_to_string (it->data, GNOME_VFS_URI_HIDE_NONE);
+ file_list = eog_util_parse_uri_string_list_to_file_list ((gchar *) selection_data->data);
- str_list = g_slist_prepend (str_list, filename);
- }
-
- gnome_vfs_uri_list_free (uri_list);
-
- /*str_list = g_slist_reverse (str_list);*/
-
- eog_application_open_uri_list (EOG_APP,
- str_list,
- GDK_CURRENT_TIME,
- 0,
- NULL);
+ eog_window_open_file_list (window, file_list);
}
}
@@ -4323,10 +4310,10 @@
priv->print_page_setup = NULL;
}
- if (priv->uri_list != NULL) {
- g_slist_foreach (priv->uri_list, (GFunc) gnome_vfs_uri_unref, NULL);
- g_slist_free (priv->uri_list);
- priv->uri_list = NULL;
+ if (priv->file_list != NULL) {
+ g_slist_foreach (priv->file_list, (GFunc) g_object_unref, NULL);
+ g_slist_free (priv->file_list);
+ priv->file_list = NULL;
}
#ifdef HAVE_LCMS
@@ -4796,22 +4783,22 @@
window);
if (n_images == 0) {
- gint n_uris;
+ gint n_files;
priv->status = EOG_WINDOW_STATUS_NORMAL;
update_action_groups_state (window);
- n_uris = g_slist_length (priv->uri_list);
+ n_files = g_slist_length (priv->file_list);
- if (n_uris > 0) {
+ if (n_files > 0) {
GtkWidget *message_area;
- GnomeVFSURI *uri = NULL;
+ GFile *file = NULL;
- if (n_uris == 1) {
- uri = (GnomeVFSURI *) priv->uri_list->data;
+ if (n_files == 1) {
+ file = (GFile *) priv->file_list->data;
}
- message_area = eog_no_images_error_message_area_new (uri);
+ message_area = eog_no_images_error_message_area_new (file);
eog_window_set_message_area (window, message_area);
@@ -4823,7 +4810,7 @@
}
void
-eog_window_open_uri_list (EogWindow *window, GSList *uri_list)
+eog_window_open_file_list (EogWindow *window, GSList *file_list)
{
EogJob *job;
@@ -4831,10 +4818,10 @@
window->priv->status = EOG_WINDOW_STATUS_INIT;
- g_slist_foreach (uri_list, (GFunc) gnome_vfs_uri_ref, NULL);
- window->priv->uri_list = uri_list;
+ g_slist_foreach (file_list, (GFunc) g_object_ref, NULL);
+ window->priv->file_list = file_list;
- job = eog_job_model_new (uri_list);
+ job = eog_job_model_new (file_list);
g_signal_connect (job,
"finished",
Modified: trunk/src/eog-window.h
==============================================================================
--- trunk/src/eog-window.h (original)
+++ trunk/src/eog-window.h Fri Mar 14 20:56:06 2008
@@ -111,7 +111,7 @@
EogImage *eog_window_get_image (EogWindow *window);
-void eog_window_open_uri_list (EogWindow *window,
+void eog_window_open_file_list (EogWindow *window,
GSList *uri_list);
gboolean eog_window_is_empty (EogWindow *window);
Modified: trunk/src/test-eog-tb.c
==============================================================================
--- trunk/src/test-eog-tb.c (original)
+++ trunk/src/test-eog-tb.c Fri Mar 14 20:56:06 2008
@@ -1,7 +1,7 @@
-/* gcc -o eog-thumb-view test-eog-tb.c eog-thumb-view.c `pkg-config --cflags --libs gtk+-2.0 gnome-vfs-2.0` */
+/* gcc -o eog-thumb-view test-eog-tb.c eog-thumb-view.c `pkg-config --cflags --libs gtk+-2.0 gio-2.0` */
#include <gtk/gtk.h>
-#include <libgnomevfs/gnome-vfs.h>
+#include <gio/gio.h>
#include "eog-thumbnail.h"
#include "eog-image.h"
#include "eog-thumb-view.h"
@@ -91,20 +91,14 @@
}
-static GnomeVFSURI*
-make_canonical_uri (const char *path)
+static GFile*
+make_file (const char *path)
{
- char *uri_str;
- GnomeVFSURI *uri = NULL;
+ GFile *file = NULL;
- uri_str = gnome_vfs_make_uri_from_shell_arg (path);
+ file = g_file_new_for_commandline_arg (path);
- if (uri_str) {
- uri = gnome_vfs_uri_new (uri_str);
- g_free (uri_str);
- }
-
- return uri;
+ return file;
}
static GList*
@@ -118,7 +112,7 @@
}
for (i = 0; i < n_files; i++) {
- list = g_list_prepend (list, make_canonical_uri (files [i]));
+ list = g_list_prepend (list, make_file (files [i]));
g_print ("%s\n", files[i]);
}
return g_list_reverse (list);
@@ -159,7 +153,6 @@
GtkListStore *model;
gtk_init (&argc, &argv);
- gnome_vfs_init ();
eog_thumbnail_init ();
eog_job_queue_init ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]