[gthumb] update the current image properties after changing the date
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] update the current image properties after changing the date
- Date: Sun, 18 Jul 2010 19:06:22 +0000 (UTC)
commit 8b31d69daf3f84afa4094a16e57e54f87a75b8e5
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Jul 18 21:00:59 2010 +0200
update the current image properties after changing the date
extensions/change_date/dlg-change-date.c | 3 +-
extensions/change_date/gth-change-date-task.c | 70 ++++++++++++++----------
extensions/change_date/gth-change-date-task.h | 3 +-
3 files changed, 45 insertions(+), 31 deletions(-)
---
diff --git a/extensions/change_date/dlg-change-date.c b/extensions/change_date/dlg-change-date.c
index 6312de0..7f5fec5 100644
--- a/extensions/change_date/dlg-change-date.c
+++ b/extensions/change_date/dlg-change-date.c
@@ -87,7 +87,8 @@ ok_button_clicked (GtkWidget *button,
time_adjustment = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("adjust_timezone_spinbutton")));
}
- task = gth_change_date_task_new (data->file_list,
+ task = gth_change_date_task_new (gth_browser_get_location (data->browser),
+ data->file_list,
change_fields,
change_type,
date_time,
diff --git a/extensions/change_date/gth-change-date-task.c b/extensions/change_date/gth-change-date-task.c
index 518edf8..fa7462b 100644
--- a/extensions/change_date/gth-change-date-task.c
+++ b/extensions/change_date/gth-change-date-task.c
@@ -28,6 +28,7 @@
struct _GthChangeDateTaskPrivate {
+ GFile *location;
GList *files; /* GFile */
GList *file_list; /* GthFileData */
GthChangeFields fields;
@@ -50,6 +51,7 @@ gth_change_date_task_finalize (GObject *object)
self = GTH_CHANGE_DATE_TASK (object);
+ _g_object_unref (self->priv->location);
_g_object_list_unref (self->priv->file_list);
_g_object_list_unref (self->priv->files);
gth_datetime_free (self->priv->date_time);
@@ -85,48 +87,56 @@ set_date_time_from_change_type (GthChangeDateTask *self,
static void
update_modification_time (GthChangeDateTask *self)
{
- GthDateTime *date_time;
- GList *scan;
- GError *error = NULL;
- if ((self->priv->fields & GTH_CHANGE_LAST_MODIFIED_DATE) == 0) {
- gth_task_completed (GTH_TASK (self), NULL);
- return;
- }
+ GList *scan;
+ GError *error = NULL;
+ GthMonitor *monitor;
+ GList *files;
- date_time = gth_datetime_new ();
- for (scan = self->priv->file_list; scan; scan = scan->next) {
- GthFileData *file_data = scan->data;
- GTimeVal timeval;
+ if ((self->priv->fields & GTH_CHANGE_LAST_MODIFIED_DATE) == GTH_CHANGE_LAST_MODIFIED_DATE) {
+ GthDateTime *date_time;
- gth_datetime_clear (date_time);
- if (self->priv->change_type == GTH_CHANGE_ADJUST_TIMEZONE)
- set_date_time_from_change_type (self, date_time, GTH_CHANGE_TO_FILE_MODIFIED_DATE, file_data);
- else
- set_date_time_from_change_type (self, date_time, self->priv->change_type, file_data);
- if (! gth_datetime_valid (date_time))
- continue;
+ date_time = gth_datetime_new ();
+ for (scan = self->priv->file_list; scan; scan = scan->next) {
+ GthFileData *file_data = scan->data;
+ GTimeVal timeval;
- if (gth_datetime_to_timeval (date_time, &timeval)) {
+ gth_datetime_clear (date_time);
if (self->priv->change_type == GTH_CHANGE_ADJUST_TIMEZONE)
- timeval.tv_sec += HOURS_TO_SECONDS (self->priv->timezone_offset);
- if (! _g_file_set_modification_time (file_data->file,
- &timeval,
- gth_task_get_cancellable (GTH_TASK (self)),
- &error))
- {
- break;
+ set_date_time_from_change_type (self, date_time, GTH_CHANGE_TO_FILE_MODIFIED_DATE, file_data);
+ else
+ set_date_time_from_change_type (self, date_time, self->priv->change_type, file_data);
+ if (! gth_datetime_valid (date_time))
+ continue;
+
+ if (gth_datetime_to_timeval (date_time, &timeval)) {
+ if (self->priv->change_type == GTH_CHANGE_ADJUST_TIMEZONE)
+ timeval.tv_sec += HOURS_TO_SECONDS (self->priv->timezone_offset);
+ if (! _g_file_set_modification_time (file_data->file,
+ &timeval,
+ gth_task_get_cancellable (GTH_TASK (self)),
+ &error))
+ {
+ break;
+ }
}
}
+
+ gth_datetime_free (date_time);
}
+
+ monitor = gth_main_get_default_monitor ();
+ files = gth_file_data_list_to_file_list (self->priv->file_list);
+ gth_monitor_folder_changed (monitor, self->priv->location, files, GTH_MONITOR_EVENT_CHANGED);
+
gth_task_completed (GTH_TASK (self), error);
- gth_datetime_free (date_time);
+ _g_object_list_unref (files);
}
static void
-write_metadata_reasy_cb (GError *error,
+write_metadata_ready_cb (GError *error,
gpointer user_data)
{
GthChangeDateTask *self = user_data;
@@ -363,7 +373,8 @@ gth_change_date_task_get_type (void)
GthTask *
-gth_change_date_task_new (GList *files, /* GthFileData */
+gth_change_date_task_new (GFile *location,
+ GList *files, /* GthFileData */
GthChangeFields fields,
GthChangeType change_type,
GthDateTime *date_time,
@@ -372,6 +383,7 @@ gth_change_date_task_new (GList *files, /* GthFileData */
GthChangeDateTask *self;
self = GTH_CHANGE_DATE_TASK (g_object_new (GTH_TYPE_CHANGE_DATE_TASK, NULL));
+ self->priv->location = g_file_dup (location);
self->priv->files = gth_file_data_list_to_file_list (files);
self->priv->fields = fields;
self->priv->change_type = change_type;
diff --git a/extensions/change_date/gth-change-date-task.h b/extensions/change_date/gth-change-date-task.h
index 8e97c93..b1c046c 100644
--- a/extensions/change_date/gth-change-date-task.h
+++ b/extensions/change_date/gth-change-date-task.h
@@ -63,7 +63,8 @@ struct _GthChangeDateTaskClass {
};
GType gth_change_date_task_get_type (void);
-GthTask * gth_change_date_task_new (GList *files, /* GthFileData */
+GthTask * gth_change_date_task_new (GFile *location,
+ GList *files, /* GthFileData */
GthChangeFields fields,
GthChangeType change_type,
GthDateTime *date_time,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]