[evolution/gnome-3-22] Bug 779738 - [Wayland] Date picker misplaced (missing transient-for)
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-22] Bug 779738 - [Wayland] Date picker misplaced (missing transient-for)
- Date: Wed, 8 Mar 2017 10:45:18 +0000 (UTC)
commit 841d6555271b2a3cc1c21643a5d7b13ee37706a4
Author: Milan Crha <mcrha redhat com>
Date: Wed Mar 8 11:43:49 2017 +0100
Bug 779738 - [Wayland] Date picker misplaced (missing transient-for)
addressbook/gui/contact-editor/e-contact-editor.c | 3 --
.../gui/contact-list-editor/contact-list-editor.ui | 1 -
.../contact-list-editor/e-contact-list-editor.c | 24 ++++++++++++++----
composer/e-composer-name-header.c | 14 +++++++---
e-util/e-categories-editor.c | 26 ++++++++++++++++++-
e-util/e-dateedit.c | 7 +++++
modules/addressbook/e-book-shell-backend.c | 18 +++++++------
modules/addressbook/e-book-shell-view-actions.c | 3 ++
modules/addressbook/e-book-shell-view-private.c | 2 +
9 files changed, 75 insertions(+), 23 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c
b/addressbook/gui/contact-editor/e-contact-editor.c
index 4704528..f002bc2 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -5108,9 +5108,6 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
gtk_window_set_icon_name (
GTK_WINDOW (e_contact_editor->priv->app), "contact-editor");
- /* show window */
- gtk_widget_show (e_contact_editor->priv->app);
-
gtk_application_add_window (
GTK_APPLICATION (shell),
GTK_WINDOW (e_contact_editor->priv->app));
diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.ui
b/addressbook/gui/contact-list-editor/contact-list-editor.ui
index c1a24f0..350a0da 100644
--- a/addressbook/gui/contact-list-editor/contact-list-editor.ui
+++ b/addressbook/gui/contact-list-editor/contact-list-editor.ui
@@ -2,7 +2,6 @@
<!--*- mode: xml -*-->
<interface>
<object class="GtkDialog" id="dialog">
- <property name="visible">True</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Contact List Editor</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 4df72b2..06433d3 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -1219,13 +1219,20 @@ contact_editor_fudge_new (EBookClient *book_client,
gboolean is_new,
gboolean editable)
{
+ EABEditor *editor;
EShell *shell = e_shell_get_default ();
+ GtkWindow *parent;
/* XXX Putting this function signature in libedataserverui
* was a terrible idea. Now we're stuck with it. */
- return e_contact_editor_new (
- shell, book_client, contact, is_new, editable);
+ editor = e_contact_editor_new (shell, book_client, contact, is_new, editable);
+ parent = e_shell_get_active_window (shell);
+ if (parent)
+ gtk_window_set_transient_for (eab_editor_get_window (editor), parent);
+ eab_editor_show (editor);
+
+ return editor;
}
static gpointer
@@ -1234,13 +1241,20 @@ contact_list_editor_fudge_new (EBookClient *book_client,
gboolean is_new,
gboolean editable)
{
+ EABEditor *editor;
EShell *shell = e_shell_get_default ();
+ GtkWindow *parent;
/* XXX Putting this function signature in libedataserverui
* was a terrible idea. Now we're stuck with it. */
- return e_contact_list_editor_new (
- shell, book_client, contact, is_new, editable);
+ editor = e_contact_list_editor_new (shell, book_client, contact, is_new, editable);
+ parent = e_shell_get_active_window (shell);
+ if (parent)
+ gtk_window_set_transient_for (eab_editor_get_window (editor), parent);
+ eab_editor_show (editor);
+
+ return editor;
}
static void
@@ -1493,7 +1507,7 @@ contact_list_editor_constructed (GObject *object)
editor, "notify::editable",
G_CALLBACK (contact_list_editor_notify_cb), NULL);
- gtk_widget_show_all (WIDGET (DIALOG));
+ gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (WIDGET (DIALOG))));
setup_custom_widgets (editor);
diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
index d99b325..965213d 100644
--- a/composer/e-composer-name-header.c
+++ b/composer/e-composer-name-header.c
@@ -59,13 +59,16 @@ contact_editor_fudge_new (EBookClient *book_client,
gboolean is_new,
gboolean editable)
{
+ EABEditor *editor;
EShell *shell = e_shell_get_default ();
/* XXX Putting this function signature in libedataserverui
* was a terrible idea. Now we're stuck with it. */
- return e_contact_editor_new (
- shell, book_client, contact, is_new, editable);
+ editor = e_contact_editor_new (shell, book_client, contact, is_new, editable);
+ eab_editor_show (editor);
+
+ return editor;
}
static gpointer
@@ -74,13 +77,16 @@ contact_list_editor_fudge_new (EBookClient *book_client,
gboolean is_new,
gboolean editable)
{
+ EABEditor *editor;
EShell *shell = e_shell_get_default ();
/* XXX Putting this function signature in libedataserverui
* was a terrible idea. Now we're stuck with it. */
- return e_contact_list_editor_new (
- shell, book_client, contact, is_new, editable);
+ editor = e_contact_list_editor_new (shell, book_client, contact, is_new, editable);
+ eab_editor_show (editor);
+
+ return editor;
}
static void
diff --git a/e-util/e-categories-editor.c b/e-util/e-categories-editor.c
index eed1043..3b1bca3 100644
--- a/e-util/e-categories-editor.c
+++ b/e-util/e-categories-editor.c
@@ -109,7 +109,18 @@ static void
new_button_clicked_cb (GtkButton *button,
ECategoriesEditor *editor)
{
- ECategoryEditor *cat_editor = e_category_editor_new ();
+ GtkWidget *toplevel, *parent;
+ ECategoryEditor *cat_editor;
+
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (editor));
+ if (GTK_IS_WINDOW (toplevel))
+ parent = toplevel;
+ else
+ parent = NULL;
+
+ cat_editor = g_object_new (E_TYPE_CATEGORY_EDITOR,
+ "transient-for", parent,
+ NULL);
e_category_editor_create_category (cat_editor);
@@ -120,9 +131,20 @@ static void
edit_button_clicked_cb (GtkButton *button,
ECategoriesEditor *editor)
{
- ECategoryEditor *cat_editor = e_category_editor_new ();
+ GtkWidget *toplevel, *parent;
+ ECategoryEditor *cat_editor;
gchar *category;
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (editor));
+ if (GTK_IS_WINDOW (toplevel))
+ parent = toplevel;
+ else
+ parent = NULL;
+
+ cat_editor = g_object_new (E_TYPE_CATEGORY_EDITOR,
+ "transient-for", parent,
+ NULL);
+
category = e_categories_selector_get_selected (
editor->priv->categories_list);
diff --git a/e-util/e-dateedit.c b/e-util/e-dateedit.c
index 6b08132..75e6846 100644
--- a/e-util/e-dateedit.c
+++ b/e-util/e-dateedit.c
@@ -1408,6 +1408,7 @@ e_date_edit_show_date_popup (EDateEdit *dedit,
GdkDevice *pointer_device;
GdkWindow *window;
GdkGrabStatus grab_status;
+ GtkWidget *toplevel;
struct tm mtm;
const gchar *date_text;
GDate selected_day;
@@ -1438,6 +1439,12 @@ e_date_edit_show_date_popup (EDateEdit *dedit,
* emissions. */
e_calendar_get_item (calendar)->selection_changed = FALSE;
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (dedit));
+ if (!GTK_IS_WINDOW (toplevel))
+ toplevel = NULL;
+
+ gtk_window_set_transient_for (GTK_WINDOW (priv->cal_popup), toplevel ? GTK_WINDOW (toplevel) : NULL);
+
position_date_popup (dedit);
gtk_widget_show (priv->cal_popup);
gtk_widget_grab_focus (priv->cal_popup);
diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c
index 666120f..fd31ffe 100644
--- a/modules/addressbook/e-book-shell-backend.c
+++ b/modules/addressbook/e-book-shell-backend.c
@@ -91,7 +91,7 @@ book_shell_backend_new_contact_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- EShell *shell = user_data;
+ EShellWindow *shell_window = user_data;
EClient *client;
EContact *contact;
EABEditor *editor;
@@ -115,7 +115,8 @@ book_shell_backend_new_contact_cb (GObject *source_object,
contact = e_contact_new ();
editor = e_contact_editor_new (
- shell, E_BOOK_CLIENT (client), contact, TRUE, TRUE);
+ e_shell_window_get_shell (shell_window), E_BOOK_CLIENT (client), contact, TRUE, TRUE);
+ gtk_window_set_transient_for (eab_editor_get_window (editor), GTK_WINDOW (shell_window));
eab_editor_show (editor);
@@ -123,7 +124,7 @@ book_shell_backend_new_contact_cb (GObject *source_object,
g_object_unref (client);
exit:
- g_object_unref (shell);
+ g_object_unref (shell_window);
}
static void
@@ -131,7 +132,7 @@ book_shell_backend_new_contact_list_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- EShell *shell = user_data;
+ EShellWindow *shell_window = user_data;
EClient *client;
EContact *contact;
EABEditor *editor;
@@ -155,7 +156,8 @@ book_shell_backend_new_contact_list_cb (GObject *source_object,
contact = e_contact_new ();
editor = e_contact_list_editor_new (
- shell, E_BOOK_CLIENT (client), contact, TRUE, TRUE);
+ e_shell_window_get_shell (shell_window), E_BOOK_CLIENT (client), contact, TRUE, TRUE);
+ gtk_window_set_transient_for (eab_editor_get_window (editor), GTK_WINDOW (shell_window));
eab_editor_show (editor);
@@ -163,7 +165,7 @@ book_shell_backend_new_contact_list_cb (GObject *source_object,
g_object_unref (client);
exit:
- g_object_unref (shell);
+ g_object_unref (shell_window);
}
static void
@@ -220,14 +222,14 @@ action_contact_new_cb (GtkAction *action,
E_SOURCE_EXTENSION_ADDRESS_BOOK, 30,
NULL,
book_shell_backend_new_contact_cb,
- g_object_ref (shell));
+ g_object_ref (shell_window));
if (strcmp (action_name, "contact-new-list") == 0)
e_client_cache_get_client (
client_cache, source,
E_SOURCE_EXTENSION_ADDRESS_BOOK, 30,
NULL,
book_shell_backend_new_contact_list_cb,
- g_object_ref (shell));
+ g_object_ref (shell_window));
g_object_unref (source);
}
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 06c9c5d..3cc0985 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -402,6 +402,7 @@ map_window_show_contact_editor_cb (EContactMapWindow *window,
editor = e_contact_editor_new (
shell, E_BOOK_CLIENT (client), contact, FALSE, TRUE);
+ gtk_window_set_transient_for (eab_editor_get_window (editor), GTK_WINDOW (window));
g_signal_connect (
editor, "contact-modified",
@@ -706,6 +707,7 @@ action_contact_new_cb (GtkAction *action,
contact = e_contact_new ();
editor = e_contact_editor_new (shell, book, contact, TRUE, TRUE);
+ gtk_window_set_transient_for (eab_editor_get_window (editor), GTK_WINDOW (shell_window));
eab_editor_show (editor);
g_object_unref (contact);
}
@@ -738,6 +740,7 @@ action_contact_new_list_cb (GtkAction *action,
contact = e_contact_new ();
editor = e_contact_list_editor_new (shell, book, contact, TRUE, TRUE);
+ gtk_window_set_transient_for (eab_editor_get_window (editor), GTK_WINDOW (shell_window));
eab_editor_show (editor);
g_object_unref (contact);
}
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 59d3584..dbb1fa6 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -55,6 +55,8 @@ open_contact (EBookShellView *book_shell_view,
editor = e_contact_editor_new (
shell, book, contact, is_new_contact, editable);
+ gtk_window_set_transient_for (eab_editor_get_window (editor), GTK_WINDOW (shell_window));
+
eab_editor_show (editor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]