network: Set transient window from outside NetConnectionEditor constructor
This commit is contained in:
parent
2d8e3d786e
commit
a1e26cdac1
6 changed files with 13 additions and 33 deletions
|
@ -682,10 +682,9 @@ create_connection_cb (GtkWidget *button,
|
||||||
CcNetworkPanel *self)
|
CcNetworkPanel *self)
|
||||||
{
|
{
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
GtkWindow *toplevel;
|
|
||||||
|
|
||||||
toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)));
|
editor = net_connection_editor_new (NULL, NULL, NULL, self->client);
|
||||||
editor = net_connection_editor_new (toplevel, NULL, NULL, NULL, self->client);
|
gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
|
||||||
net_connection_editor_run (editor);
|
net_connection_editor_run (editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,6 @@ struct _NetConnectionEditor
|
||||||
GtkNotebook *notebook;
|
GtkNotebook *notebook;
|
||||||
GtkStack *toplevel_stack;
|
GtkStack *toplevel_stack;
|
||||||
|
|
||||||
GtkWidget *parent_window;
|
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
NMDevice *device;
|
NMDevice *device;
|
||||||
|
|
||||||
|
@ -199,7 +198,6 @@ net_connection_editor_finalize (GObject *object)
|
||||||
|
|
||||||
g_clear_object (&self->connection);
|
g_clear_object (&self->connection);
|
||||||
g_clear_object (&self->orig_connection);
|
g_clear_object (&self->orig_connection);
|
||||||
g_clear_object (&self->parent_window);
|
|
||||||
g_clear_object (&self->device);
|
g_clear_object (&self->device);
|
||||||
g_clear_object (&self->client);
|
g_clear_object (&self->client);
|
||||||
g_clear_object (&self->ap);
|
g_clear_object (&self->ap);
|
||||||
|
@ -250,7 +248,7 @@ net_connection_editor_error_dialog (NetConnectionEditor *self,
|
||||||
if (gtk_widget_is_visible (GTK_WIDGET (self)))
|
if (gtk_widget_is_visible (GTK_WIDGET (self)))
|
||||||
parent = GTK_WINDOW (self);
|
parent = GTK_WINDOW (self);
|
||||||
else
|
else
|
||||||
parent = GTK_WINDOW (self->parent_window);
|
parent = gtk_window_get_transient_for (GTK_WINDOW (self));
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (parent,
|
dialog = gtk_message_dialog_new (parent,
|
||||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
@ -786,8 +784,7 @@ permission_changed (NetConnectionEditor *self,
|
||||||
}
|
}
|
||||||
|
|
||||||
NetConnectionEditor *
|
NetConnectionEditor *
|
||||||
net_connection_editor_new (GtkWindow *parent_window,
|
net_connection_editor_new (NMConnection *connection,
|
||||||
NMConnection *connection,
|
|
||||||
NMDevice *device,
|
NMDevice *device,
|
||||||
NMAccessPoint *ap,
|
NMAccessPoint *ap,
|
||||||
NMClient *client)
|
NMClient *client)
|
||||||
|
@ -799,11 +796,6 @@ net_connection_editor_new (GtkWindow *parent_window,
|
||||||
"use-header-bar", 1,
|
"use-header-bar", 1,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (parent_window) {
|
|
||||||
self->parent_window = GTK_WIDGET (g_object_ref (parent_window));
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW (self),
|
|
||||||
parent_window);
|
|
||||||
}
|
|
||||||
if (ap)
|
if (ap)
|
||||||
self->ap = g_object_ref (ap);
|
self->ap = g_object_ref (ap);
|
||||||
if (device)
|
if (device)
|
||||||
|
|
|
@ -28,8 +28,7 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (NetConnectionEditor, net_connection_editor, NET, CONNECTION_EDITOR, GtkDialog)
|
G_DECLARE_FINAL_TYPE (NetConnectionEditor, net_connection_editor, NET, CONNECTION_EDITOR, GtkDialog)
|
||||||
|
|
||||||
NetConnectionEditor *net_connection_editor_new (GtkWindow *parent_window,
|
NetConnectionEditor *net_connection_editor_new (NMConnection *connection,
|
||||||
NMConnection *connection,
|
|
||||||
NMDevice *device,
|
NMDevice *device,
|
||||||
NMAccessPoint *ap,
|
NMAccessPoint *ap,
|
||||||
NMClient *client);
|
NMClient *client);
|
||||||
|
|
|
@ -217,15 +217,13 @@ show_details (NetDeviceEthernet *self, GtkButton *button, const gchar *title)
|
||||||
{
|
{
|
||||||
GtkWidget *row;
|
GtkWidget *row;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
GtkWidget *window;
|
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
|
|
||||||
window = gtk_widget_get_toplevel (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
row = g_object_get_data (G_OBJECT (button), "row");
|
row = g_object_get_data (G_OBJECT (button), "row");
|
||||||
connection = NM_CONNECTION (g_object_get_data (G_OBJECT (row), "connection"));
|
connection = NM_CONNECTION (g_object_get_data (G_OBJECT (row), "connection"));
|
||||||
|
|
||||||
editor = net_connection_editor_new (GTK_WINDOW (window), connection, self->device, NULL, self->client);
|
editor = net_connection_editor_new (connection, self->device, NULL, self->client);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
|
||||||
if (title)
|
if (title)
|
||||||
net_connection_editor_set_title (editor, title);
|
net_connection_editor_set_title (editor, title);
|
||||||
g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
|
g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
|
||||||
|
@ -391,7 +389,6 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self)
|
||||||
g_autofree gchar *uuid = NULL;
|
g_autofree gchar *uuid = NULL;
|
||||||
g_autofree gchar *id = NULL;
|
g_autofree gchar *id = NULL;
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
GtkWidget *window;
|
|
||||||
const GPtrArray *connections;
|
const GPtrArray *connections;
|
||||||
|
|
||||||
connection = nm_simple_connection_new ();
|
connection = nm_simple_connection_new ();
|
||||||
|
@ -412,9 +409,8 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self)
|
||||||
|
|
||||||
nm_connection_add_setting (connection, nm_setting_wired_new ());
|
nm_connection_add_setting (connection, nm_setting_wired_new ());
|
||||||
|
|
||||||
window = gtk_widget_get_toplevel (GTK_WIDGET (self));
|
editor = net_connection_editor_new (connection, self->device, NULL, self->client);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
|
||||||
editor = net_connection_editor_new (GTK_WINDOW (window), connection, self->device, NULL, self->client);
|
|
||||||
g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
|
g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
|
||||||
net_connection_editor_run (editor);
|
net_connection_editor_run (editor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -967,15 +967,13 @@ show_details_for_row (NetDeviceWifi *self, CcWifiConnectionRow *row, CcWifiConne
|
||||||
{
|
{
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMAccessPoint *ap;
|
NMAccessPoint *ap;
|
||||||
GtkWidget *window;
|
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
|
|
||||||
window = gtk_widget_get_toplevel (GTK_WIDGET (row));
|
|
||||||
|
|
||||||
connection = cc_wifi_connection_row_get_connection (row);
|
connection = cc_wifi_connection_row_get_connection (row);
|
||||||
ap = cc_wifi_connection_row_best_access_point (row);
|
ap = cc_wifi_connection_row_best_access_point (row);
|
||||||
|
|
||||||
editor = net_connection_editor_new (GTK_WINDOW (window), connection, self->device, ap, self->client);
|
editor = net_connection_editor_new (connection, self->device, ap, self->client);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (row))));
|
||||||
net_connection_editor_run (editor);
|
net_connection_editor_run (editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,15 +150,11 @@ editor_done (NetVpn *self)
|
||||||
static void
|
static void
|
||||||
edit_connection (NetVpn *self)
|
edit_connection (NetVpn *self)
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
|
||||||
NetConnectionEditor *editor;
|
NetConnectionEditor *editor;
|
||||||
g_autofree gchar *title = NULL;
|
g_autofree gchar *title = NULL;
|
||||||
|
|
||||||
window = gtk_widget_get_toplevel (GTK_WIDGET (self));
|
editor = net_connection_editor_new (self->connection, NULL, NULL, self->client);
|
||||||
|
gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))));
|
||||||
editor = net_connection_editor_new (GTK_WINDOW (window),
|
|
||||||
self->connection,
|
|
||||||
NULL, NULL, self->client);
|
|
||||||
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (self->connection));
|
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (self->connection));
|
||||||
net_connection_editor_set_title (editor, title);
|
net_connection_editor_set_title (editor, title);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue