soylent r93 - trunk/src



Author: treitter
Date: Sat Mar  8 06:21:37 2008
New Revision: 93
URL: http://svn.gnome.org/viewvc/soylent?rev=93&view=rev

Log:
Cut commented code from the last commit

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	Sat Mar  8 06:21:37 2008
@@ -1694,10 +1694,6 @@
 static gboolean
 detail_add_person_add_mail_attrs (SoylentBrowser *browser,
                                   const gchar *param_val)
-/*
-detail_add_person_add_attr (SoylentBrowser *browser, const gchar *attr_name,
-                            const gchar *param_val)
-                            */
 {
   gboolean retval = FALSE;
   GladeXML *wtree = NULL;
@@ -1715,8 +1711,6 @@
     {
       EContactAddress *addr = NULL;
 
-      g_debug ("\n%s\n", e_vcard_to_string (e_vcard, EVC_FORMAT_VCARD_30));
-
       addr = g_new (EContactAddress, 1);
       if (addr)
         {
@@ -1729,12 +1723,7 @@
           GtkEntry *entry_add_country = NULL;
           GtkTextIter start;
           GtkTextIter end;
-          EVCardAttribute *attr = NULL;
-
-          /*
-          GtkEntry *entry_add = NULL;
-          const gchar *attr_val = NULL;
-          */
+          EVCardAttribute *attr_adr = NULL;
 
           entry_add_po = GTK_ENTRY (glade_xml_get_widget
                                                   (wtree,
@@ -1771,56 +1760,43 @@
           addr->country = g_strdup (gtk_entry_get_text (entry_add_country));
           addr->code = g_strdup (gtk_entry_get_text (entry_add_code));
 
-      /*
-          entry_add = GTK_ENTRY (glade_xml_get_widget (wtree, "entry_detail_add"));
-          attr_val = gtk_entry_get_text (entry_add);      
-          */
-
-
-          attr = e_vcard_attribute_new (NULL, EVC_ADR);
-          if (attr)
+          /* Create the multi-field VCard "ADR" address entry */
+          attr_adr = e_vcard_attribute_new (NULL, EVC_ADR);
+          if (attr_adr)
             {
               EVCardAttributeParam *param = NULL;
+              EVCardAttribute *attr_label = NULL;
 
               if (param_val)
                 {
                   param = e_vcard_attribute_param_new (EVC_TYPE);
-                  e_vcard_attribute_add_param_with_value (attr, param,
+                  e_vcard_attribute_add_param_with_value (attr_adr, param,
                                                           param_val);
                 }
 
-              e_vcard_add_attribute_with_values (e_vcard, attr, addr->po, "",
-                                                 addr->street, addr->locality,
-                                                 addr->region, addr->code,
-                                                 addr->country, NULL);
-
-              /* XXX: do we need to free attr and param here? */
-              attr = e_vcard_attribute_new (NULL, "LABEL");
-              if (attr)
+              e_vcard_add_attribute_with_values (e_vcard, attr_adr, addr->po,
+                                                 "", addr->street,
+                                                 addr->locality, addr->region,
+                                                 addr->code, addr->country,
+                                                 NULL);
+
+              /* Create the single-string VCard "LABEL" address entry */
+              attr_label = e_vcard_attribute_new (NULL, "LABEL");
+              if (attr_label)
                 {
                   if (param)
                     {
                       e_vcard_attribute_add_param
-                                        (attr,
+                                        (attr_label,
                                          e_vcard_attribute_param_copy (param));
                     }
                   e_vcard_add_attribute_with_value
-                                            (e_vcard, attr,
+                                            (e_vcard, attr_label,
                                              e_contact_address_to_label (addr));
                 }
 
               e_contact_address_free (addr);
 
-
-
-
-      /* XXX: do we need to free attr and param here? */
-
-      /*
-              vcard = E_VCARD (soylent_browser_get_selected_person_e_contact (browser));
-              e_vcard_add_attribute_with_value (vcard, attr, attr_val);
-              */
-
               retval = TRUE;
             }
         }
@@ -1829,97 +1805,6 @@
   return retval;
 }
 
-#if 0
-/* Save a new mailing address for the person being edited
- *
- * Return TRUE for success, FALSE for any failure. */
-static gboolean
-detail_add_person_add_mail_attrs (SoylentBrowser *browser,
-                                  const gchar *param_val)
-{
-  GladeXML *wtree = NULL;
-  EVCard *vcard = NULL;
-  EVCardAttribute *attr = NULL;
-  EVCardAttributeParam *param = NULL;
-  EContactAddress *addr = NULL;
-  GtkTextView *tv_add_street = NULL;
-  GtkTextBuffer *tb_add_street = NULL;
-  GtkEntry *entry_add_po = NULL;
-  GtkEntry *entry_add_locality = NULL;
-  GtkEntry *entry_add_region = NULL;
-  GtkEntry *entry_add_code = NULL;
-  GtkEntry *entry_add_country = NULL;
-  GtkTextIter start;
-  GtkTextIter end;
-
-  g_return_val_if_fail (browser != NULL, retval);
-  /* FIXME: uncomment once SoylentBrowser is a GObject:
-  g_return_val_if_fail (SOYLENT_IS_BROWSER (browser), NULL);
-   */
-
-  wtree = soylent_browser_get_widget_tree (browser);
-
-  attr = e_vcard_attribute_new (NULL, EVC_ADR);
-  addr = g_new (EContactAddress, 1);
-  tv_add_street = GTK_TEXT_VIEW (glade_xml_get_widget (wtree,
-                                                  "tv_person_mail_add_street"));
-  tb_add_street = gtk_text_view_get_buffer (tv_add_street);
-  entry_add_po       = GTK_ENTRY (glade_xml_get_widget (wtree,
-                                                  "entry_person_mail_add_po"));
-  entry_add_locality = GTK_ENTRY (glade_xml_get_widget (wtree,
-                                            "entry_person_mail_add_locality"));
-  entry_add_region   = GTK_ENTRY (glade_xml_get_widget (wtree,
-                                              "entry_person_mail_add_region"));
-  entry_add_code     = GTK_ENTRY (glade_xml_get_widget (wtree,
-                                                "entry_person_mail_add_code"));
-  entry_add_country  = GTK_ENTRY (glade_xml_get_widget (wtree,
-                                              "entry_person_mail_add_country"));
-  
-  gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (tb_add_street), &start, &end);
-  /* next two are dummy - just so the e_contact_address_free() below doesn't
-   * cause a segfault */
-  addr->address_format  = g_strdup ("");
-  addr->ext             = g_strdup ("");
-  addr->po        = g_strdup (gtk_entry_get_text (entry_add_po));
-  addr->street    = g_strdup (gtk_text_buffer_get_text (tb_add_street, &start,
-                                                        &end, FALSE));
-  addr->locality  = g_strdup (gtk_entry_get_text (entry_add_locality));
-  addr->region    = g_strdup (gtk_entry_get_text (entry_add_region));
-  addr->country   = g_strdup (gtk_entry_get_text (entry_add_country));
-  addr->code      = g_strdup (gtk_entry_get_text (entry_add_code));
-
-  param = e_vcard_attribute_param_new (EVC_TYPE);
-
-  if (!param_val)
-    {
-      GtkComboBox *cbox_type = NULL;
-      gchar *param_val_lc = NULL;
-
-      cbox_type = GTK_COMBO_BOX (glade_xml_get_widget (wtree,
-                                                       "cbox_detail_type"));
-      param_val_lc = gtk_combo_box_get_active_text (cbox_type);
-      param_val = g_ascii_strup (param_val_lc, -1);
-
-      g_free (param_val_lc);
-    }
-
-  e_vcard_attribute_add_param_with_value (attr, param, param_val);
-  vcard = E_VCARD (soylent_browser_get_selected_person_e_contact (browser));
-  e_vcard_add_attribute_with_values (vcard, attr, addr->po, "", addr->street,
-                                     addr->locality, addr->region,
-                                     addr->code, addr->country, NULL);
-
-  /* XXX: do we need to free attr and param here? */
-  attr = e_vcard_attribute_new (NULL, "LABEL");
-  e_vcard_attribute_add_param (attr, e_vcard_attribute_param_copy (param));
-  e_vcard_add_attribute_with_value (vcard, attr,
-                                    e_contact_address_to_label (addr));
-  e_contact_address_free (addr);
-
-  /* XXX: do we need to free attr and param here? */
-}
-#endif
-
 /* Save edits to the current person's existing details */
 static gboolean
 person_apply_edits_from_widgets_switch (gpointer key, gpointer value,



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