Expand row in calllog

This commit is contained in:
Margaux Clerc 2013-03-13 12:05:45 +01:00
parent 74edc29206
commit cfca813d06
2 changed files with 28 additions and 21 deletions

View file

@ -22,7 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void fill_renderers(GtkTreeView *v){
GtkTreeViewColumn *c;
GtkCellRenderer *r=gtk_cell_renderer_pixbuf_new ();
GtkCellRenderer *r;
r=gtk_cell_renderer_pixbuf_new();
c=gtk_tree_view_column_new_with_attributes("icon",r,"pixbuf",0,NULL);
gtk_tree_view_append_column (v,c);
@ -34,27 +35,27 @@ static void fill_renderers(GtkTreeView *v){
void linphone_gtk_call_log_update(GtkWidget *w){
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
GtkListStore *store;
GtkTreeStore *store;
const MSList *logs;
store=(GtkListStore*)gtk_tree_view_get_model(v);
store=(GtkTreeStore*)gtk_tree_view_get_model(v);
if (store==NULL){
store=gtk_list_store_new(3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_POINTER);
store=gtk_tree_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")));
// gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
// create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
}
gtk_list_store_clear (store);
gtk_tree_store_clear (store);
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
LinphoneCallLog *cl=(LinphoneCallLog*)logs->data;
GtkTreeIter iter;
GtkTreeIter iter, iter2;
LinphoneAddress *la=linphone_call_log_get_dir(cl)==LinphoneCallIncoming ? linphone_call_log_get_from(cl) : linphone_call_log_get_to(cl);
char *addr= linphone_address_as_string_uri_only (la);
const char *display;
gchar *logtxt, *minutes, *seconds;
gchar *logtxt, *headtxt, *minutes, *seconds;
gchar quality[20];
const char *status=NULL;
gchar *start_date=NULL;
@ -99,28 +100,33 @@ void linphone_gtk_call_log_update(GtkWidget *w){
seconds=g_markup_printf_escaped(
ngettext("%i second", "%i seconds", duration%60),
duration%60);
if (status==NULL) logtxt=g_markup_printf_escaped(
_("<big><b>%s</b></big>\t<small><i>%s</i>\t"
"<i>Quality: %s</i></small>\n%s\t%s %s\t"),
display, addr, quality ,
start_date ? start_date : "", minutes, seconds);
else logtxt=g_markup_printf_escaped(
_("<big><b>%s</b></big>\t<small><i>%s</i></small>\t"
"\n%s\t%s"),
display, addr,
start_date ? start_date : "", status);
if (status==NULL) {
headtxt=g_markup_printf_escaped(_("<big><b>%s</b></big>\t%s"),display,start_date ? start_date : "");
logtxt=g_markup_printf_escaped(
_("<small><i>%s</i>\t"
"<i>Quality: %s</i></small>\n%s\t%s\t"),
addr, quality, minutes, seconds);
} else {
headtxt=g_markup_printf_escaped(_("<big><b>%s</b></big>\t%s"),display,start_date ? start_date : "");
logtxt=g_markup_printf_escaped(
_("<small><i>%s</i></small>\t"
"\n%s"),addr, status);
}
g_free(minutes);
g_free(seconds);
if (start_date) g_free(start_date);
gtk_list_store_append (store,&iter);
gtk_tree_store_append (store,&iter,NULL);
GdkPixbuf *incoming = create_pixbuf("call_status_incoming.png");
GdkPixbuf *outgoing = create_pixbuf("call_status_outgoing.png");
gtk_list_store_set (store,&iter,
gtk_tree_store_set (store,&iter,
0, linphone_call_log_get_dir(cl)==LinphoneCallOutgoing ? outgoing : incoming,
1, logtxt,2,la,-1);
1, headtxt,2,la,-1);
gtk_tree_store_append (store,&iter2,&iter);
gtk_tree_store_set (store,&iter2,1,logtxt,2,la,-1);
ms_free(addr);
g_free(logtxt);
g_free(headtxt);
}
}

View file

@ -581,12 +581,13 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_column_set_max_width(column,60);
gtk_tree_view_append_column (GTK_TREE_VIEW (friendlist), column);
/* Call column*/
renderer = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes (_("Call"),renderer,"pixbuf",FRIEND_CALL,NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (friendlist), column);
/* chat column*/
/* Chat column*/
renderer = gtk_cell_renderer_pixbuf_new();
column = gtk_tree_view_column_new_with_attributes (_("Chat"),renderer,"pixbuf",FRIEND_CHAT,NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (friendlist), column);