[gnome-online-accounts/wip/rishi/kerberos: 1/4] Rename goa_util_add_account_info as goa_utils_account_add_header



commit 34264b2b14a175977106a9538250c66d18fc9976
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jul 26 17:00:11 2016 +0200

    Rename goa_util_add_account_info as goa_utils_account_add_header
    
    ... and move it to goautils.[ch]. It is not part of the GoaProvider
    implementation and it should not be exported via goaprovider.h as
    public API. It is merely an internal convenience function to show the
    heading for each account.

 src/goabackend/goaimapsmtpprovider.c |    2 +-
 src/goabackend/goaprovider.c         |   47 +--------------------------------
 src/goabackend/goaprovider.h         |    2 -
 src/goabackend/goautils.c            |   41 ++++++++++++++++++++++++++++-
 src/goabackend/goautils.h            |    4 ++-
 5 files changed, 46 insertions(+), 50 deletions(-)
---
diff --git a/src/goabackend/goaimapsmtpprovider.c b/src/goabackend/goaimapsmtpprovider.c
index 86b6636..0b7ad08 100644
--- a/src/goabackend/goaimapsmtpprovider.c
+++ b/src/goabackend/goaimapsmtpprovider.c
@@ -1517,7 +1517,7 @@ show_account (GoaProvider         *provider,
   gint row;
 
   row = 0;
-  goa_util_add_account_info (grid, row++, object);
+  goa_utils_account_add_header (object, grid, row++);
 
   username = g_get_user_name ();
 
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 780cdb2..c48e24a 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2011, 2012, 2013, 2014, 2015 Red Hat, Inc.
+ * Copyright (C) 2011, 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
@@ -586,7 +586,7 @@ goa_provider_show_account_real (GoaProvider         *provider,
 
   row = 0;
 
-  goa_util_add_account_info (grid, row++, object);
+  goa_utils_account_add_header (object, grid, row++);
 
   features = goa_provider_get_provider_features (provider);
   /* Translators: This is a label for a series of
@@ -1572,49 +1572,6 @@ goa_util_account_notify_property_cb (GObject *object, GParamSpec *pspec, gpointe
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-void
-goa_util_add_account_info (GtkGrid *grid, gint row, GoaObject *object)
-{
-  GIcon *icon;
-  GoaAccount *account;
-  GtkWidget *image;
-  GtkWidget *label;
-  const gchar *icon_str;
-  const gchar *identity;
-  const gchar *name;
-  gchar *markup;
-
-  account = goa_object_peek_account (object);
-
-  icon_str = goa_account_get_provider_icon (account);
-  icon = g_icon_new_for_string (icon_str, NULL);
-  image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
-  g_object_unref (icon);
-  gtk_widget_set_halign (image, GTK_ALIGN_END);
-  gtk_widget_set_hexpand (image, TRUE);
-  gtk_widget_set_margin_bottom (image, 12);
-  gtk_grid_attach (grid, image, 0, row, 1, 1);
-
-  name = goa_account_get_provider_name (account);
-  identity = goa_account_get_presentation_identity (account);
-  markup = g_strdup_printf ("<b>%s</b>\n%s",
-                            name,
-                            (identity == NULL || identity[0] == '\0') ? "\xe2\x80\x94" : identity);
-  label = gtk_label_new (NULL);
-  gtk_label_set_markup (GTK_LABEL (label), markup);
-  gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
-  gtk_label_set_max_width_chars (GTK_LABEL (label), 24);
-  gtk_label_set_width_chars (GTK_LABEL (label), 24);
-  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
-  gtk_widget_set_margin_bottom (label, 12);
-  g_free (markup);
-  gtk_grid_attach (grid, label, 1, row, 3, 1);
-
-  return;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
 GtkWidget *
 goa_util_add_row_switch_from_keyfile_with_blurb (GtkGrid      *grid,
                                                  gint          row,
diff --git a/src/goabackend/goaprovider.h b/src/goabackend/goaprovider.h
index 1a59fbe..1a436aa 100644
--- a/src/goabackend/goaprovider.h
+++ b/src/goabackend/goaprovider.h
@@ -131,8 +131,6 @@ goa_util_lookup_keyfile_boolean (GoaObject    *object,
 void
 goa_util_account_notify_property_cb (GObject *object, GParamSpec *pspec, gpointer user_data);
 
-void       goa_util_add_account_info (GtkGrid *grid, gint row, GoaObject *object);
-
 GtkWidget *goa_util_add_row_switch_from_keyfile_with_blurb (GtkGrid      *grid,
                                                             gint          row,
                                                             GoaObject    *object,
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 727c663..5626683 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.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.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,6 +38,45 @@ static const SecretSchema secret_password_schema =
 };
 
 void
+goa_utils_account_add_header (GoaObject *object, GtkGrid *grid, gint row)
+{
+  GIcon *icon;
+  GoaAccount *account;
+  GtkWidget *image;
+  GtkWidget *label;
+  const gchar *icon_str;
+  const gchar *identity;
+  const gchar *name;
+  gchar *markup;
+
+  account = goa_object_peek_account (object);
+
+  icon_str = goa_account_get_provider_icon (account);
+  icon = g_icon_new_for_string (icon_str, NULL);
+  image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG);
+  g_object_unref (icon);
+  gtk_widget_set_halign (image, GTK_ALIGN_END);
+  gtk_widget_set_hexpand (image, TRUE);
+  gtk_widget_set_margin_bottom (image, 12);
+  gtk_grid_attach (grid, image, 0, row, 1, 1);
+
+  name = goa_account_get_provider_name (account);
+  identity = goa_account_get_presentation_identity (account);
+  markup = g_strdup_printf ("<b>%s</b>\n%s",
+                            name,
+                            (identity == NULL || identity[0] == '\0') ? "\xe2\x80\x94" : identity);
+  label = gtk_label_new (NULL);
+  gtk_label_set_markup (GTK_LABEL (label), markup);
+  gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+  gtk_label_set_max_width_chars (GTK_LABEL (label), 24);
+  gtk_label_set_width_chars (GTK_LABEL (label), 24);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_widget_set_margin_bottom (label, 12);
+  g_free (markup);
+  gtk_grid_attach (grid, label, 1, row, 3, 1);
+}
+
+void
 goa_utils_initialize_client_factory (void)
 {
   static gsize once_init_value = 0;
diff --git a/src/goabackend/goautils.h b/src/goabackend/goautils.h
index 83a5d70..9e5dfcc 100644
--- a/src/goabackend/goautils.h
+++ b/src/goabackend/goautils.h
@@ -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
@@ -38,6 +38,8 @@ G_BEGIN_DECLS
 
 typedef gpointer (*GoaPeekInterfaceFunc)   (GoaObject *);
 
+void             goa_utils_account_add_header (GoaObject *object, GtkGrid *grid, gint row);
+
 void             goa_utils_initialize_client_factory (void);
 
 gboolean         goa_utils_check_duplicate (GoaClient              *client,


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