Changeset 465
- Timestamp:
- 12/25/06 10:40:54 (6 years ago)
- Location:
- trunk/src/target/OM-2007/applications/openmoko-dialer
- Files:
-
- 3 added
- 15 edited
-
data/10086.png (modified) (previous)
-
data/Makefile.am (modified) (2 diffs)
-
data/status0.png (added)
-
data/status1.png (added)
-
data/status2.png (added)
-
data/unkown.png (modified) (previous)
-
src/common.c (modified) (1 diff)
-
src/contacts.c (modified) (1 diff)
-
src/contacts.h (modified) (2 diffs)
-
src/moko-dialer-autolist.h (modified) (1 diff)
-
src/moko-dialer-declares.h (modified) (1 diff)
-
src/moko-dialer-includes.h (modified) (2 diffs)
-
src/moko-dialer-status.c (modified) (4 diffs)
-
src/moko-dialer-status.h (modified) (1 diff)
-
src/moko-dialer-textview.c (modified) (2 diffs)
-
src/moko-dialer-textview.h (modified) (1 diff)
-
src/openmoko-dialer-main.h (modified) (3 diffs)
-
src/openmoko-dialer-window-dialer.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007/applications/openmoko-dialer/data/Makefile.am
r430 r465 5 5 10086.png\ 6 6 chaowei.png\ 7 unkown.png 7 unkown.png\ 8 status0.png\ 9 status1.png\ 10 status2.png 11 8 12 resourcedir = $(pkgdatadir) 9 13 … … 14 18 10086.png\ 15 19 chaowei.png\ 16 unkown.png 17 20 unkown.png\ 21 status0.png\ 22 status1.png\ 23 status2.png -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/common.c
r458 r465 158 158 DBG_MESSAGE("file_load_person_image_scalable_from_relative_path,width=%d,height=%d",widget->allocation.width, widget->allocation.height); 159 159 160 // dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, widget->requisition.width, widget->requisition.height, GDK_INTERP_NEAREST); 160 161 dest_pixbuf = gdk_pixbuf_scale_simple (src_pixbuf, widget->allocation.width, widget->allocation.height, GDK_INTERP_NEAREST); 161 162 gtk_image_set_from_pixbuf (image,dest_pixbuf); -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c
r459 r465 363 363 } 364 364 365 /** 366 * @brief get the name and picture path from the contact list, indexed by the number provided. 367 * in the case that contact API returns NULL, we will call this function for debug. 368 * 369 * 370 * 371 * @param contacts, the first contact pointer of the list. 372 * @param peer, the structure to hold the pointer to the strings in the contact list. 373 * @return 0-failed, 1-found the contact. 374 * @retval 375 */ 376 377 int contact_get_peer_info_from_number(DIALER_CONTACT* contacts, DIALER_CONTACT_PEER_INFO * peer) 378 { 379 380 peer->hasname=0; 381 peer->searched=1; 382 peer->name=0; 383 peer->picpath=0; 384 385 if(peer->number==0)return 0; 386 if(strlen(peer->number)==0)return 0; 387 388 // DIALER_CONTACT* contacts=g_contactlist.contacts; 389 390 DIALER_CONTACT_ENTRY* entry; 391 392 while(contacts!= 0) 393 { 394 entry=contacts->entry; 395 396 while(entry) 397 { 398 399 //judge if the entry includes the string 400 401 if(strcmp(entry->content,peer->number)==0) 402 { 403 peer->picpath=contacts->picpath; 404 peer->name=contacts->name; 405 // DBG_MESSAGE("Yeah, we know the owner is %s.",name); 406 peer->hasname=1; 407 return 1; 408 } 409 entry=entry->next; 410 } 411 412 413 contacts= contacts->next; 414 415 } 416 //DBG_MESSAGE("Can not find the number."); 417 return 0; 418 } 419 420 365 421 366 422 /** -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.h
r459 r465 62 62 63 63 /** 64 * @brief contact structure for open dialer. 65 */ 66 typedef struct peer_info_ 67 { 68 //we should at least have the number called. 69 char number[MOKO_DIALER_MAX_NUMBER_LEN]; ///<the number of the peer 70 char *name; ///<person name 71 char *picpath; ///<the picture file path for the person 72 int searched; ///<if true; no need to search for the name 73 int hasname; ///<if true, we the picpath & name can be used. 74 }DIALER_CONTACT_PEER_INFO; 75 76 77 /** 64 78 * @brief the structure for intelligent search results. 65 79 */ … … 85 99 int contact_init_from_cmd(DIALER_CONTACTS_LIST_HEAD * head); 86 100 int contact_get_info_from_number(DIALER_CONTACT* contacts,char* name,char* picpath,const char* number); 101 int contact_get_peer_info_from_number(DIALER_CONTACT* contacts, DIALER_CONTACT_PEER_INFO * peer); 87 102 int contact_init_contact_data(DIALER_CONTACTS_LIST_HEAD *p_contactlist); 88 103 int contact_print_contact_list(DIALER_CONTACTS_LIST_HEAD * head); -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-autolist.h
r438 r465 57 57 DIALER_CONTACTS_LIST_HEAD* head; 58 58 59 HISTORY_ENTRY * g_currentselected; ///<pointer to the history entry which in the GUI the user selects.59 // HISTORY_ENTRY * g_currentselected; ///<pointer to the history entry which in the GUI the user selects. 60 60 61 61 //static PangoFontDescription *font_desc=NULL; ///<the PangoFontDescription which a lot of widget will use it. -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h
r458 r465 25 25 //only when user inputs at least MINSENSATIVELEN, should we start to search. 26 26 #define MOKO_DIALER_MIN_SENSATIVE_LEN (1) 27 #define MOKO_DIALER_MAX_STATUS_ICONS ( 1)28 #define MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH (" ./default.png")27 #define MOKO_DIALER_MAX_STATUS_ICONS (3) 28 #define MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH ("unkown.png") 29 29 #define MOKO_DIALER_MAX_TIPS (3) 30 30 -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-includes.h
r438 r465 28 28 #include "moko-dialer-textview.h" 29 29 #include "moko-digit-button.h" 30 30 #include "moko-dialer-status.h" 31 #include <libmokoui/moko-dialog-window.h> 32 // 31 33 32 34 … … 78 80 gint stopsec; ///<indicates when the ticks reaches stopsec, then this timer has to be stopped. 79 81 gint timeout; ///<indicates wether this timer has timeout to stopsec. 80 GtkWidget* label; 82 81 83 gint ticks; //seconds together 82 84 gint sec; 83 85 gint min; 84 86 gint hour; 85 char timestring[9] ; 86 gint updatewidget; 87 TimeExpireCallback expirecallback; 87 char timestring[MOKO_DIALER_MAX_NUMBER_LEN] ; 88 88 }TIMER_DATA; 89 89 90 enum { 90 91 COLUMN_TYPE, -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-status.c
r458 r465 49 49 ; ///<the topmost title bar of the status 50 50 moko_dialer_status->labelStatusTitle= gtk_label_new(""); 51 52 /* 51 53 for(gint i=0;i<MOKO_DIALER_MAX_STATUS_ICONS;i++) 52 54 moko_dialer_status->iconStatus[i]=gtk_image_new(); 55 */ 56 57 moko_dialer_status->icon=gtk_image_new(); 58 53 59 54 60 //lower section 55 61 moko_dialer_status->imagePerson=gtk_image_new(); ///<the image of the person we care 62 gtk_widget_set_size_request (moko_dialer_status->imagePerson, 130,130); 63 gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->imagePerson), 1, 0); 64 65 56 66 moko_dialer_status->labelStatus=gtk_label_new(""); ///<the status label 67 gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->labelStatus), 0, 0); 68 // gtk_misc_set_padding(GTK_MISC (moko_dialer_status->labelStatus), 20,0); 57 69 moko_dialer_status->labelPersonName=gtk_label_new(""); ///<the person name 70 gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->labelPersonName), 0, 0); 58 71 moko_dialer_status->labelNumber=gtk_label_new(""); ///<the number of the person 72 gtk_misc_set_alignment (GTK_MISC (moko_dialer_status->labelNumber), 0, 0); 59 73 //private section 60 74 moko_dialer_status->number_of_the_icons=0; 61 75 62 gtk_box_pack_start( GTK_BOX(moko_dialer_status), moko_dialer_status->labelStatusTitle , FALSE, FALSE, 0 ); 63 gtk_box_pack_start( GTK_BOX(moko_dialer_status), moko_dialer_status->iconStatus[0], FALSE, FALSE, 0 ); 76 gtk_widget_set_size_request (moko_dialer_status->icon, 64,64); 77 gtk_box_pack_start( GTK_BOX(moko_dialer_status), moko_dialer_status->labelStatusTitle , FALSE, FALSE, 20 ); 78 gtk_box_pack_start( GTK_BOX(moko_dialer_status), moko_dialer_status->icon, FALSE, FALSE, 20); 64 79 65 80 //ok now, we arrange them in the vbox. … … 67 82 // we create another vbox to hold the status labels. 68 83 GtkVBox * vbox2 = gtk_vbox_new( FALSE, 0 ); 69 gtk_box_pack_start( GTK_BOX(vbox2), moko_dialer_status->labelStatus, FALSE, FALSE, 0);84 gtk_box_pack_start( GTK_BOX(vbox2), moko_dialer_status->labelStatus, TRUE, TRUE, 0); 70 85 71 gtk_box_pack_start( GTK_BOX(vbox2), moko_dialer_status->labelPersonName, FALSE, FALSE, 0 );86 gtk_box_pack_start( GTK_BOX(vbox2), moko_dialer_status->labelPersonName, TRUE, TRUE, 0 ); 72 87 73 88 74 89 75 gtk_box_pack_start( GTK_BOX(vbox2), moko_dialer_status->labelNumber, FALSE, FALSE, 0 );90 gtk_box_pack_start( GTK_BOX(vbox2), moko_dialer_status->labelNumber, TRUE, TRUE, 0 ); 76 91 // a hbox to hold the image and the vbox2 77 92 GtkVBox * hbox2 = gtk_hbox_new( FALSE, 0 ); 78 gtk_widget_set_size_request (moko_dialer_status->imagePerson, 64,64); 79 gtk_box_pack_start( GTK_BOX(hbox2), moko_dialer_status->imagePerson, FALSE, FALSE, 0 ); 80 81 gtk_box_pack_start( GTK_BOX(hbox2),vbox2, FALSE, FALSE, 0 ); 82 83 gtk_box_pack_start( GTK_BOX(moko_dialer_status),hbox2, FALSE, FALSE, 0 ); 84 85 gtk_widget_set_size_request (GTK_WIDGET(moko_dialer_status), 480, 40); 93 94 95 96 // gtk_box_pack_start( GTK_BOX(hbox2), moko_dialer_status->imagePerson, FALSE, FALSE, 0 ); 97 gtk_box_pack_start( GTK_BOX(hbox2), moko_dialer_status->imagePerson, TRUE,TRUE, 0 ); 98 99 // gtk_box_pack_start( GTK_BOX(hbox2),vbox2, FALSE, FALSE, 0 ); 100 gtk_box_pack_start( GTK_BOX(hbox2),vbox2, TRUE,TRUE, 36 ); 101 102 gtk_box_pack_start( GTK_BOX(moko_dialer_status),hbox2, TRUE, TRUE, 0 ); 103 104 //gtk_widget_set_size_request (GTK_WIDGET(moko_dialer_status), 320, 200); 86 105 87 106 DBG_LEAVE(); … … 107 126 void moko_dialer_status_set_status_label(MokoDialerStatus *moko_dialer_status,const gchar* text) 108 127 { 128 129 DBG_MESSAGE("moko_dialer_status_set_status_label:moko_dialer_status=0X%x",moko_dialer_status); 109 130 gtk_label_set_text(GTK_LABEL(moko_dialer_status->labelStatus),text); 110 131 } … … 121 142 void moko_dialer_status_set_person_image(MokoDialerStatus *moko_dialer_status,const gchar* path) 122 143 { 123 file_load_person_image_scalable_from_relative_path(moko_dialer_status->imagePerson,path); 124 } 125 void moko_dialer_status_set_icons(MokoDialerStatus *moko_dialer_status,const gchar* text) 126 { 127 128 } 129 130 144 //file_load_person_image_scalable_from_relative_path(moko_dialer_status->imagePerson,path); 145 file_load_person_image_from_relative_path(moko_dialer_status->imagePerson,path); 146 //file_load_person_image_scalable_from_relative_path(moko_dialer_status->imagePerson,path); 147 } 148 int moko_dialer_status_add_status_icon(MokoDialerStatus *moko_dialer_status,const gchar* text) 149 { 150 if(moko_dialer_status->number_of_the_icons<MOKO_DIALER_MAX_STATUS_ICONS) 151 { 152 moko_dialer_status->iconStatus[moko_dialer_status->number_of_the_icons]=create_pixbuf (text); 153 154 moko_dialer_status->number_of_the_icons++; 155 return 1; 156 } 157 else 158 { 159 DBG_ERROR("MOKO_DIALER_MAX_STATUS_ICONS has reached, add no more icons."); 160 return 0; 161 } 162 } 163 164 void moko_dialer_status_set_error_icon(MokoDialerStatus *moko_dialer_status,const gchar* text) 165 { 166 167 168 moko_dialer_status->iconError=create_pixbuf (text); 169 // file_load_person_image_from_relative_path(moko_dialer_status->iconError,text); 170 } 171 void moko_dialer_status_set_success_icon(MokoDialerStatus *moko_dialer_status,const gchar* text) 172 { 173 moko_dialer_status->iconError=create_pixbuf (text); 174 // file_load_person_image_from_relative_path(moko_dialer_status->iconSuccuss,text); 175 } 176 177 void moko_dialer_status_set_icon_by_index(MokoDialerStatus *moko_dialer_status,gint index) 178 { 179 if( moko_dialer_status->iconStatus[index]!=0&&index<moko_dialer_status->number_of_the_icons) 180 gtk_image_set_from_pixbuf(moko_dialer_status->icon, moko_dialer_status->iconStatus[index]); 181 } 182 void moko_dialer_status_update_icon(MokoDialerStatus *moko_dialer_status) 183 { 184 static gint currenticon=0; 185 currenticon=(currenticon+1)%moko_dialer_status->number_of_the_icons; 186 if( moko_dialer_status->iconStatus[currenticon]) 187 moko_dialer_status_set_icon_by_index(moko_dialer_status,currenticon); 188 } 189 190 191 void moko_dialer_status_set_error(MokoDialerStatus *moko_dialer_status) 192 { 193 if(moko_dialer_status->iconError) 194 gtk_image_set_from_pixbuf(moko_dialer_status->icon, moko_dialer_status->iconError); 195 } 196 197 void moko_dialer_status_set_success(MokoDialerStatus *moko_dialer_status) 198 { 199 if(moko_dialer_status->iconSuccess) 200 gtk_image_set_from_pixbuf(moko_dialer_status->icon, moko_dialer_status->iconSuccess); 201 202 } 203 -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-status.h
r458 r465 56 56 //upper section 57 57 GtkWidget * labelStatusTitle; ///<the topmost title bar of the status 58 GtkWidget * iconStatus[MOKO_DIALER_MAX_STATUS_ICONS]; 59 58 GtkWidget * icon; 59 GdkPixbuf * iconStatus[MOKO_DIALER_MAX_STATUS_ICONS]; 60 GdkPixbuf * iconError; 61 GdkPixbuf * iconSuccess; 60 62 //lower section 61 63 GtkWidget * imagePerson; ///<the image of the person we care -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-textview.c
r458 r465 179 179 } 180 180 181 182 181 183 /** 182 184 * @brief moko_dialer_textview_insert … … 299 301 } 300 302 303 //delete all the input 304 int moko_dialer_textview_empty(MokoDialerTextview *moko_dialer_textview) 305 { 306 307 GtkTextBuffer *buffer; 308 309 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview)); 310 311 gtk_text_buffer_set_text(buffer,"",-1); 312 return 1; 313 } 314 301 315 ///delete the selection or one character. 302 316 int moko_dialer_textview_delete(MokoDialerTextview *moko_dialer_textview) -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-textview.h
r438 r465 68 68 69 69 int moko_dialer_textview_get_input(MokoDialerTextview *moko_dialer_textview,gchar* input,int ALL); 70 int moko_dialer_textview_empty(MokoDialerTextview *moko_dialer_textview); 70 71 71 72 G_END_DECLS -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h
r458 r465 17 17 */ 18 18 #include "moko-dialer-includes.h" 19 /* 19 20 21 typedef struct _window_outgoing 22 { 23 24 MokoDialerStatus * status_outgoing; 25 26 GtkWidget* window_outgoing; 27 28 GtkWidget* buttonSpeaker; 29 GtkWidget* buttonCancel; 30 GtkWidget* buttonRedial; 31 }WindowOutgoing; 32 */ 20 33 typedef struct _dialer_data 21 34 { … … 29 42 DIALER_CONTACTS_LIST_HEAD g_contactlist; ///< the whole list of the contacts from the contact book. 30 43 44 DIALER_CONTACT_PEER_INFO g_peer_info; ///<hold the peer's name, number, etc. 45 31 46 HISTORY_LIST_HEAD g_historylist; ///< the whole list of the talk history 32 47 … … 37 52 TIMER_DATA g_timer_data;///< the data used by the timers 38 53 54 MokoDialerStatus * status_outgoing; 39 55 GtkWidget * window_dialer; 40 56 GtkWidget* window_outgoing; 41 57 58 //buttons 59 GtkWidget* buttonSpeaker; 60 GtkWidget* buttonCancel; 61 GtkWidget* buttonRedial; 62 63 //WindowOutgoing window_outgoing_data; 42 64 // GtkListStore *g_list_store_filter;///<the list store used by the gtktreeview, for displaying the history list dynamically. 43 65 -
trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-dialer.c
r458 r465 74 74 void cb_dialer_button_clicked( GtkButton* button, MOKO_DIALER_APP_DATA * appdata) 75 75 { 76 g_debug( "dialer button clicked" ); 76 g_debug( "dialer button clicked" ); 77 gchar codesinput[MOKO_DIALER_MAX_NUMBER_LEN]; 78 //get the input digits 79 moko_dialer_textview_get_input(appdata->moko_dialer_text_view, codesinput, 0); 80 if(strlen(codesinput)<=1) 81 return; 82 //empty the textview 83 moko_dialer_textview_empty(appdata->moko_dialer_text_view); 84 85 //got the number; 86 strcpy(appdata->g_peer_info.number,codesinput); 87 88 //retrieve the contact information if any. 89 contact_get_peer_info_from_number(appdata->g_contactlist.contacts , &(appdata->g_peer_info)); 90 // contact_get_peer_info_from_number 91 77 92 if(!appdata->window_outgoing) 78 93 window_outgoing_init(appdata); 79 94 95 //transfer the contact info 96 window_outgoing_prepare(appdata); 97 98 //start dialling. 80 99 gtk_widget_show(appdata->window_outgoing); 81 100 } … … 118 137 DBG_MESSAGE("And here we are supposed to call out directly"); 119 138 139 140 120 141 } 121 142 void … … 259 280 //the buttons 260 281 261 /*262 GtkWidget *iconimage = gtk_image_new();263 file_load_person_image_from_relative_path( iconimage,"unkown.png");264 //gtk_image_new_from_stock ("gtk-delete", GTK_ICON_SIZE_BUTTON);265 */266 // moko_pixmap_button_set_finger_toolbox_btn_center_image (button1, iconimage);267 282 GtkVBox * vbox2 = gtk_vbox_new( FALSE, 0 ); 268 283 GtkButton* button1 = moko_pixmap_button_new(); 269 284 g_signal_connect( G_OBJECT(button1), "clicked", G_CALLBACK(cb_delete_button_clicked), p_dialer_data ); 270 285 gtk_widget_set_name( GTK_WIDGET(button1), "mokofingerbutton-orange" ); 271 moko_pixmap_button_set_ action_btn_center_stock(button1,"gtk-delete");286 moko_pixmap_button_set_center_stock(button1,"gtk-delete"); 272 287 moko_pixmap_button_set_action_btn_lower_label(button1,"Delete"); 273 288 gtk_widget_set_size_request (button1, WINDOW_DIALER_BUTTON_SIZE_X, WINDOW_DIALER_BUTTON_SIZE_Y); … … 278 293 g_signal_connect( G_OBJECT(button3), "clicked", G_CALLBACK(cb_history_button_clicked), p_dialer_data ); 279 294 gtk_widget_set_name( GTK_WIDGET(button3), "mokofingerbutton-orange" ); 280 moko_pixmap_button_set_ action_btn_center_stock(button3,"gtk-refresh");295 moko_pixmap_button_set_center_stock(button3,"gtk-refresh"); 281 296 moko_pixmap_button_set_action_btn_lower_label(button3,"History"); 282 297 gtk_widget_set_size_request (button3, WINDOW_DIALER_BUTTON_SIZE_X, WINDOW_DIALER_BUTTON_SIZE_Y); … … 288 303 g_signal_connect( G_OBJECT(button2), "clicked", G_CALLBACK(cb_dialer_button_clicked), p_dialer_data ); 289 304 gtk_widget_set_name( GTK_WIDGET(button2), "mokofingerbutton-black" ); 290 moko_pixmap_button_set_ action_btn_center_stock(button2,"gtk-yes");305 moko_pixmap_button_set_center_stock(button2,"gtk-yes"); 291 306 moko_pixmap_button_set_action_btn_lower_label(button2,"Dial"); 292 307 gtk_widget_set_size_request (button2, WINDOW_DIALER_BUTTON_SIZE_X+20, WINDOW_DIALER_BUTTON_SIZE_Y+80);
Note: See TracChangeset
for help on using the changeset viewer.
