Changeset 438


Ignore:
Timestamp:
12/20/06 11:36:51 (6 years ago)
Author:
tony_guan
Message:

MokoAutolist? refined,buttons added, deletebutton function added,window-dialer finished
Now this application can do some DEMO job, unless some of the colors or effect still remain not perfect. Please look at it first.

Location:
trunk/src/target/OM-2007/applications/openmoko-dialer/src
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/Makefile.am

    r430 r438  
    1010moko-dialer-autolist.c\ 
    1111contacts.c\ 
    12 common.c 
     12common.c\ 
     13openmoko-dialer-window-dialer.c 
    1314 
    1415openmoko_dialer_LDADD = @OPENMOKO_LIBS@ 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.c

    r430 r438  
    376376{ 
    377377        int i; 
    378         g_printf("hassensentive:%s,%s\n",content,string); 
     378//      g_printf("hassensentive:%s,%s\n",content,string); 
    379379        if(content==0)  
    380380        return 0; 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/contacts.h

    r430 r438  
    8787int contact_init_contact_data(DIALER_CONTACTS_LIST_HEAD   *p_contactlist); 
    8888int contact_print_contact_list(DIALER_CONTACTS_LIST_HEAD * head); 
    89 //int contact_string_has_sensentive(gchar* content,gchar *string); 
    90  
    91  
     89int contact_string_has_sensentive (char * content, char *string); 
    9290#ifdef __cplusplus 
    9391} 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-autolist.c

    r430 r438  
    9797moko_dialer_autolist->g_alternatecount=0; 
    9898moko_dialer_autolist->imagePerson=0; 
    99      
     99gtk_widget_set_size_request (GTK_WIDGET(moko_dialer_autolist), 480, 40);  
     100 
    100101} 
    101102/** 
     
    115116return TRUE; 
    116117} 
    117 /** 
    118  * @brief initiate the font for widget of textviewCodes  
    119  * 
    120  * 
    121  * 
    122  * @param text_view GtkWidget*, any widget which can help to lookup for labelcontactN 
    123  * @param count gint, the count of the alternative, max set to MAXDISPNAMENUM. 
    124  * @retval  
    125  */ 
    126  
    127 int moko_dialer_autolist_fill_alternative(MokoDialerAutolist *moko_dialer_autolist,gint count) 
    128 { 
    129 gint i; 
    130 //DBG_ENTER(); 
    131  
    132  
    133 moko_dialer_autolist->g_alternatecount=count; 
    134  
    135 if(count>0) 
    136 { 
    137         //init the labels. 
    138         for(i=0;i<count&&i<MOKO_DIALER_MAX_TIPS;i++) 
    139         { 
    140         moko_dialer_tip_set_label(moko_dialer_autolist->tips[i],moko_dialer_autolist->readycontacts[i].p_contact->name); 
    141         moko_dialer_tip_set_index(moko_dialer_autolist->tips[i],i); 
    142         moko_dialer_tip_set_selected(moko_dialer_autolist->tips[i],FALSE); 
    143         gtk_widget_show(moko_dialer_autolist->tips[i]); 
    144         } 
    145  
    146         for(;i<MOKO_DIALER_MAX_TIPS;i++) 
    147         { 
    148         moko_dialer_tip_set_index(moko_dialer_autolist->tips[i],-1); 
    149         moko_dialer_tip_set_label(moko_dialer_autolist->tips[i],""); 
    150         gtk_widget_hide(moko_dialer_autolist->tips[i]); 
    151         moko_dialer_tip_set_selected(moko_dialer_autolist->tips[i],FALSE); 
    152         } 
    153  
    154         //we set the first one as defaultly selected 
    155         moko_dialer_autolist_set_select(moko_dialer_autolist, 0); 
    156 }        
    157 else 
    158         { 
    159          
     118 
     119gint moko_dialer_autolist_hide_all_tips(MokoDialerAutolist *moko_dialer_autolist) 
     120{ 
     121 
     122if(moko_dialer_autolist->tipscreated) 
     123{ 
     124                moko_dialer_autolist->selected=FALSE; 
    160125                        //no alternative, hide all 3 labels. 
    161                 for(i=0;i<MOKO_DIALER_MAX_TIPS;i++) 
     126                for(gint i=0;i<MOKO_DIALER_MAX_TIPS;i++) 
    162127                { 
    163128                moko_dialer_tip_set_selected(moko_dialer_autolist->tips[i],FALSE); 
     
    166131                //hide the imagePerson 
    167132                gtk_widget_hide(moko_dialer_autolist->imagePerson); 
     133} 
     134                return 1; 
     135 
     136} 
     137 
     138/** 
     139 * @brief initiate the font for widget of textviewCodes  
     140 * 
     141 * 
     142 * 
     143 * @param text_view GtkWidget*, any widget which can help to lookup for labelcontactN 
     144 * @param count gint, the count of the alternative, max set to MAXDISPNAMENUM. 
     145 * @param selectdefault if selectdefault, then we will automatically emit the message to fill the sensed string, 
     146 *  else, we only refresh our tip list. 
     147 * @retval  
     148 */ 
     149 
     150int moko_dialer_autolist_fill_alternative(MokoDialerAutolist *moko_dialer_autolist,gint count,gboolean selectdefault) 
     151{ 
     152gint i; 
     153//DBG_ENTER(); 
     154moko_dialer_autolist->selected=FALSE; 
     155 
     156moko_dialer_autolist->g_alternatecount=count; 
     157 
     158if(count>0) 
     159{ 
     160        //init the labels. 
     161        for(i=0;i<count&&i<MOKO_DIALER_MAX_TIPS;i++) 
     162        { 
     163        moko_dialer_tip_set_label(moko_dialer_autolist->tips[i],moko_dialer_autolist->readycontacts[i].p_contact->name); 
     164        moko_dialer_tip_set_index(moko_dialer_autolist->tips[i],i); 
     165        moko_dialer_tip_set_selected(moko_dialer_autolist->tips[i],FALSE); 
     166        gtk_widget_show(moko_dialer_autolist->tips[i]); 
     167        } 
     168 
     169        for(;i<MOKO_DIALER_MAX_TIPS;i++) 
     170        { 
     171        moko_dialer_tip_set_index(moko_dialer_autolist->tips[i],-1); 
     172        moko_dialer_tip_set_label(moko_dialer_autolist->tips[i],""); 
     173        gtk_widget_hide(moko_dialer_autolist->tips[i]); 
     174        moko_dialer_tip_set_selected(moko_dialer_autolist->tips[i],FALSE); 
     175        } 
     176 
     177        if(selectdefault) 
     178        { 
     179                //we set the first one as defaultly selected 
     180                moko_dialer_autolist_set_select(moko_dialer_autolist, 0); 
     181        } 
     182}        
     183else 
     184        { 
     185        moko_dialer_autolist_hide_all_tips(moko_dialer_autolist);        
    168186                //notify the client that no match has been foudn 
    169187//              autolist_nomatch 
     
    173191} 
    174192 
    175  
    176 gint  moko_dialer_autolist_refresh_by_string (MokoDialerAutolist *moko_dialer_autolist,gchar * string) 
     193//if selectdefault, then we will automatically emit the message to fill the sensed string 
     194//else, we only refresh our tip list. 
     195gint  moko_dialer_autolist_refresh_by_string (MokoDialerAutolist *moko_dialer_autolist,gchar * string,gboolean selectdefault) 
    177196{ 
    178197//first, we fill the ready list 
     
    191210  else 
    192211          len=0; 
    193   DBG_TRACE(); 
     212//  DBG_TRACE(); 
    194213   
    195214//insert the tips here to avoid the _show_all show it from the start. 
     
    208227        imagePerson=gtk_image_new_from_stock("gtk-yes",GTK_ICON_SIZE_DND); 
    209228        } 
    210   gtk_widget_hide (imagePerson); 
    211   gtk_box_pack_start (GTK_CONTAINER(moko_dialer_autolist), imagePerson, TRUE, TRUE, 0); 
    212  moko_dialer_autolist->imagePerson=imagePerson; 
     229 gtk_widget_hide (imagePerson); 
     230 gtk_widget_set_size_request (imagePerson, 40, 40);      
     231//  gtk_box_pack_start (GTK_CONTAINER(moko_dialer_autolist), imagePerson, TRUE, TRUE, 0); 
     232//gtk_box_pack_start (GTK_CONTAINER(moko_dialer_autolist), imagePerson, TRUE, FALSE, 0); 
     233 gtk_box_pack_start (GTK_CONTAINER(moko_dialer_autolist), imagePerson, FALSE, FALSE, 0); 
     234   
     235  moko_dialer_autolist->imagePerson=imagePerson; 
    213236 
    214237  for(int i=0;i<MOKO_DIALER_MAX_TIPS;i++) 
     
    223246 
    224247         gtk_box_pack_start(GTK_CONTAINER(moko_dialer_autolist), tip, TRUE, TRUE, 0);    
    225                   
     248//       gtk_box_pack_start(GTK_CONTAINER(moko_dialer_autolist), tip, FALSE,FALSE, 0);                   
     249//       gtk_box_pack_start(GTK_CONTAINER(moko_dialer_autolist), tip, FALSE,TRUE, 0); 
     250//                       gtk_box_pack_start(GTK_CONTAINER(moko_dialer_autolist), tip, TRUE, FALSE,0); 
     251         
    226252          g_signal_connect ((gpointer) tip, "button_press_event",G_CALLBACK (on_tip_press_event),moko_dialer_autolist); 
    227253 
    228         gtk_widget_set_size_request (tip, 20, 20);       
     254//      gtk_widget_set_size_request (tip, 20, 20);       
    229255 
    230256        gtk_widget_hide(tip); 
     
    265291 
    266292//DBG_MESSAGE("inserted=%d",inserted); 
    267 moko_dialer_autolist_fill_alternative(moko_dialer_autolist,inserted); 
    268  
    269 DBG_LEAVE(); 
     293moko_dialer_autolist_fill_alternative(moko_dialer_autolist,inserted,selectdefault); 
     294 
     295//DBG_LEAVE(); 
    270296  return inserted; 
    271297} 
     
    296322 
    297323} 
     324 
     325gboolean moko_dialer_autolist_has_selected(MokoDialerAutolist *moko_dialer_autolist) 
     326{ 
     327        return moko_dialer_autolist->selected; 
     328} 
     329 
     330// selected ==-1 means there are no selected tips 
    298331gboolean moko_dialer_autolist_set_select(MokoDialerAutolist *moko_dialer_autolist,gint selected) 
    299332{ 
    300333 
    301 if(selected!=-1&&selected<MOKO_DIALER_MAX_TIPS&&moko_dialer_autolist->g_alternatecount) 
     334                if(selected==-1) 
     335                { 
     336 
     337                        //set the selected status to be false 
     338                        for(gint i=0;i<moko_dialer_autolist->g_alternatecount;i++) 
     339                        { 
     340                        moko_dialer_tip_set_selected( moko_dialer_autolist->tips[i], FALSE); 
     341                        } 
     342                        //set 
     343                        gtk_widget_hide(moko_dialer_autolist->imagePerson);      
     344                        moko_dialer_autolist->selected=FALSE; 
     345                        return TRUE; 
     346                } 
     347 
     348 
     349if(selected<MOKO_DIALER_MAX_TIPS&&moko_dialer_autolist->g_alternatecount) 
    302350        { 
    303351        //first of all, determin if this tip is already selected previously. 
     
    313361                        } 
    314362                } 
     363        moko_dialer_autolist->selected=FALSE; 
    315364        //emit confirm message; 
    316                 DBG_MESSAGE("we confirm %s is right.",moko_dialer_autolist->readycontacts[selected].p_contact->name);                    
     365//              DBG_MESSAGE("we confirm %s is right.",moko_dialer_autolist->readycontacts[selected].p_contact->name);                    
    317366        g_signal_emit (moko_dialer_autolist,   moko_dialer_autolist_signals[CONFIRMED_SIGNAL],0,&(moko_dialer_autolist->readycontacts[selected])); 
    318367 
     
    334383                        moko_dialer_tip_set_selected( moko_dialer_autolist->tips[i], TRUE); 
    335384                } 
     385        moko_dialer_autolist->selected=TRUE; 
    336386                //emit selected message 
    337                 DBG_MESSAGE(" %s is selectd.",moko_dialer_autolist->readycontacts[selected].p_contact->name); 
     387//              DBG_MESSAGE(" %s is selectd.",moko_dialer_autolist->readycontacts[selected].p_contact->name); 
    338388                g_signal_emit (moko_dialer_autolist,   moko_dialer_autolist_signals[SELECTED_SIGNAL],0,&(moko_dialer_autolist->readycontacts[selected]));        
    339389        } 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-autolist.h

    r430 r438  
    6363 DIALER_READY_CONTACT readycontacts[MOKO_DIALER_MAX_TIPS]; ///<the prepared contact list which will display to the user when he/she inputs part of the digits he/she wants to dial out 
    6464 
    65  gint g_selected;///<indicates the offset of the selected ready contacts list 
     65 gboolean selected;///<indicates wether some tip is currently selected. 
    6666 
    6767 gint g_alternatecount;///<indicates how many alternative is ready in the ready list array. 
     
    8989gboolean moko_dialer_autolist_set_select(MokoDialerAutolist *moko_dialer_autolist,gint selected); 
    9090 
     91gboolean moko_dialer_autolist_has_selected(MokoDialerAutolist *moko_dialer_autolist); 
    9192 
     93gint  moko_dialer_autolist_refresh_by_string (MokoDialerAutolist *moko_dialer_autolist,gchar * string,gboolean selectdefault); 
    9294 
     95gint moko_dialer_autolist_hide_all_tips(MokoDialerAutolist *moko_dialer_autolist); 
    9396G_END_DECLS 
    9497 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-declares.h

    r410 r438  
    2424//MAXDISPNAMENUM MUST >=1 & <=9! 
    2525//only when user inputs at least MINSENSATIVELEN, should we start to search. 
    26 #define MOKO_DIALER_MIN_SENSATIVE_LEN (1) 
     26#define MOKO_DIALER_MIN_SENSATIVE_LEN (3) 
    2727#define MOKO_DIALER_DEFAULT_PERSON_IMAGE_PATH ("./default.png") 
    2828#define MOKO_DIALER_MAX_TIPS (3) 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-includes.h

    r425 r438  
    9999}; 
    100100 
    101 typedef struct _dialer_data 
    102 { 
    103  //the global data area begins here 
    104  
    105  
    106 MokoDialerTextview *moko_dialer_text_view; 
    107  
    108 MokoDialerAutolist *moko_dialer_autolist; 
    109  
    110 DIALER_CONTACTS_LIST_HEAD       g_contactlist; ///< the whole list of the contacts from the contact book. 
    111  
    112 HISTORY_LIST_HEAD g_historylist; ///< the whole list of the talk history 
    113  
    114 GLOBAL_STATE g_state; ///< the global states holder. we count on it a lot. 
    115  
    116 gint g_ptimeout; ///< the timer hanle 
    117  
    118 TIMER_DATA g_timer_data;///< the data used by the timers 
    119  
    120 // GtkListStore  *g_list_store_filter;///<the list store used by the gtktreeview, for displaying the history list dynamically. 
    121  
    122 // HISTORY_TYPE g_historyfiltertype;///<indicates the current history filter type, the gtktreeview will be filtered on the value. 
    123  
    124 // GdkPixbuf * g_iconReceived,*g_iconMissed,*g_iconDialed;///<the global pixbuf for the 3 icons displayed in the history window.}DIALER_APP_DATA; 
    125 }MOKO_DIALER_APP_DATA; 
    126101 
    127102#endif 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-textview.c

    r430 r438  
    1515 * 
    1616 *  Current Version: $Rev$ ($Date) [$Author: Tony Guan $] 
     17  
    1718 */ 
    1819 
     
    5051{ 
    5152 
    52 GtkTextView *textview=0; 
    53 GtkTextBuffer *buffer; 
     53                        GtkTextView *textview=0; 
     54                        GtkTextBuffer *buffer; 
    5455 
    5556                        textview=&moko_dialer_textview->textview; 
     
    8990                moko_dialer_textview->tag_for_cursor=  gtk_text_buffer_create_tag (buffer, "tag_cursor","weight","PANGO_WEIGHT_BOLD",   NULL);  
    9091                moko_dialer_textview->tag_for_autofilled=  gtk_text_buffer_create_tag (buffer, "tag_filled","foreground", "#FFFF00", NULL);  
    91  
     92                moko_dialer_textview->sensed=FALSE; 
    9293     
    9394} 
     
    262263GtkTextMark *insertmark; 
    263264         
    264 DBG_ENTER(); 
     265//DBG_ENTER(); 
    265266 
    266267/* Obtaining the buffer associated with the widget. */ 
     
    279280        return 0; 
    280281} 
    281  DBG_TRACE(); 
     282// DBG_TRACE(); 
    282283if(ALL) 
    283284        /* Get the entire buffer text. */ 
     
    285286else 
    286287        codestring = gtk_text_buffer_get_text (buffer, &start, &insertiter, FALSE); 
    287 DBG_MESSAGE("%s",codestring); 
     288//DBG_MESSAGE("%s",codestring); 
    288289strcpy(input,codestring); 
    289  DBG_TRACE(); 
     290// DBG_TRACE(); 
    290291g_free(codestring); 
    291292return 1; 
     293} 
     294 
     295///delete the selection or one character. 
     296int  moko_dialer_textview_delete(MokoDialerTextview *moko_dialer_textview) 
     297{ 
     298GtkTextBuffer *buffer; 
     299GtkTextIter selectioniter,insertiter; 
     300GtkTextMark *selectmark,*insertmark; 
     301gint len; 
     302 
     303buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (moko_dialer_textview)); 
     304 
     305selectmark=gtk_text_buffer_get_selection_bound(buffer); 
     306insertmark=     gtk_text_buffer_get_insert(buffer); 
     307//get current cursor iterator 
     308gtk_text_buffer_get_iter_at_mark(buffer,&insertiter,insertmark); 
     309gtk_text_buffer_get_iter_at_mark(buffer,&selectioniter,selectmark); 
     310        //to see whether there is a selection range. 
     311        if(gtk_text_iter_get_offset(&insertiter)!=gtk_text_iter_get_offset(&selectioniter)) 
     312        { 
     313                //yes, first delete the range. 
     314        gtk_text_buffer_delete(buffer,&selectioniter,&insertiter); 
     315        } 
     316        else 
     317        { 
     318                //no selection, then just perform backspace. 
     319        gtk_text_buffer_backspace(buffer,&insertiter,TRUE,TRUE); 
     320        } 
     321 
     322//now we get the inputed string length.  
     323        insertmark=     gtk_text_buffer_get_insert(buffer); 
     324        //get current cursor iterator 
     325        gtk_text_buffer_get_iter_at_mark(buffer,&insertiter,insertmark); 
     326        len=gtk_text_iter_get_offset(&insertiter); 
     327 
     328        return 1; 
     329 
    292330} 
    293331 
     
    307345gint offsetstart;        
    308346 
    309 DBG_ENTER(); 
    310 DBG_MESSAGE("Sensative string:%s",string); 
     347//DBG_ENTER(); 
     348//DBG_MESSAGE("Sensative string:%s",string); 
    311349 
    312350/* Obtaining the buffer associated with the widget. */ 
     
    333371        gtk_text_buffer_place_cursor(buffer,&start); 
    334372        moko_dialer_textview_set_color(moko_dialer_textview); 
    335          
     373        moko_dialer_textview->sensed=TRUE; 
    336374        //gtk_widget_grab_focus(text_view); 
    337375        return 1; 
     
    362400        gtk_text_buffer_get_iter_at_mark(buffer,&insertiter,insertmark); 
    363401        gtk_text_iter_set_offset(&insertiter,offset); 
     402        //set the private data of sensed. 
    364403        } 
    365404} 
     
    373412//g_free (codestring ); 
    374413 
    375 DBG_LEAVE(); 
     414//DBG_LEAVE(); 
    376415return 1; 
    377416} 
     
    392431//set the cursor to the end of the buffer 
    393432gtk_text_buffer_place_cursor(buffer,&end); 
     433 
     434moko_dialer_textview_set_color(moko_dialer_textview); 
     435// 
    394436         
    395437return 1; 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-dialer-textview.h

    r430 r438  
    5252GtkTextTag*  tag_for_cursor; ///<the formatting tag  for the right digit user just inputed. 
    5353GtkTextTag*  tag_for_autofilled;///<the formatting tag for the autofilled digits if any. 
     54gboolean  sensed; 
    5455}; 
    5556 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/moko-digit-button.c

    r410 r438  
    7171  gtk_widget_set_size_request (digitbutton, 64, 64); 
    7272 
    73   GtkWidget * hbox = gtk_hbox_new (TRUE, 0); 
     73//  GtkWidget * hbox = gtk_hbox_new (TRUE, 0); 
     74  GtkWidget * hbox = gtk_hbox_new (FALSE, 0); 
    7475  gtk_widget_show (hbox); 
    7576  gtk_container_add (GTK_CONTAINER (digitbutton), hbox); 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c

    r430 r438  
    3131#include "contacts.h" 
    3232#include "openmoko-dialer-main.h" 
    33  
    34 void 
    35 on_dialer_autolist_user_selected(GtkWidget * widget,gpointer para_pointer, 
    36                                         gpointer         user_data) 
    37 { 
    38 gchar codesinput[MOKO_DIALER_MAX_NUMBER_LEN]; 
    39 gint lenstring=0; 
    40 gint leninput=0; 
    41 MOKO_DIALER_APP_DATA * appdata=(MOKO_DIALER_APP_DATA*)user_data; 
    42 MokoDialerTextview *moko_dialer_text_view=appdata->moko_dialer_text_view; 
    43 DIALER_READY_CONTACT * ready_contact=(DIALER_READY_CONTACT * )para_pointer; 
    44 DBG_MESSAGE("GOT THE MESSAGE OF SELECTED:%s",ready_contact->p_entry->content); 
    45 moko_dialer_textview_get_input(moko_dialer_text_view,codesinput, 0); 
    46 lenstring=strlen(ready_contact->p_entry->content); 
    47 leninput=strlen(codesinput); 
    48 if(lenstring>=leninput) 
    49 { 
    50  
    51 moko_dialer_textview_fill_it(moko_dialer_text_view,&(ready_contact->p_entry->content[leninput])); 
    52  
    53 } 
    54  
    55 } 
    56  
    57 void 
    58 on_dialer_autolist_user_confirmed(GtkWidget * widget,gpointer para_pointer, 
    59                                         gpointer         user_data) 
    60 { 
    61  
    62 MOKO_DIALER_APP_DATA * appdata=(MOKO_DIALER_APP_DATA*)user_data; 
    63 MokoDialerTextview *moko_dialer_text_view=appdata->moko_dialer_text_view; 
    64 DIALER_READY_CONTACT * ready_contact=(DIALER_READY_CONTACT * )para_pointer; 
    65 DBG_MESSAGE("GOT THE MESSAGE OF confirmed:%s",ready_contact->p_entry->content); 
    66 moko_dialer_textview_confirm_it(moko_dialer_text_view,ready_contact->p_entry->content); 
    67 DBG_MESSAGE("And here we are supposed to call out directly"); 
    68  
    69 } 
    70 void 
    71 on_dialer_autolist_nomatch(GtkWidget * widget,gpointer         user_data) 
    72 { 
    73  
    74 MOKO_DIALER_APP_DATA * appdata=(MOKO_DIALER_APP_DATA*)user_data; 
    75 MokoDialerTextview *moko_dialer_text_view=appdata->moko_dialer_text_view; 
    76  
    77 DBG_MESSAGE("GOT THE MESSAGE OF no match"); 
    78 moko_dialer_textview_fill_it(moko_dialer_text_view,""); 
    79  
    80 } 
    81  
    82  
    83 void 
    84 on_dialer_panel_user_input(GtkWidget * widget,gchar parac, 
    85                                         gpointer         user_data) 
    86 { 
    87 char input[2]; 
    88 input[0]=parac; 
    89 input[1]=0; 
    90 char codesinput[MOKO_DIALER_MAX_NUMBER_LEN]; 
    91  
    92  
    93 MOKO_DIALER_APP_DATA * appdata=(MOKO_DIALER_APP_DATA*)user_data; 
    94 MokoDialerTextview *moko_dialer_text_view=appdata->moko_dialer_text_view; 
    95  
    96 moko_dialer_textview_insert(moko_dialer_text_view, input); 
    97  
    98 moko_dialer_textview_get_input(moko_dialer_text_view,codesinput, 0); 
    99  
    100 moko_dialer_autolist_refresh_by_string(appdata->moko_dialer_autolist,codesinput); 
    101  
    102 } 
    103 void 
    104 on_dialer_panel_user_hold(GtkWidget * widget,gchar parac, 
    105                                         gpointer         user_data) 
    106 { 
    107  
    108 g_print("on_dialer_panel_user_hold:%c\n", parac); 
    109 } 
    110  
    111  
     33#include "openmoko-dialer-window-dialer.h" 
    11234int main( int argc, char** argv ) 
    11335{ 
     
    11537    MOKO_DIALER_APP_DATA* p_dialer_data; 
    11638    p_dialer_data=calloc(1,sizeof(MOKO_DIALER_APP_DATA)); 
    117     GtkVBox* vbox = NULL; 
    118         static MokoFingerToolBox* tools = NULL; 
    11939    /* Initialize GTK+ */ 
    12040    gtk_init( &argc, &argv ); 
     
    12848    g_set_application_name( "OpenMoko Dialer" ); 
    12949 
    130     /* main window */ 
    131     MokoFingerWindow* window = MOKO_FINGER_WINDOW(moko_finger_window_new()); 
    132  
    133     /* application menu */ 
    134     GtkMenu* appmenu = GTK_MENU(gtk_menu_new()); 
    135  
    136     GtkMenuItem* closeitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label( "Close" )); 
    137     g_signal_connect( G_OBJECT(closeitem), "activate", G_CALLBACK(gtk_main_quit), NULL ); 
    138      
    139     gtk_menu_shell_append( appmenu, closeitem ); 
    140     moko_finger_window_set_application_menu( window, appmenu ); 
    141  
    142     /* connect close event */ 
    143     g_signal_connect( G_OBJECT(window), "delete_event", G_CALLBACK( gtk_main_quit ), NULL ); 
    144  
    145  
    146     /* contents */ 
    147     vbox = gtk_vbox_new( FALSE, 0 ); 
    148  
    149  
    150     GtkHBox* hbox = gtk_hbox_new( TRUE, 10 ); 
    151  
    152  
    153     MokoDialerAutolist* autolist=moko_dialer_autolist_new(); 
    154     moko_dialer_autolist_set_data       (autolist,&(p_dialer_data->g_contactlist)); 
    155     p_dialer_data->moko_dialer_autolist=autolist; 
    156     gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(autolist), FALSE, FALSE, 5 ); 
    157  
    158  
    159     g_signal_connect (GTK_OBJECT (autolist), "user_selected", 
    160                             G_CALLBACK (on_dialer_autolist_user_selected),p_dialer_data); 
    161  
    162    
    163     g_signal_connect (GTK_OBJECT (autolist), "user_confirmed", 
    164                             G_CALLBACK ( on_dialer_autolist_user_confirmed),p_dialer_data); 
    165  
    166     g_signal_connect (GTK_OBJECT (autolist), "autolist_nomatch", 
    167                             G_CALLBACK ( on_dialer_autolist_nomatch),p_dialer_data); 
    168  
    169  
    170     MokoDialerTextview * mokotextview=moko_dialer_textview_new(); 
    171     p_dialer_data->moko_dialer_text_view=mokotextview; 
    172  
    173     gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(mokotextview), FALSE,FALSE, 5 ); 
    174  
    175  
    176     MokoDialerPanel* mokodialerpanel=moko_dialer_panel_new(); 
    177  
    178  
    179  
    180     g_signal_connect (GTK_OBJECT (mokodialerpanel), "user_input", 
    181                             G_CALLBACK (on_dialer_panel_user_input),p_dialer_data); 
    182  
    183    
    184     g_signal_connect (GTK_OBJECT (mokodialerpanel), "user_hold", 
    185                             G_CALLBACK ( on_dialer_panel_user_hold),p_dialer_data); 
    186          
    187     gtk_box_pack_start( GTK_BOX(hbox), GTK_WIDGET(mokodialerpanel), TRUE, TRUE, 5 ); 
    188  
    189  
    190  
    191     gtk_box_pack_start( GTK_BOX(vbox), GTK_WIDGET(hbox), TRUE, TRUE, 5 ); 
    192          
    193  
    194  
    195      
    196     
    197      
    198      
    199     moko_finger_window_set_contents( window, GTK_WIDGET(vbox) ); 
    200  
    201     /* show everything and run main loop */ 
    202     gtk_widget_show_all( GTK_WIDGET(window) ); 
    203  
     50//init the dialer window 
     51   window_dialer_init(p_dialer_data); 
    20452 
    20553    gtk_main(); 
  • trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.h

    r410 r438  
    1717 */ 
    1818 #include "moko-dialer-includes.h" 
     19 
     20 typedef struct _dialer_data 
     21{ 
     22 //the global data area begins here 
     23 
     24 
     25MokoDialerTextview *moko_dialer_text_view; 
     26 
     27MokoDialerAutolist *moko_dialer_autolist; 
     28 
     29DIALER_CONTACTS_LIST_HEAD       g_contactlist; ///< the whole list of the contacts from the contact book. 
     30 
     31HISTORY_LIST_HEAD g_historylist; ///< the whole list of the talk history 
     32 
     33GLOBAL_STATE g_state; ///< the global states holder. we count on it a lot. 
     34 
     35gint g_ptimeout; ///< the timer hanle 
     36 
     37TIMER_DATA g_timer_data;///< the data used by the timers 
     38 
     39GtkWidget * window_dialer; 
     40 
     41// GtkListStore  *g_list_store_filter;///<the list store used by the gtktreeview, for displaying the history list dynamically. 
     42 
     43// HISTORY_TYPE g_historyfiltertype;///<indicates the current history filter type, the gtktreeview will be filtered on the value. 
     44 
     45// GdkPixbuf * g_iconReceived,*g_iconMissed,*g_iconDialed;///<the global pixbuf for the 3 icons displayed in the history window.}DIALER_APP_DATA; 
     46}MOKO_DIALER_APP_DATA; 
     47 
Note: See TracChangeset for help on using the changeset viewer.