[gnumeric] GUI: Fix focus problem after failed file read.



commit 6c9f5d007fca326892d39fe8801d5c9b92a445a3
Author: Morten Welinder <terra gnome org>
Date:   Mon Apr 22 21:18:18 2013 -0400

    GUI: Fix focus problem after failed file read.

 ChangeLog                   |  5 +++++
 NEWS                        |  1 +
 src/dialogs/ChangeLog       |  4 ++++
 src/dialogs/dialog-recent.c | 11 +++++++----
 src/gui-file.c              |  4 ++++
 5 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e75b9ab..d730ecd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-22  Morten Welinder  <terra gnome org>
+
+       * src/gui-file.c (gui_file_read): Re-take focus if the read fails.
+       Somehow fixes #625687.
+
 2013-04-20  Morten Welinder  <terra gnome org>
 
        * src/go-data-slicer-field.c
diff --git a/NEWS b/NEWS
index f35f86a..4de24c3 100644
--- a/NEWS
+++ b/NEWS
@@ -65,6 +65,7 @@ Morten:
        * Merge long format toolbar into regular one.
        * Work around gtk+ behaviour change.  [#689283]
        * Improve handling of broken xls.  [#698424]
+       * Fix failed-read focus problem.  [#625687]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.1
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 39d4963..3c0042c 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,7 @@
+2013-04-22  Morten Welinder  <terra gnome org>
+
+       * dialog-recent.c (cb_response): Destroy dialog before reading.
+
 2013-04-16  Morten Welinder  <terra gnome org>
 
        * dialog-so-styled.c (dialog_so_styled): Plug leak.
diff --git a/src/dialogs/dialog-recent.c b/src/dialogs/dialog-recent.c
index 9ea3ff5..70de499 100644
--- a/src/dialogs/dialog-recent.c
+++ b/src/dialogs/dialog-recent.c
@@ -52,19 +52,22 @@ cb_response (GtkWidget *dialog,
        case GTK_RESPONSE_OK: {
                GtkTreeModel *model;
                GtkTreeIter iter;
-               const char *uri = NULL;
+               char *uri = NULL;
 
                if (gtk_tree_selection_get_selected (tsel, &model, &iter)) {
                        GtkRecentInfo *info;
                        gtk_tree_model_get (model, &iter, RECENT_COL_INFO, &info, -1);
-                       uri = gtk_recent_info_get_uri (info);
+                       uri = g_strdup (gtk_recent_info_get_uri (info));
                        gtk_recent_info_unref (info);
                }
 
-               if (uri)
+               gtk_widget_destroy (dialog);
+
+               if (uri) {
                        gui_file_read (wbcg, uri, NULL, NULL);
+                       g_free (uri);
+               }
 
-               gtk_widget_destroy (dialog);
                break;
        }
 
diff --git a/src/gui-file.c b/src/gui-file.c
index 9315d22..8f85b17 100644
--- a/src/gui-file.c
+++ b/src/gui-file.c
@@ -126,7 +126,11 @@ gui_file_read (WBCGtk *wbcg, char const *uri,
                gui_wb_view_show (wbcg, wbv);
                workbook_update_history (wb_view_get_workbook (wbv), FILE_SAVE_AS_SAVE);
                return TRUE;
+       } else {
+               /* Somehow fixes #625687.  Don't know why.  */
+               wbcg_focus_cur_scg (wbcg);
        }
+
        return FALSE;
 }
 


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