Make the setup wizard and the adding contact window transient

That notifies the window manager to keep these windows over the main window
This commit is contained in:
François Grisez 2015-05-26 01:09:21 +02:00
parent fcbbbd1979
commit 68ca8ff500
5 changed files with 16 additions and 9 deletions

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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*/

View file

@ -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

View file

@ -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);
}