From 68ca8ff500e1dc0751b6c411e8126393e92ee027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= <francois.grisez@belledonne-communications.com> Date: Tue, 26 May 2015 01:09:21 +0200 Subject: [PATCH] Make the setup wizard and the adding contact window transient That notifies the window manager to keep these windows over the main window --- gtk/calllogs.c | 3 ++- gtk/friendlist.c | 10 +++++++--- gtk/linphone.h | 4 ++-- gtk/main.c | 4 ++-- gtk/setupwizard.c | 4 +++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 51fcb260b2..d6895ae33b 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -70,6 +70,7 @@ void linphone_gtk_call_log_chat_selected(GtkWidget *w){ } void linphone_gtk_call_log_add_contact(GtkWidget *w){ + GtkWidget *main_window = gtk_widget_get_toplevel(w); GtkTreeSelection *select; GtkTreeIter iter; @@ -87,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); + linphone_gtk_show_contact(lf, GTK_WINDOW(main_window)); ms_free(uri); } } diff --git a/gtk/friendlist.c b/gtk/friendlist.c index 3aafb3187d..838ee1e937 100644 --- a/gtk/friendlist.c +++ b/gtk/friendlist.c @@ -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); + linphone_gtk_show_contact(lf, GTK_WINDOW(w)); } } @@ -471,6 +471,7 @@ void linphone_gtk_my_presence_clicked(GtkWidget *button){ } static void icon_press_handler(GtkEntry *entry){ + GtkWidget *w = gtk_widget_get_toplevel(GTK_WIDGET(entry)); const char *text=gtk_entry_get_text(entry); if (text && strlen(text)>0){ LinphoneAddress *addr; @@ -487,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); + linphone_gtk_show_contact(lf, GTK_WINDOW(w)); } linphone_address_destroy(addr); } @@ -869,7 +870,7 @@ void linphone_gtk_show_friends(void){ ms_list_free(sorted); } -void linphone_gtk_show_contact(LinphoneFriend *lf){ +void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWindow *parent){ GtkWidget *w=linphone_gtk_create_window("contact"); char *uri; const char *name; @@ -888,6 +889,9 @@ void linphone_gtk_show_contact(LinphoneFriend *lf){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"allow_presence")), 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); } diff --git a/gtk/linphone.h b/gtk/linphone.h index a4b87ce25b..281a47a871 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -89,7 +89,7 @@ LINPHONE_PUBLIC GtkWidget *linphone_gtk_get_widget(GtkWidget *window, const char LINPHONE_PUBLIC GtkWidget *linphone_gtk_create_widget(const char *filename, const char *widget_name); const char *linphone_gtk_message_storage_get_db_file(const char *filename); -LINPHONE_PUBLIC void linphone_gtk_show_assistant(void); +LINPHONE_PUBLIC void linphone_gtk_show_assistant(GtkWidget* parent); LINPHONE_PUBLIC void linphone_gtk_close_assistant(void); LINPHONE_PUBLIC LinphoneCore *linphone_gtk_get_core(void); @@ -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); +LINPHONE_PUBLIC void linphone_gtk_show_contact(LinphoneFriend* lf, GtkWindow* parent); LINPHONE_PUBLIC void linphone_gtk_buddy_info_updated(LinphoneCore *lc, LinphoneFriend *lf); /*functions controlling the different views*/ diff --git a/gtk/main.c b/gtk/main.c index c73c57ec21..2d02dbb5b5 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1051,7 +1051,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); + linphone_gtk_show_contact(lf, GTK_WINDOW(the_ui)); break; default: linphone_core_reject_subscriber(linphone_gtk_get_core(),lf); @@ -2022,7 +2022,7 @@ static void linphone_gtk_init_ui(void){ #ifdef BUILD_WIZARD // Veryfing if at least one sip account is configured. If not, show wizard if (linphone_core_get_proxy_config_list(linphone_gtk_get_core()) == NULL) { - linphone_gtk_show_assistant(); + linphone_gtk_show_assistant(the_ui); } #endif diff --git a/gtk/setupwizard.c b/gtk/setupwizard.c index 335062a012..96b12d50df 100644 --- a/gtk/setupwizard.c +++ b/gtk/setupwizard.c @@ -589,7 +589,7 @@ void linphone_gtk_close_assistant(void){ the_assistant = NULL; } -void linphone_gtk_show_assistant(void){ +void linphone_gtk_show_assistant(GtkWidget *parent){ GtkWidget *w; GtkWidget *p1; GtkWidget *p2; @@ -670,6 +670,8 @@ void linphone_gtk_show_assistant(void){ g_signal_connect(G_OBJECT(w),"close",(GCallback)linphone_gtk_assistant_closed,NULL); g_signal_connect(G_OBJECT(w),"cancel",(GCallback)linphone_gtk_assistant_closed,NULL); g_signal_connect(G_OBJECT(w),"prepare",(GCallback)linphone_gtk_assistant_prepare,NULL); + + gtk_window_set_transient_for(GTK_WINDOW(the_assistant), GTK_WINDOW(parent)); gtk_widget_show(w); } -- GitLab