[nautilus/merge_replace_dialog: 5/12] Finish implement icon boxes in the dialog.



commit 5459e8644a0bb25c1541b1fd3f55f1fc3b80dac1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Apr 2 21:22:53 2008 +0200

    Finish implement icon boxes in the dialog.
    
    Finish implement icon boxes in the conflict dialog.
    Add a main thread runner from inside the file operations, as
    the operation itself is done in an I/O worker thread.
---
 .../nautilus-file-conflict-dialog.c                |   17 +++---
 libnautilus-private/nautilus-file-operations.c     |   59 +++++++++++++++++--
 2 files changed, 60 insertions(+), 16 deletions(-)

diff --git a/libnautilus-private/nautilus-file-conflict-dialog.c b/libnautilus-private/nautilus-file-conflict-dialog.c
index a508bc4..58a9106 100644
--- a/libnautilus-private/nautilus-file-conflict-dialog.c
+++ b/libnautilus-private/nautilus-file-conflict-dialog.c
@@ -87,9 +87,9 @@ build_dialog_appearance (NautilusFileConflictDialog *fcd)
 	char *src_name, *dest_name, *dest_dir_name;
 	char *label_text;
 	char *size, *date;
-	//NautilusIconInfo *src_icon, *dest_icon;
-	//GdkPixbuf *src_pixbuf, *dest_pixbuf;
-	//GtkWidget *src_image, *dest_image;
+	NautilusIconInfo *src_icon, *dest_icon;
+	GdkPixbuf *src_pixbuf, *dest_pixbuf;
+	GtkWidget *src_image, *dest_image;
 	GtkWidget *label;
 	GtkWidget *rename_button;
 	NautilusFile *src, *dest, *dest_dir;
@@ -157,7 +157,7 @@ build_dialog_appearance (NautilusFileConflictDialog *fcd)
 	g_free (primary_text);
 	g_free (primary_markup);
 	g_free (secondary_text);
-#if 0
+
 	/* Set up file icons */
 
 	src_icon = nautilus_file_get_icon (src,
@@ -181,16 +181,15 @@ build_dialog_appearance (NautilusFileConflictDialog *fcd)
 	dest_pixbuf = nautilus_icon_info_get_pixbuf_at_size (src_icon,
 							    NAUTILUS_ICON_SIZE_STANDARD);
 
-	src_image = gtk_image_new ();
-	dest_image = gtk_image_new ();
-	gtk_widget_show (src_image);
-	gtk_widget_show (dest_image);
+	src_image = gtk_image_new_from_pixbuf (src_pixbuf);
+	dest_image = gtk_image_new_from_pixbuf (dest_pixbuf);
 	gtk_box_pack_start (GTK_BOX (details->first_hbox),
 			    src_image, FALSE, FALSE, 0);
 	gtk_box_pack_start (GTK_BOX (details->second_hbox),
 			    dest_image, FALSE, FALSE, 0);
+	gtk_widget_show (src_image);
+	gtk_widget_show (dest_image);
 
-#endif
 	/* Set up labels */
 	label = gtk_label_new (NULL);
 	date = nautilus_file_get_string_attribute (src,
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 34c361a..433ec15 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -3682,7 +3682,7 @@ static gboolean
 test_dir_is_parent (GFile *child, GFile *root)
 {
 	GFile *f;
-
+	
 	f = g_file_dup (child);
 	while (f) {
 		if (g_file_equal (f, root)) {
@@ -3691,7 +3691,6 @@ test_dir_is_parent (GFile *child, GFile *root)
 		}
 		f = g_file_get_parent (f);
 	}
-
 	if (f) {
 		g_object_unref (f);
 	}
@@ -3772,6 +3771,56 @@ is_trusted_desktop_file (GFile *file,
 	return res;
 }
 
+typedef struct {
+	GFile *src;
+	GFile *dest;
+	GFile *dest_dir;
+	GtkWindow *parent;
+} MyData;
+
+static gboolean
+do_run_my_dialog (gpointer _data)
+{
+	MyData *data = _data;
+	GtkWidget *dialog;
+	
+	dialog = nautilus_file_conflict_dialog_new (data->parent,
+						    data->src,
+						    data->dest,
+						    data->dest_dir);
+	gtk_dialog_run (GTK_DIALOG (dialog));
+	
+	return FALSE;
+}
+
+static void
+run_my_dialog (CommonJob *job,
+	       GFile *src,
+	       GFile *dest,
+	       GFile *dest_dir)
+{
+	MyData *data;
+
+	g_timer_stop (job->time);
+	
+	data = g_new0 (MyData, 1);
+	data->parent = job->parent_window;
+	data->src = src;
+	data->dest = dest;
+	data->dest_dir = dest_dir;
+	
+	nautilus_progress_info_pause (job->progress);
+	g_io_scheduler_job_send_to_mainloop (job->io_job,
+					     do_run_my_dialog,
+					     data,
+					     NULL);
+	nautilus_progress_info_resume (job->progress);
+
+	g_free (data);
+
+	g_timer_continue (job->time);
+}
+
 /* Debuting files is non-NULL only for toplevel items */
 static void
 copy_move_file (CopyMoveJob *copy_job,
@@ -3990,7 +4039,6 @@ copy_move_file (CopyMoveJob *copy_job,
 	if (!overwrite &&
 	    IS_IO_ERROR (error, EXISTS)) {
 		gboolean is_merge;
-		GtkWidget *dialog;
 
 		if (unique_names) {
 			g_object_unref (dest);
@@ -3999,10 +4047,7 @@ copy_move_file (CopyMoveJob *copy_job,
 			goto retry;
 		}
 		    
-		dialog = nautilus_file_conflict_dialog_new (job->parent_window,
-							    src, dest, dest_dir);
-		gtk_widget_show (dialog);
-		
+		run_my_dialog (job, src, dest, dest_dir);	
 		is_merge = FALSE;
 #if 0
 		    if (is_dir (dest)) {



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