};
#define INSTALLED_XML_DIR PACKAGE_DATA_DIR "/linphone"
-#define RELATIVE_XML_DIR
+#define RELATIVE_XML_DIR
#define BUILD_TREE_XML_DIR "gtk"
#ifndef WIN32
#define SECRETS_FILE "linphone-zidcache"
#endif
-
char *linphone_gtk_get_config_file(const char *filename){
const int path_max=1024;
char *config_file=g_malloc0(path_max);
"%s",FACTORY_CONFIG_FILE);
} else {
char *progdir;
-
+
if (progpath != NULL) {
char *basename;
progdir = strdup(progpath);
}
}
-
-
LinphoneCore *linphone_gtk_get_core(void){
return the_core;
}
GtkWidget *w;
if (get_ui_file(window_name,path,sizeof(path))==-1) return NULL;
-
+
if (!gtk_builder_add_from_file (builder, path, &error)){
g_error("Couldn't load builder file: %s", error->message);
g_error_free (error);
gchar *object_ids[2];
object_ids[0]=g_strdup(widget_name);
object_ids[1]=NULL;
-
+
if (get_ui_file(filename,path,sizeof(path))==-1) return NULL;
if (!gtk_builder_add_objects_from_file(builder,path,object_ids,&error)){
g_error("Couldn't load %s from builder file %s: %s", widget_name,path,error->message);
void linphone_gtk_display_something(GtkMessageType type,const gchar *message){
GtkWidget *dialog;
GtkWidget *main_window=linphone_gtk_get_main_window();
-
+
gtk_widget_show(main_window);
if (type==GTK_MESSAGE_QUESTION)
{
GdkPixbuf *logo=create_pixbuf(
linphone_gtk_get_ui_config("logo","linphone-banner.png"));
static const char *defcfg="defcfg";
-
+
about=linphone_gtk_create_window("about");
gtk_about_dialog_set_url_hook(about_url_clicked,NULL,NULL);
memset(&filestat,0,sizeof(filestat));
const char *icon_path=linphone_gtk_get_ui_config("icon",LINPHONE_ICON);
char video_title[256];
GdkPixbuf *pbuf=create_pixbuf(icon_path);
-
+
if (!linphone_core_in_call(linphone_gtk_get_core())){
snprintf(video_title,sizeof(video_title),"%s video",title);
/* When not in call, treat the video as a normal window */
static void completion_add_text(GtkEntry *entry, const char *text){
GtkTreeIter iter;
GtkTreeModel *model=gtk_entry_completion_get_model(gtk_entry_get_completion(entry));
-
- if (gtk_tree_model_get_iter_first(model,&iter)){
+
+ if (gtk_tree_model_get_iter_first(model,&iter)){
do {
gchar *uri=NULL;
gtk_tree_model_get(model,&iter,0,&uri,-1);
save_uri_history();
}
-
bool_t linphone_gtk_video_enabled(void){
const LinphoneVideoPolicy *vpol=linphone_core_get_video_policy(linphone_gtk_get_core());
return vpol->automatically_accept && vpol->automatically_initiate;
//bool_t stop_active=FALSE;
bool_t add_call=FALSE;
int call_list_size=ms_list_size(calls);
-
+
if (calls==NULL){
start_active=TRUE;
//stop_active=FALSE;
}else{
- //stop_active=TRUE;
+ //stop_active=TRUE;
start_active=TRUE;
add_call=TRUE;
}
button=linphone_gtk_get_widget(mw,"start_call");
gtk_widget_set_sensitive(button,start_active);
gtk_widget_set_visible(button,!add_call);
-
+
button=linphone_gtk_get_widget(mw,"add_call");
if (linphone_core_sound_resources_locked(lc) || (call && linphone_call_get_state(call)==LinphoneCallIncomingReceived)) {
gtk_widget_set_sensitive(button,FALSE);
gtk_widget_set_sensitive(button,start_active);
}
gtk_widget_set_visible(button,add_call);
-
+
//gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"terminate_call"),stop_active);
linphone_gtk_enable_transfer_button(lc,call_list_size>1);
return FALSE;
}
-
void linphone_gtk_start_call(GtkWidget *w){
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneCall *call;
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"start_call"),FALSE);
g_timeout_add(100,(GSourceFunc)linphone_gtk_start_call_do,uri_bar);
}
-
+
}
void linphone_gtk_uri_bar_activate(GtkWidget *w){
linphone_gtk_start_call(w);
}
-
void linphone_gtk_terminate_call(GtkWidget *button){
gboolean is_conf;
LinphoneCall *call=linphone_gtk_get_currently_displayed_call(&is_conf);
policy.automatically_initiate=policy.automatically_accept=val;
linphone_core_enable_video(linphone_gtk_get_core(),TRUE,TRUE);
linphone_core_set_video_policy(linphone_gtk_get_core(),&policy);
-
+
if (val){
linphone_core_enable_video_preview(linphone_gtk_get_core(),
linphone_gtk_get_ui_config_int("videoselfview",VIDEOSELFVIEW_DEFAULT));
if (sel) g_free(sel);
}
-
void on_proxy_refresh_button_clicked(GtkWidget *w){
LinphoneCore *lc=linphone_gtk_get_core();
MSList const *item=linphone_core_get_proxy_config_list(lc);
GtkWidget *w;
} AuthTimeout;
-
static void auth_timeout_clean(AuthTimeout *tout){
tout->w=NULL;
}
LinphoneAuthInfo *info;
gchar *msg;
GtkWidget *mw=linphone_gtk_get_main_window();
-
+
if (mw && GTK_WIDGET_VISIBLE(linphone_gtk_get_widget(mw,"login_frame"))){
/*don't prompt for authentication when login frame is visible*/
linphone_core_abort_authentication(lc,NULL);
static void linphone_gtk_display_status(LinphoneCore *lc, const char *status){
GtkWidget *w=linphone_gtk_get_main_window();
GtkWidget *status_bar=linphone_gtk_get_widget(w,"status_bar");
-
+
gtk_statusbar_push(GTK_STATUSBAR(status_bar),
gtk_statusbar_get_context_id(GTK_STATUSBAR(status_bar),""),
status);
if (!notify_init ("Linphone")) ms_error("Libnotify failed to init.");
#endif
if (!call) {
-
+
#ifdef HAVE_NOTIFY
if (!notify_notification_show(notify_notification_new("Linphone",msg,NULL
#ifdef HAVE_NOTIFY1
,NULL
#endif
),NULL))
-
+
ms_error("Failed to send notification.");
#else
linphone_gtk_show_main_window();
if (auto_answer) {
linphone_call_ref(call);
g_timeout_add(2000,(GSourceFunc)linphone_gtk_auto_answer ,call);
- }
+ }
break;
case LinphoneCallResuming:
linphone_gtk_enable_hold_button(call,TRUE,TRUE);
break;
case LinphoneCallPausing:
linphone_gtk_enable_hold_button(call,TRUE,FALSE);
+ update_tab_header(call,FALSE);
case LinphoneCallPausedByRemote:
linphone_gtk_in_call_view_set_paused(call);
+ update_tab_header(call,TRUE);
break;
case LinphoneCallConnected:
linphone_gtk_enable_hold_button (call,TRUE,TRUE);
GtkTreeIter iter;
gboolean found=FALSE;
const char *stock_id=NULL;
-
+
if (gtk_tree_model_get_iter_first(model,&iter)){
gpointer p;
do{
gtk_list_store_set(GTK_LIST_STORE(model),&iter,1,stock_id,-1);
}
-static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg,
+static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg,
LinphoneRegistrationState rs, const char *msg){
switch (rs){
case LinphoneRegistrationOk:
GtkWidget *image;
gchar *tmp;
const gchar *homesite;
-
+
homesite=linphone_gtk_get_ui_config("home","http://www.linphone.org");
menu_item=gtk_image_menu_item_new_with_label(_("Website link"));
tmp=g_strdup(homesite);
g_object_set_data(G_OBJECT(menu_item),"home",tmp);
g_object_weak_ref(G_OBJECT(menu_item),(GWeakNotify)g_free,tmp);
-
+
image=gtk_image_new_from_stock(GTK_STOCK_HELP,GTK_ICON_SIZE_MENU);
gtk_widget_show(image);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_link_to_website,NULL);
-
+
menu_item=gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT,NULL);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
linphone_core_stop_dtmf (linphone_gtk_get_core());
}
+
static void linphone_gtk_connect_digits(void){
GtkContainer *cont=GTK_CONTAINER(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"dtmf_table"));
GList *children=gtk_container_get_children(cont);
static gboolean buttons_have_borders;
static gboolean show_abcd;
GtkWidget *w=linphone_gtk_get_main_window();
-
- //Change the color
- GdkColor color;
- //RGB(246^2,249^2,252^2)
- color.pixel = 0;
- color.red=65025;
- color.green=46656;
- color.blue=50625;
- gtk_widget_modify_bg(GTK_WIDGET(w), GTK_STATE_NORMAL, &color);
-
+ GHashTable *contacts_history;
+
+ contacts_history=g_hash_table_new_full(g_str_hash, g_str_equal,g_free, NULL);
+ g_object_set_data(G_OBJECT(w),"history",(gpointer)contacts_history);
+
if (!config_loaded){
title=linphone_gtk_get_ui_config("title","Linphone");
home=linphone_gtk_get_ui_config("home","http://www.linphone.org");
linphone_gtk_call_log_update(main_window);
linphone_gtk_update_call_buttons (NULL);
+ g_object_set_data(G_OBJECT(main_window),"is_conf",GINT_TO_POINTER(FALSE));
/*prevent the main window from being destroyed by a user click on WM controls, instead we hide it*/
g_signal_connect (G_OBJECT (main_window), "delete-event",
G_CALLBACK (linphone_gtk_close), main_window);
g_thread_init(NULL);
#endif
gdk_threads_init();
-
+
progpath = strdup(argv[0]);
-
+
config_file=linphone_gtk_get_config_file(NULL);
-
+
#ifdef WIN32
/*workaround for windows: sometimes LANG is defined to an integer value, not understood by gtk */
gtk_rc_add_default_file("./gtkrc");
#endif
gdk_threads_enter();
-
+
if (!gtk_init_with_args(&argc,&argv,_("A free SIP video-phone"),
linphone_options,NULL,NULL)){
gdk_threads_leave();
return -1;
}
-
+
settings=gtk_settings_get_default();
g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM));
g_type_class_unref (g_type_class_ref (GTK_TYPE_BUTTON));
/*never block termination:*/
g_signal_connect(G_OBJECT(theMacApp),"NSApplicationBlockTermination",(GCallback)on_block_termination,NULL);
#endif
-
+
the_ui=linphone_gtk_create_window("main");
-
+
+ g_object_set_data(G_OBJECT(the_ui),"is_created",GINT_TO_POINTER(FALSE));
+
linphone_gtk_create_log_window();
linphone_core_enable_logs_with_cb(linphone_gtk_log_handler);
linphone_gtk_init_liblinphone(config_file, factory_config_file);
-
+
g_set_application_name(app_name);
pbuf=create_pixbuf(linphone_gtk_get_ui_config("icon",LINPHONE_ICON));
if (pbuf!=NULL) gtk_window_set_default_icon(pbuf);
-
+
/* do not lower timeouts under 30 ms because it exhibits a bug on gtk+/win32, with cpu running 20% all the time...*/
gtk_timeout_add(30,(GtkFunction)linphone_gtk_iterate,(gpointer)linphone_gtk_get_core());
gtk_timeout_add(30,(GtkFunction)linphone_gtk_check_logs,(gpointer)NULL);