[gnome-online-accounts] owncloud: Stop the progress widgets from changing the dialog's height
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] owncloud: Stop the progress widgets from changing the dialog's height
- Date: Tue, 16 Feb 2016 11:10:28 +0000 (UTC)
commit 935fac45ab2acc537e9f82b3251549b0829c737f
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Feb 15 13:53:53 2016 +0100
owncloud: Stop the progress widgets from changing the dialog's height
Use GtkWidget::opacity instead of relying on GtkWidget::visible because
"hidden" widgets are zero-sized. When we show and hide the controls
the rows jump around and the dialog changes its height. This looks
awkward. We want the rows to hold their positions even when they are
hidden.
src/goabackend/goaowncloudprovider.c | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
---
diff --git a/src/goabackend/goaowncloudprovider.c b/src/goabackend/goaowncloudprovider.c
index 8c6754d..a763007 100644
--- a/src/goabackend/goaowncloudprovider.c
+++ b/src/goabackend/goaowncloudprovider.c
@@ -1,6 +1,6 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
- * Copyright (C) 2012, 2013, 2014, 2015 Red Hat, Inc.
+ * Copyright (C) 2012, 2013, 2014, 2015, 2016 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -497,6 +497,25 @@ on_uri_username_or_password_changed (GtkEditable *editable, gpointer user_data)
}
static void
+show_progress_ui (GtkContainer *container, gboolean progress)
+{
+ GList *children;
+ GList *l;
+
+ children = gtk_container_get_children (container);
+ for (l = children; l != NULL; l = l->next)
+ {
+ GtkWidget *widget = GTK_WIDGET (l->data);
+ gdouble opacity;
+
+ opacity = progress ? 1.0 : 0.0;
+ gtk_widget_set_opacity (widget, opacity);
+ }
+
+ g_list_free (children);
+}
+
+static void
create_account_details_ui (GoaProvider *provider,
GtkDialog *dialog,
GtkBox *vbox,
@@ -553,19 +572,18 @@ create_account_details_ui (GoaProvider *provider,
gtk_dialog_set_response_sensitive (data->dialog, GTK_RESPONSE_OK, FALSE);
data->progress_grid = gtk_grid_new ();
- gtk_widget_set_no_show_all (data->progress_grid, TRUE);
gtk_orientable_set_orientation (GTK_ORIENTABLE (data->progress_grid), GTK_ORIENTATION_HORIZONTAL);
gtk_grid_set_column_spacing (GTK_GRID (data->progress_grid), 3);
gtk_container_add (GTK_CONTAINER (grid0), data->progress_grid);
spinner = gtk_spinner_new ();
+ gtk_widget_set_opacity (spinner, 0.0);
gtk_widget_set_size_request (spinner, 20, 20);
- gtk_widget_show (spinner);
gtk_spinner_start (GTK_SPINNER (spinner));
gtk_container_add (GTK_CONTAINER (data->progress_grid), spinner);
label = gtk_label_new (_("Connecting…"));
- gtk_widget_show (label);
+ gtk_widget_set_opacity (label, 0.0);
gtk_container_add (GTK_CONTAINER (data->progress_grid), label);
if (new_account)
@@ -611,7 +629,7 @@ check_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
goa_http_client_check_finish (client, res, &data->error);
g_main_loop_quit (data->loop);
gtk_widget_set_sensitive (data->connect_button, TRUE);
- gtk_widget_hide (data->progress_grid);
+ show_progress_ui (GTK_CONTAINER (data->progress_grid), FALSE);
}
static void
@@ -711,7 +729,7 @@ add_account (GoaProvider *provider,
g_free (uri_webdav);
gtk_widget_set_sensitive (data.connect_button, FALSE);
- gtk_widget_show (data.progress_grid);
+ show_progress_ui (GTK_CONTAINER (data.progress_grid), TRUE);
g_main_loop_run (data.loop);
if (g_cancellable_is_cancelled (data.cancellable))
@@ -904,7 +922,7 @@ refresh_account (GoaProvider *provider,
check_cb,
&data);
gtk_widget_set_sensitive (data.connect_button, FALSE);
- gtk_widget_show (data.progress_grid);
+ show_progress_ui (GTK_CONTAINER (data.progress_grid), TRUE);
g_main_loop_run (data.loop);
if (g_cancellable_is_cancelled (data.cancellable))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]