[gnome-software] Work around the update dialog coming up with a label selected



commit 3bdeef5f2f7b6a3fa2da05cde34c74a53c7848ea
Author: Kalev Lember <kalevlember gmail com>
Date:   Sat Aug 2 21:21:29 2014 +0200

    Work around the update dialog coming up with a label selected
    
    It's really a bug in gtk+'s initial keyboard focus setting code, but
    let's go with a workaround here for now.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=734033

 src/gs-update-dialog.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index cad81d7..0d194fb 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -317,6 +317,17 @@ 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);
@@ -356,6 +367,8 @@ gs_update_dialog_init (GsUpdateDialog *dialog)
                          G_CALLBACK (button_back_cb),
                          dialog);
 
+       g_signal_connect_after (dialog, "show", G_CALLBACK (unset_focus), NULL);
+
        scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->scrolledwindow_details));
        g_signal_connect (scrollbar, "map", G_CALLBACK (scrollbar_mapped_cb), priv->scrolledwindow_details);
        g_signal_connect (scrollbar, "unmap", G_CALLBACK (scrollbar_mapped_cb), priv->scrolledwindow_details);


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