Commit aa173d77 authored by smorlat's avatar smorlat

gui improvements, lang selection in config file.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@232 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 04a97f1c
......@@ -61,3 +61,5 @@ const gchar *linphone_gtk_get_ui_config(const char *key, const char *def);
int linphone_gtk_get_ui_config_int(const char *key, int def);
void linphone_gtk_open_browser(const char *url);
void linphone_gtk_check_for_new_version(void);
const char *linphone_gtk_get_lang(const char *config_file);
......@@ -333,7 +333,6 @@ static gboolean linphone_gtk_iterate(LinphoneCore *lc){
static void load_uri_history(){
GtkEntry *uribar=GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar"));
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
char key[20];
int i;
GtkEntryCompletion *gep=gtk_entry_completion_new();
......@@ -341,7 +340,7 @@ static void load_uri_history(){
for (i=0;;i++){
const char *uri;
snprintf(key,sizeof(key),"uri%i",i);
uri=lp_config_get_string(cfg,"GtkUi",key,NULL);
uri=linphone_gtk_get_ui_config(key,NULL);
if (uri!=NULL) {
GtkTreeIter iter;
gtk_list_store_append(model,&iter);
......@@ -654,16 +653,6 @@ static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl)
static void linphone_gtk_general_state(LinphoneCore *lc, LinphoneGeneralState *gstate){
}
const gchar *linphone_gtk_get_ui_config(const char *key, const char *def){
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
return lp_config_get_string(cfg,"GtkUi",key,def);
}
int linphone_gtk_get_ui_config_int(const char *key, int def){
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
return lp_config_get_int(cfg,"GtkUi",key,def);
}
static void icon_popup_menu(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data){
GtkWidget *menu=(GtkWidget*)g_object_get_data(G_OBJECT(status_icon),"menu");
gtk_menu_popup(GTK_MENU(menu),NULL,NULL,gtk_status_icon_position_menu,status_icon,button,activate_time);
......@@ -892,8 +881,22 @@ void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
int main(int argc, char *argv[]){
void *p;
const char *config_file;
const char *lang;
g_thread_init(NULL);
gdk_threads_init();
config_file=linphone_gtk_get_config_file();
if (linphone_core_wake_up_possible_already_running_instance(config_file)==0){
g_warning("Another running instance of linphone has been detected. It has been woken-up.");
g_warning("This instance is going to exit now.");
return 0;
}
if ((lang=linphone_gtk_get_lang(config_file))!=NULL && lang[0]!='\0'){
setenv("LANG",lang,1);
}
#ifdef ENABLE_NLS
p=bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
if (p==NULL) perror("bindtextdomain failed");
......@@ -902,13 +905,6 @@ int main(int argc, char *argv[]){
#else
g_message("NLS disabled.\n");
#endif
config_file=linphone_gtk_get_config_file();
if (linphone_core_wake_up_possible_already_running_instance(config_file)==0){
g_warning("Another running instance of linphone has been detected. It has been woken-up.");
g_warning("This instance is going to exit now.");
return 0;
}
#ifdef WIN32
gtk_rc_add_default_file("./gtkrc");
#endif
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Fri Jan 9 23:02:58 2009 -->
<!--Generated with glade3 3.4.5 on Mon Jan 12 14:50:28 2009 -->
<glade-interface>
<widget class="GtkWindow" id="main">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
......@@ -424,6 +424,7 @@ Online users</property>
<widget class="GtkTable" id="dtmf_table">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">4</property>
<property name="n_rows">4</property>
<property name="n_columns">4</property>
<property name="homogeneous">True</property>
......@@ -722,6 +723,8 @@ Online users</property>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Thu Jan 8 14:52:09 2009 -->
<!--Generated with glade3 3.4.5 on Mon Jan 12 14:45:17 2009 -->
<glade-interface>
<widget class="GtkAssistant" id="p2pwizard">
<property name="title" translatable="yes">Creating a FONICS account</property>
......@@ -11,7 +11,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">WARNING: experimental feature !
FONICS stands for Free Overlay Network for Interactive Communication Systems
FONIS stands for Free Overlay Network for Instant SIP.
Based on SIP and Peer to Peer technologies, it allows people to find each other through the help of a virtual network.
Once you and your friends registered, you'll be able to call each other simply by entering your friend's username in linphone's sip uri box.
Read more information about FONICS at http://www.fonics.org
......
#include "linphone.h"
#include "lpconfig.h"
static GList *pixmaps_directories = NULL;
......@@ -101,3 +102,42 @@ glade_set_atk_action_description (AtkAction *action,
}
}
static char linphone_lang[256]={0};
/*lang has to be read before the config file is parsed...*/
const char *linphone_gtk_get_lang(const char *config_file){
FILE *f=fopen(config_file,"r");
if (f){
char tmp[256];
while(fgets(tmp,sizeof(tmp),f)!=NULL){
char *p;
if ((p=strstr(tmp,"lang="))!=NULL){
p+=5;
sscanf(p,"%s",linphone_lang);
g_message("Found lang %s",linphone_lang);
break;
}
}
}
fclose(f);
return linphone_lang;
}
const gchar *linphone_gtk_get_ui_config(const char *key, const char *def){
LinphoneCore *lc=linphone_gtk_get_core();
if (lc){
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
return lp_config_get_string(cfg,"GtkUi",key,def);
}else{
ms_warning ("Cannot read config, no core created yet.");
return NULL;
}
}
int linphone_gtk_get_ui_config_int(const char *key, int def){
LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core());
return lp_config_get_int(cfg,"GtkUi",key,def);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment