[gthumb/ext] grab the focus only if the widget if realized



commit 42054e13895d3de98c008a94eec19abddd69e5c1
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Sep 24 19:42:30 2009 +0200

    grab the focus only if the widget if realized

 extensions/file_viewer/gth-file-viewer-page.c   |    6 +++++-
 extensions/image_viewer/gth-image-viewer-page.c |    8 +++++++-
 gthumb/gio-utils.c                              |    7 +++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/extensions/file_viewer/gth-file-viewer-page.c b/extensions/file_viewer/gth-file-viewer-page.c
index 4439a8e..230a9df 100644
--- a/extensions/file_viewer/gth-file-viewer-page.c
+++ b/extensions/file_viewer/gth-file-viewer-page.c
@@ -217,7 +217,11 @@ gth_file_viewer_page_real_view (GthViewerPage *base,
 static void
 gth_file_viewer_page_real_focus (GthViewerPage *base)
 {
-	gtk_widget_grab_focus (GTH_FILE_VIEWER_PAGE (base)->priv->label);
+	GtkWidget *widget;
+
+	widget = GTH_FILE_VIEWER_PAGE (base)->priv->label;
+	if (GTK_WIDGET_REALIZED (widget))
+		gtk_widget_grab_focus (widget);
 }
 
 
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 73edb5e..6fe64a6 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -561,6 +561,8 @@ gth_image_viewer_page_real_view (GthViewerPage *base,
 	self = (GthImageViewerPage*) base;
 	g_return_if_fail (file_data != NULL);
 
+	gth_viewer_page_focus (GTH_VIEWER_PAGE (self));
+
 	if ((self->priv->file_data != NULL)
 	    && g_file_equal (file_data->file, self->priv->file_data->file)
 	    && (gth_file_data_get_mtime (file_data) == gth_file_data_get_mtime (self->priv->file_data))
@@ -595,7 +597,11 @@ gth_image_viewer_page_real_view (GthViewerPage *base,
 static void
 gth_image_viewer_page_real_focus (GthViewerPage *base)
 {
-	gtk_widget_grab_focus (GTH_IMAGE_VIEWER_PAGE (base)->priv->viewer);
+	GtkWidget *widget;
+
+	widget = GTH_IMAGE_VIEWER_PAGE (base)->priv->viewer;
+	if (GTK_WIDGET_REALIZED (widget))
+		gtk_widget_grab_focus (widget);
 }
 
 
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index 83f7394..4c58f67 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -1270,6 +1270,13 @@ _g_copy_file_to_destination (CopyFileData   *copy_file_data,
 		else
 			copy_file_data->message = g_strdup_printf (_("Copying \"%s\" to \"%s\""), g_file_info_get_display_name (copy_file_data->source->info), destination_name);
 
+		copy_file_data->progress_callback (NULL,
+						   copy_file_data->message,
+						   "",
+						   TRUE,
+						   0.0,
+						   copy_file_data->progress_callback_data);
+
 		g_free (destination_name);
 		g_object_unref (destination_parent);
 	}



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