Commit 89296a7e authored by smorlat's avatar smorlat

add waiting window and methods.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@374 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent e3fd37b5
......@@ -1027,6 +1027,9 @@ void linphone_core_iterate(LinphoneCore *lc)
eXosip_unlock();
}
}
ms_list_for_each(lc->sip_conf.proxies,(void (*)(void*))&linphone_proxy_config_update);
if (lc->call!=NULL){
LinphoneCall *call=lc->call;
......@@ -2298,6 +2301,31 @@ void linphone_core_set_mtu(LinphoneCore *lc, int mtu){
}else ms_set_mtu(0);//use mediastreamer2 default value
}
void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose){
if (lc->vtable.waiting){
lc->wait_ctx=lc->vtable.waiting(lc,NULL,LinphoneWaitingStart,purpose,0);
}
}
void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progress){
if (lc->vtable.waiting){
lc->wait_ctx=lc->vtable.waiting(lc,lc->wait_ctx,LinphoneWaitingProgress,purpose,progress);
}else{
#ifdef WIN32
Sleep(50000);
#else
usleep(50000);
#endif
}
}
void linphone_core_stop_waiting(LinphoneCore *lc){
if (lc->vtable.waiting){
lc->wait_ctx=lc->vtable.waiting(lc,lc->wait_ctx,LinphoneWaitingFinished,NULL,0);
}
}
void net_config_uninit(LinphoneCore *lc)
{
net_config_t *config=&lc->net_conf;
......
......@@ -295,7 +295,7 @@ typedef struct _LinphoneProxyConfig
char *type;
struct _SipSetupContext *ssctx;
int auth_failures;
bool_t frozen;
bool_t commit;
bool_t reg_sendregister;
bool_t registered;
bool_t publish;
......@@ -418,6 +418,12 @@ typedef void (*CallLogUpdated)(struct _LinphoneCore *lc, struct _LinphoneCallLog
typedef void (*TextMessageReceived)(struct _LinphoneCore *lc, LinphoneChatRoom *room, const char *from, const char *message);
typedef void (*GeneralStateChange)(struct _LinphoneCore *lc, LinphoneGeneralState *gstate);
typedef void (*DtmfReceived)(struct _LinphoneCore* lc, int dtmf);
typedef enum _LinphoneWaitingState{
LinphoneWaitingStart,
LinphoneWaitingProgress,
LinphoneWaitingFinished
} LinphoneWaitingState;
typedef void * (*Waiting)(struct _LinphoneCore *lc, void *context, LinphoneWaitingState ws, const char *purpose, float progress);
typedef struct _LinphoneVTable
{
......@@ -440,6 +446,7 @@ typedef struct _LinphoneVTable
TextMessageReceived text_received;
GeneralStateChange general_state;
DtmfReceived dtmf_received;
Waiting waiting;
} LinphoneCoreVTable;
typedef struct _LCCallbackObj
......@@ -504,6 +511,7 @@ typedef struct _LinphoneCore
gstate_t gstate_power;
gstate_t gstate_reg;
gstate_t gstate_call;
void *wait_ctx;
bool_t use_files;
bool_t apply_nat_settings;
bool_t ready;
......@@ -767,6 +775,10 @@ void linphone_core_stop_media_streams(LinphoneCore *lc);
const char * linphone_core_get_identity(LinphoneCore *lc);
const char * linphone_core_get_route(LinphoneCore *lc);
bool_t linphone_core_interpret_url(LinphoneCore *lc, const char *url, char **real_url, osip_to_t **real_parsed_url, char **route);
void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses);
void linphone_core_stop_waiting(LinphoneCore *lc);
#ifdef __cplusplus
}
......
......@@ -127,5 +127,6 @@ void linphone_core_update_allocated_audio_bandwidth_in_call(LinphoneCore *lc, co
void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call);
void linphone_core_write_friends_config(LinphoneCore* lc);
void linphone_proxy_config_update(LinphoneProxyConfig *cfg);
#endif /* _PRIVATE_H */
......@@ -218,7 +218,6 @@ void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val){
}
void linphone_proxy_config_edit(LinphoneProxyConfig *obj){
obj->frozen=TRUE;
obj->auth_failures=0;
if (obj->reg_sendregister){
/* unregister */
......@@ -255,7 +254,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
int linphone_proxy_config_done(LinphoneProxyConfig *obj)
{
if (!linphone_proxy_config_check(obj->lc,obj)) return -1;
obj->frozen=FALSE;
obj->commit=TRUE;
linphone_proxy_config_register(obj);
linphone_proxy_config_write_all_to_config_file(obj->lc);
return 0;
......@@ -588,15 +587,16 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config
return cfg;
}
void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type){
SipSetup *ss=sip_setup_lookup(type);
static void linphone_proxy_config_activate_sip_setup(LinphoneProxyConfig *cfg){
SipSetupContext *ssc;
if (cfg->type)
ms_free(cfg->type);
cfg->type=ms_strdup(type);
SipSetup *ss=sip_setup_lookup(cfg->type);
if (!ss) return ;
ssc=sip_setup_context_new(ss,cfg);
if (cfg->reg_identity==NULL){
ms_error("Invalid identity for this proxy configuration.");
return;
}
if (sip_setup_context_login_account(ssc,cfg->reg_identity,NULL)==0){
if (sip_setup_context_get_capabilities(ssc) & SIP_SETUP_CAP_PROXY_PROVIDER){
char proxy[256];
......@@ -608,6 +608,25 @@ void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *t
cfg->ssctx=ssc;
}
void linphone_proxy_config_update(LinphoneProxyConfig *cfg){
if (cfg->commit){
if (cfg->type && cfg->ssctx==NULL){
linphone_proxy_config_activate_sip_setup(cfg);
}
cfg->commit=FALSE;
}
}
void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type){
if (cfg->type)
ms_free(cfg->type);
cfg->type=ms_strdup(type);
if (linphone_proxy_config_get_addr(cfg)==NULL){
/*put a placeholder so that the sip setup gets saved into the config */
linphone_proxy_config_set_server_addr(cfg,"sip:undefined");
}
}
SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig *cfg){
return cfg->ssctx;
}
......
......@@ -98,9 +98,9 @@ int sip_setup_context_get_capabilities(SipSetupContext *ctx){
return ctx->funcs->capabilities;
}
int sip_setup_new_account(SipSetup *funcs, const char *uri, const char *passwd){
if (funcs->create_account)
return funcs->create_account(uri, passwd);
int sip_setup_context_create_account(SipSetupContext * ctx, const char *uri, const char *passwd){
if (ctx->funcs->create_account)
return ctx->funcs->create_account(ctx,uri, passwd);
else return -1;
}
......
......@@ -75,7 +75,7 @@ struct _SipSetup{
unsigned int capabilities;
bool_t (*init)(void);
void (*init_instance)(SipSetupContext *ctx);
int (*create_account)( const char *uri, const char *passwd);
int (*create_account)(SipSetupContext *ctx, const char *uri, const char *passwd);
int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd);
int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
int (*get_stun_servers)(SipSetupContext *ctx, char *stun1, char *stun2, size_t size);
......@@ -100,8 +100,8 @@ void sip_setup_register_all(void);
SipSetup *sip_setup_lookup(const char *type_name);
void sip_setup_unregister_all(void);
int sip_setup_new_account(SipSetup *s, const char *uri, const char *passwd);
SipSetupContext * sip_setup_context_new(SipSetup *s, struct _LinphoneProxyConfig *cfg);
int sip_setup_context_create_account(SipSetupContext *ctx, const char *uri, const char *passwd);
int sip_setup_context_get_capabilities(SipSetupContext *ctx);
int sip_setup_context_login_account(SipSetupContext * ctx, const char *uri, const char *passwd);
int sip_setup_context_get_proxy(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
......
......@@ -8,7 +8,8 @@ GLADE_FILES= about.glade \
chatroom.glade \
call_logs.glade \
log.glade \
buddylookup.glade
buddylookup.glade \
waiting.glade
PIXMAPS= linphone2.png \
linphone.png \
......@@ -32,6 +33,7 @@ linphone_3_SOURCES= main.c\
logging.c \
update.c \
buddylookup.c \
utils.c \
linphone.h
linphone_3_LDADD=$(top_builddir)/oRTP/src/libortp.la \
......
......@@ -68,3 +68,4 @@ void linphone_gtk_check_for_new_version(void);
const char *linphone_gtk_get_lang(const char *config_file);
SipSetupContext* linphone_gtk_get_default_sip_setup_context(void);
void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx);
void * linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, const char *purpose, float progress);
......@@ -74,7 +74,8 @@ static LinphoneCoreVTable vtable={
.display_question=linphone_gtk_display_question,
.call_log_updated=linphone_gtk_call_log_updated,
.text_received=linphone_gtk_text_received,
.general_state=linphone_gtk_general_state
.general_state=linphone_gtk_general_state,
.waiting=linphone_gtk_wait
};
static gboolean verbose=0;
......
/*
linphone, gtk-glade interface.
Copyright (C) 2008 Simon MORLAT (simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphone.h"
static void run_gtk(){
while (gtk_events_pending ())
gtk_main_iteration ();
}
void *linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, const char *purpose, float progress){
GtkWidget *w;
switch(ws){
case LinphoneWaitingStart:
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();
return w;
break;
case LinphoneWaitingProgress:
w=(GtkWidget*)ctx;
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();
g_usleep(50000);
return w;
break;
case LinphoneWaitingFinished:
w=(GtkWidget*)ctx;
gtk_widget_destroy(w);
return NULL;
break;
}
return NULL;
}
<?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 Mar 27 23:13:04 2009 -->
<glade-interface>
<widget class="GtkWindow" id="waiting">
<property name="type">GTK_WINDOW_POPUP</property>
<property name="title" translatable="yes">Linphone</property>
<property name="resizable">False</property>
<property name="icon">linphone2.png</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkProgressBar" id="progressbar">
<property name="visible">True</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Please wait</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
......@@ -44,7 +44,13 @@ AC_MSG_CHECKING([warning make an error on compilation])
AC_ARG_ENABLE(strict,
[ --enable-strict Enable error on compilation warning [default=no]],
[wall_werror=$enableval],
[wall_werror=yes]
[
if test "$USER" = "smorlat" ; then
wall_werror=yes
else
wall_werror=no
fi
]
)
CFLAGS="-DORTP_INET6 $CFLAGS "
......
......@@ -8,7 +8,7 @@ echo_SOURCES=echo.c
ring_SOURCES=ring.c
videodisplay_SOURCES=videodisplay.c
mtudiscover_SOURCES=mtudiscover.c
becnh_SOURCES=bench.c
bench_SOURCES=bench.c
libexec_PROGRAMS=mediastream
......
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