Changeset 3468


Ignore:
Timestamp:
11/21/07 17:55:09 (6 years ago)
Author:
chris
Message:
  • 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)
Location:
trunk/src/target/OM-2007.2/applications/openmoko-messages2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog

    r3467 r3468  
     12007-11-21  Chris Lord  <chris@openedhand.com> 
     2 
     3        * src/sms-notes.c: (get_selected_contact), (page_hidden), 
     4        (sms_notes_data_func), (sms_notes_page_new): 
     5        * src/sms.h: 
     6        Add some code to show avatars/change justification depending on whether 
     7        a message was sent or received (unfinished) 
     8 
    192007-11-21  Chris Lord  <chris@openedhand.com> 
    210 
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c

    r3464 r3468  
    2424#include <libmokoui2/moko-search-bar.h> 
    2525#include <libebook/e-book.h> 
     26#include <string.h> 
    2627 
    2728static GdkColor alt_color; 
     
    4546        if (!gtk_tree_selection_get_selected (selection, &model, &iter)) 
    4647                return NULL; 
    47         gtk_tree_model_get (model, &iter, COL_UID, &uid, -1); 
     48        gtk_tree_model_get (model, &iter, COL_UID, &uid, 
     49                COL_ICON, &data->author_icon, -1); 
    4850         
    4951        if (!e_book_get_contact (data->ebook, uid, &contact, &error)) { 
     
    101103        gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON ( 
    102104                data->new_button), FALSE); 
     105        if (data->recipient_icon) { 
     106                g_object_unref (data->recipient_icon); 
     107                data->recipient_icon = NULL; 
     108        } 
    103109} 
    104110 
     
    209215                                 SmsData *data) 
    210216{ 
    211         gchar *author, *recipient, *body; 
     217        gchar *author, *recipient, *body, **categories; 
    212218        JanaTime *created, *modified; 
     219        gboolean outgoing = FALSE; 
     220        gint i; 
    213221         
    214222        gtk_tree_model_get (model, iter, 
     
    217225                JANA_GTK_NOTE_STORE_COL_BODY, &body, 
    218226                JANA_GTK_NOTE_STORE_COL_CREATED, &created, 
    219                 JANA_GTK_NOTE_STORE_COL_MODIFIED, &modified, -1); 
    220  
     227                JANA_GTK_NOTE_STORE_COL_MODIFIED, &modified, 
     228                JANA_GTK_NOTE_STORE_COL_CATEGORIES, &categories, -1); 
     229 
     230        if (categories) for (i = 0; categories[i]; i++) { 
     231                /* Note that this category is not meant for display and  
     232                 * shouldn't be translated... (see phone-kit) 
     233                 */ 
     234                if ((strcmp (categories[i], "Sent") == 0) || 
     235                    (strcmp (categories[i], "Sending") == 0) || 
     236                    (strcmp (categories[i], "Rejected") == 0)) { 
     237                        outgoing = TRUE; 
     238                        break; 
     239                } 
     240        } 
     241         
    221242        g_object_set (cell, 
    222243                "author", author, 
     
    224245                "body", body, 
    225246                "created", created, 
    226                 "modified", modified, NULL); 
     247                "modified", modified, 
     248                "justify", outgoing ? 
     249                      GTK_JUSTIFY_LEFT : GTK_JUSTIFY_RIGHT, 
     250                "icon", outgoing ? 
     251                      data->author_icon : data->recipient_icon, 
     252                NULL); 
    227253         
    228254        g_free (author); 
    229255        g_free (recipient); 
    230256        g_free (body); 
     257        g_strfreev (categories); 
    231258        if (created) g_object_unref (created); 
    232259        if (modified) g_object_unref (modified); 
     
    248275        GHashTable *colours_hash; 
    249276         
     277        /* FIXME: Set recipient pixbuf */ 
     278        data->recipient_icon = g_object_ref (data->no_photo); 
     279         
    250280        /* Create note store */ 
    251281        data->notes = jana_ecal_store_new (JANA_COMPONENT_NOTE); 
     
    260290        colours_hash = g_hash_table_new (g_str_hash, g_str_equal); 
    261291        g_hash_table_insert (colours_hash, "Sent", &alt_color); 
     292        g_hash_table_insert (colours_hash, "Sending", &alt_color); 
    262293         
    263294        /* Create treeview and cell renderer */ 
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h

    r3464 r3468  
    4848        GtkWidget *sms_hbox; 
    4949        GtkWidget *sms_textview; 
     50        GdkPixbuf *author_icon; 
     51        GdkPixbuf *recipient_icon; 
    5052 
    5153        GtkWidget *contacts_treeview; 
Note: See TracChangeset for help on using the changeset viewer.