[gnome-software] update dialog: Workaround a label coming up as selected
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] update dialog: Workaround a label coming up as selected
- Date: Sun, 7 Jun 2015 20:39:25 +0000 (UTC)
commit 12f99e514aba6e734c442179ac8caebd5b29a378
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 806be74..21b85a8 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -254,6 +254,17 @@ gs_update_dialog_show_installed_updates (GsUpdateDialog *dialog)
dialog);
}
+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)
{
@@ -267,6 +278,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;
@@ -377,17 +392,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
set_plugin_loader (GsUpdateDialog *dialog, GsPluginLoader *plugin_loader)
{
GsUpdateDialogPrivate *priv = gs_update_dialog_get_instance_private (dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]