soylent r175 - trunk/src



Author: treitter
Date: Mon Jun 23 03:55:07 2008
New Revision: 175
URL: http://svn.gnome.org/viewvc/soylent?rev=175&view=rev

Log:
pull out name field prep as well

Modified:
   trunk/src/soylent-browser-person-view.c

Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c	(original)
+++ trunk/src/soylent-browser-person-view.c	Mon Jun 23 03:55:07 2008
@@ -1256,6 +1256,34 @@
   return retval;
 }
 
+/* Add name field changes to selected EContact (but do not commit) */
+static gboolean
+soylent_browser_person_view_save_changes_prep_name (SoylentBrowser *browser,
+                                                    EContact *e_contact)
+{
+  gboolean retval = FALSE;
+  GladeXML *wtree = NULL;
+  gchar *contents_new = NULL;
+  GtkEntry *entry_name = NULL;
+
+  g_return_val_if_fail (browser, retval);
+  /* FIXME: uncomment once SoylentBrowser is a GObject:
+  g_return_val_if_fail (SOYLENT_IS_BROWSER (browser), retval);
+   */
+
+  wtree = soylent_browser_get_widget_tree (browser);
+  entry_name = GTK_ENTRY (glade_xml_get_widget (wtree, "entry_person_name")); 
+
+  contents_new = g_strdup (gtk_entry_get_text (entry_name));
+  retval = soylent_browser_person_set_field_simple (e_contact,
+                                                    E_CONTACT_FULL_NAME,
+                                                    contents_new);
+
+  g_free (contents_new);
+
+  return retval;
+}
+
 /* Add email field changes to selected EContact (but do not commit) */
 static gboolean
 soylent_browser_person_view_save_changes_prep_email (SoylentBrowser *browser,
@@ -1427,25 +1455,7 @@
   /* TODO: make this one of the parameters instead */
   e_contact = soylent_browser_get_selected_person_e_contact (browser);
 
-  /* Prep the name field (and its multiple vCard fields) for saving */
-  {
-    gchar *contents_new = NULL;
-    GtkEntry *entry_name = NULL;
-
-    entry_name = GTK_ENTRY (glade_xml_get_widget (wtree, "entry_person_name")); 
-
-    contents_new = g_strdup (gtk_entry_get_text (entry_name));
-    /* Ensure name is set to something useful, to prevent blanking the name the
-     * first time it's edited */
-    if (contents_new && !g_str_equal (contents_new, ""))
-      {
-        soylent_browser_person_set_field_simple (e_contact, E_CONTACT_FULL_NAME,
-                                                 contents_new);
-      }
-
-    g_free (contents_new);
-  }
-
+  soylent_browser_person_view_save_changes_prep_name (browser, e_contact);
   soylent_browser_person_view_save_changes_prep_email (browser, e_contact);
 
   /* Prep the phone numbers for saving */



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