r3468 - in trunk/src/target/OM-2007.2/applications/openmoko-messages2: . src

chris at sita.openmoko.org chris at sita.openmoko.org
Wed Nov 21 17:55:11 CET 2007


Author: chris
Date: 2007-11-21 17:55:09 +0100 (Wed, 21 Nov 2007)
New Revision: 3468

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h
Log:
        * src/sms-notes.c: (get_selected_contact), (page_hidden),
        (sms_notes_data_func), (sms_notes_page_new):
        * src/sms.h:
        Add some code to show avatars/change justification depending on whether
        a message was sent or received (unfinished)


Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog	2007-11-21 16:11:23 UTC (rev 3467)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog	2007-11-21 16:55:09 UTC (rev 3468)
@@ -1,5 +1,13 @@
 2007-11-21  Chris Lord  <chris at openedhand.com>
 
+	* src/sms-notes.c: (get_selected_contact), (page_hidden),
+	(sms_notes_data_func), (sms_notes_page_new):
+	* src/sms.h:
+	Add some code to show avatars/change justification depending on whether
+	a message was sent or received (unfinished)
+
+2007-11-21  Chris Lord  <chris at openedhand.com>
+
 	* src/sms-contacts.c: (contacts_iter_compare_func),
 	(sms_contacts_page_new):
 	Add a sort function for the contacts

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c	2007-11-21 16:11:23 UTC (rev 3467)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c	2007-11-21 16:55:09 UTC (rev 3468)
@@ -23,6 +23,7 @@
 #include <libmokoui2/moko-finger-scroll.h>
 #include <libmokoui2/moko-search-bar.h>
 #include <libebook/e-book.h>
+#include <string.h>
 
 static GdkColor alt_color;
 static gboolean hidden = TRUE;
@@ -44,7 +45,8 @@
 	
 	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
 		return NULL;
-	gtk_tree_model_get (model, &iter, COL_UID, &uid, -1);
+	gtk_tree_model_get (model, &iter, COL_UID, &uid,
+		COL_ICON, &data->author_icon, -1);
 	
 	if (!e_book_get_contact (data->ebook, uid, &contact, &error)) {
 		g_warning ("Error retrieving contact: %s", error->message);
@@ -100,6 +102,10 @@
 		data->note_store), NULL);
 	gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (
 		data->new_button), FALSE);
+	if (data->recipient_icon) {
+		g_object_unref (data->recipient_icon);
+		data->recipient_icon = NULL;
+	}
 }
 
 static void
@@ -208,26 +214,47 @@
 				 GtkTreeIter *iter,
 				 SmsData *data)
 {
-	gchar *author, *recipient, *body;
+	gchar *author, *recipient, *body, **categories;
 	JanaTime *created, *modified;
+	gboolean outgoing = FALSE;
+	gint i;
 	
 	gtk_tree_model_get (model, iter,
 		JANA_GTK_NOTE_STORE_COL_AUTHOR, &author,
 		JANA_GTK_NOTE_STORE_COL_RECIPIENT, &recipient,
 		JANA_GTK_NOTE_STORE_COL_BODY, &body,
 		JANA_GTK_NOTE_STORE_COL_CREATED, &created,
-		JANA_GTK_NOTE_STORE_COL_MODIFIED, &modified, -1);
+		JANA_GTK_NOTE_STORE_COL_MODIFIED, &modified,
+		JANA_GTK_NOTE_STORE_COL_CATEGORIES, &categories, -1);
 
+	if (categories) for (i = 0; categories[i]; i++) {
+		/* Note that this category is not meant for display and 
+		 * shouldn't be translated... (see phone-kit)
+		 */
+		if ((strcmp (categories[i], "Sent") == 0) ||
+		    (strcmp (categories[i], "Sending") == 0) ||
+		    (strcmp (categories[i], "Rejected") == 0)) {
+			outgoing = TRUE;
+			break;
+		}
+	}
+	
 	g_object_set (cell,
 		"author", author,
 		"recipient", recipient,
 		"body", body,
 		"created", created,
-		"modified", modified, NULL);
+		"modified", modified,
+		"justify", outgoing ?
+		      GTK_JUSTIFY_LEFT : GTK_JUSTIFY_RIGHT,
+		"icon", outgoing ?
+		      data->author_icon : data->recipient_icon,
+		NULL);
 	
 	g_free (author);
 	g_free (recipient);
 	g_free (body);
+	g_strfreev (categories);
 	if (created) g_object_unref (created);
 	if (modified) g_object_unref (modified);
 }
@@ -247,6 +274,9 @@
 	GtkCellRenderer *renderer;
 	GHashTable *colours_hash;
 	
+	/* FIXME: Set recipient pixbuf */
+	data->recipient_icon = g_object_ref (data->no_photo);
+	
 	/* Create note store */
 	data->notes = jana_ecal_store_new (JANA_COMPONENT_NOTE);
 	g_signal_connect (data->notes, "opened",
@@ -259,6 +289,7 @@
 	/* Create a category-colour hash for the cell renderer */
 	colours_hash = g_hash_table_new (g_str_hash, g_str_equal);
 	g_hash_table_insert (colours_hash, "Sent", &alt_color);
+	g_hash_table_insert (colours_hash, "Sending", &alt_color);
 	
 	/* Create treeview and cell renderer */
 	treeview = gtk_tree_view_new_with_model (data->note_filter);

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h	2007-11-21 16:11:23 UTC (rev 3467)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h	2007-11-21 16:55:09 UTC (rev 3468)
@@ -47,6 +47,8 @@
 	GtkWidget *notes_combo;
 	GtkWidget *sms_hbox;
 	GtkWidget *sms_textview;
+	GdkPixbuf *author_icon;
+	GdkPixbuf *recipient_icon;
 
 	GtkWidget *contacts_treeview;
 	GtkWidget *contacts_combo;





More information about the commitlog mailing list