Changeset 3918


Ignore:
Timestamp:
01/22/08 16:07:45 (5 years ago)
Author:
chris
Message:
  • src/sms.h:
  • src/sms-contacts.c: (sms_contacts_page_new): Store the MokoFingerScroll? the treeview is placed in
  • src/sms-notes.c: (forward_clicked_cb): Show a contacts chooser for picking which contact to forward to
  • src/sms-utils.c: (sms_contact_picker_dialog):
  • src/sms-utils.h: Add a utility function to pop up a dialog with the contacts chooser from the contacts page
Location:
trunk/src/target/OM-2007.2/applications/openmoko-messages2
Files:
6 edited

Legend:

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

    r3868 r3918  
     12008-01-22  Chris Lord  <chris@openedhand.com> 
     2 
     3        * src/sms.h: 
     4        * src/sms-contacts.c: (sms_contacts_page_new): 
     5        Store the MokoFingerScroll the treeview is placed in 
     6 
     7        * src/sms-notes.c: (forward_clicked_cb): 
     8        Show a contacts chooser for picking which contact to forward to 
     9 
     10        * src/sms-utils.c: (sms_contact_picker_dialog): 
     11        * src/sms-utils.h: 
     12        Add a utility function to pop up a dialog with the contacts chooser 
     13        from the contacts page 
     14 
    1152008-01-17  Chris Lord  <chris@openedhand.com> 
    216 
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-contacts.c

    r3795 r3918  
    595595{ 
    596596        EBookQuery *qrys[(E_CONTACT_LAST_PHONE_ID-E_CONTACT_FIRST_PHONE_ID)+1]; 
    597         GtkWidget *contacts_combo, *scroll, *vbox; 
     597        GtkWidget *contacts_combo, *vbox; 
    598598        GtkTreeSelection *selection; 
    599599        GtkCellRenderer *renderer; 
     
    731731 
    732732        /* Pack treeview into a finger-scroll */ 
    733         scroll = moko_finger_scroll_new (); 
    734         gtk_container_add (GTK_CONTAINER (scroll), data->contacts_treeview); 
     733        data->contacts_scroll = moko_finger_scroll_new (); 
     734        gtk_container_add (GTK_CONTAINER (data->contacts_scroll), 
     735                data->contacts_treeview); 
    735736         
    736737        /* Pack widgets into vbox and return */ 
    737738        vbox = gtk_vbox_new (FALSE, 0); 
    738         gtk_box_pack_start (GTK_BOX (vbox), data->contacts_search, FALSE, TRUE, 0); 
    739         gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0); 
     739        gtk_box_pack_start (GTK_BOX (vbox), data->contacts_search, 
     740                FALSE, TRUE, 0); 
     741        gtk_box_pack_start (GTK_BOX (vbox), data->contacts_scroll, 
     742                TRUE, TRUE, 0); 
    740743        gtk_widget_show_all (vbox); 
    741744         
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c

    r3868 r3918  
    616616{ 
    617617        gchar *body; 
    618         GtkTreeIter iter; 
     618        GtkTreeIter iter, citer; 
    619619        GtkTreeModel *model; 
    620         GtkTreeSelection *selection; 
     620        GtkTreeSelection *selection, *cselection; 
    621621 
    622622        /* Fill in compose box with message text and call new */ 
     
    633633        g_free (body); 
    634634         
    635         /* TODO: Launch a contact-picker */ 
    636          
    637         gtk_notebook_set_current_page ( 
    638                 GTK_NOTEBOOK (data->notebook), SMS_PAGE_COMPOSE); 
     635        cselection = gtk_tree_view_get_selection ( 
     636                GTK_TREE_VIEW (data->contacts_treeview)); 
     637        if (cselection) 
     638                gtk_tree_selection_get_selected (cselection, NULL, &citer); 
     639         
     640        if (sms_contact_picker_dialog ( 
     641            data, "Choose a contact to forward to:")) { 
     642                gtk_notebook_set_current_page ( 
     643                        GTK_NOTEBOOK (data->notebook), SMS_PAGE_COMPOSE); 
     644        } else { 
     645                gtk_tree_selection_select_iter (cselection, &citer); 
     646        } 
    639647} 
    640648 
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-utils.c

    r3868 r3918  
    2222#include <string.h> 
    2323#include <libmokoui2/moko-search-bar.h> 
     24#include <libmokoui2/moko-finger-scroll.h> 
    2425#ifdef HAVE_CONFIG_H 
    2526#  include <config.h> 
     
    444445        return FALSE; 
    445446} 
     447 
     448gboolean 
     449sms_contact_picker_dialog (SmsData *data, const gchar *message) 
     450{ 
     451        GtkWidget *dialog, *scroll, *frame; 
     452        gint width, height; 
     453        gint result; 
     454         
     455        dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (data->window), 
     456                GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, 
     457                message); 
     458        gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); 
     459        gtk_button_box_set_layout (GTK_BUTTON_BOX ( 
     460                GTK_DIALOG (dialog)->action_area), GTK_BUTTONBOX_SPREAD); 
     461        gtk_window_get_size (GTK_WINDOW (data->window), &width, &height); 
     462        gtk_window_resize (GTK_WINDOW (dialog), width * 0.85, height * 0.85); 
     463         
     464        /* Remove the main contacts treeview from the contacts page and add it  
     465         * to this dialog... Bit hacky... 
     466         */ 
     467        g_object_ref (data->contacts_treeview); 
     468        gtk_container_remove (GTK_CONTAINER (data->contacts_treeview->parent), 
     469                data->contacts_treeview); 
     470         
     471        frame = gtk_frame_new (NULL); 
     472        scroll = moko_finger_scroll_new (); 
     473        gtk_container_add (GTK_CONTAINER (scroll), data->contacts_treeview); 
     474        gtk_container_add (GTK_CONTAINER (frame), scroll); 
     475        gtk_widget_show_all (frame); 
     476        gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), 
     477                frame, TRUE, TRUE, 0); 
     478        result = gtk_dialog_run (GTK_DIALOG (dialog)); 
     479         
     480        gtk_container_remove (GTK_CONTAINER (data->contacts_treeview->parent), 
     481                data->contacts_treeview); 
     482        gtk_container_add (GTK_CONTAINER (data->contacts_scroll), 
     483                data->contacts_treeview); 
     484        g_object_unref (data->contacts_treeview); 
     485         
     486        gtk_widget_destroy (dialog); 
     487         
     488        return (result == GTK_RESPONSE_OK) ? TRUE : FALSE; 
     489} 
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-utils.h

    r3868 r3918  
    3232gboolean sms_delete_selected_contact_messages (SmsData *data); 
    3333gboolean sms_select_contact (SmsData *data, const gchar *uid); 
     34gboolean sms_contact_picker_dialog (SmsData *data, const gchar *message); 
    3435 
    3536#endif /* SMS_UTILS_H */ 
  • trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h

    r3826 r3918  
    7070        guint notes_scroll_idle; 
    7171 
     72        GtkWidget *contacts_scroll; 
    7273        GtkWidget *contacts_treeview; 
    7374        GtkWidget *contacts_search; 
Note: See TracChangeset for help on using the changeset viewer.