soylent r89 - trunk/src
- From: treitter svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r89 - trunk/src
- Date: Thu, 6 Mar 2008 05:45:35 +0000 (GMT)
Author: treitter
Date: Thu Mar 6 05:45:34 2008
New Revision: 89
URL: http://svn.gnome.org/viewvc/soylent?rev=89&view=rev
Log:
begin cleaning up commit_detail_add()
Modified:
trunk/src/soylent-browser-person-view.c
trunk/src/soylent-browser-person-view.h
Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c (original)
+++ trunk/src/soylent-browser-person-view.c Thu Mar 6 05:45:34 2008
@@ -643,6 +643,113 @@
return retval;
}
+gboolean
+soylent_browser_detail_add_get_attr_val_email (SoylentBrowser *browser,
+ gchar **attr, gchar **val)
+{
+ gboolean retval = FALSE;
+ GladeXML *wtree = NULL;
+
+ g_return_val_if_fail (browser != NULL, retval);
+ /* FIXME: uncomment once SoylentBrowser is a GObject:
+ g_return_val_if_fail (SOYLENT_IS_BROWSER (user_data), NULL);
+ */
+ g_return_val_if_fail (attr != NULL, retval);
+ g_return_val_if_fail (val != NULL, retval);
+
+ wtree = soylent_browser_get_widget_tree (browser);
+
+ /* Fill the parameter value with the IM protocol name */
+ {
+ GtkComboBox *cbox_type = NULL;
+ gchar *val_lc = NULL;
+
+ cbox_type = GTK_COMBO_BOX (glade_xml_get_widget (wtree,
+ "cbox_detail_type"));
+ val_lc = gtk_combo_box_get_active_text (cbox_type);
+ /* eg, HOME, WORK, OTHER */
+ *val = g_ascii_strup (val_lc, -1);
+
+ g_free (val_lc);
+ }
+
+ *attr = g_strdup ("EMAIL");
+ if (*attr && *val)
+ {
+ retval = TRUE;
+ }
+ else
+ {
+ g_free (*attr);
+ g_free (*val);
+ }
+
+ return retval;
+}
+
+gboolean
+soylent_browser_detail_add_get_attr_val_im (SoylentBrowser *browser,
+ gchar **attr, gchar **val)
+{
+ gboolean retval = FALSE;
+ GladeXML *wtree = NULL;
+
+ g_return_val_if_fail (browser != NULL, retval);
+ /* FIXME: uncomment once SoylentBrowser is a GObject:
+ g_return_val_if_fail (SOYLENT_IS_BROWSER (user_data), NULL);
+ */
+ g_return_val_if_fail (attr != NULL, retval);
+ g_return_val_if_fail (val != NULL, retval);
+
+ wtree = soylent_browser_get_widget_tree (browser);
+
+ /* Fill in the attribute name */
+ {
+ GtkComboBox *cbox_proto = NULL;
+ gchar *proto = NULL;
+ gchar *proto_uc = NULL;
+
+ cbox_proto = GTK_COMBO_BOX (glade_xml_get_widget (wtree,
+ "cbox_detail_proto"));
+ proto = gtk_combo_box_get_active_text (cbox_proto);
+ proto_uc = g_ascii_strup (proto, -1);
+
+ *attr = g_strdup_printf ("X-%s", proto_uc);
+
+ g_free (proto);
+ g_free (proto_uc);
+ }
+
+ /* Fill the parameter value with the IM protocol name */
+ {
+ GtkComboBox *cbox_type = NULL;
+ gchar *val_lc = NULL;
+
+ cbox_type = GTK_COMBO_BOX (glade_xml_get_widget (wtree,
+ "cbox_detail_type"));
+ val_lc = gtk_combo_box_get_active_text (cbox_type);
+ /* eg, HOME, WORK, OTHER */
+ *val = g_ascii_strup (val_lc, -1);
+
+ g_free (val_lc);
+ }
+
+ if (*attr && *val)
+ {
+ retval = TRUE;
+ }
+ else
+ {
+ g_free (*attr);
+ g_free (*val);
+ }
+
+ return retval;
+}
+
+
+
+/* FIXME: make this boolean */
/* Commit any new details to the person being edited */
void
commit_detail_add (GtkWidget *widget, gpointer user_data)
@@ -669,23 +776,15 @@
if (g_str_equal (domain, "Email"))
{
- attr_name = g_strdup ("EMAIL");
+ /* FIXME: check the return value */
+ soylent_browser_detail_add_get_attr_val_email (browser, &attr_name,
+ ¶m_val);
}
else if (g_str_equal (domain, "Instant Messaging"))
{
- GtkComboBox *cbox_proto = NULL;
- gchar *proto = NULL;
- gchar *proto_uc = NULL;
-
- cbox_proto = GTK_COMBO_BOX (glade_xml_get_widget (wtree,
- "cbox_detail_proto"));
- proto = gtk_combo_box_get_active_text (cbox_proto);
- proto_uc = g_ascii_strup (proto, -1);
-
- attr_name = g_strdup_printf ("X-%s", proto_uc);
-
- g_free (proto);
- g_free (proto_uc);
+ /* FIXME: check the return value */
+ soylent_browser_detail_add_get_attr_val_im (browser, &attr_name,
+ ¶m_val);
}
else if (g_str_equal (domain, "Phone"))
{
@@ -1616,6 +1715,8 @@
/* TODO: Also need to set TYPE=VOICE for phone, etc. */
param = e_vcard_attribute_param_new (EVC_TYPE);
+ /* FIXME: this special-case code is really ugly; push it into the appropriate
+ * detail_add_get_attr_val_*() functions */
if (!param_val)
{
GtkComboBox *cbox_type = GTK_COMBO_BOX (glade_xml_get_widget (wtree,
Modified: trunk/src/soylent-browser-person-view.h
==============================================================================
--- trunk/src/soylent-browser-person-view.h (original)
+++ trunk/src/soylent-browser-person-view.h Thu Mar 6 05:45:34 2008
@@ -67,6 +67,11 @@
gboolean entry_changed_e_contact (GtkEditable *editable, gpointer user_data);
/* Committing changes from the above functions */
+gboolean soylent_browser_detail_add_get_attr_val_email (SoylentBrowser *browser,
+ gchar **attr,
+ gchar **val);
+gboolean soylent_browser_detail_add_get_attr_val_im (SoylentBrowser *browser,
+ gchar **attr, gchar **val);
void commit_detail_add (GtkWidget *widget, gpointer user_data);
/* Setup/update sections of the person view UI with latest data from e-d-s */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]