r1164 - in trunk/src/target/OM-2007/applications/openmoko-contacts: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Wed Feb 28 16:28:27 CET 2007


Author: thomas
Date: 2007-02-28 16:28:25 +0100 (Wed, 28 Feb 2007)
New Revision: 1164

Modified:
   trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
Log:
* src/contacts-contact-pane.c: (make_widget): Set a widget name for the field
label
(contacts_contact_pane_set_editable): Save the contact when switching to view
mode


Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog	2007-02-28 15:15:37 UTC (rev 1163)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog	2007-02-28 15:28:25 UTC (rev 1164)
@@ -1,3 +1,10 @@
+2007-02-28  Thomas Wood  <thomas at openedhand.com>
+
+	* src/contacts-contact-pane.c: (make_widget): Set a widget name for the field
+	label
+	(contacts_contact_pane_set_editable): Save the contact when switching to view
+	mode
+
 2007-02-25  Thomas Wood  <thomas at openedhand.com>
 
 	* src/contacts-contact-pane.c: (make_widget): Support custom field types

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c	2007-02-28 15:15:37 UTC (rev 1163)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c	2007-02-28 15:28:25 UTC (rev 1164)
@@ -70,7 +70,7 @@
 
 static FieldInfo fields[] = {
   { EVC_FN, "Name", NULL, TRUE, "<big><b>%s</b></big>", NULL },
-  { EVC_ORG, "Organization", NULL, TRUE, "<span size=\"x-small\">%s</span>", NULL },
+  { EVC_ORG, "Organization", NULL, TRUE, "<span size=\"small\">%s</span>", NULL },
   { EVC_EMAIL, "E-Mail", "stock_mail", FALSE, NULL, email_types },
   { EVC_TEL, "Telephone", NULL, FALSE, NULL, phone_types },
   { EVC_X_JABBER, "Jabber", GTK_STOCK_MISSING_IMAGE, FALSE, NULL, email_types },
@@ -78,6 +78,7 @@
 
 /* Function prototypes */
 static GtkWidget * make_widget (ContactsContactPane *pane, EVCardAttribute *attr, FieldInfo *info, GtkSizeGroup *size);
+static void on_commit_cb (EBook *book, EBookStatus status, gpointer closure);
 /*
  * TODO: 
  * - add EBookView and listen for changes
@@ -400,6 +401,7 @@
   if (!info->unique && !pane->priv->editable) {
     s = g_strdup_printf ("%s:", type);
     type_label = gtk_label_new (s);
+    gtk_widget_set_name (type_label, "fieldlabel");
     if (size)
       gtk_size_group_add_widget (size, type_label);
     gtk_box_pack_start (GTK_BOX (box), type_label, FALSE, FALSE, 4);
@@ -679,9 +681,17 @@
   if (pane->priv->editable != editable) {
     pane->priv->editable = editable;
 
-    /* strip empty attributes */
-    if (editable == FALSE && pane->priv->contact)
+    /* strip empty attributes and save the contact if we're switching to view
+     * mode
+     */
+    if (editable == FALSE && pane->priv->contact) {
       strip_empty_attributes (E_VCARD (pane->priv->contact));
+      if (pane->priv->dirty && pane->priv->bookview) {
+        e_book_async_commit_contact (e_book_view_get_book (pane->priv->bookview),
+                                     pane->priv->contact,
+                                     on_commit_cb, pane);
+      }
+    }
 
     update_ui (pane);
   }





More information about the commitlog mailing list