[gthumb/ext: 13/15] use the filename if no name and date is set for the catalog



commit 5a03f5fa64850bc30f46517ffef8aebdfa3a3239
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Dec 15 20:26:48 2009 +0100

    use the filename if no name and date is set for the catalog

 extensions/catalogs/dlg-catalog-properties.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/extensions/catalogs/dlg-catalog-properties.c b/extensions/catalogs/dlg-catalog-properties.c
index 67a976f..980fa32 100644
--- a/extensions/catalogs/dlg-catalog-properties.c
+++ b/extensions/catalogs/dlg-catalog-properties.c
@@ -171,8 +171,24 @@ catalog_ready_cb (GObject  *object,
 
 	data->catalog = g_object_ref (object);
 
-	if (gth_catalog_get_name (data->catalog) != NULL)
+	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 {
+		char *basename;
+		char *name;
+		char *utf8_name;
+
+		basename = g_file_get_basename (data->file_data->file);
+		name = _g_uri_remove_extension (basename);
+		utf8_name = g_filename_to_utf8 (name, -1, NULL, NULL, NULL);
+		gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("name_entry")), utf8_name);
+
+		g_free (utf8_name);
+		g_free (name);
+		g_free (basename);
+	}
+
 	gth_time_selector_set_value (GTH_TIME_SELECTOR (data->time_selector), gth_catalog_get_date (data->catalog));
 	gth_hook_invoke ("dlg-catalog-properties", data->builder, data->file_data, data->catalog);
 	gtk_widget_show (data->dialog);



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