soylent r107 - trunk/src
- From: treitter svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r107 - trunk/src
- Date: Tue, 18 Mar 2008 06:09:54 +0000 (GMT)
Author: treitter
Date: Tue Mar 18 06:09:54 2008
New Revision: 107
URL: http://svn.gnome.org/viewvc/soylent?rev=107&view=rev
Log:
continued soylent-browser-person-view.c cleanup
Modified:
trunk/src/eds-utils.c
trunk/src/soylent-browser-person-view.c
Modified: trunk/src/eds-utils.c
==============================================================================
--- trunk/src/eds-utils.c (original)
+++ trunk/src/eds-utils.c Tue Mar 18 06:09:54 2008
@@ -83,6 +83,7 @@
retval = gdk_pixbuf_scale_simple (pixbuf, width, height,
GDK_INTERP_BILINEAR);
+ g_object_ref (G_OBJECT (retval));
}
else
{
Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c (original)
+++ trunk/src/soylent-browser-person-view.c Tue Mar 18 06:09:54 2008
@@ -2467,83 +2467,77 @@
proto < (E_CONTACT_IM_AIM + PROTO_NUM);
proto++)
{
-
for (context = CONTEXT_FIRST; context < CONTEXT_NUM; context++)
{
GList *im_attr_list = NULL;
GList *l = NULL;
im_attr_list = e_contact_get_attributes (e_contact, proto);
- for (l = im_attr_list; l; l = g_list_next(l))
+ for (l = im_attr_list;
+ l && entry_pos[context] < IM_FIELDS_PER_CONTEXT;
+ l = g_list_next(l))
{
- GtkHBox *hbox_im = NULL;
- GtkLabel *label_im = NULL;
- GtkEntry *entry_im = NULL;
- GList *param_type_value = NULL;
- gchar *widget_str = NULL;
-
- if (entry_pos[context] >= IM_FIELDS_PER_CONTEXT)
- {
- break;
- }
+ GList *param_type = NULL;
attr = l->data;
im_name = e_vcard_attribute_get_value (attr);
-
- param_type_value = e_vcard_attribute_get_param (attr,
- EVC_TYPE);
-
- widget_str = g_strdup_printf ("hbox_person_im_%s_%c",
- CONTEXT_STRS[context],
- '1' + entry_pos[context]);
- hbox_im = GTK_HBOX (glade_xml_get_widget (wtree, widget_str));
- g_free (widget_str);
+ param_type = e_vcard_attribute_get_param (attr, EVC_TYPE);
/* "HOME" is the catch-all, since that's how Evo does it */
- if ( (context != CONTEXT_HOME
- && !(param_type_value
- && (g_ascii_strcasecmp (param_type_value->data,
- CONTEXT_STRS[context])
- == 0)))
- || (context == CONTEXT_HOME
- && !(param_type_value
- && (g_ascii_strcasecmp
- (param_type_value->data,
- CONTEXT_STRS[CONTEXT_HOME])
- == 0))))
+ if ((context == CONTEXT_HOME)
+ || (param_type
+ && (g_ascii_strcasecmp (param_type->data,
+ CONTEXT_STRS[context]) == 0)))
{
- continue;
- }
-
- widget_str = g_strdup_printf ("entry_person_im_%s_%c",
- CONTEXT_STRS[context],
- '1' + entry_pos[context]);
-
- entry_im = GTK_ENTRY (glade_xml_get_widget (wtree,
- widget_str));
- g_free (widget_str);
-
- widget_str = g_strdup_printf ("label_person_im_%s_%c",
- CONTEXT_STRS[context],
- '1' + entry_pos[context]);
+ GtkHBox *hbox_im = NULL;
+ GtkLabel *label_im = NULL;
+ GtkEntry *entry_im = NULL;
+ gchar *widget_str = NULL;
+
+ widget_str = g_strdup_printf ("hbox_person_im_%s_%c",
+ CONTEXT_STRS[context],
+ '1' + entry_pos[context]);
+ hbox_im = GTK_HBOX (glade_xml_get_widget (wtree,
+ widget_str));
+ g_free (widget_str);
+
+ widget_str = g_strdup_printf ("entry_person_im_%s_%c",
+ CONTEXT_STRS[context],
+ '1' + entry_pos[context]);
+ entry_im = GTK_ENTRY (glade_xml_get_widget (wtree,
+ widget_str));
+ g_free (widget_str);
+
+ widget_str = g_strdup_printf ("label_person_im_%s_%c",
+ CONTEXT_STRS[context],
+ '1' + entry_pos[context]);
+ label_im = GTK_LABEL (glade_xml_get_widget (wtree,
+ widget_str));
+ g_free (widget_str);
+
+ if (im_name)
+ {
+ /* The IM attributes are named "X-<IM PROTO NAME>", so
+ * we're skipping the first two characters to get to
+ * the actual IM protocol name */
+ gtk_label_set_text
+ (label_im,
+ e_vcard_attribute_get_name (attr) + 2);
+ entry_set_text_block_handler
+ (entry_im, im_name,
+ soylent_browser_person_entry_changed_e_contact_cb);
- label_im = GTK_LABEL (glade_xml_get_widget (wtree,
- widget_str));
- g_free (widget_str);
+ gtk_widget_show (GTK_WIDGET (hbox_im));
+ }
- if (im_name)
+ entry_pos[context]++;
+ }
+ else
{
- gtk_label_set_text
- (label_im,
- e_vcard_attribute_get_name (attr) + 2);
- entry_set_text_block_handler
- (entry_im, im_name,
- soylent_browser_person_entry_changed_e_contact_cb);
-
- gtk_widget_show (GTK_WIDGET (hbox_im));
+ /* The current IM field TYPE isn't what we're handling in
+ * this loop and we aren't handling HOME (the fallback for
+ * unknown/mangled TYPEs) */
}
-
- entry_pos[context]++;
}
}
}
@@ -2610,7 +2604,9 @@
}
}
- /* FIXME: actually set this appropriately above */
+ /* If we got this far, we're handling a real person (whether they have any
+ * IM fields on record doesn't really change whether this function
+ * succeeded or not) */
retval = TRUE;
}
@@ -2654,11 +2650,15 @@
icon_width_max = soylent_browser_get_icon_width_max (browser);
pixbuf = gdk_pixbuf_from_inline_photo (photo, icon_width_max,
- icon_height_max);
+ icon_height_max);
if (pixbuf)
{
gtk_image_set_from_pixbuf (img_person_view, pixbuf);
gtk_widget_show (GTK_WIDGET (img_person_view));
+
+ g_object_unref (pixbuf);
+
+ retval = TRUE;
}
else
{
@@ -2668,11 +2668,9 @@
else
{
gtk_image_clear (img_person_view);
- /* FIXME - probably need to free the pixbuf and the photo */
- }
- /* FIXME: actually set this appropriately above */
- retval = TRUE;
+ retval = TRUE;
+ }
return retval;
}
@@ -2705,8 +2703,6 @@
e_contact = soylent_person_get_e_contact (person);
frame_mail = GTK_FRAME (glade_xml_get_widget (wtree, "frame_person_mail"));
- g_assert (GTK_IS_FRAME (frame_mail));
-
for (context = 0; context < CONTEXT_NUM; context++)
{
GtkTextView *tv_street = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]