GtkWidget * linphone_gtk_show_call_logs(void){ GtkWidget *mw=linphone_gtk_get_main_window(); 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); linphone_gtk_call_log_update(w); }else gtk_window_present(GTK_WINDOW(w)); return w; }
void linphone_gtk_create_in_call_view(LinphoneCall *call){ GtkWidget *call_view=linphone_gtk_create_widget("main","in_call_frame"); GtkWidget *main_window=linphone_gtk_get_main_window (); GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch"); static int call_index=1; int idx; if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){ /*this is the only call at this time */ call_index=1; } g_object_set_data(G_OBJECT(call_view),"call",call); g_object_set_data(G_OBJECT(call_view),"call_index",GINT_TO_POINTER(call_index)); linphone_call_set_user_pointer (call,call_view); linphone_call_ref(call); gtk_notebook_append_page (notebook,call_view,make_tab_header(call_index)); gtk_widget_show(call_view); idx = gtk_notebook_page_num(notebook, call_view); gtk_notebook_set_current_page(notebook, idx); call_index++; linphone_gtk_enable_hold_button (call,FALSE,TRUE); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(call_view,"incall_mute")),FALSE); }
void linphone_gtk_set_in_conference(LinphoneCall *call){ GtkWidget *mw=linphone_gtk_get_main_window(); GtkWidget *participant=find_conferencee_from_call(call); if (participant==NULL){ GtkWidget *tab=get_conference_tab(mw); const LinphoneAddress *addr=linphone_call_get_remote_address(call); participant=linphone_gtk_create_widget("main","callee_frame"); GtkWidget *sound_meter; GtkWidget *viewswitch=linphone_gtk_get_widget(mw,"viewswitch"); gchar *markup; if (linphone_address_get_display_name(addr)!=NULL){ markup=g_strdup_printf("<b>%s</b>",linphone_address_get_display_name(addr)); }else{ char *tmp=linphone_address_as_string_uri_only(addr); markup=g_strdup_printf("%s",tmp); ms_free(tmp); } gtk_label_set_markup(GTK_LABEL(linphone_gtk_get_widget(participant,"callee_name_label")),markup); g_free(markup); sound_meter=linphone_gtk_get_widget(participant,"sound_indicator"); linphone_gtk_init_audio_meter(sound_meter, (get_volume_t) linphone_call_get_play_volume, call); gtk_box_pack_start(GTK_BOX(tab),participant,FALSE,FALSE,PADDING_PIXELS); g_object_set_data_full(G_OBJECT(participant),"call",linphone_call_ref(call),(GDestroyNotify)linphone_call_unref); gtk_widget_show(participant); gtk_notebook_set_current_page(GTK_NOTEBOOK(viewswitch), gtk_notebook_page_num(GTK_NOTEBOOK(viewswitch),tab)); } }
LinphoneCall *linphone_gtk_get_currently_displayed_call(gboolean *is_conf) { LinphoneCore *lc=linphone_gtk_get_core(); GtkWidget *main_window=linphone_gtk_get_main_window (); GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch"); const MSList *calls=linphone_core_get_calls(lc); if (is_conf) *is_conf=FALSE; if (!linphone_gtk_use_in_call_view() || ms_list_size(calls)==1) { if (calls) return (LinphoneCall*)calls->data; } else { int idx=gtk_notebook_get_current_page (notebook); GtkWidget *page=gtk_notebook_get_nth_page(notebook,idx); if (page!=NULL) { LinphoneCall *call=(LinphoneCall*)g_object_get_data(G_OBJECT(page),"call"); if (call==NULL) { GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(main_window),"conf_frame"); if (conf_frame==page) { if (is_conf) *is_conf=TRUE; return NULL; } } return call; } } return NULL; }
void linphone_gtk_update_video_button(LinphoneCall *call){ GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *button; const LinphoneCallParams *params=linphone_call_get_current_params(call); gboolean has_video=linphone_call_params_video_enabled(params); if (call_view==NULL) return; button=linphone_gtk_get_widget(call_view,"video_button"); gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_stock(has_video ? GTK_STOCK_REMOVE : GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON)); g_object_set_data(G_OBJECT(button),"adding_video",GINT_TO_POINTER(!has_video)); if (!linphone_core_video_supported(linphone_call_get_core(call))){ gtk_widget_set_sensitive(button,FALSE); return; } if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"signal_connected"))==0){ g_signal_connect(G_OBJECT(button),"clicked",(GCallback)video_button_clicked,call); g_object_set_data(G_OBJECT(button),"signal_connected",GINT_TO_POINTER(1)); } GtkWidget *conf_frame=(GtkWidget *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"conf_frame"); gtk_widget_set_sensitive(button,linphone_call_get_state(call)==LinphoneCallStreamsRunning); if(conf_frame!=NULL){ gtk_widget_set_sensitive(button,FALSE); } }
void linphone_gtk_remove_in_call_view(LinphoneCall *call) { GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer (call); GtkWidget *main_window=linphone_gtk_get_main_window (); GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch"); gboolean in_conf=linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call)); int idx; g_return_if_fail(w!=NULL); idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w); if (in_conf) { linphone_gtk_unset_from_conference(call); } linphone_call_set_user_pointer (call,NULL); linphone_call_unref(call); call=linphone_core_get_current_call(linphone_gtk_get_core()); if (call==NULL) { if (linphone_core_is_in_conference(linphone_gtk_get_core())) { /*show the conference*/ gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb), g_object_get_data(G_OBJECT(main_window),"conf_frame"))); } else gtk_notebook_prev_page(GTK_NOTEBOOK(nb)); } else { /*show the active call*/ gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb), linphone_call_get_user_pointer(call))); } gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx); gtk_widget_destroy(w); }
void linphone_gtk_call_update_tab_header(LinphoneCall *call,gboolean pause) { GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *main_window=linphone_gtk_get_main_window(); GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(main_window,"viewswitch")); gint call_index=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"call_index")); GtkWidget *new_label=gtk_hbox_new (FALSE,0); GtkWidget *i=NULL; GtkWidget *l; gchar *text; if(pause) { i=gtk_image_new_from_stock(GTK_STOCK_MEDIA_PAUSE,GTK_ICON_SIZE_SMALL_TOOLBAR); } else { i=create_pixmap ("startcall-small.png"); } text=g_strdup_printf(_("Call #%i"),call_index); l=gtk_label_new (text); gtk_box_pack_start (GTK_BOX(new_label),i,FALSE,FALSE,0); gtk_box_pack_end(GTK_BOX(new_label),l,TRUE,TRUE,0); gtk_notebook_set_tab_label(notebook,w,new_label); gtk_widget_show_all(new_label); g_free(text); }
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"); 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; }
void linphone_gtk_show_camera_preview_clicked(GtkButton *button){ GtkWidget *mw=linphone_gtk_get_main_window(); GtkWidget *video_preview=(GtkWidget *)g_object_get_data(G_OBJECT(mw),"video_preview"); if (!video_preview){ gchar *title; LinphoneCore *lc=linphone_gtk_get_core(); GdkColor color; guint tid; video_preview=gtk_window_new(GTK_WINDOW_TOPLEVEL); title=g_strdup_printf("%s - Video preview",linphone_gtk_get_ui_config("title","Linphone")); gtk_window_set_title(GTK_WINDOW(video_preview),title); gdk_color_parse("black",&color); gtk_widget_modify_bg(video_preview,GTK_STATE_NORMAL,&color); g_free(title); g_object_set_data(G_OBJECT(mw),"video_preview",video_preview); g_signal_connect(video_preview,"destroy",(GCallback)on_video_preview_destroyed,mw); gtk_widget_show(video_preview); linphone_core_set_native_preview_window_id(lc,get_native_handle(gtk_widget_get_window(video_preview))); linphone_core_enable_video_preview(lc,TRUE); tid=g_timeout_add(100,(GSourceFunc)check_preview_size,video_preview); g_object_set_data(G_OBJECT(video_preview),"timeout-id",GINT_TO_POINTER(tid)); } }
void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,GtkWidget *chat_view){ GtkWidget *main_window=linphone_gtk_get_main_window (); LinphoneChatRoom *cr2=(LinphoneChatRoom *)g_object_get_data(G_OBJECT(chat_view),"cr"); const LinphoneAddress *from=linphone_chat_room_get_peer_address(cr2); char *from_str=linphone_address_as_string_uri_only(from); char *uri_str=linphone_address_as_string(uri); char *uri_only=linphone_address_as_string_uri_only(uri); MSList *messages=NULL; if(g_strcmp0(from_str,uri_only)!=0){ GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview")); GtkTextIter start; GtkTextIter end; GtkTextBuffer *text_buffer; text_buffer=gtk_text_view_get_buffer(text_view); gtk_text_buffer_get_bounds(text_buffer, &start, &end); gtk_text_buffer_delete (text_buffer, &start, &end); udpate_tab_chat_header(chat_view,uri,cr); g_object_set_data(G_OBJECT(chat_view),"cr",cr); g_object_set_data(G_OBJECT(linphone_gtk_get_widget(main_window,"contact_list")),"chatview",(gpointer)chat_view); messages=linphone_chat_room_get_history(cr,NB_MSG_HIST); g_object_set_data(G_OBJECT(chat_view),"from_message",g_strdup(uri_str)); display_history_message(chat_view,messages,uri); gtk_text_buffer_get_end_iter(text_buffer,&end); gtk_text_view_scroll_to_iter(text_view,&end,0,FALSE,1.0,0); } ms_free(from_str); ms_free(uri_str); ms_free(uri_only); }
GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with){ GtkWidget *chat_view=linphone_gtk_create_widget("main","chatroom_frame"); GtkWidget *main_window=linphone_gtk_get_main_window(); GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch"); GtkWidget *text=linphone_gtk_get_widget(chat_view,"textview"); GdkColor color; GdkColor colorb; int idx; GtkWidget *button; GtkWidget *entry; MSList *messages; GHashTable *table; char *with_str; color.red = 32512; color.green = 32512; color.blue = 32512; colorb.red = 56832; colorb.green = 60928; colorb.blue = 61952; with_str=linphone_address_as_string_uri_only(with); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD_CHAR); gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text),FALSE); gtk_notebook_append_page(notebook,chat_view,create_tab_chat_header(cr,with)); idx = gtk_notebook_page_num(notebook, chat_view); gtk_notebook_set_current_page(notebook, idx); gtk_widget_show(chat_view); table=g_hash_table_new_full(g_direct_hash,g_direct_equal,NULL,NULL); g_object_set_data(G_OBJECT(chat_view),"cr",cr); g_object_set_data(G_OBJECT(chat_view),"from_message",NULL); g_object_set_data(G_OBJECT(chat_view),"table",table); gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), "right","justification", GTK_JUSTIFY_RIGHT,NULL); gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), "left","justification", GTK_JUSTIFY_LEFT,NULL); gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), "bold","weight", PANGO_WEIGHT_BOLD,NULL); gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), "italic","style", PANGO_STYLE_ITALIC,NULL); gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), "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","indent",10,NULL); gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), "bg","paragraph-background-gdk",&colorb,NULL); messages = linphone_chat_room_get_history(cr,NB_MSG_HIST); display_history_message(chat_view,messages,with); button = linphone_gtk_get_widget(chat_view,"send"); g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,NULL); entry = linphone_gtk_get_widget(chat_view,"text_entry"); g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,NULL); g_signal_connect_swapped(G_OBJECT(entry),"changed",(GCallback)linphone_gtk_compose_text,NULL); g_signal_connect(G_OBJECT(notebook),"switch_page",(GCallback)linphone_gtk_notebook_tab_select,NULL); ms_free(with_str); return chat_view; }
gboolean linphone_gtk_call_log_reset_missed_call(GtkWidget *w, GdkEvent *event,gpointer user_data){ GtkWidget *mw=linphone_gtk_get_main_window(); GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch")); gtk_notebook_set_current_page(notebook,0); linphone_core_reset_missed_calls_count(linphone_gtk_get_core()); linphone_gtk_call_log_clear_missed_call(); return TRUE; }
void linphone_gtk_exit_login_frame(void){ GtkWidget *mw=linphone_gtk_get_main_window(); gtk_widget_show(linphone_gtk_get_widget(mw,"main_frame")); gtk_widget_hide(linphone_gtk_get_widget(mw,"login_frame")); gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"main_menu"),TRUE); gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"options_menu"),TRUE); gtk_widget_show(linphone_gtk_get_widget(mw,"disconnect_item")); }
void linphone_gtk_record_call_toggled(GtkWidget *button) { gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); gboolean is_conf=FALSE; const char *filepath; gchar *message; LinphoneCore *lc=linphone_gtk_get_core(); LinphoneCall *call=linphone_gtk_get_currently_displayed_call(&is_conf); GtkWidget *callview; GtkWidget *label; if (call) { const LinphoneCallParams *params; callview=(GtkWidget*)linphone_call_get_user_pointer (call); params=linphone_call_get_current_params(call); filepath=linphone_call_params_get_record_file(params); label=linphone_gtk_get_widget(callview,"record_status"); } else if (is_conf) { GtkWidget *mw=linphone_gtk_get_main_window(); callview=(GtkWidget *)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"conf_frame"); label=linphone_gtk_get_widget(callview,"conf_record_status"); filepath=(const char*)g_object_get_data(G_OBJECT(mw),"conf_record_path"); if (filepath==NULL) { filepath=linphone_gtk_get_record_path(NULL,TRUE); g_object_set_data_full(G_OBJECT(mw),"conf_record_path",(char*)filepath,g_free); } } else { g_warning("linphone_gtk_record_call_toggled(): bug."); return; } message=g_strdup_printf(_("<small><i>Recording into\n%s %s</i></small>"),filepath,active ? "" : _("(Paused)")); if (active) { if (call) linphone_call_start_recording(call); else linphone_core_start_conference_recording(lc,filepath); } else { if (call) linphone_call_stop_recording(call); else linphone_core_stop_conference_recording(lc); } gtk_label_set_markup(GTK_LABEL(label),message); g_free(message); }
void linphone_gtk_compose_text(void) { GtkWidget *main_window=linphone_gtk_get_main_window(); GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list"); GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview"); LinphoneChatRoom *cr=g_object_get_data(G_OBJECT(w),"cr"); if (cr) { linphone_chat_room_compose(cr); } }
void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg ) { GtkWidget *main_window=linphone_gtk_get_main_window(); GtkWidget *friendlist=linphone_gtk_get_widget ( main_window,"contact_list" ); GtkWidget *w; gboolean send=TRUE; /*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/ const LinphoneAddress *from= linphone_chat_message_get_from ( msg ); w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" ); if ( w!=NULL ) { /* Chat window opened */ const LinphoneAddress *from_chatview=linphone_gtk_friend_list_get_active_address(); if (linphone_address_weak_equal(from,from_chatview)) { send=TRUE; } else { if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } send=FALSE; } } else { /* Chat window closed */ #ifdef MSG_STORAGE_ENABLED send=FALSE; #else send=TRUE; #endif if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } w=linphone_gtk_init_chatroom ( room,linphone_chat_message_get_from ( msg ) ); g_object_set_data ( G_OBJECT ( friendlist ),"chatview", ( gpointer ) w ); linphone_gtk_friend_list_set_active_address(from); } #ifdef HAVE_GTK_OSX /* Notified when a new message is sent */ linphone_gtk_status_icon_set_blinking ( TRUE ); #else if ( !gtk_window_is_active ( GTK_WINDOW ( main_window ) ) ) { if ( !GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( w ),"is_notified" ) ) ) { linphone_gtk_notify ( NULL,linphone_chat_message_get_text ( msg ) ); g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( TRUE ) ); } else { g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( FALSE ) ); } } #endif if ( send ) { linphone_gtk_push_text ( w,linphone_chat_message_get_from ( msg ), FALSE,room,msg,FALSE ); } linphone_core_play_local(lc,linphone_gtk_get_sound_path("incoming_chat.wav")); linphone_gtk_show_friends(); }
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"); GHashTable *table=(GHashTable*)g_object_get_data(G_OBJECT(page),"table"); if(page!=NULL){ GtkTextView *text=GTK_TEXT_VIEW(linphone_gtk_get_widget(page,"textview")); GtkTextBuffer *b=gtk_text_view_get_buffer(text); GtkTextIter iter; GtkTextIter end; GtkTextIter start; gchar *result; gint line; line=GPOINTER_TO_INT(g_hash_table_lookup(table,msg)); gtk_text_buffer_get_iter_at_line(b,&iter,line); if(gtk_text_iter_get_chars_in_line(&iter) >0) { gtk_text_buffer_get_iter_at_line_offset(b,&start,line, gtk_text_iter_get_chars_in_line(&iter)-1); }else{ gtk_text_buffer_get_iter_at_line_offset(b,&start,line,0); } gtk_text_buffer_get_iter_at_line_offset(b,&end,line,0); gtk_text_buffer_delete(b,&start,&end); gtk_text_buffer_get_iter_at_line(b,&iter,line); switch (state) { case LinphoneChatMessageStateInProgress: result="Sending .."; break; case LinphoneChatMessageStateDelivered: { time_t t=time(NULL); struct tm *tm=localtime(&t); char buf[80]; strftime(buf,80,"%H:%M",tm); result=buf; g_hash_table_remove(table,msg); break; } case LinphoneChatMessageStateNotDelivered: { result="Message not sent"; g_hash_table_remove(table,msg); break; } default : result="Sending .."; } gtk_text_buffer_insert_with_tags_by_name(b,&iter,result,-1, "right","small","italic","font_grey","bg",NULL); g_object_set_data(G_OBJECT(page),"table",table); } }
void linphone_gtk_remove_in_call_view(LinphoneCall *call){ GtkWidget *w=(GtkWidget*)linphone_call_get_user_pointer (call); GtkWidget *main_window=linphone_gtk_get_main_window (); GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch"); int idx; g_return_if_fail(w!=NULL); idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w); gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx); gtk_widget_destroy(w); linphone_call_set_user_pointer (call,NULL); linphone_call_unref(call); gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), 0); }
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); }
void *linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, const char *purpose, float progress){ GtkWidget *w; switch(ws){ case LinphoneWaitingStart: gdk_threads_enter(); w=linphone_gtk_create_window("waiting"); gtk_window_set_transient_for(GTK_WINDOW(w),GTK_WINDOW(linphone_gtk_get_main_window())); gtk_window_set_position(GTK_WINDOW(w),GTK_WIN_POS_CENTER_ON_PARENT); if (purpose) { gtk_progress_bar_set_text( GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar")), purpose); } gtk_widget_show(w); /*g_message("Creating waiting window");*/ run_gtk(); gdk_threads_leave(); return w; break; case LinphoneWaitingProgress: w=(GtkWidget*)ctx; gdk_threads_enter(); if (progress>=0){ gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar")), progress); }else { gtk_progress_bar_pulse( GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar")) ); } /*g_message("Updating progress");*/ run_gtk(); gdk_threads_leave(); g_usleep(50000); return w; break; case LinphoneWaitingFinished: w=(GtkWidget*)ctx; gdk_threads_enter(); gtk_widget_destroy(w); run_gtk(); gdk_threads_leave(); return NULL; break; } return NULL; }
void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg ) { GtkWidget *main_window=linphone_gtk_get_main_window(); GtkWidget *friendlist=linphone_gtk_get_widget ( main_window,"contact_list" ); GtkWidget *w; gboolean send=TRUE; /*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/ char *from=linphone_address_as_string ( linphone_chat_message_get_from ( msg ) ); w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" ); if ( w!=NULL ) { char *from_chatview= ( char * ) g_object_get_data ( G_OBJECT ( friendlist ),"from" ); if ( g_strcmp0 ( from,from_chatview ) ==0 ) { send=TRUE; } else { if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } send=FALSE; } } else { send=FALSE; if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } w=linphone_gtk_init_chatroom ( room,linphone_chat_message_get_from ( msg ) ); g_object_set_data ( G_OBJECT ( friendlist ),"chatview", ( gpointer ) w ); g_object_set_data ( G_OBJECT ( friendlist ),"from",from ); } #ifdef HAVE_GTK_OSX /* Notified when a new message is sent */ linphone_gtk_status_icon_set_blinking ( TRUE ); #else if ( !gtk_window_is_active ( GTK_WINDOW ( main_window ) ) ) { if ( !GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( w ),"is_notified" ) ) ) { linphone_gtk_notify ( NULL,linphone_chat_message_get_text ( msg ) ); g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( TRUE ) ); } else { g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( FALSE ) ); } } #endif if ( send ) { linphone_gtk_push_text ( w,linphone_chat_message_get_from ( msg ), FALSE,room,msg,FALSE ); } linphone_gtk_show_friends(); }
static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){ GtkTreeSelection *select; GtkTreeIter iter; GtkTreeModel *model; LinphoneFriend *lf=NULL; gchar* friend; select = gtk_tree_view_get_selection (treeview); if (gtk_tree_selection_get_selected (select, &model, &iter)) { gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1); friend=linphone_address_as_string(linphone_friend_get_address(lf)); gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),friend); ms_free(friend); }
void linphone_gtk_create_in_call_view(LinphoneCall *call){ GtkWidget *call_view=linphone_gtk_create_widget("main","in_call_frame"); GtkWidget *main_window=linphone_gtk_get_main_window (); GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch"); static int call_index=1; int idx; GtkWidget *transfer; GtkWidget *conf; GtkWidget *button; GtkWidget *image; if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){ /*this is the only call at this time */ call_index=1; } g_object_set_data(G_OBJECT(call_view),"call",call); g_object_set_data(G_OBJECT(call_view),"call_index",GINT_TO_POINTER(call_index)); linphone_call_set_user_pointer (call,call_view); linphone_call_ref(call); gtk_notebook_append_page (notebook,call_view,make_tab_header(call_index)); gtk_widget_show(call_view); idx = gtk_notebook_page_num(notebook, call_view); gtk_notebook_set_current_page(notebook, idx); call_index++; linphone_gtk_enable_hold_button (call,FALSE,TRUE); linphone_gtk_enable_video_button (call,FALSE,TRUE); linphone_gtk_enable_mute_button( GTK_BUTTON(linphone_gtk_get_widget(call_view,"incall_mute")),FALSE); transfer = linphone_gtk_get_widget(call_view,"transfer_button"); gtk_button_set_image(GTK_BUTTON(transfer),gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,GTK_ICON_SIZE_BUTTON)); g_signal_connect(G_OBJECT(transfer),"clicked",(GCallback)transfer_button_clicked,call); gtk_widget_hide(transfer); conf = linphone_gtk_get_widget(call_view,"conference_button"); gtk_button_set_image(GTK_BUTTON(conf),gtk_image_new_from_stock (GTK_STOCK_ADD,GTK_ICON_SIZE_BUTTON)); g_signal_connect(G_OBJECT(conf),"clicked",(GCallback)conference_button_clicked,call); gtk_widget_hide(conf); button=linphone_gtk_get_widget(call_view,"terminate_call"); image=create_pixmap (linphone_gtk_get_ui_config("stop_call_icon","stopcall-small.png")); gtk_button_set_label(GTK_BUTTON(button),_("Hang up")); gtk_button_set_image(GTK_BUTTON(button),image); gtk_widget_show(image); g_signal_connect_swapped(G_OBJECT(linphone_gtk_get_widget(call_view,"quality_indicator")),"button-press-event",(GCallback)linphone_gtk_show_call_stats,call); }
void linphone_gtk_call_log_clear_missed_call(){ GtkWidget *mw=linphone_gtk_get_main_window(); GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch")); GtkWidget *page=gtk_notebook_get_nth_page(notebook,0); GtkWidget *box=gtk_hbox_new(FALSE,0); GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_REFRESH,GTK_ICON_SIZE_MENU); GtkWidget *l; const gchar*text=gtk_label_get_text(GTK_LABEL(linphone_gtk_get_widget(mw,"label3"))); l=gtk_label_new(text); gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0); gtk_notebook_set_tab_label(notebook,page,box); gtk_widget_show_all(box); }
void linphone_gtk_send_text() { GtkWidget *main_window=linphone_gtk_get_main_window(); GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list"); GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview"); GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry"); const gchar *entered; LinphoneChatRoom *cr=g_object_get_data(G_OBJECT(w),"cr"); entered=gtk_entry_get_text(GTK_ENTRY(entry)); 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_chat_message_get_from(msg), TRUE,cr,msg,FALSE); gtk_entry_set_text(GTK_ENTRY(entry),""); } }
static gboolean popup_new_version(const char *download_site){ GtkWidget *dialog; /* draw a question box. link to dialog_click callback */ dialog = gtk_message_dialog_new ( GTK_WINDOW(linphone_gtk_get_main_window()), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("A more recent version is availalble from %s.\nWould you like to open a browser to download it ?"), download_site); g_signal_connect(G_OBJECT (dialog), "response", G_CALLBACK (new_version_response), (gpointer)download_site); /* actually show the box */ gtk_widget_show(dialog); return FALSE; }
void linphone_gtk_unset_from_conference(LinphoneCall *call){ GtkWidget *mw=linphone_gtk_get_main_window(); GtkWidget *box=(GtkWidget*)g_object_get_data(G_OBJECT(mw),"conference_tab"); GtkWidget *frame; if (box==NULL) return; /*conference tab already destroyed*/ frame=find_conferencee_from_call(call); GList *children; if (frame){ gtk_widget_destroy(frame); } children=gtk_container_get_children(GTK_CONTAINER(box)); if (g_list_length(children)==2){ /*the conference is terminated */ gtk_widget_destroy(box); g_object_set_data(G_OBJECT(mw),"conference_tab",NULL); } g_list_free(children); }
static GtkWidget *find_conferencee_from_call(LinphoneCall *call){ GtkWidget *mw=linphone_gtk_get_main_window(); GtkWidget *tab=get_conference_tab(mw); GList *elem; GtkWidget *ret=NULL; if (call!=NULL){ GList *l=gtk_container_get_children(GTK_CONTAINER(tab)); for(elem=l;elem!=NULL;elem=elem->next){ GtkWidget *frame=(GtkWidget*)elem->data; if (call==g_object_get_data(G_OBJECT(frame),"call")){ ret=frame; break; } } g_list_free(l); } //g_message("find_conferencee_from_call(): found widget %p for call %p",ret,call); return ret; }
void udpate_tab_chat_header(GtkWidget *chat_view,const LinphoneAddress *uri,LinphoneChatRoom *cr){ GtkWidget *main_window=linphone_gtk_get_main_window(); GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(main_window,"viewswitch")); GtkWidget *w=gtk_hbox_new (FALSE,0); GtkWidget *i=create_pixmap ("chat.png"); GtkWidget *l; GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_CLOSE,GTK_ICON_SIZE_MENU); GtkWidget *b=gtk_button_new(); gtk_button_set_image(GTK_BUTTON(b),image); gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE); gtk_widget_set_size_request(b,25,20); g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr); l=gtk_label_new (get_display_name(uri)); gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0); gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0); gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0); gtk_notebook_set_tab_label(notebook,chat_view,w); gtk_widget_show_all(w); }
void linphone_gtk_send_text(){ GtkWidget *main_window=linphone_gtk_get_main_window(); GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list"); GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview"); GtkWidget *entry=linphone_gtk_get_widget(w,"text_entry"); const gchar *entered; LinphoneChatRoom *cr=g_object_get_data(G_OBJECT(w),"cr"); entered=gtk_entry_get_text(GTK_ENTRY(entry)); 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_chat_message_get_from(msg), TRUE,cr,msg,FALSE); // Disconnect and reconnect the "changed" signal to prevent triggering it when clearing the text entry. g_signal_handlers_disconnect_by_func(G_OBJECT(entry),(GCallback)linphone_gtk_compose_text,NULL); gtk_entry_set_text(GTK_ENTRY(entry),""); g_signal_connect_swapped(G_OBJECT(entry),"changed",(GCallback)linphone_gtk_compose_text,NULL); } }