Commit b96bf923 authored by François Grisez's avatar François Grisez

Make some sub-windows transient

parent 7382c09a
......@@ -497,7 +497,7 @@ void linphone_gtk_show_audio_assistant(void){
GtkWidget *end_page;
if(audio_assistant!=NULL)
return;
w=audio_assistant=linphone_gtk_create_window("audio_assistant");
w=audio_assistant=linphone_gtk_create_window("audio_assistant", linphone_gtk_get_main_window());
gtk_window_set_resizable (GTK_WINDOW(w), FALSE);
gtk_window_set_title(GTK_WINDOW(w),_("Audio Assistant"));
......
......@@ -71,7 +71,7 @@ GtkWidget * linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
GtkCellRenderer *renderer,*pbuf_renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *select;
GtkWidget *w=linphone_gtk_create_window("buddylookup");
GtkWidget *w=linphone_gtk_create_window("buddylookup", NULL);
GtkWidget *results=linphone_gtk_get_widget(w,"search_results");
GtkProgressBar *pb=GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar"));
......
......@@ -88,7 +88,7 @@ void linphone_gtk_call_log_add_contact(GtkWidget *w){
if (la != NULL){
char *uri=linphone_address_as_string(la);
lf=linphone_friend_new_with_address(uri);
linphone_gtk_show_contact(lf, GTK_WINDOW(main_window));
linphone_gtk_show_contact(lf, main_window);
ms_free(uri);
}
}
......@@ -399,18 +399,18 @@ void linphone_gtk_call_log_response(GtkWidget *w, guint response_id){
gtk_widget_destroy(w);
}
GtkWidget * linphone_gtk_show_call_logs(void){
GtkWidget *mw=linphone_gtk_get_main_window();
GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
if (w==NULL){
w=linphone_gtk_create_window("call_logs");
// gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
// create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
g_object_set_data(G_OBJECT(mw),"call_logs",w);
g_signal_connect(G_OBJECT(w),"response",(GCallback)linphone_gtk_call_log_response,NULL);
gtk_widget_show(w);
linphone_gtk_call_log_update(w);
}else gtk_window_present(GTK_WINDOW(w));
return w;
}
// GtkWidget * linphone_gtk_show_call_logs(void){
// GtkWidget *mw=linphone_gtk_get_main_window();
//
// GtkWidget *w=(GtkWidget*)g_object_get_data(G_OBJECT(linphone_gtk_get_main_window()),"call_logs");
// if (w==NULL){
// w=linphone_gtk_create_window("call_logs");
// // gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
// // create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
// g_object_set_data(G_OBJECT(mw),"call_logs",w);
// g_signal_connect(G_OBJECT(w),"response",(GCallback)linphone_gtk_call_log_response,NULL);
// gtk_widget_show(w);
// linphone_gtk_call_log_update(w);
// }else gtk_window_present(GTK_WINDOW(w));
// return w;
// }
......@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void linphone_gtk_set_configuration_uri(void){
GtkWidget *w=linphone_gtk_create_window("config-uri");
GtkWidget *w=linphone_gtk_create_window("config-uri", linphone_gtk_get_main_window());
GtkWidget *entry=linphone_gtk_get_widget(w,"uri_entry");
const char *uri=linphone_core_get_provisioning_uri(linphone_gtk_get_core());
if (uri) gtk_entry_set_text(GTK_ENTRY(entry),uri);
......@@ -52,7 +52,7 @@ void linphone_gtk_config_uri_cancel(GtkWidget *button){
GtkWidget * linphone_gtk_show_config_fetching(void){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *w=linphone_gtk_create_window("provisioning-fetch");
GtkWidget *w=linphone_gtk_create_window("provisioning-fetch", linphone_gtk_get_main_window());
g_message("Fetching started");
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(w),_("fetching from %s"),linphone_core_get_provisioning_uri(lc));
#if GTK_CHECK_VERSION(2,20,0)
......
......@@ -149,7 +149,7 @@ static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
}
void linphone_gtk_add_contact(void){
GtkWidget *w=linphone_gtk_create_window("contact");
GtkWidget *w=linphone_gtk_create_window("contact", linphone_gtk_get_main_window());
int presence_enabled=linphone_gtk_get_ui_config_int("use_subscribe_notify",1);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"show_presence")),presence_enabled);
......@@ -168,7 +168,7 @@ void linphone_gtk_edit_contact(GtkWidget *button){
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
linphone_gtk_show_contact(lf, GTK_WINDOW(w));
linphone_gtk_show_contact(lf, w);
}
}
......@@ -488,7 +488,7 @@ static void icon_press_handler(GtkEntry *entry){
lf=linphone_friend_new();
if (lf!=NULL){
linphone_friend_set_address(lf,addr);
linphone_gtk_show_contact(lf, GTK_WINDOW(w));
linphone_gtk_show_contact(lf, w);
}
linphone_address_destroy(addr);
}
......@@ -870,8 +870,8 @@ void linphone_gtk_show_friends(void){
ms_list_free(sorted);
}
void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWindow *parent){
GtkWidget *w=linphone_gtk_create_window("contact");
void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWidget *parent){
GtkWidget *w=linphone_gtk_create_window("contact", parent);
char *uri;
const char *name;
const LinphoneAddress *f_uri=linphone_friend_get_address(lf);
......@@ -890,8 +890,6 @@ void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWindow *parent){
linphone_friend_get_inc_subscribe_policy(lf)==LinphoneSPAccept);
g_object_set_data(G_OBJECT(w),"friend_ref",(gpointer)lf);
gtk_window_set_transient_for(GTK_WINDOW(w), parent);
gtk_widget_show(w);
}
......
......@@ -338,7 +338,7 @@ static void linphone_gtk_show_call_stats(LinphoneCall *call){
GtkWidget *call_stats=(GtkWidget*)g_object_get_data(G_OBJECT(w),"call_stats");
if (call_stats==NULL){
guint tid;
call_stats=linphone_gtk_create_window("call_statistics");
call_stats=linphone_gtk_create_window("call_statistics", NULL);
g_object_set_data(G_OBJECT(w),"call_stats",call_stats);
g_object_set_data(G_OBJECT(call_stats),"call",linphone_call_ref(call));
tid=g_timeout_add(1000,(GSourceFunc)refresh_call_stats,call_stats);
......
......@@ -84,7 +84,7 @@ GtkWidget *_gtk_image_new_from_memory_at_scale(const void *data, gint len, gint
GdkPixbuf *_gdk_pixbuf_new_from_memory_at_scale(const void *data, gint len, gint w, gint h, gboolean preserve_ratio);
LINPHONE_PUBLIC void linphone_gtk_destroy_window(GtkWidget *window);
LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_window(const char *window_name);
LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_window(const char *window_name, GtkWidget *parent);
LINPHONE_PUBLIC GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char *name);
LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_widget(const char *filename, const char *widget_name);
......@@ -147,7 +147,7 @@ LINPHONE_PUBLIC void linphone_gtk_friend_list_set_active_address(const LinphoneA
LINPHONE_PUBLIC const LinphoneAddress *linphone_gtk_friend_list_get_active_address(void);
LINPHONE_PUBLIC void linphone_gtk_notebook_tab_select(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer data);
LINPHONE_PUBLIC void linphone_gtk_show_friends(void);
LINPHONE_PUBLIC void linphone_gtk_show_contact(LinphoneFriend* lf, GtkWindow* parent);
LINPHONE_PUBLIC void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWidget *parent);
LINPHONE_PUBLIC void linphone_gtk_buddy_info_updated(LinphoneCore *lc, LinphoneFriend *lf);
/*functions controlling the different views*/
......
......@@ -209,7 +209,7 @@ void linphone_gtk_log_hide(void){
void linphone_gtk_create_log_window(void){
GtkTextBuffer *b;
log_window=linphone_gtk_create_window("log");
log_window=linphone_gtk_create_window("log", NULL);
b=gtk_text_view_get_buffer(GTK_TEXT_VIEW(linphone_gtk_get_widget(log_window,"textview")));
gtk_text_buffer_create_tag(b,"red","foreground","red",NULL);
gtk_text_buffer_create_tag(b,"orange","foreground","orange",NULL);
......
......@@ -379,7 +379,7 @@ void linphone_gtk_destroy_window(GtkWidget *widget) {
g_object_unref (G_OBJECT (builder));
}
GtkWidget *linphone_gtk_create_window(const char *window_name){
GtkWidget *linphone_gtk_create_window(const char *window_name, GtkWidget *parent){
GError* error = NULL;
GtkBuilder* builder = gtk_builder_new ();
char path[512];
......@@ -402,6 +402,12 @@ GtkWidget *linphone_gtk_create_window(const char *window_name){
g_object_set_data(G_OBJECT(w), "builder",builder);
gtk_builder_connect_signals(builder,w);
linphone_gtk_configure_window(w,window_name);
if(parent) {
gtk_window_set_modal(GTK_WINDOW(w), TRUE);
gtk_window_set_transient_for(GTK_WINDOW(w), GTK_WINDOW(parent));
} else {
gtk_window_set_modal(GTK_WINDOW(w), FALSE);
}
return w;
}
......@@ -527,8 +533,10 @@ void linphone_gtk_show_about(void){
linphone_gtk_get_ui_config("logo","linphone-banner.png"));
static const char *defcfg="defcfg";
about=linphone_gtk_create_window("about");
about=linphone_gtk_create_window("about", the_ui);
gtk_about_dialog_set_url_hook(about_url_clicked,NULL,NULL);
memset(&filestat,0,sizeof(filestat));
if (stat(license_file,&filestat)!=0){
license_file="COPYING";
......@@ -1053,7 +1061,7 @@ static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){
static void linphone_gtk_new_subscriber_response(GtkWidget *dialog, guint response_id, LinphoneFriend *lf){
switch(response_id){
case GTK_RESPONSE_YES:
linphone_gtk_show_contact(lf, GTK_WINDOW(the_ui));
linphone_gtk_show_contact(lf, the_ui);
break;
default:
linphone_core_reject_subscriber(linphone_gtk_get_core(),lf);
......@@ -1135,7 +1143,7 @@ void linphone_gtk_password_ok(GtkWidget *w){
}
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain){
GtkWidget *w=linphone_gtk_create_window("password");
GtkWidget *w=linphone_gtk_create_window("password", the_ui);
GtkWidget *label=linphone_gtk_get_widget(w,"message");
LinphoneAuthInfo *info;
gchar *msg;
......@@ -1871,7 +1879,7 @@ void linphone_gtk_create_keypad(GtkWidget *button){
if(k!=NULL){
gtk_widget_destroy(k);
}
keypad=linphone_gtk_create_window("keypad");
keypad=linphone_gtk_create_window("keypad", NULL);
linphone_gtk_connect_digits(keypad);
linphone_gtk_init_dtmf_table(keypad);
g_object_set_data(G_OBJECT(mw),"keypad",(gpointer)keypad);
......@@ -2190,7 +2198,7 @@ core_start:
return 0;
}
the_ui=linphone_gtk_create_window("main");
the_ui=linphone_gtk_create_window("main", NULL);
g_object_set_data(G_OBJECT(the_ui),"is_created",GINT_TO_POINTER(FALSE));
......
......@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
#include "linphone_tunnel.h"
#include "lpconfig.h"
#include "config.h"
void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices, const char *selected, DeviceCap cap){
const char **p=devices;
......@@ -153,7 +154,7 @@ static void linphone_gtk_ldap_load_settings(GtkWidget* param)
void linphone_gtk_show_ldap_config(GtkWidget* button)
{
GtkWidget* param = gtk_widget_get_toplevel(button);
GtkWidget* ldap_config = linphone_gtk_create_window("ldap");
GtkWidget* ldap_config = linphone_gtk_create_window("ldap", param);
linphone_gtk_ldap_load_settings(ldap_config);
// to refresh parameters when the ldap config is destroyed
......@@ -998,7 +999,7 @@ void linphone_gtk_proxy_address_changed(GtkEditable *editable){
}
void linphone_gtk_show_proxy_config(GtkWidget *pb, LinphoneProxyConfig *cfg){
GtkWidget *w=linphone_gtk_create_window("sip_account");
GtkWidget *w=linphone_gtk_create_window("sip_account", gtk_widget_get_toplevel(pb));
const char *tmp;
gboolean is_new=FALSE;
......@@ -1581,7 +1582,7 @@ void linphone_gtk_show_parameters(void){
int min_port = 0, max_port = 0;
if (pb==NULL) {
pb=linphone_gtk_create_window("parameters");
pb=linphone_gtk_create_window("parameters", linphone_gtk_get_main_window());
g_object_set_data(G_OBJECT(mw),"parameters",pb);
}else {
gtk_widget_show(pb);
......@@ -1765,7 +1766,7 @@ void linphone_gtk_edit_tunnel_closed(GtkWidget *button){
}
void linphone_gtk_edit_tunnel(GtkButton *button){
GtkWidget *w=linphone_gtk_create_window("tunnel_config");
GtkWidget *w=linphone_gtk_create_window("tunnel_config", gtk_widget_get_toplevel(GTK_WIDGET(button)));
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneTunnel *tunnel=linphone_core_get_tunnel(lc);
const MSList *configs;
......@@ -1863,7 +1864,7 @@ static int read_dscp(GtkWidget *entry){
void linphone_gtk_dscp_edit(void){
LinphoneCore *lc=linphone_gtk_get_core();
GtkWidget *widget=linphone_gtk_create_window("dscp_settings");
GtkWidget *widget=linphone_gtk_create_window("dscp_settings", linphone_gtk_get_main_window());
show_dscp(linphone_gtk_get_widget(widget,"sip_dscp"),
linphone_core_get_sip_dscp(lc));
show_dscp(linphone_gtk_get_widget(widget,"audio_dscp"),
......
......@@ -30,7 +30,7 @@ void *linphone_gtk_wait(LinphoneCore *lc, void *ctx, LinphoneWaitingState ws, co
switch(ws){
case LinphoneWaitingStart:
gdk_threads_enter();
w=linphone_gtk_create_window("waiting");
w=linphone_gtk_create_window("waiting", NULL);
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) {
......
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