diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-10 18:59:42 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-14 17:29:45 +0800 |
commit | 0a04322be34dcaecf2490b56f98a332a88947d9a (patch) | |
tree | fd77417a0a9b27620692d0a22f1805941edcf87e /libempathy-gtk/empathy-individual-widget.c | |
parent | e6e284c7dbcc97c007091b937837c94c47876922 (diff) | |
download | gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.tar gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.tar.gz gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.tar.bz2 gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.tar.lz gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.tar.xz gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.tar.zst gsoc2013-empathy-0a04322be34dcaecf2490b56f98a332a88947d9a.zip |
individual-widget: factor out add_row()
https://bugzilla.gnome.org/show_bug.cgi?id=663763
Diffstat (limited to 'libempathy-gtk/empathy-individual-widget.c')
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 3245f22ef..49e52861c 100644 --- a/libempathy-gtk/empathy-individual-widget.c +++ b/libempathy-gtk/empathy-individual-widget.c @@ -213,6 +213,21 @@ update_weak_contact (EmpathyIndividualWidget *self) } } +static void +add_row (GtkGrid *grid, + guint row, + GtkWidget *title, + GtkWidget *value) +{ + gtk_grid_attach (grid, title, 0, row, 1, 1); + gtk_misc_set_alignment (GTK_MISC (title), 0, 0.5); + gtk_widget_show (title); + + gtk_grid_attach (grid, value, 1, row, 1, 1); + gtk_misc_set_alignment (GTK_MISC (value), 0, 0.5); + gtk_widget_show (value); +} + static guint details_update_show (EmpathyIndividualWidget *self, TpContact *contact) @@ -229,7 +244,7 @@ details_update_show (EmpathyIndividualWidget *self, gchar *title; const gchar *value; EmpathyContactInfoFormatFunc format; - GtkWidget *w; + GtkWidget *title_widget, *value_widget; if (field->field_value == NULL || field->field_value[0] == NULL) continue; @@ -250,32 +265,25 @@ details_update_show (EmpathyIndividualWidget *self, /* Add Title */ title = empathy_contact_info_field_label (field->field_name, field->parameters); - w = gtk_label_new (title); - g_free (title); - gtk_grid_attach (GTK_GRID (priv->grid_details), - w, 0, n_rows, 1, 1); - gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5); - gtk_widget_show (w); + title_widget = gtk_label_new (title); /* Add Value */ - w = gtk_label_new (value); + value_widget = gtk_label_new (value); if (format != NULL) { gchar *markup; markup = format (field->field_value); - gtk_label_set_markup (GTK_LABEL (w), markup); + gtk_label_set_markup (GTK_LABEL (value_widget), markup); g_free (markup); } - gtk_label_set_selectable (GTK_LABEL (w), + gtk_label_set_selectable (GTK_LABEL (value_widget), (priv->flags & EMPATHY_INDIVIDUAL_WIDGET_FOR_TOOLTIP) ? FALSE : TRUE); - gtk_grid_attach (GTK_GRID (priv->grid_details), - w, 1, n_rows, 1, 1); - gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5); - gtk_widget_show (w); + add_row (GTK_GRID (priv->grid_details), n_rows, title_widget, + value_widget); n_rows++; } |