[gnome-software/gnome-3-14] update dialog: Workaround a label coming up as selected



commit 30ea87e0f0dc1e770f5ca12063f693957536298e
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Jun 7 20:26:41 2015 +0200

    update dialog: Workaround a label coming up as selected
    
    Workaround a gtk+ issue where its initial focus setting code leaves
    behind a selected label. We already had the workaround in place when
    initially mapping the update dialog window, but as it turns out it's
    also needed each time we switch to a new GtkStack page.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750451
    https://bugzilla.gnome.org/show_bug.cgi?id=734033

 src/gs-update-dialog.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 314e073..c816da4 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -203,6 +203,17 @@ gs_update_dialog_show_installed_updates (GsUpdateDialog *dialog, GList *installe
        }
 }
 
+static void
+unset_focus (GtkWidget *widget)
+{
+       GtkWidget *focus;
+
+       focus = gtk_window_get_focus (GTK_WINDOW (widget));
+       if (GTK_IS_LABEL (focus))
+               gtk_label_select_region (GTK_LABEL (focus), 0, 0);
+       gtk_window_set_focus (GTK_WINDOW (widget), NULL);
+}
+
 void
 gs_update_dialog_show_update_details (GsUpdateDialog *dialog, GsApp *app)
 {
@@ -216,6 +227,10 @@ gs_update_dialog_show_update_details (GsUpdateDialog *dialog, GsApp *app)
        /* set update header */
        set_updates_description_ui (dialog, app);
 
+       /* workaround a gtk+ issue where the dialog comes up with a label selected,
+        * https://bugzilla.gnome.org/show_bug.cgi?id=734033 */
+       unset_focus (GTK_WIDGET (dialog));
+
        /* set update description */
        if (kind == GS_APP_KIND_OS_UPDATE) {
                GPtrArray *related;
@@ -326,17 +341,6 @@ scrollbar_mapped_cb (GtkWidget *sb, GtkScrolledWindow *swin)
 }
 
 static void
-unset_focus (GtkWidget *widget)
-{
-       GtkWidget *focus;
-
-       focus = gtk_window_get_focus (GTK_WINDOW (widget));
-       if (GTK_IS_LABEL (focus))
-               gtk_label_select_region (GTK_LABEL (focus), 0, 0);
-       gtk_window_set_focus (GTK_WINDOW (widget), NULL);
-}
-
-static void
 gs_update_dialog_finalize (GObject *object)
 {
        GsUpdateDialog *dialog = GS_UPDATE_DIALOG (object);


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