gthumb r2327 - in trunk: . libgthumb src
- From: mjc svn gnome org
- To: svn-commits-list gnome org
- Subject: gthumb r2327 - in trunk: . libgthumb src
- Date: Sat, 10 May 2008 18:09:14 +0100 (BST)
Author: mjc
Date: Sat May 10 17:09:14 2008
New Revision: 2327
URL: http://svn.gnome.org/viewvc/gthumb?rev=2327&view=rev
Log:
2008-05-10 Michael J. Chudobiak <mjc svn gnome org>
* configure.in:
* libgthumb/file-data.c: (file_data_new):
* libgthumb/file-data.h:
* libgthumb/file-utils.c: (get_file_size):
* libgthumb/file-utils.h:
* libgthumb/gth-filter.c: (gth_filter_set_max_size):
* libgthumb/gth-filter.h:
* libgthumb/gth-sort-utils.c: (gth_sort_by_size_then_name):
* libgthumb/gth-sort-utils.h:
* libgthumb/thumb-loader.c: (thumb_loader_set_max_file_size):
* libgthumb/thumb-loader.h:
* src/catalog-png-exporter.c: (set_item_caption):
* src/catalog-web-exporter.c: (gth_parsed_doc_print):
* src/dlg-duplicates.c: (update_entry), (add_entry),
(update_duplicates_label):
* src/dlg-file-utils.c: (set_filename_labels):
* src/dlg-image-prop.c: (update_general_info):
* src/dlg-photo-importer.c: (ok_clicked_cb):
* src/dlg-rename-series.c: (update_list):
* src/gth-browser.c: (window_update_statusbar_image_info),
(window_update_statusbar_list_info):
* src/gth-exif-data-viewer.c: (update_file_info):
* src/gth-fullscreen.c: (get_file_info):
* src/gth-viewer.c: (viewer_update_statusbar_image_info):
Start of gnomevfs -> gvfs porting. Specifically:
gnome_vfs_format_file_size_for_display -> g_format_size_for_display
GnomeVFSFileSize -> goffset
Based partly on Gabriel FalcÃo's patch from bug 525482.
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/libgthumb/file-data.c
trunk/libgthumb/file-data.h
trunk/libgthumb/file-utils.c
trunk/libgthumb/file-utils.h
trunk/libgthumb/gth-filter.c
trunk/libgthumb/gth-filter.h
trunk/libgthumb/gth-sort-utils.c
trunk/libgthumb/gth-sort-utils.h
trunk/libgthumb/thumb-loader.c
trunk/libgthumb/thumb-loader.h
trunk/src/catalog-png-exporter.c
trunk/src/catalog-web-exporter.c
trunk/src/dlg-duplicates.c
trunk/src/dlg-file-utils.c
trunk/src/dlg-image-prop.c
trunk/src/dlg-photo-importer.c
trunk/src/dlg-rename-series.c
trunk/src/gth-browser.c
trunk/src/gth-exif-data-viewer.c
trunk/src/gth-fullscreen.c
trunk/src/gth-viewer.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Sat May 10 17:09:14 2008
@@ -28,6 +28,7 @@
LIBGNOME_REQUIRED=2.6.0
LIBGNOMEUI_REQUIRED=2.6.0
LIBGNOMECANVAS_REQUIRED=2.6.0
+GIO_REQUIRED=2.16.1
GNOME_VFS_REQUIRED=2.6.0
LIBGLADE_REQUIRED=2.4.0
LIBGPHOTO_REQUIRED=2.1.3
@@ -42,6 +43,7 @@
AC_SUBST(LIBGNOME_REQUIRED)
AC_SUBST(LIBGNOMEUI_REQUIRED)
AC_SUBST(LIBGNOMECANVAS_REQUIRED)
+AC_SUBST(GIO_REQUIRED)
AC_SUBST(GNOME_VFS_REQUIRED)
AC_SUBST(LIBGLADE_REQUIRED)
AC_SUBST(LIBGPHOTO_REQUIRED)
@@ -65,6 +67,7 @@
libbonobo-2.0 >= $BONOBO_REQUIRED \
libbonoboui-2.0 >= $BONOBO_REQUIRED \
bonobo-activation-2.0 >= $BONOBO_REQUIRED \
+ gio-2.0 >= $GIO_REQUIRED \
gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED \
gnome-vfs-module-2.0 \
exiv2 >= $EXIV2_REQUIRED \
Modified: trunk/libgthumb/file-data.c
==============================================================================
--- trunk/libgthumb/file-data.c (original)
+++ trunk/libgthumb/file-data.c Sat May 10 17:09:14 2008
@@ -83,7 +83,7 @@
fd->can_read = info->permissions && GNOME_VFS_PERM_ACCESS_READABLE;
}
else {
- fd->size = (GnomeVFSFileSize) 0;
+ fd->size = (goffset) 0;
fd->ctime = (time_t) 0;
fd->mtime = (time_t) 0;
fd->can_read = TRUE;
Modified: trunk/libgthumb/file-data.h
==============================================================================
--- trunk/libgthumb/file-data.h (original)
+++ trunk/libgthumb/file-data.h Sat May 10 17:09:14 2008
@@ -24,7 +24,6 @@
#define FILE_DATA_H
#include <glib.h>
-#include <libgnomevfs/gnome-vfs-file-size.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <time.h>
#include <sys/stat.h>
@@ -37,7 +36,7 @@
const char *name; /* File name only. */
char *display_name;
const char *mime_type;
- GnomeVFSFileSize size;
+ goffset size;
time_t ctime;
time_t mtime;
gboolean can_read;
Modified: trunk/libgthumb/file-utils.c
==============================================================================
--- trunk/libgthumb/file-utils.c (original)
+++ trunk/libgthumb/file-utils.c Sat May 10 17:09:14 2008
@@ -40,6 +40,7 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf-animation.h>
#include <libgnomeui/gnome-thumbnail.h>
#include <libgnomevfs/gnome-vfs.h>
@@ -1115,28 +1116,31 @@
}
-GnomeVFSFileSize
+goffset
get_file_size (const char *uri)
{
- GnomeVFSFileInfo *info;
- GnomeVFSResult result;
- GnomeVFSFileSize size;
-
- if (! uri || ! *uri)
- return 0;
-
- info = gnome_vfs_file_info_new ();
- result = gnome_vfs_get_file_info (uri,
- info,
- (GNOME_VFS_FILE_INFO_DEFAULT
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS));
- size = 0;
- if (result == GNOME_VFS_OK)
- size = info->size;
+ GFile *file;
+ GFileInfo *info;
+ goffset size;
+ GError *err = NULL;
+
+ if ((uri == NULL) || (*uri == '\0'))
+ return 0;
+
+ file = g_file_new_for_uri (uri);
+ info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, &err);
+ if (err == NULL) {
+ size = g_file_info_get_size (info);
+ }
+ else {
+ g_warning ("Failed to get file size for %s: %s", uri, err->message);
+ g_error_free (err);
+ }
- gnome_vfs_file_info_unref (info);
+ g_object_unref (info);
+ g_object_unref (file);
- return size;
+ return size;
}
Modified: trunk/libgthumb/file-utils.h
==============================================================================
--- trunk/libgthumb/file-utils.h (original)
+++ trunk/libgthumb/file-utils.h Sat May 10 17:09:14 2008
@@ -149,7 +149,7 @@
gboolean path_exists (const char *s);
gboolean path_is_file (const char *s);
gboolean path_is_dir (const char *s);
-GnomeVFSFileSize get_file_size (const char *s);
+goffset get_file_size (const char *s);
time_t get_file_mtime (const char *s);
time_t get_file_ctime (const char *s);
void set_file_mtime (const char *s,
Modified: trunk/libgthumb/gth-filter.c
==============================================================================
--- trunk/libgthumb/gth-filter.c (original)
+++ trunk/libgthumb/gth-filter.c Sat May 10 17:09:14 2008
@@ -360,10 +360,10 @@
struct _GthFilterPrivate
{
- gboolean match_all_tests;
- int max_images, current_images;
- GnomeVFSFileSize max_size, current_size;
- GList *tests;
+ gboolean match_all_tests;
+ int max_images, current_images;
+ goffset max_size, current_size;
+ GList *tests;
};
@@ -462,14 +462,14 @@
void
-gth_filter_set_max_size (GthFilter *filter,
- GnomeVFSFileSize max_size)
+gth_filter_set_max_size (GthFilter *filter,
+ goffset max_size)
{
filter->priv->max_size = max_size;
}
-GnomeVFSFileSize
+goffset
gth_filter_get_max_size (GthFilter *filter)
{
return filter->priv->max_size;
Modified: trunk/libgthumb/gth-filter.h
==============================================================================
--- trunk/libgthumb/gth-filter.h (original)
+++ trunk/libgthumb/gth-filter.h Sat May 10 17:09:14 2008
@@ -24,7 +24,6 @@
#define GTH_FILTER_H
#include <glib-object.h>
-#include <libgnomevfs/gnome-vfs-file-size.h>
#include "file-data.h"
#define GTH_TYPE_FILTER (gth_filter_get_type ())
@@ -105,8 +104,8 @@
int max_images);
int gth_filter_get_max_images (GthFilter *filter);
void gth_filter_set_max_size (GthFilter *filter,
- GnomeVFSFileSize max_size);
-GnomeVFSFileSize gth_filter_get_max_size (GthFilter *filter);
+ goffset max_size);
+goffset gth_filter_get_max_size (GthFilter *filter);
void gth_filter_set_match_all (GthFilter *filter,
gboolean match_all);
gboolean gth_filter_get_match_all (GthFilter *filter);
Modified: trunk/libgthumb/gth-sort-utils.c
==============================================================================
--- trunk/libgthumb/gth-sort-utils.c (original)
+++ trunk/libgthumb/gth-sort-utils.c Sat May 10 17:09:14 2008
@@ -63,10 +63,10 @@
}
-int gth_sort_by_size_then_name (GnomeVFSFileSize size1,
- GnomeVFSFileSize size2,
- const char *name1,
- const char *name2)
+int gth_sort_by_size_then_name (goffset size1,
+ goffset size2,
+ const char *name1,
+ const char *name2)
{
if (size1 < size2) return -1;
if (size1 > size2) return 1;
Modified: trunk/libgthumb/gth-sort-utils.h
==============================================================================
--- trunk/libgthumb/gth-sort-utils.h (original)
+++ trunk/libgthumb/gth-sort-utils.h Sat May 10 17:09:14 2008
@@ -29,8 +29,8 @@
const char *string2,
const char *name1,
const char *name2);
-int gth_sort_by_size_then_name (GnomeVFSFileSize size1,
- GnomeVFSFileSize size2,
+int gth_sort_by_size_then_name (goffset size1,
+ goffset size2,
const char *name1,
const char *name2);
int gth_sort_by_filetime_then_name (time_t time1,
Modified: trunk/libgthumb/thumb-loader.c
==============================================================================
--- trunk/libgthumb/thumb-loader.c (original)
+++ trunk/libgthumb/thumb-loader.c Sat May 10 17:09:14 2008
@@ -69,7 +69,7 @@
int cache_max_w;
int cache_max_h;
GnomeThumbnailSize thumb_size;
- GnomeVFSFileSize max_file_size; /* If the file size is greater
+ goffset max_file_size; /* If the file size is greater
* than this the thumbnail
* will not be created, for
* functionality reasons. */
@@ -309,8 +309,8 @@
void
-thumb_loader_set_max_file_size (ThumbLoader *tl,
- GnomeVFSFileSize size)
+thumb_loader_set_max_file_size (ThumbLoader *tl,
+ goffset size)
{
g_return_if_fail (tl != NULL);
tl->priv->max_file_size = size;
Modified: trunk/libgthumb/thumb-loader.h
==============================================================================
--- trunk/libgthumb/thumb-loader.h (original)
+++ trunk/libgthumb/thumb-loader.h Sat May 10 17:09:14 2008
@@ -25,7 +25,6 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomevfs/gnome-vfs-file-size.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include "image-loader.h"
#include "file-data.h"
@@ -70,7 +69,7 @@
void thumb_loader_save_thumbnails (ThumbLoader *tl,
gboolean save);
void thumb_loader_set_max_file_size (ThumbLoader *tl,
- GnomeVFSFileSize size);
+ goffset size);
void thumb_loader_set_file (ThumbLoader *tl,
FileData *fd);
void thumb_loader_set_path (ThumbLoader *tl,
Modified: trunk/src/catalog-png-exporter.c
==============================================================================
--- trunk/src/catalog-png-exporter.c (original)
+++ trunk/src/catalog-png-exporter.c Sat May 10 17:09:14 2008
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkrgb.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs.h>
#include "catalog-png-exporter.h"
@@ -837,7 +838,7 @@
}
if (ce->caption_fields & GTH_CAPTION_FILE_SIZE)
- idata->caption_row[row++] = gnome_vfs_format_file_size_for_display (idata->file->size);
+ idata->caption_row[row++] = g_format_size_for_display (idata->file->size);
if (ce->caption_fields & GTH_CAPTION_IMAGE_DIM)
idata->caption_row[row++] = g_strdup_printf (
Modified: trunk/src/catalog-web-exporter.c
==============================================================================
--- trunk/src/catalog-web-exporter.c (original)
+++ trunk/src/catalog-web-exporter.c Sat May 10 17:09:14 2008
@@ -1581,7 +1581,7 @@
case GTH_TAG_FILESIZE:
idx = get_image_idx (tag, ce);
idata = g_list_nth (ce->file_list, idx)->data;
- line = gnome_vfs_format_file_size_for_display (idata->src_file->size);
+ line = g_format_size_for_display (idata->src_file->size);
write_markup_escape_line (line, fout);
break;
Modified: trunk/src/dlg-duplicates.c
==============================================================================
--- trunk/src/dlg-duplicates.c (original)
+++ trunk/src/dlg-duplicates.c Sat May 10 17:09:14 2008
@@ -33,6 +33,7 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <libgnomeui/libgnomeui.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs.h>
#include "catalog.h"
@@ -1079,7 +1080,7 @@
if (! get_iter_from_image_data (data, idata, &iter))
return;
- size_txt = gnome_vfs_format_file_size_for_display (idata->common->size * idata->common->duplicates);
+ size_txt = g_format_size_for_display (idata->common->size * idata->common->duplicates);
n_txt = g_strdup_printf ("%d", idata->common->duplicates);
gtk_list_store_set (GTK_LIST_STORE (data->images_model),
@@ -1100,7 +1101,7 @@
GtkTreeIter iter;
char *size_txt;
- size_txt = gnome_vfs_format_file_size_for_display (idata->common->size);
+ size_txt = g_format_size_for_display (idata->common->size);
gtk_list_store_append (GTK_LIST_STORE (data->images_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (data->images_model),
@@ -1141,7 +1142,7 @@
}
}
- size_txt = gnome_vfs_format_file_size_for_display (size);
+ size_txt = g_format_size_for_display (size);
label = g_strdup_printf ("%d (%s)", data->duplicates, size_txt);
g_free (size_txt);
Modified: trunk/src/dlg-file-utils.c
==============================================================================
--- trunk/src/dlg-file-utils.c (original)
+++ trunk/src/dlg-file-utils.c Sat May 10 17:09:14 2008
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <glade/glade.h>
@@ -538,7 +539,7 @@
g_free (utf8_name);
label = glade_xml_get_widget (gui, size_widget);
- file_size_txt = gnome_vfs_format_file_size_for_display (get_file_size (filename));
+ file_size_txt = g_format_size_for_display (get_file_size (filename));
_gtk_label_set_locale_text (GTK_LABEL (label), file_size_txt);
g_free (file_size_txt);
Modified: trunk/src/dlg-image-prop.c
==============================================================================
--- trunk/src/dlg-image-prop.c (original)
+++ trunk/src/dlg-image-prop.c Sat May 10 17:09:14 2008
@@ -28,6 +28,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <glade/glade.h>
@@ -424,7 +425,7 @@
/**/
- file_size_txt = gnome_vfs_format_file_size_for_display (get_file_size (image_filename));
+ file_size_txt = g_format_size_for_display (get_file_size (image_filename));
gtk_label_set_text (GTK_LABEL (data->i_file_size_label), file_size_txt);
g_free (file_size_txt);
Modified: trunk/src/dlg-photo-importer.c
==============================================================================
--- trunk/src/dlg-photo-importer.c (original)
+++ trunk/src/dlg-photo-importer.c Sat May 10 17:09:14 2008
@@ -34,9 +34,6 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-help.h>
#include <libgnomeui/gnome-icon-lookup.h>
-#include <libgnomevfs/gnome-vfs-file-info.h>
-#include <libgnomevfs/gnome-vfs-mime.h>
-#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <gphoto2/gphoto2-context.h>
#include <gphoto2/gphoto2-camera.h>
@@ -1679,10 +1676,10 @@
ok_clicked_cb (GtkButton *button,
DialogData *data)
{
- GList *file_list = NULL, *scan;
- GList *sel_list;
- gboolean error;
- GnomeVFSFileSize total_size = 0;
+ GList *file_list = NULL, *scan;
+ GList *sel_list;
+ gboolean error;
+ goffset total_size = 0;
if (!data->camera_setted) {
display_error_dialog (data,
@@ -1784,7 +1781,7 @@
camera_filename,
&info,
NULL) == GP_OK)
- total_size += (GnomeVFSFileSize) info.file.size;
+ total_size += (goffset) info.file.size;
g_free (camera_folder);
}
Modified: trunk/src/dlg-rename-series.c
==============================================================================
--- trunk/src/dlg-rename-series.c (original)
+++ trunk/src/dlg-rename-series.c Sat May 10 17:09:14 2008
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include <gio/gio.h>
#include <libgnome/gnome-help.h>
#include <libgnomevfs/gnome-vfs-utils.h>
@@ -394,7 +395,7 @@
g_free (image_date);
g_free (utf8_txt);
- image_size = gnome_vfs_format_file_size_for_display (fdata->size);
+ image_size = g_format_size_for_display (fdata->size);
name4 = _g_substitute_pattern (name3, 's', image_size);
g_free (image_size);
Modified: trunk/src/gth-browser.c
==============================================================================
--- trunk/src/gth-browser.c (original)
+++ trunk/src/gth-browser.c Sat May 10 17:09:14 2008
@@ -27,6 +27,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
#include <libgnomevfs/gnome-vfs-result.h>
@@ -468,7 +469,7 @@
utf8_time_txt = g_locale_to_utf8 (time_txt, -1, 0, 0, 0);
size_txt = g_strdup_printf (_("%d x %d pixels"), width, height);
- file_size_txt = gnome_vfs_format_file_size_for_display (priv->image->size);
+ file_size_txt = g_format_size_for_display (priv->image->size);
/**/
@@ -682,7 +683,7 @@
char *info, *size_txt, *sel_size_txt;
char *total_info, *selected_info;
int tot_n, sel_n;
- GnomeVFSFileSize tot_size, sel_size;
+ goffset tot_size, sel_size;
GList *file_list, *scan;
GList *selection;
@@ -709,8 +710,8 @@
file_data_list_free (selection);
- size_txt = gnome_vfs_format_file_size_for_display (tot_size);
- sel_size_txt = gnome_vfs_format_file_size_for_display (sel_size);
+ size_txt = g_format_size_for_display (tot_size);
+ sel_size_txt = g_format_size_for_display (sel_size);
if (tot_n == 0)
total_info = g_strdup (_("No image"));
Modified: trunk/src/gth-exif-data-viewer.c
==============================================================================
--- trunk/src/gth-exif-data-viewer.c (original)
+++ trunk/src/gth-exif-data-viewer.c Sat May 10 17:09:14 2008
@@ -26,6 +26,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-utils.h>
@@ -332,7 +333,7 @@
strftime (time_txt, 50, _("%d %B %Y, %H:%M"), tm);
utf8_time_txt = g_locale_to_utf8 (time_txt, -1, 0, 0, 0);
- file_size_txt = gnome_vfs_format_file_size_for_display (edv->priv->file->size);
+ file_size_txt = g_format_size_for_display (edv->priv->file->size);
mime_type = edv->priv->file->mime_type;
Modified: trunk/src/gth-fullscreen.c
==============================================================================
--- trunk/src/gth-fullscreen.c (original)
+++ trunk/src/gth-fullscreen.c Sat May 10 17:09:14 2008
@@ -29,7 +29,7 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
+#include <gio/gio.h>
#include "comments.h"
#include "dlg-file-utils.h"
@@ -872,7 +872,7 @@
height = image_viewer_get_image_height (image_viewer);
size_txt = g_strdup_printf (_("%d x %d pixels"), width, height);
- file_size_txt = gnome_vfs_format_file_size_for_display (get_file_size (image_filename));
+ file_size_txt = g_format_size_for_display (get_file_size (image_filename));
zoom = (int) (image_viewer->zoom_level * 100.0);
Modified: trunk/src/gth-viewer.c
==============================================================================
--- trunk/src/gth-viewer.c (original)
+++ trunk/src/gth-viewer.c Sat May 10 17:09:14 2008
@@ -27,6 +27,7 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include <gio/gio.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-mime.h>
@@ -587,7 +588,7 @@
utf8_time_txt = g_locale_to_utf8 (time_txt, -1, 0, 0, 0);
size_txt = g_strdup_printf (_("%d x %d pixels"), width, height);
- file_size_txt = gnome_vfs_format_file_size_for_display (priv->image->size);
+ file_size_txt = g_format_size_for_display (priv->image->size);
/**/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]