[gnome-online-accounts/wip/mail: 3/4] provider: Add goa_util_add_account_info_2
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/mail: 3/4] provider: Add goa_util_add_account_info_2
- Date: Wed, 13 Feb 2013 16:51:22 +0000 (UTC)
commit 924ca70c01934c14659fffa74c6f1b6afad36bd2
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Feb 13 15:10:57 2013 +0100
provider: Add goa_util_add_account_info_2
We should be using a single grid, not two, for arranging things in a
table. Currently goa_util_add_account_info does not do that, and
changing it would require changing the signature of the show_account
virtual method.
Lets temporarily add a new function to minimize the churn because we
are very close to the beta release.
src/goabackend/goaprovider.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/goabackend/goaprovider.h | 2 ++
2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index b768fb3..56823d9 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -978,6 +978,46 @@ goa_util_add_account_info (GtkGrid *left, GtkGrid *right, GoaObject *object)
return;
}
+void
+goa_util_add_account_info_2 (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_misc_set_alignment (GTK_MISC (image), 1.0, 0.5);
+ gtk_widget_set_margin_bottom (image, 12);
+ gtk_grid_attach (GTK_GRID (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_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_margin_bottom (label, 12);
+ g_free (markup);
+ gtk_grid_attach (GTK_GRID (grid), label, 1, row, 3, 1);
+
+ return;
+}
+
/* ---------------------------------------------------------------------------------------------------- */
GtkWidget *
diff --git a/src/goabackend/goaprovider.h b/src/goabackend/goaprovider.h
index 15a4b94..5f8b143 100644
--- a/src/goabackend/goaprovider.h
+++ b/src/goabackend/goaprovider.h
@@ -191,6 +191,8 @@ goa_util_account_notify_property_cb (GObject *object, GParamSpec *pspec, gpointe
void goa_util_add_account_info (GtkGrid *left, GtkGrid *right, GoaObject *object);
+void goa_util_add_account_info_2 (GtkGrid *grid, gint row, GoaObject *object);
+
GtkWidget *goa_util_add_row_switch_from_keyfile_with_blurb (GtkGrid *left,
GtkGrid *right,
GoaObject *object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]