From: Margaux Clerc Date: Wed, 6 Feb 2013 12:55:02 +0000 (+0100) Subject: add pixmaps for calllog and imporved display chat X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=750c28f183c5eb7d9ccd1e13651d7896b4a7798f add pixmaps for calllog and imporved display chat --- diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 9494dbfa..20ff8181 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -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); diff --git a/gtk/chat.c b/gtk/chat.c index bcaca1a9..201d138d 100644 --- a/gtk/chat.c +++ b/gtk/chat.c @@ -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); diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am index d10d4822..2386d68c 100644 --- a/pixmaps/Makefile.am +++ b/pixmaps/Makefile.am @@ -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 index 00000000..72ca1330 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 index 00000000..aa15b3be Binary files /dev/null and b/pixmaps/call_status_outgoing.png differ