mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
Merge branch 'master' of git.sv.gnu.org:/srv/git/linphone
This commit is contained in:
commit
e62335cc11
3 changed files with 144 additions and 40 deletions
|
|
@ -1,31 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--Generated with glade3 3.4.5 on Wed Jul 30 17:55:28 2008 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="2.16"/>
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkListStore" id="call_logs_store">
|
||||
<columns>
|
||||
<!-- column-name icon -->
|
||||
<column type="gchar"/>
|
||||
<!-- column-name sipaddress -->
|
||||
<column type="gchar"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkDialog" id="call_logs">
|
||||
<property name="width_request">500</property>
|
||||
<property name="height_request">370</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Call history</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="icon">linphone2.png</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="has_separator">False</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="logtextview">
|
||||
<object class="GtkTreeView" id="logs_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<signal name="row_activated" handler="linphone_gtk_history_row_activated"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
@ -36,32 +45,65 @@
|
|||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">Clear all</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="image">image1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="call_back_button">
|
||||
<property name="label" translatable="yes">Call back</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="call_logs_close">
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="label" translatable="yes">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="0">button1</action-widget>
|
||||
<action-widget response="2">button1</action-widget>
|
||||
<action-widget response="1">call_back_button</action-widget>
|
||||
<action-widget response="0">call_logs_close</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-clear</property>
|
||||
</object>
|
||||
</interface>
|
||||
|
|
|
|||
106
gtk/calllogs.c
106
gtk/calllogs.c
|
|
@ -21,47 +21,109 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
void linphone_gtk_call_log_update(GtkWidget *w){
|
||||
GtkTextView *v=GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"logtextview"));
|
||||
GtkTextBuffer *b=gtk_text_view_get_buffer(v);
|
||||
GtkTextIter iter,begin;
|
||||
int off;
|
||||
char *logmsg;
|
||||
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
|
||||
GtkListStore *store;
|
||||
const MSList *logs;
|
||||
|
||||
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);
|
||||
gtk_tree_view_set_model(v,GTK_TREE_MODEL(store));
|
||||
g_object_unref(G_OBJECT(store));
|
||||
}
|
||||
gtk_list_store_clear (store);
|
||||
|
||||
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
|
||||
LinphoneCallLog *cl=(LinphoneCallLog*)logs->data;
|
||||
logmsg=linphone_call_log_to_str(cl);
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
off=gtk_text_iter_get_offset(&iter);
|
||||
gtk_text_buffer_insert(b,&iter,logmsg,-1);
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_buffer_insert(b,&iter,"\n",-1);
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_buffer_get_iter_at_offset(b,&begin,off);
|
||||
gtk_text_buffer_apply_tag_by_name(b,cl->dir==LinphoneCallOutgoing ? "green" : "blue" ,&begin,&iter);
|
||||
ms_free(logmsg);
|
||||
GtkTreeIter iter;
|
||||
LinphoneAddress *la=cl->dir==LinphoneCallIncoming ? cl->from : cl->to;
|
||||
char *addr= linphone_address_as_string_uri_only (la);
|
||||
const char *display;
|
||||
gchar *logtxt;
|
||||
display=linphone_address_get_display_name (la);
|
||||
if (display==NULL){
|
||||
display=linphone_address_get_username (la);
|
||||
if (display==NULL)
|
||||
display=linphone_address_get_domain (la);
|
||||
}
|
||||
logtxt=g_markup_printf_escaped("<big><b>%s</b></big>\t<small><i>%s</i></small>\n"
|
||||
"%s\t%i minutes %i seconds",display, addr, cl->start_date,
|
||||
cl->duration/60,cl->duration%60);
|
||||
gtk_list_store_append (store,&iter);
|
||||
gtk_list_store_set (store,&iter,
|
||||
0, cl->dir==LinphoneCallOutgoing ? GTK_STOCK_GO_UP : GTK_STOCK_GO_DOWN,
|
||||
1, logtxt,2,la,-1);
|
||||
ms_free(addr);
|
||||
g_free(logtxt);
|
||||
}
|
||||
gtk_text_buffer_get_end_iter(b,&iter);
|
||||
gtk_text_view_scroll_to_iter(v,&iter,0,FALSE,0,0);
|
||||
|
||||
}
|
||||
|
||||
void linphone_gtk_call_log_response(GtkWidget *w){
|
||||
static bool_t put_selection_to_uribar(GtkWidget *treeview){
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
sel=gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
|
||||
if (sel!=NULL){
|
||||
GtkTreeModel *model=NULL;
|
||||
GtkTreeIter iter;
|
||||
if (gtk_tree_selection_get_selected (sel,&model,&iter)){
|
||||
gpointer pla;
|
||||
LinphoneAddress *la;
|
||||
char *tmp;
|
||||
gtk_tree_model_get(model,&iter,2,&pla,-1);
|
||||
la=(LinphoneAddress*)pla;
|
||||
tmp=linphone_address_as_string (la);
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
|
||||
ms_free(tmp);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void linphone_gtk_history_row_activated(GtkWidget *treeview){
|
||||
put_selection_to_uribar(treeview);
|
||||
}
|
||||
|
||||
void linphone_gtk_call_log_response(GtkWidget *w, guint response_id){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
if (response_id==1){
|
||||
if (put_selection_to_uribar(linphone_gtk_get_widget(w,"logs_view")))
|
||||
linphone_gtk_start_call(linphone_gtk_get_widget(mw,"start_call"));
|
||||
}else if (response_id==2){
|
||||
linphone_core_clear_call_logs (linphone_gtk_get_core());
|
||||
linphone_gtk_call_log_update(w);
|
||||
return;
|
||||
}
|
||||
g_object_set_data(G_OBJECT(mw),"call_logs",NULL);
|
||||
gtk_widget_destroy(w);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
gtk_tree_view_append_column (v,c);
|
||||
|
||||
r=gtk_cell_renderer_text_new ();
|
||||
c=gtk_tree_view_column_new_with_attributes("sipaddress",r,"markup",1,NULL);
|
||||
gtk_tree_view_append_column (v,c);
|
||||
}
|
||||
|
||||
GtkWidget * linphone_gtk_show_call_logs(void){
|
||||
GtkWidget *mw=linphone_gtk_get_main_window();
|
||||
GtkTextBuffer *b;
|
||||
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
|
||||
if (w==NULL){
|
||||
w=linphone_gtk_create_window("call_logs");
|
||||
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")));
|
||||
fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
|
||||
g_object_set_data(G_OBJECT(mw),"call_logs",w);
|
||||
g_signal_connect(G_OBJECT(w),"response",(GCallback)linphone_gtk_call_log_response,NULL);
|
||||
gtk_widget_show(w);
|
||||
b=gtk_text_view_get_buffer(GTK_TEXT_VIEW(linphone_gtk_get_widget(w,"logtextview")));
|
||||
gtk_text_buffer_create_tag(b,"blue","foreground","blue",NULL);
|
||||
gtk_text_buffer_create_tag(b,"green","foreground","green",NULL);
|
||||
linphone_gtk_call_log_update(w);
|
||||
}else gtk_window_present(GTK_WINDOW(w));
|
||||
return w;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 292e7943c683fd8ada2dc0234fdcb1b9e299aba9
|
||||
Subproject commit f2ddc59ed02f26ff828243fa400abae925b6f730
|
||||
Loading…
Add table
Reference in a new issue