[gthumb/ext] load the search result only at the end to speed up the search.



commit 4ac8e7c02e936b45edc832dcb0bdbd20f951aec5
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Dec 21 17:43:52 2009 +0100

    load the search result only at the end to speed up the search.

 extensions/catalogs/dlg-add-to-catalog.c       |    2 +-
 extensions/catalogs/gth-file-source-catalogs.c |    4 +-
 extensions/search/gth-search-task.c            |   45 ++++--------------------
 gthumb/gth-embedded-dialog.c                   |    1 +
 4 files changed, 11 insertions(+), 41 deletions(-)
---
diff --git a/extensions/catalogs/dlg-add-to-catalog.c b/extensions/catalogs/dlg-add-to-catalog.c
index fca98d2..4ed6a83 100644
--- a/extensions/catalogs/dlg-add-to-catalog.c
+++ b/extensions/catalogs/dlg-add-to-catalog.c
@@ -139,7 +139,7 @@ catalog_ready_cb (GObject  *catalog,
 
 	for (scan = add_data->files; scan; scan = scan->next) {
 		GthFileData *file_to_add = scan->data;
-		gth_catalog_insert_file (add_data->catalog, -1, file_to_add->file);
+		gth_catalog_insert_file (add_data->catalog, file_to_add->file, -1);
 	}
 
 	add_data->buffer = gth_catalog_to_data (add_data->catalog, &add_data->length);
diff --git a/extensions/catalogs/gth-file-source-catalogs.c b/extensions/catalogs/gth-file-source-catalogs.c
index 6dc2dca..8f1a5cb 100644
--- a/extensions/catalogs/gth-file-source-catalogs.c
+++ b/extensions/catalogs/gth-file-source-catalogs.c
@@ -725,7 +725,7 @@ catalog_ready_cb (GObject  *catalog,
 	cod->catalog = (GthCatalog *) catalog;
 
 	for (scan = cod->files; scan; scan = scan->next)
-		gth_catalog_insert_file (cod->catalog, -1, (GFile *) scan->data);
+		gth_catalog_insert_file (cod->catalog, (GFile *) scan->data, -1);
 
 	cod->buffer = gth_catalog_to_data (cod->catalog, &cod->length);
 	gio_file = gth_catalog_file_to_gio_file (cod->destination->file);
@@ -882,7 +882,7 @@ reorder_catalog_list (GthCatalog *catalog,
 	}
 
 	for (scan = file_list; scan; scan = scan->next)
-		if (gth_catalog_insert_file (catalog, dest_pos, (GFile *) scan->data))
+		if (gth_catalog_insert_file (catalog, (GFile *) scan->data, dest_pos))
 			dest_pos++;
 
 	all_files = gth_catalog_get_file_list (catalog);
diff --git a/extensions/search/gth-search-task.c b/extensions/search/gth-search-task.c
index 26cd18a..c698b6b 100644
--- a/extensions/search/gth-search-task.c
+++ b/extensions/search/gth-search-task.c
@@ -97,14 +97,9 @@ embedded_dialog_response_cb (GeditMessageArea *message_area,
 	EmbeddedDialogData *data = user_data;
 
 	switch (response_id) {
-	case GTK_RESPONSE_CLOSE:
-		/* gth_browser_set_list_extra_widget (data->browser, NULL); FIXME */
-		break;
-
 	case GTK_RESPONSE_CANCEL:
 		gth_task_cancel (GTH_TASK (data->task));
 		break;
-
 	default:
 		break;
 	}
@@ -118,30 +113,10 @@ save_search_result_copy_done_cb (void     *buffer,
 				 gpointer  user_data)
 {
 	GthSearchTask *task = user_data;
-	GList         *result;
-	int            n;
-	char          *text;
 
 	g_free (buffer);
-
-	gth_embedded_dialog_set_primary_text (GTH_EMBEDDED_DIALOG (task->priv->dialog), _("Search completed"));
-
-	/*result = gth_catalog_get_file_list (GTH_CATALOG (task->priv->search));
-	n = g_list_length (result);
-	text = g_strdup_printf (ngettext("%d file found.", "%d files found.", n), n);
-	gth_embedded_dialog_set_secondary_text (GTH_EMBEDDED_DIALOG (task->priv->dialog), text);
-
-	g_free (text);*/
-
 	gth_browser_update_extra_widget (task->priv->browser);
 
-	/* FIXME
-	gedit_message_area_add_stock_button_with_text (GEDIT_MESSAGE_AREA (task->priv->dialog),
-						       NULL,
-						       GTK_STOCK_CLOSE,
-						       GTK_RESPONSE_CLOSE);
-	*/
-
 	task->priv->io_operation = FALSE;
 	gth_task_completed (GTH_TASK (task), task->priv->error);
 }
@@ -168,6 +143,11 @@ done_func (GObject  *object,
 			task->priv->error = error;
 	}
 
+	gth_monitor_folder_changed (gth_main_get_default_monitor (),
+				    task->priv->search_catalog,
+				    gth_catalog_get_file_list (GTH_CATALOG (task->priv->search)),
+				    GTH_MONITOR_EVENT_CREATED);
+
 	/* save the search result */
 
 	doc = dom_document_new ();
@@ -201,18 +181,8 @@ for_each_file_func (GFile     *file,
 
 	file_data = gth_file_data_new (file, info);
 
-	if (gth_test_match (GTH_TEST (task->priv->test), file_data)) {
-		GList *list;
-
-		gth_catalog_insert_file (GTH_CATALOG (task->priv->search), -1, file_data->file);
-
-		list = g_list_prepend (NULL, g_object_ref (file_data->file));
-		gth_monitor_folder_changed (gth_main_get_default_monitor (),
-					    task->priv->search_catalog,
-					    list,
-					    GTH_MONITOR_EVENT_CREATED);
-		_g_object_list_unref (list);
-	}
+	if (gth_test_match (GTH_TEST (task->priv->test), file_data))
+		gth_catalog_insert_file (GTH_CATALOG (task->priv->search), file_data->file, -1);
 
 	g_object_unref (file_data);
 }
@@ -230,7 +200,6 @@ start_dir_func (GFile      *directory,
 
 	uri = g_file_get_parse_name (directory);
 	text = g_strdup_printf ("Searching in %s", uri);
-	/*gth_embedded_dialog_set_secondary_text (GTH_EMBEDDED_DIALOG (task->priv->dialog), text); FIXME */
 	gth_embedded_dialog_set_primary_text (GTH_EMBEDDED_DIALOG (task->priv->dialog), text);
 
 	g_free (text);
diff --git a/gthumb/gth-embedded-dialog.c b/gthumb/gth-embedded-dialog.c
index 1bb7946..4f32118 100644
--- a/gthumb/gth-embedded-dialog.c
+++ b/gthumb/gth-embedded-dialog.c
@@ -119,6 +119,7 @@ gth_embedded_dialog_construct (GthEmbeddedDialog *self)
 	gtk_box_pack_start (GTK_BOX (vbox), primary_label, TRUE, TRUE, 0);
 	gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
 	gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
+	gtk_label_set_ellipsize (GTK_LABEL (primary_label), PANGO_ELLIPSIZE_MIDDLE);
 	gtk_misc_set_alignment (GTK_MISC (primary_label), 0, 0.5);
 	gtk_misc_set_padding (GTK_MISC (primary_label), 0, 6);
 	GTK_WIDGET_SET_FLAGS (primary_label, GTK_CAN_FOCUS);



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