[network-manager-applet] applet: always center dialogs on the screen



commit fff8de7a8afa69203d096d769d29ac57dc318955
Author: Antti Kaijanmäki <antti kaijanmaki canonical com>
Date:   Thu Aug 30 14:27:42 2012 +0800

    applet: always center dialogs on the screen
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783938

 src/applet-dialogs.c |    4 ++++
 src/utils/utils.c    |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index 662da03..3182430 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -39,6 +39,7 @@ info_dialog_show_error (const char *err)
 
        dialog = gtk_message_dialog_new_with_markup (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
                        "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", _("Error displaying 
connection information:"), err);
+       gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
        gtk_window_present (GTK_WINDOW (dialog));
        g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
 }
@@ -973,6 +974,7 @@ applet_info_dialog_show (NMApplet *applet)
        g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), dialog);
        g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_hide), dialog);
        gtk_widget_realize (dialog);
+       gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS);
        gtk_window_present_with_time (GTK_WINDOW (dialog),
                gdk_x11_get_server_time (gtk_widget_get_window (dialog)));
 }
@@ -1028,6 +1030,7 @@ applet_mobile_password_dialog_new (NMConnection *connection,
 
        dialog = GTK_DIALOG (gtk_dialog_new ());
        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+       gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
        gtk_window_set_title (GTK_WINDOW (dialog), _("Mobile broadband network password"));
 
        gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
@@ -1365,6 +1368,7 @@ applet_mobile_pin_dialog_new (const char *unlock_required,
        } else
                g_assert_not_reached ();
 
+       gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS);
        gtk_window_set_title (GTK_WINDOW (dialog), title);
 
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "header_label"));
diff --git a/src/utils/utils.c b/src/utils/utils.c
index 684987b..c355be3 100644
--- a/src/utils/utils.c
+++ b/src/utils/utils.c
@@ -202,6 +202,8 @@ utils_show_error_dialog (const char *title,
                                             "%s",
                                             text1);
 
+       gtk_window_set_position (GTK_WINDOW (err_dialog), GTK_WIN_POS_CENTER_ALWAYS);
+
        if (text2)
                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (err_dialog), "%s", text2);
        if (title)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]