]> sjero.net Git - linphone/commitdiff
add pixmaps for calllog and imporved display chat
authorMargaux Clerc <margaux.clerc@belledonne-communications.com>
Wed, 6 Feb 2013 12:55:02 +0000 (13:55 +0100)
committerMargaux Clerc <margaux.clerc@belledonne-communications.com>
Wed, 6 Feb 2013 12:56:42 +0000 (13:56 +0100)
gtk/calllogs.c
gtk/chat.c
pixmaps/Makefile.am
pixmaps/call_status_incoming.png [new file with mode: 0644]
pixmaps/call_status_outgoing.png [new file with mode: 0644]

index 9494dbfa2661a681278372c2431511805ef25b65..20ff8181ff273b39bcffb5ed851a5430c96ac87b 100644 (file)
@@ -24,8 +24,7 @@ static void fill_renderers(GtkTreeView *v){
        GtkTreeViewColumn *c;
        GtkCellRenderer *r=gtk_cell_renderer_pixbuf_new ();
 
-       g_object_set(r,"stock-size",GTK_ICON_SIZE_BUTTON,NULL);
-       c=gtk_tree_view_column_new_with_attributes("icon",r,"stock-id",0,NULL);
+       c=gtk_tree_view_column_new_with_attributes("icon",r,"pixbuf",0,NULL);
        gtk_tree_view_append_column (v,c);
 
        r=gtk_cell_renderer_text_new ();
@@ -40,7 +39,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){
 
        store=(GtkListStore*)gtk_tree_view_get_model(v);
        if (store==NULL){
-               store=gtk_list_store_new(3,G_TYPE_STRING,G_TYPE_STRING, G_TYPE_POINTER);
+               store=gtk_list_store_new(3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_POINTER);
                gtk_tree_view_set_model(v,GTK_TREE_MODEL(store));
                g_object_unref(G_OBJECT(store));
                fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
@@ -110,8 +109,11 @@ void linphone_gtk_call_log_update(GtkWidget *w){
                g_free(seconds);
                if (start_date) g_free(start_date);
                gtk_list_store_append (store,&iter);
+
+               GdkPixbuf *incoming = create_pixbuf("call_status_incoming.png");
+               GdkPixbuf *outgoing = create_pixbuf("call_status_outgoing.png");
                gtk_list_store_set (store,&iter,
-                              0, cl->dir==LinphoneCallOutgoing ? GTK_STOCK_GO_UP : GTK_STOCK_GO_DOWN,
+                              0, cl->dir==LinphoneCallOutgoing ? outgoing : incoming,
                               1, logtxt,2,la,-1);
                ms_free(addr);
                g_free(logtxt);
index bcaca1a99e291bcdd9ffbb2d2ec0285ffd55165f..201d138d9cdc5bebce286b117ac6899339dc6499 100644 (file)
@@ -118,7 +118,7 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
        gtk_text_buffer_get_end_iter(buffer,&iter);
        gtk_text_buffer_get_iter_at_offset(buffer,&begin,off);
        gtk_text_buffer_get_end_iter(buffer,&iter);                             
-       gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,message,-1,me ? "left" : "left",NULL);
+       gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,message,-1,"margin",NULL);
        gtk_text_buffer_get_end_iter(buffer,&iter);     
        gtk_text_buffer_insert(buffer,&iter,"\n",-1);
        gtk_text_buffer_get_bounds (buffer, &begin, &end);      
@@ -136,13 +136,13 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
        gtk_text_buffer_get_end_iter(buffer,&iter);
        if(me){
                list=g_list_append(list,GINT_TO_POINTER(gtk_text_iter_get_line(&iter)));
-               gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Message in progress.. ",-1,                                                                      
+               gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending .. ",-1,                                                                 
                                                         "italic","right","small","font_grey",NULL);
                g_object_set_data(G_OBJECT(w),"list",list);
        } else {
                struct tm *tm=localtime(&t);
                char buf[80];
-               strftime(buf,80,"Received at %H:%M",tm);
+               strftime(buf,80,"Send at %H:%M",tm);
                gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1,                                                                   
                               "italic","right","small","font_grey",NULL);
        }
@@ -162,7 +162,7 @@ const LinphoneAddress* linphone_gtk_get_used_identity(){
 
 
 /* function in dev for displaying ack*/
-void update_chat_state_message(LinphoneChatMessageState state){
+void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessage *msg){
     GtkWidget *main_window=linphone_gtk_get_main_window();
     GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
        GtkWidget *page=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
@@ -192,15 +192,21 @@ void update_chat_state_message(LinphoneChatMessageState state){
                gchar *result;
                switch (state) {
                        case LinphoneChatMessageStateInProgress:
-                               result="Message in progress.. ";
+                               result="Sending ";
                                break;
                        case LinphoneChatMessageStateDelivered:
-                               result="Message delivered ";
+                       {
+                               time_t t=time(NULL);
+                               struct tm *tm=localtime(&t);
+                               char buf[80];
+                               strftime(buf,80,"%H:%M",tm);
+                               result=buf;
                                break;
+                       }
                        case  LinphoneChatMessageStateNotDelivered:
                                result="Message not delivered ";
                                break;
-                       default : result="Message in progress.. ";
+                       default : result="Sending ..";
                }
                gtk_text_buffer_insert_with_tags_by_name(b,&iter,result,-1,
                                                                                                "italic","right","small","font_grey",NULL);
@@ -211,7 +217,7 @@ void update_chat_state_message(LinphoneChatMessageState state){
 
 static void on_chat_state_changed(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *user_pointer){
        g_message("chat message state is %s",linphone_chat_message_state_to_string(state));
-       update_chat_state_message(state);
+       update_chat_state_message(state,msg);
 }
 
 void linphone_gtk_send_text(){
@@ -225,10 +231,10 @@ void linphone_gtk_send_text(){
        if (strlen(entered)>0) {
                LinphoneChatMessage *msg;
                msg=linphone_chat_room_create_message(cr,entered);
+               linphone_chat_room_send_message2(cr,msg,on_chat_state_changed,NULL);
                linphone_gtk_push_text(w,
                                linphone_gtk_get_used_identity(),
                                entered,TRUE,cr,linphone_chat_message_get_time(msg));
-               linphone_chat_room_send_message2(cr,msg,on_chat_state_changed,NULL);
                gtk_entry_set_text(GTK_ENTRY(entry),"");
        }
 }
@@ -285,6 +291,8 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
                                        "small","size",9*PANGO_SCALE,NULL);
        gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
                                        "font_grey","foreground-gdk",&color,NULL);
+       gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
+                                       "margin","left-margin",10,NULL);
        
        GtkWidget *button = linphone_gtk_get_widget(chat_view,"send");
        g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,NULL);
index d10d48222cff8416840a8331a5f040be81b95f80..2386d68cf5f9468e181bd5abd86941b6dcf9e401 100644 (file)
@@ -17,6 +17,7 @@ contact-orange.png dialer-orange.png history-orange.png\
 startcall-green.png startcall-small.png stopcall-red.png stopcall-small.png addcall-green.png linphone.icns \
 contact_starred.png contact_unstarred.png \
 speaker.png \
+call_status_incoming.png call_status_outgoing.png \
 ok.png \
 dialer.png \
 notok.png
diff --git a/pixmaps/call_status_incoming.png b/pixmaps/call_status_incoming.png
new file mode 100644 (file)
index 0000000..72ca133
Binary files /dev/null and b/pixmaps/call_status_incoming.png differ
diff --git a/pixmaps/call_status_outgoing.png b/pixmaps/call_status_outgoing.png
new file mode 100644 (file)
index 0000000..aa15b3b
Binary files /dev/null and b/pixmaps/call_status_outgoing.png differ