Commit 1cf3a233 authored by smorlat's avatar smorlat

login screen, work in progress

remove gtk_show_uri that doesn't work.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@641 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent fd285ca7
......@@ -319,6 +319,7 @@ int linphone_proxy_config_done(LinphoneProxyConfig *obj);
void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
#define linphone_proxy_config_get_route(obj) ((obj)->reg_route)
#define linphone_proxy_config_get_identity(obj) ((obj)->reg_identity)
#define linphone_proxy_config_publish_enabled(obj) ((obj)->publish)
......
......@@ -55,7 +55,7 @@ SipSetup *sip_setup_lookup(const char *type_name){
SipSetup *ss=(SipSetup*)elem->data;
if ( strcasecmp(ss->name,type_name)==0){
if (!ss->initialized){
ss->init();
if (ss->init!=NULL) ss->init();
ss->initialized=TRUE;
if (ss->capabilities==0){
ms_error("%s SipSetup isn't capable of anything ?",ss->name);
......
......@@ -22,20 +22,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *label=linphone_gtk_get_widget(mw,"login_label");
LinphoneAuthInfo *ai;
gchar *str;
gtk_widget_hide(linphone_gtk_get_widget(mw,"idle_view"));
osip_from_t *from;
gtk_widget_hide(linphone_gtk_get_widget(mw,"idle_frame"));
gtk_widget_show(linphone_gtk_get_widget(mw,"login_frame"));
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"main_menu"),FALSE);
gtk_widget_set_sensitive(linphone_gtk_get_widget(mw,"modes"),FALSE);
str=g_strdup_printf(_("Please enter login information for %s"),linphone_proxy_config_get_domain(cfg));
gtk_label_set_text(GTK_LABEL(label),str);
g_object_set_data(G_OBJECT(mw),"login_proxy_config",cfg);
g_free(str);
osip_from_init(&from);
osip_from_parse(from,linphone_proxy_config_get_identity(cfg));
ai=linphone_core_find_auth_info(linphone_gtk_get_core(),linphone_proxy_config_get_domain(cfg),from->url->username);
/*display the last entered username*/
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")),
from->url->username);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_password")),
ai!=NULL ? ai->passwd : "");
osip_from_free(from);
}
void linphone_gtk_exit_login_frame(void){
GtkWidget *mw=linphone_gtk_get_main_window();
gtk_widget_show(linphone_gtk_get_widget(mw,"idle_view"));
gtk_widget_show(linphone_gtk_get_widget(mw,"idle_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,"modes"),TRUE);
......@@ -50,8 +64,12 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
GtkWidget *mw=gtk_widget_get_toplevel(button);
const char *username;
const char *password;
char *identity;
int netkind_id;
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)g_object_get_data(G_OBJECT(mw),"login_proxy_config");
SipSetupContext *ssctx=linphone_proxy_config_get_sip_setup_context(cfg);
osip_from_t *from;
username=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")));
password=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_password")));
......@@ -65,4 +83,13 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
linphone_core_set_upload_bandwidth(lc,0);
linphone_core_set_download_bandwidth(lc,0);
}
osip_from_init(&from);
osip_from_parse(from,linphone_proxy_config_get_identity(cfg));
osip_free(from->url->username);
from->url->username=osip_strdup(username);
osip_from_to_str(from,&identity);
osip_from_free(from);
if (sip_setup_context_login_account(ssctx,identity,password)==0){
linphone_gtk_exit_login_frame();
}
}
......@@ -786,8 +786,8 @@ static void icon_popup_menu(GtkStatusIcon *status_icon, guint button, guint acti
}
void linphone_gtk_open_browser(const char *url){
gtk_show_uri(NULL,url,GDK_CURRENT_TIME,NULL);
#if 0
/*in gtk 2.16, gtk_show_uri does not work...*/
/*gtk_show_uri(NULL,url,GDK_CURRENT_TIME,NULL);*/
#ifdef WIN32
ShellExecute(0,"open",url,NULL,NULL,1);
#else
......@@ -795,7 +795,6 @@ void linphone_gtk_open_browser(const char *url){
snprintf(cl,sizeof(cl),"/usr/bin/x-www-browser %s",url);
g_spawn_command_line_async(cl,NULL);
#endif
#endif
}
void linphone_gtk_link_to_website(GtkWidget *item){
......@@ -977,6 +976,7 @@ void linphone_gtk_manage_login(void){
static void linphone_gtk_init_main_window(){
linphone_gtk_configure_main_window();
linphone_gtk_manage_login();
load_uri_history();
linphone_gtk_load_identities();
linphone_gtk_set_my_presence(linphone_core_get_presence_info(linphone_gtk_get_core()));
......
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