[network-manager-applet/jklimes/team] fixup! editor: make Team config importing dialog modal and set parent window for it
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/jklimes/team] fixup! editor: make Team config importing dialog modal and set parent window for it
- Date: Wed, 9 Oct 2013 15:55:27 +0000 (UTC)
commit 3b0e8e5c0be6d04e3a490c691c29d9034d77540e
Author: Dan Williams <dcbw redhat com>
Date: Wed Oct 9 11:00:05 2013 -0500
fixup! editor: make Team config importing dialog modal and set parent window for it
The widget may not be in a window at page init time, but is when the widget
is realized. Get the toplevel parent at realize time.
src/connection-editor/page-team.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index 4e7a490..a21d1e6 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -50,6 +50,17 @@ typedef struct {
} CEPageTeamPrivate;
static void
+widget_realized_cb (GtkWidget *widget, gpointer user_data)
+{
+ CEPageTeamPrivate *priv = CE_PAGE_TEAM_GET_PRIVATE (user_data);
+
+ priv->toplevel = GTK_WINDOW (gtk_widget_get_toplevel (widget));
+ if (!gtk_widget_is_toplevel (GTK_WIDGET (priv->toplevel)))
+ priv->toplevel = NULL;
+ g_signal_handlers_disconnect_by_func (widget, widget_realized_cb, user_data);
+}
+
+static void
team_private_init (CEPageTeam *self)
{
CEPageTeamPrivate *priv = CE_PAGE_TEAM_GET_PRIVATE (self);
@@ -60,8 +71,8 @@ team_private_init (CEPageTeam *self)
priv->json_config_widget = GTK_TEXT_VIEW (gtk_builder_get_object (builder, "team_json_config"));
priv->import_config_button = GTK_WIDGET (gtk_builder_get_object (builder, "import_config_button"));
- priv->toplevel = GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (priv->json_config_widget),
- GTK_TYPE_WINDOW));
+ /* Wait for widget to be realized to get toplevel window */
+ g_signal_connect (priv->json_config_widget, "realize", G_CALLBACK (widget_realized_cb), self);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]