Changeset 1880
- Timestamp:
- 04/30/07 18:20:27 (6 years ago)
- Location:
- trunk/src/target/OM-2007/applications/openmoko-dialer/src
- Files:
-
- 5 edited
-
dialer-main.c (modified) (3 diffs)
-
dialer-main.h (modified) (1 diff)
-
dialer-window-history.c (modified) (6 diffs)
-
dialer-window-history.h (modified) (1 diff)
-
moko-dialer-includes.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-main.c
r1857 r1880 181 181 182 182 /* application object */ 183 // MokoApplication* app = MOKO_APPLICATION(moko_application_get_instance());184 183 g_set_application_name ("OpenMoko Dialer"); 185 184 … … 189 188 g_signal_connect (G_OBJECT (conn), "incoming-call", (GCallback) incoming_call_cb, NULL); 190 189 g_signal_connect (G_OBJECT (conn), "incoming-clip", (GCallback) incoming_clip_cb, NULL); 190 191 /* Set up journal handling */ 192 p_dialer_data->journal = moko_journal_open_default (); 191 193 192 194 signal (SIGUSR1, handle_sigusr1); … … 207 209 208 210 209 //release everything 211 //release everything 210 212 contact_release_contact_list (&(p_dialer_data->g_contactlist)); 211 213 214 /* closes the journal and frees allocated memory */ 215 moko_journal_close (p_dialer_data->journal); 216 212 217 return 0; 213 218 } -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-main.h
r1857 r1880 18 18 #include "moko-dialer-includes.h" 19 19 #include <libmokogsmd/moko-gsmd-connection.h> 20 /* 20 #include <libmokojournal/moko-journal.h> 21 21 22 typedef struct _window_outgoing23 {24 25 MokoDialerStatus * status_outgoing;26 27 GtkWidget* window_outgoing;28 29 GtkWidget* buttonSpeaker;30 GtkWidget* buttonCancel;31 GtkWidget* buttonRedial;32 }WindowOutgoing;33 */34 22 typedef struct _dialer_data 35 23 { 36 24 //the global data area begins here 25 37 26 MokoGsmdConnection *connection; 27 MokoJournal *journal; 28 29 GtkListStore *history; 38 30 39 31 char str_sim_pin[MOKO_DIALER_MAX_PIN_LEN + 1]; -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.c
r1857 r1880 425 425 GtkTreeModel *model; 426 426 GtkTreeSelection *selection; 427 / *HISTORY_ENTRY*/void *p;428 int hasname;427 //HISTORY_ENTRY void *p; 428 //int hasname; 429 429 MokoDialerData *p_dialer_data = (MokoDialerData *) user_data; 430 430 … … 439 439 } 440 440 441 gtk_tree_model_get (model, &iter, COLUMN_ENTRYPOINTER, &p, -1);441 /*gtk_tree_model_get (model, &iter, COLUMN_ENTRYPOINTER, &p, -1); 442 442 443 443 //p_dialer_data->g_currentselected = p; … … 445 445 gtk_tree_model_get (model, &iter, COLUMN_HASNAME, &hasname, -1); 446 446 history_update_counter (p_dialer_data); 447 */ 447 448 448 449 } … … 588 589 GtkListStore *list_store; 589 590 590 // GtkTreeIter iter;591 // HISTORY_ENTRY *entry;592 593 //copied594 591 GtkTreeViewColumn *col; 595 592 GtkCellRenderer *renderer; 596 593 597 //GtkTreeModel *model;598 594 GtkWidget *contactview = NULL; 599 595 … … 606 602 if (contactview == NULL) 607 603 return 0; 608 //pack image and label 604 605 /* Create column with icon and text */ 609 606 col = gtk_tree_view_column_new (); 610 611 gtk_tree_view_column_set_title (col, ("Title"));612 gtk_tree_view_column_set_resizable (col, TRUE);613 614 615 607 616 608 renderer = gtk_cell_renderer_pixbuf_new (); 617 609 gtk_tree_view_column_pack_start (col, renderer, FALSE); 618 610 gtk_tree_view_column_set_attributes (col, renderer, 619 "pixbuf", COLUMN_TYPEICON, NULL); 620 621 renderer = gtk_cell_renderer_text_new (); 622 gtk_tree_view_column_pack_start (col, renderer, FALSE); 623 gtk_tree_view_column_set_attributes (col, renderer, 624 "text", COLUMN_TIME, NULL); 625 626 renderer = gtk_cell_renderer_text_new (); 627 gtk_tree_view_column_pack_start (col, renderer, FALSE); 628 gtk_tree_view_column_set_attributes (col, renderer, 629 "text", COLUMN_SEPRATE, NULL); 611 "icon-name", HISTORY_ICON_NAME_COLUMN, NULL); 630 612 631 613 renderer = gtk_cell_renderer_text_new (); 632 614 gtk_tree_view_column_pack_start (col, renderer, TRUE); 633 615 gtk_tree_view_column_set_attributes (col, renderer, 634 "text", COLUMN_NAME_NUMBER, NULL); 635 616 "text", HISTORY_DISPLAY_TEXT_COLUMN, NULL); 636 617 637 618 gtk_tree_view_append_column (GTK_TREE_VIEW (contactview), col); 638 619 639 620 640 //entry = p_dialer_data->g_historylist.first; 641 642 list_store = gtk_list_store_new (N_COLUMN, G_TYPE_INT, GDK_TYPE_PIXBUF, 643 G_TYPE_STRING, G_TYPE_STRING, 644 G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER, 645 G_TYPE_INT, -1); 646 //we will use a filter to facilitate the filtering in treeview without rebuilding the database. 621 /* Set up a list store for the history items */ 622 /* UID, DSTART, MISSED, DIRECTION */ 623 list_store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN, G_TYPE_INT); 624 625 626 //we will use a filter to facilitate the filtering in treeview without rebuilding the database. 647 627 p_dialer_data->g_list_store_filter = 648 628 gtk_tree_model_filter_new (GTK_TREE_MODEL (list_store), NULL); … … 654 634 655 635 //load the three icons to memory. 656 657 // GError *error = NULL;658 p_dialer_data->g_iconReceived = create_pixbuf ("received.png");659 660 /* FIXME: error handling hasn't been implemented yet!661 p_dialer_data->g_iconReceived = create_pixbuf ("received.png", &error);662 if (error)663 {664 DBG_WARN ("Cound not load icon :%s", error->message);665 g_error_free (error);666 p_dialer_data->g_iconReceived = NULL;667 error = NULL;668 }669 */670 671 p_dialer_data->g_iconDialed = create_pixbuf ("dialed.png");672 /* FIXME: error handling hasn't been implemented yet!673 p_dialer_data->g_iconDialed = create_pixbuf ("dialed.png", &error);674 if (error)675 {676 DBG_WARN ("Cound not load icon :%s", error->message);677 g_error_free (error);678 p_dialer_data->g_iconDialed = NULL;679 error = NULL;680 }681 */682 683 p_dialer_data->g_iconMissed = create_pixbuf ("missed.png");684 /* FIXME: error handling hasn't been implemented yet!685 p_dialer_data->g_iconMissed = create_pixbuf ("missed.png", &error);686 if (error)687 {688 DBG_WARN ("Cound not load icon :%s", error->message);689 g_error_free (error);690 p_dialer_data->g_iconMissed = NULL;691 error = NULL;692 }693 */694 #if 0695 while (entry)696 {697 //DBG_MESSAGE(entry->number);698 gtk_list_store_append (list_store, &iter);699 gtk_list_store_set (list_store, &iter, COLUMN_TYPE, entry->type,700 COLUMN_SEPRATE, "--", COLUMN_TIME, entry->time,701 COLUMN_DURATION, entry->durationsec,702 COLUMN_ENTRYPOINTER, entry, COLUMN_HASNAME, 0, -1);703 if (entry->name == 0)704 {705 //DBG_MESSAGE(entry->number);706 gtk_list_store_set (list_store, &iter, COLUMN_NAME_NUMBER,707 entry->number, -1);708 gtk_list_store_set (list_store, &iter, COLUMN_HASNAME, 0, -1);709 }710 else711 {712 gtk_list_store_set (list_store, &iter, COLUMN_NAME_NUMBER,713 entry->name, -1);714 gtk_list_store_set (list_store, &iter, COLUMN_HASNAME, 1, -1);715 }716 switch (entry->type)717 {718 case INCOMING:719 {720 gtk_list_store_set (list_store, &iter, COLUMN_TYPEICON,721 p_dialer_data->g_iconReceived, -1);722 // icon=gdk_pixbuf_new_from_file("./received.png",&error);723 break;724 }725 case OUTGOING:726 { // icon=gdk_pixbuf_new_from_file("./dialed.png",&error);727 gtk_list_store_set (list_store, &iter, COLUMN_TYPEICON,728 p_dialer_data->g_iconDialed, -1);729 break;730 }731 case MISSED:732 { //icon=gdk_pixbuf_new_from_file("./missed.png",&error);733 gtk_list_store_set (list_store, &iter, COLUMN_TYPEICON,734 p_dialer_data->g_iconMissed, -1);735 break;736 }737 738 default:739 740 { //icon=gdk_pixbuf_new_from_file("./missed.png",&error);741 gtk_list_store_set (list_store, &iter, COLUMN_TYPEICON,742 p_dialer_data->g_iconMissed, -1);743 break;744 }745 }746 747 748 749 entry = entry->next;750 }751 #endif752 636 gtk_tree_view_set_model (GTK_TREE_VIEW (contactview), 753 637 GTK_TREE_MODEL (p_dialer_data-> 754 638 g_list_store_filter)); 755 639 756 g_object_unref (list_store); 640 641 /* add the initial contents of the list store */ 642 int i = 0; 643 MokoJournalEntry *j_entry; 644 645 /* if there aren't any entries in the journal, we don't need to do any more 646 * here 647 */ 648 if (moko_journal_get_nb_entries (p_dialer_data->journal)) 649 return 1; 650 651 j_entry = moko_journal_entry_new (VOICE_JOURNAL_ENTRY); 652 653 while (moko_journal_get_entry_at (p_dialer_data->journal, i, &j_entry)) 654 { 655 const gchar *uid, *number; 656 gchar *icon_name, *display_text; 657 int dstart; 658 enum MessageDirection direction; 659 gboolean was_missed; 660 const MokoTime *time; 661 662 uid = moko_journal_entry_get_contact_uid (j_entry); 663 moko_journal_entry_get_direction (j_entry, &direction); 664 time = moko_journal_entry_get_dtstart (j_entry); 665 was_missed = moko_journal_voice_info_get_was_missed ((MokoJournalVoiceInfo*) j_entry); 666 number = moko_journal_voice_info_get_distant_number ((MokoJournalVoiceInfo*)j_entry); 667 668 if (direction == DIRECTION_OUT) 669 icon_name = "call-in"; 670 else 671 if (was_missed) 672 icon_name = "call-missed"; 673 else 674 icon_name = "call-out"; 675 676 /* display text should be either the contact name, or the number if the 677 * contact name is not know */ 678 /* FIXME: look up uid */ 679 display_text = number; 680 681 gtk_list_store_insert_with_values (list_store, NULL, 0, 682 HISTORY_NUMBER_COLUMN, number, 683 HISTORY_DSTART_COLUMN, dstart, 684 HISTORY_ICON_NAME_COLUMN, icon_name, 685 HISTORY_DISPLAY_TEXT_COLUMN, display_text, 686 -1); 687 } 688 689 757 690 758 691 return 1; -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialer-window-history.h
r1857 r1880 20 20 #ifndef _OPENMOKO_DIALER_WINDOW_HISTORY_H 21 21 22 /* columns available in the history list store */ 23 enum history_columns { 24 HISTORY_NUMBER_COLUMN, /* number for re-dial */ 25 HISTORY_DSTART_COLUMN, /* call time, used for sorting */ 26 HISTORY_ICON_NAME_COLUMN, /* icon name for display */ 27 HISTORY_DISPLAY_TEXT_COLUMN, /* name or number for display */ 28 }; 29 30 22 31 gint window_history_init (MokoDialerData * p_dialer_data); 23 32 -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-includes.h
r1857 r1880 93 93 } TIMER_DATA; 94 94 95 enum96 {97 COLUMN_TYPE,98 COLUMN_TYPEICON,99 COLUMN_SEPRATE,100 COLUMN_NAME_NUMBER,101 COLUMN_TIME,102 COLUMN_DURATION,103 COLUMN_ENTRYPOINTER,104 COLUMN_HASNAME,105 N_COLUMN106 };107 95 void gsm_incoming_call (gchar * number); 108 96 void gsm_peer_accept ();
Note: See TracChangeset
for help on using the changeset viewer.
