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

thomas at sita.openmoko.org thomas at sita.openmoko.org
Wed Apr 18 18:35:57 CEST 2007


Author: thomas
Date: 2007-04-18 18:35:55 +0200 (Wed, 18 Apr 2007)
New Revision: 1795

Modified:
   trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-callbacks-ebook.c
   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.h
   trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-main.c
   trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c
Log:
* src/contacts-callbacks-ebook.c: (contacts_changed_cb):
* src/contacts-contact-pane.c: (field_changed),
(contacts_contact_pane_class_init):
* src/contacts-contact-pane.h:
* src/contacts-main.c:
* src/contacts-omoko.c: (create_main_window):

Add a cell-changed signal, and update fullname/mobile column in treeview on
reciveing the new changed signals. Fixes bug 474.


Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog	2007-04-18 14:29:38 UTC (rev 1794)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog	2007-04-18 16:35:55 UTC (rev 1795)
@@ -4,6 +4,18 @@
 	* src/contacts-contact-pane.c: (field_changed),
 	(contacts_contact_pane_class_init):
 	* src/contacts-contact-pane.h:
+	* src/contacts-main.c:
+	* src/contacts-omoko.c: (create_main_window):
+
+	Add a cell-changed signal, and update fullname/mobile column in treeview on
+	reciveing the new changed signals. Fixes bug 474.
+
+2007-04-18  Thomas Wood  <thomas at openedhand.com>
+
+	* src/contacts-callbacks-ebook.c: (contacts_changed_cb):
+	* src/contacts-contact-pane.c: (field_changed),
+	(contacts_contact_pane_class_init):
+	* src/contacts-contact-pane.h:
 	* src/contacts-omoko.c: (fullname_changed_cb),
 	(create_main_window):
 	Add a fullname-changed signal to the contact pane widget.

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-callbacks-ebook.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-callbacks-ebook.c	2007-04-18 14:29:38 UTC (rev 1794)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-callbacks-ebook.c	2007-04-18 16:35:55 UTC (rev 1795)
@@ -134,7 +134,7 @@
 
 		/* TODO: There's some funniness going on here... */
 		/* Replace contact */
-/*		g_object_unref (hash->contact);*/
+		g_object_unref (hash->contact);
 		hash->contact = g_object_ref (contact);
 		hash->contacts_data = data;
 		g_hash_table_steal (data->contacts_table, uid);

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-04-18 14:29:38 UTC (rev 1794)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.c	2007-04-18 16:35:55 UTC (rev 1795)
@@ -43,6 +43,7 @@
 
 enum {
   FULLNAME_CHANGED,
+  CELL_CHANGED,
   LAST_SIGNAL
 };
 
@@ -214,10 +215,12 @@
 
   if (info->vcard_field == EVC_FN)
   {
-    /* update treeview */
     g_signal_emit (pane, contacts_contact_pane_signals[FULLNAME_CHANGED], 0, pane->priv->contact);
   }
-
+  else if (info->vcard_field == EVC_TEL)
+  {
+    g_signal_emit (pane, contacts_contact_pane_signals[CELL_CHANGED], 0, pane->priv->contact);
+  }
   pane->priv->dirty = TRUE;
 }
 
@@ -823,7 +826,7 @@
   entry_quark = g_quark_from_static_string("contact-pane-entry");
 
 
-    contacts_contact_pane_signals[FULLNAME_CHANGED] = g_signal_new (("fullname-changed"),
+  contacts_contact_pane_signals[FULLNAME_CHANGED] = g_signal_new (("fullname-changed"),
       G_OBJECT_CLASS_TYPE (klass),
       G_SIGNAL_RUN_LAST,
       G_STRUCT_OFFSET (ContactsContactPaneClass, fullname_changed),
@@ -832,6 +835,16 @@
       G_TYPE_NONE, 1,
       E_TYPE_CONTACT);
 
+  contacts_contact_pane_signals[CELL_CHANGED] = g_signal_new (("cell-changed"),
+      G_OBJECT_CLASS_TYPE (klass),
+      G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (ContactsContactPaneClass, cell_changed),
+      NULL, NULL,
+      g_cclosure_marshal_VOID__OBJECT,
+      G_TYPE_NONE, 1,
+      E_TYPE_CONTACT);
+
+
 }
 
 static void

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.h	2007-04-18 14:29:38 UTC (rev 1794)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-contact-pane.h	2007-04-18 16:35:55 UTC (rev 1795)
@@ -58,6 +58,7 @@
 typedef struct {
   GtkVBoxClass parent_class;
   void (* fullname_changed) (ContactsContactPane *self, EContact *contact);
+  void (* cell_changed) (ContactsContactPane *self, EContact *contact);
 } ContactsContactPaneClass;
 
 GType contacts_contact_pane_get_type (void);

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-main.c	2007-04-18 14:29:38 UTC (rev 1794)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-main.c	2007-04-18 16:35:55 UTC (rev 1795)
@@ -136,7 +136,6 @@
 int
 main (int argc, char **argv)
 {
-	GError *error = NULL;
 	BaconMessageConnection *mc;
 #ifdef HAVE_GCONF
 	const char *search;

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c	2007-04-18 14:29:38 UTC (rev 1794)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c	2007-04-18 16:35:55 UTC (rev 1795)
@@ -37,11 +37,44 @@
 static void
 fullname_changed_cb (ContactsContactPane *pane, EContact *contact, ContactsData *data)
 {
-	GList *l = g_list_prepend (NULL, contact);
-	contacts_changed_cb (data->book_view, l, data);
-	g_list_free (l);
+	EContactListHash *hash;
+	gchar *name = NULL;
+	const gchar *uid;
+
+	uid = e_contact_get_const (contact, E_CONTACT_UID);
+	hash = g_hash_table_lookup (data->contacts_table, uid);
+	name = e_contact_get (contact, E_CONTACT_FULL_NAME);
+
+	if ((!name) || (g_utf8_strlen (name, -1) <= 0))
+	{
+		g_free (name);
+		name = g_strdup (_("Unnamed"));
+	}
+	gtk_list_store_set (data->contacts_liststore, &hash->iter, CONTACT_NAME_COL, name, -1);
+
+	g_free (name);
 }
 
+static void
+cell_changed_cb (ContactsContactPane *pane, EContact *contact, ContactsData *data)
+{
+	EContactListHash *hash;
+	gchar *cell = NULL;
+	const gchar *uid;
+
+	uid = e_contact_get_const (contact, E_CONTACT_UID);
+	hash = g_hash_table_lookup (data->contacts_table, uid);
+	cell = e_contact_get (contact, E_CONTACT_PHONE_MOBILE);
+
+	if (!cell)
+	{
+		cell = g_strdup ("");
+	}
+	gtk_list_store_set (data->contacts_liststore, &hash->iter, CONTACT_CELLPHONE_COL, cell, -1);
+
+	g_free (cell);
+}
+
 GtkWidget *
 create_contacts_list (ContactsData *data)
 {
@@ -213,6 +246,7 @@
 	ui->contact_pane = contacts_contact_pane_new();
 
 	g_signal_connect (ui->contact_pane, "fullname-changed", (GCallback) fullname_changed_cb, contacts_data);
+	g_signal_connect (ui->contact_pane, "cell-changed", (GCallback) cell_changed_cb, contacts_data);
 
 	contacts_contact_pane_set_editable (CONTACTS_CONTACT_PANE (ui->contact_pane), FALSE);
 	/* The book view is set later when we get it back */





More information about the commitlog mailing list