[gthumb] fixed comment date validation



commit c2cb6fc6c14d2118ea80628298507427ea5de4e8
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Aug 29 13:07:34 2010 +0200

    fixed comment date validation

 extensions/catalogs/dlg-catalog-properties.c |    2 +-
 extensions/catalogs/gth-catalog.c            |   12 ++++++------
 gthumb/gth-time.c                            |    7 +++++++
 gthumb/gth-time.h                            |    1 +
 4 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/extensions/catalogs/dlg-catalog-properties.c b/extensions/catalogs/dlg-catalog-properties.c
index 26f822a..74cc5d4 100644
--- a/extensions/catalogs/dlg-catalog-properties.c
+++ b/extensions/catalogs/dlg-catalog-properties.c
@@ -173,7 +173,7 @@ catalog_ready_cb (GObject  *object,
 	if (gth_catalog_get_name (data->catalog) != NULL) {
 		gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("name_entry")), gth_catalog_get_name (data->catalog));
 	}
-	else if (! gth_datetime_valid (gth_catalog_get_date (data->catalog))) {
+	else if (! gth_datetime_valid_date (gth_catalog_get_date (data->catalog))) {
 		char *basename;
 		char *name;
 		char *utf8_name;
diff --git a/extensions/catalogs/gth-catalog.c b/extensions/catalogs/gth-catalog.c
index 6f98f06..5a60a3e 100644
--- a/extensions/catalogs/gth-catalog.c
+++ b/extensions/catalogs/gth-catalog.c
@@ -191,7 +191,7 @@ base_write_to_doc (GthCatalog  *catalog,
 	if (catalog->priv->name != NULL)
 		dom_element_append_child (root, dom_document_create_element_with_text (doc, catalog->priv->name, "name", NULL));
 
-	if (gth_datetime_valid (catalog->priv->date_time)) {
+	if (gth_datetime_valid_date (catalog->priv->date_time)) {
 		char *s;
 
 		s = gth_datetime_to_exif_date (catalog->priv->date_time);
@@ -333,7 +333,7 @@ void
 gth_catalog_set_date (GthCatalog  *catalog,
 		      GthDateTime *date_time)
 {
-	if (gth_datetime_valid (date_time))
+	if (g_date_valid (date_time->date))
 		g_date_set_dmy (catalog->priv->date_time->date,
 				g_date_get_day (date_time->date),
 				g_date_get_month (date_time->date),
@@ -641,7 +641,7 @@ get_display_name (GFile       *file,
 		 g_string_append (display_name, _("Catalogs"));
 	}
 	else {
-		if ((name == NULL) && ! gth_datetime_valid (date_time)) {
+		if ((name == NULL) && ! gth_datetime_valid_date (date_time)) {
 			char *name;
 			char *utf8_name;
 
@@ -656,7 +656,7 @@ get_display_name (GFile       *file,
 			if (name != NULL)
 				g_string_append (display_name, name);
 
-			if (gth_datetime_valid (date_time)) {
+			if (gth_datetime_valid_date (date_time)) {
 				char *formatted;
 
 				formatted = gth_datetime_strftime (date_time, "%x");
@@ -718,7 +718,7 @@ update_standard_attributes (GFile       *file,
 	char *display_name;
 	char *edit_name;
 
-	if (gth_datetime_valid (date_time)) {
+	if (gth_datetime_valid_date (date_time)) {
 		char *sort_order_s;
 		int   sort_order;
 
@@ -764,7 +764,7 @@ gth_catalog_update_metadata (GthCatalog  *catalog,
 
 	/* general::event-date */
 
-	if (gth_datetime_valid (catalog->priv->date_time)) {
+	if (gth_datetime_valid_date (catalog->priv->date_time)) {
 		GObject *metadata;
 		char    *raw;
 		char    *formatted;
diff --git a/gthumb/gth-time.c b/gthumb/gth-time.c
index cbc6d25..a68da94 100644
--- a/gthumb/gth-time.c
+++ b/gthumb/gth-time.c
@@ -136,6 +136,13 @@ gth_datetime_valid (GthDateTime *dt)
 }
 
 
+gboolean
+gth_datetime_valid_date (GthDateTime *dt)
+{
+	return g_date_valid (dt->date);
+}
+
+
 void
 gth_datetime_from_timeval (GthDateTime *dt,
 			   GTimeVal    *tv)
diff --git a/gthumb/gth-time.h b/gthumb/gth-time.h
index d24a727..310aa96 100644
--- a/gthumb/gth-time.h
+++ b/gthumb/gth-time.h
@@ -54,6 +54,7 @@ void          gth_datetime_clear           (GthDateTime *dt);
 void          gth_datetime_copy            (GthDateTime *src,
 					    GthDateTime *dest);
 gboolean      gth_datetime_valid           (GthDateTime *dt);
+gboolean      gth_datetime_valid_date      (GthDateTime *dt);
 void          gth_datetime_from_timeval    (GthDateTime *dt,
 					    GTimeVal    *tv);
 gboolean      gth_datetime_from_exif_date  (GthDateTime *dt,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]