store selfview preference, enable video calls without selfview.

This commit is contained in:
Simon Morlat 2010-04-12 21:26:45 +02:00
parent 5ce6d74108
commit ffac56ea5e
3 changed files with 28 additions and 8 deletions

View file

@ -2582,8 +2582,8 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){
} }
if (sndcard==NULL){/*looks like a bug! take the first one !*/ if (sndcard==NULL){/*looks like a bug! take the first one !*/
const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get()); const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get());
sndcard=(MSSndCard*)elem->data; if (elem) sndcard=(MSSndCard*)elem->data;
} }
} }
if (sndcard==NULL) ms_error("Could not find a suitable soundcard !"); if (sndcard==NULL) ms_error("Could not find a suitable soundcard !");
return sndcard; return sndcard;

View file

@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define USE_LIBGLADE 1 #define USE_LIBGLADE 1
#define VIDEOSELFVIEW_DEFAULT 1
#include "linphone.h" #include "linphone.h"
#include "lpconfig.h" #include "lpconfig.h"
@ -656,7 +658,6 @@ static gboolean linphone_gtk_auto_answer(GtkWidget *incall_window){
void linphone_gtk_set_audio_video(){ void linphone_gtk_set_audio_video(){
linphone_core_enable_video(linphone_gtk_get_core(),TRUE,TRUE); linphone_core_enable_video(linphone_gtk_get_core(),TRUE,TRUE);
linphone_core_enable_video_preview(linphone_gtk_get_core(),TRUE);
} }
void linphone_gtk_set_audio_only(){ void linphone_gtk_set_audio_only(){
@ -665,8 +666,11 @@ void linphone_gtk_set_audio_only(){
} }
void linphone_gtk_enable_self_view(GtkWidget *w){ void linphone_gtk_enable_self_view(GtkWidget *w){
linphone_core_enable_self_view(linphone_gtk_get_core(), gboolean val=gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w));
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w))); LinphoneCore *lc=linphone_gtk_get_core();
linphone_core_enable_video_preview(lc,val);
linphone_core_enable_self_view(lc,val);
linphone_gtk_set_ui_config_int("videoselfview",val);
} }
void linphone_gtk_used_identity_changed(GtkWidget *w){ void linphone_gtk_used_identity_changed(GtkWidget *w){
@ -682,7 +686,8 @@ void linphone_gtk_used_identity_changed(GtkWidget *w){
static void linphone_gtk_show_main_window(){ static void linphone_gtk_show_main_window(){
GtkWidget *w=linphone_gtk_get_main_window(); GtkWidget *w=linphone_gtk_get_main_window();
LinphoneCore *lc=linphone_gtk_get_core(); LinphoneCore *lc=linphone_gtk_get_core();
linphone_core_enable_video_preview(lc,linphone_core_video_enabled(lc)); linphone_core_enable_video_preview(lc,linphone_gtk_get_ui_config_int("videoselfview",
VIDEOSELFVIEW_DEFAULT));
gtk_widget_show(w); gtk_widget_show(w);
gtk_window_present(GTK_WINDOW(w)); gtk_window_present(GTK_WINDOW(w));
} }
@ -1011,9 +1016,13 @@ static void linphone_gtk_connect_digits(void){
static void linphone_gtk_check_menu_items(void){ static void linphone_gtk_check_menu_items(void){
bool_t audio_only=!linphone_core_video_enabled(linphone_gtk_get_core()); bool_t audio_only=!linphone_core_video_enabled(linphone_gtk_get_core());
bool_t selfview=linphone_gtk_get_ui_config_int("videoselfview",VIDEOSELFVIEW_DEFAULT);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(linphone_gtk_get_widget( gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(linphone_gtk_get_widget(
linphone_gtk_get_main_window(), linphone_gtk_get_main_window(),
audio_only ? "audio_only_item" : "video_item")), TRUE); audio_only ? "audio_only_item" : "video_item")), TRUE);
g_message("Selfview enabled: %i",selfview);
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(linphone_gtk_get_widget(
linphone_gtk_get_main_window(),"selfview_item")),selfview);
} }
static gboolean linphone_gtk_can_manage_accounts(){ static gboolean linphone_gtk_can_manage_accounts(){
@ -1178,6 +1187,15 @@ static void linphone_gtk_refer_received(LinphoneCore *lc, const char *refer_to){
linphone_gtk_start_call(linphone_gtk_get_main_window()); linphone_gtk_start_call(linphone_gtk_get_main_window());
} }
static void linphone_gtk_check_soundcards(){
const char **devices=linphone_core_get_sound_devices(linphone_gtk_get_core());
if (devices==NULL || devices[0]==NULL){
linphone_gtk_display_something(GTK_MESSAGE_WARNING,
_("No sound cards have been detected on this computer.\n"
"You won't be able to send or receive audio calls."));
}
}
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
void *p; void *p;
@ -1263,8 +1281,10 @@ int main(int argc, char *argv[]){
gtk_timeout_add(30,(GtkFunction)linphone_gtk_check_logs,(gpointer)NULL); gtk_timeout_add(30,(GtkFunction)linphone_gtk_check_logs,(gpointer)NULL);
linphone_gtk_init_main_window(); linphone_gtk_init_main_window();
linphone_gtk_init_status_icon(); linphone_gtk_init_status_icon();
if (!iconified) if (!iconified){
linphone_gtk_show_main_window(); linphone_gtk_show_main_window();
linphone_gtk_check_soundcards();
}
if (linphone_gtk_get_ui_config_int("update_check_menu",0)==0) if (linphone_gtk_get_ui_config_int("update_check_menu",0)==0)
linphone_gtk_check_for_new_version(); linphone_gtk_check_for_new_version();

View file

@ -129,7 +129,7 @@
</widget> </widget>
</child> </child>
<child> <child>
<widget class="GtkCheckMenuItem" id="menuitem3"> <widget class="GtkCheckMenuItem" id="selfview_item">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Enable self-view</property> <property name="label" translatable="yes">Enable self-view</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>