[gnome-online-accounts/wip/rishi/kerberos: 3/5] Only accept a vertical GtkBox via goa_provider_show_account



commit a81537231586b71f1c503ca6425c2e50a7ddea48
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jul 26 17:25:03 2016 +0200

    Only accept a vertical GtkBox via goa_provider_show_account
    
    This gives the GoaProvider greater control over the UI. It is no longer
    going to be fettered by the high level layout created by the
    gnome-control-center panel.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769213

 src/goabackend/goaimapsmtpprovider.c  |   17 ++++++++++++--
 src/goabackend/goaprovider-priv.h     |    6 ++--
 src/goabackend/goaprovider.c          |   29 +++++++++++++++++---------
 src/goabackend/goaprovider.h          |    6 ++--
 src/goabackend/goatelepathyprovider.c |   36 +++++++++++++++++++++++---------
 5 files changed, 65 insertions(+), 29 deletions(-)
---
diff --git a/src/goabackend/goaimapsmtpprovider.c b/src/goabackend/goaimapsmtpprovider.c
index 0b7ad08..0d4d00f 100644
--- a/src/goabackend/goaimapsmtpprovider.c
+++ b/src/goabackend/goaimapsmtpprovider.c
@@ -1508,16 +1508,25 @@ show_account (GoaProvider         *provider,
               GoaClient           *client,
               GoaObject           *object,
               GtkBox              *vbox,
-              GtkGrid             *grid,
-              G_GNUC_UNUSED GtkGrid *dummy)
+              G_GNUC_UNUSED GtkGrid *dummy1,
+              G_GNUC_UNUSED GtkGrid *dummy2)
 {
+  GtkWidget *grid;
   const gchar *username;
   gchar *value_str;
   gchar *value_str_1;
   gint row;
 
   row = 0;
-  goa_utils_account_add_header (object, grid, row++);
+
+  grid = gtk_grid_new ();
+  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
+  gtk_widget_set_hexpand (grid, TRUE);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+  gtk_box_pack_start (vbox, grid, FALSE, TRUE, 0);
+
+  goa_utils_account_add_header (object, GTK_GRID (grid), row++);
 
   username = g_get_user_name ();
 
@@ -1558,6 +1567,8 @@ show_account (GoaProvider         *provider,
       show_label (GTK_WIDGET (grid), row++, _("SMTP"), value_str);
   g_free (value_str_1);
   g_free (value_str);
+
+  goa_utils_account_add_attention_needed (client, object, provider, vbox);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/goabackend/goaprovider-priv.h b/src/goabackend/goaprovider-priv.h
index bd3e486..9bdcbcd 100644
--- a/src/goabackend/goaprovider-priv.h
+++ b/src/goabackend/goaprovider-priv.h
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2013, 2014, 2015 Red Hat, Inc.
+ * Copyright (C) 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
@@ -111,8 +111,8 @@ struct _GoaProviderClass
                                                            GoaClient              *client,
                                                            GoaObject              *object,
                                                            GtkBox                 *vbox,
-                                                           GtkGrid                *grid,
-                                                           GtkGrid                *dummy);
+                                                           GtkGrid                *dummy1,
+                                                           GtkGrid                *dummy2);
 };
 
 /**
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index c48e24a..26292f4 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -98,8 +98,8 @@ static void goa_provider_show_account_real (GoaProvider         *provider,
                                             GoaClient           *client,
                                             GoaObject           *object,
                                             GtkBox              *vbox,
-                                            GtkGrid             *grid,
-                                            GtkGrid             *dummy);
+                                            GtkGrid             *dummy1,
+                                            GtkGrid             *dummy2);
 
 #define GOA_PROVIDER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GOA_TYPE_PROVIDER, 
GoaProviderPrivate))
 
@@ -559,16 +559,15 @@ goa_provider_show_account (GoaProvider         *self,
                            GoaClient           *client,
                            GoaObject           *object,
                            GtkBox              *vbox,
-                           GtkGrid             *grid,
-                           GtkGrid             *dummy)
+                           GtkGrid             *dummy1,
+                           GtkGrid             *dummy2)
 {
   g_return_if_fail (GOA_IS_PROVIDER (self));
   g_return_if_fail (GOA_IS_CLIENT (client));
   g_return_if_fail (GOA_IS_OBJECT (object) && goa_object_peek_account (object) != NULL);
   g_return_if_fail (GTK_IS_BOX (vbox));
-  g_return_if_fail (GTK_IS_GRID (grid));
 
-  GOA_PROVIDER_GET_CLASS (self)->show_account (self, client, object, vbox, grid, dummy);
+  GOA_PROVIDER_GET_CLASS (self)->show_account (self, client, object, vbox, dummy1, dummy2);
 }
 
 static void
@@ -576,17 +575,25 @@ goa_provider_show_account_real (GoaProvider         *provider,
                                 GoaClient           *client,
                                 GoaObject           *object,
                                 GtkBox              *vbox,
-                                GtkGrid             *grid,
-                                GtkGrid             *dummy)
+                                GtkGrid             *dummy1,
+                                GtkGrid             *dummy2)
 {
   GoaProviderFeatures features;
+  GtkWidget *grid;
   gint row;
   guint i;
   const char *label;
 
   row = 0;
 
-  goa_utils_account_add_header (object, grid, row++);
+  grid = gtk_grid_new ();
+  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
+  gtk_widget_set_hexpand (grid, TRUE);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+  gtk_box_pack_start (vbox, grid, FALSE, TRUE, 0);
+
+  goa_utils_account_add_header (object, GTK_GRID (grid), row++);
 
   features = goa_provider_get_provider_features (provider);
   /* Translators: This is a label for a series of
@@ -597,13 +604,15 @@ goa_provider_show_account_real (GoaProvider         *provider,
     {
       if ((features & provider_features_info[i].feature) != 0)
         {
-          goa_util_add_row_switch_from_keyfile_with_blurb (grid, row++, object,
+          goa_util_add_row_switch_from_keyfile_with_blurb (GTK_GRID (grid), row++, object,
                                                            label,
                                                            provider_features_info[i].property,
                                                            _(provider_features_info[i].blurb));
           label = NULL;
         }
     }
+
+  goa_utils_account_add_attention_needed (client, object, provider, vbox);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/goabackend/goaprovider.h b/src/goabackend/goaprovider.h
index 1a436aa..db79674 100644
--- a/src/goabackend/goaprovider.h
+++ b/src/goabackend/goaprovider.h
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2011, 2012, 2015 Red Hat, Inc.
+ * Copyright (C) 2011, 2012, 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
@@ -74,8 +74,8 @@ void                   goa_provider_show_account                 (GoaProvider
                                                                   GoaClient              *client,
                                                                   GoaObject              *object,
                                                                   GtkBox                 *vbox,
-                                                                  GtkGrid                *grid,
-                                                                  GtkGrid                *dummy);
+                                                                  GtkGrid                *dummy1,
+                                                                  GtkGrid                *dummy2);
 
 gboolean               goa_provider_build_object                 (GoaProvider            *self,
                                                                   GoaObjectSkeleton      *object,
diff --git a/src/goabackend/goatelepathyprovider.c b/src/goabackend/goatelepathyprovider.c
index 77fa82f..ec4c069 100644
--- a/src/goabackend/goatelepathyprovider.c
+++ b/src/goabackend/goatelepathyprovider.c
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2012, 2013, 2015 Red Hat, Inc.
+ * Copyright (C) 2012, 2013, 2015, 2016 Red Hat, Inc.
  * Copyright (C) 2013 Intel Corporation
  *
  * This library is free software; you can redistribute it and/or
@@ -932,20 +932,34 @@ show_account (GoaProvider         *provider,
               GoaClient           *client,
               GoaObject           *object,
               GtkBox              *vbox,
-              GtkGrid             *grid,
-              G_GNUC_UNUSED GtkGrid *dummy)
+              G_GNUC_UNUSED GtkGrid *dummy1,
+              G_GNUC_UNUSED GtkGrid *dummy2)
 {
   EditData *data = NULL;
+  GtkWidget *grid;
   GtkWidget *params_button = NULL;
   GtkWidget *details_button = NULL;
   GtkWidget *button_box = NULL;
+  gint row = 0;
+
+  grid = gtk_grid_new ();
+  gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
+  gtk_widget_set_hexpand (grid, TRUE);
+  gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
+  gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
+  gtk_box_pack_start (vbox, grid, FALSE, TRUE, 0);
+
+  goa_utils_account_add_header (object, GTK_GRID (grid), row++);
+
+  /* Translators: This is a label for a series of
+   * options switches. For example: “Use for Mail”. */
+  goa_util_add_row_switch_from_keyfile_with_blurb (GTK_GRID (grid),
+                                                   row++,
+                                                   object,
+                                                   _("Use for"),
+                                                   "chat-disabled",
+                                                   _("C_hat"));
 
-  GOA_PROVIDER_CLASS (goa_telepathy_provider_parent_class)->show_account (provider,
-                                                                          client,
-                                                                          object,
-                                                                          vbox,
-                                                                          grid,
-                                                                          dummy);
   data = edit_data_new (object, tpaw_get_toplevel_window (GTK_WIDGET (vbox)));
 
   /* Connection Settings button */
@@ -963,7 +977,9 @@ show_account (GoaProvider         *provider,
   gtk_box_pack_start (GTK_BOX (button_box), details_button,
       FALSE, FALSE, 0);
 
-  goa_util_add_row_widget (grid, 2, NULL, button_box);
+  goa_util_add_row_widget (GTK_GRID (grid), row++, NULL, button_box);
+
+  goa_utils_account_add_attention_needed (client, object, provider, vbox);
 
   edit_data_unref (data);
 }


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