[evolution] Bug 779738 - [Wayland] Date picker misplaced (missing transient-for)
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 779738 - [Wayland] Date picker misplaced (missing transient-for)
- Date: Wed, 8 Mar 2017 10:35:32 +0000 (UTC)
commit 866f9db6a83031f60e783bae934fec122cd21f90
Author: Milan Crha <mcrha redhat com>
Date: Wed Mar 8 11:34:28 2017 +0100
Bug 779738 - [Wayland] Date picker misplaced (missing transient-for)
.../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 ++++++++++++++----
src/composer/e-composer-name-header.c | 14 +++++++---
src/e-util/e-categories-editor.c | 26 ++++++++++++++++++-
src/e-util/e-dateedit.c | 7 +++++
src/modules/addressbook/e-book-shell-backend.c | 18 +++++++------
.../addressbook/e-book-shell-view-actions.c | 3 ++
.../addressbook/e-book-shell-view-private.c | 2 +
9 files changed, 75 insertions(+), 23 deletions(-)
---
diff --git a/src/addressbook/gui/contact-editor/e-contact-editor.c
b/src/addressbook/gui/contact-editor/e-contact-editor.c
index 4fddb30..571be7d 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -5106,9 +5106,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/src/addressbook/gui/contact-list-editor/contact-list-editor.ui
b/src/addressbook/gui/contact-list-editor/contact-list-editor.ui
index f23a734..f6f8b9f 100644
--- a/src/addressbook/gui/contact-list-editor/contact-list-editor.ui
+++ b/src/addressbook/gui/contact-list-editor/contact-list-editor.ui
@@ -4,7 +4,6 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="dialog">
- <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">Contact List Editor</property>
diff --git a/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
b/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 5e00836..1299812 100644
--- a/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/src/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -1217,13 +1217,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
@@ -1232,13 +1239,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
@@ -1491,7 +1505,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/src/composer/e-composer-name-header.c b/src/composer/e-composer-name-header.c
index 669a52f..700007c 100644
--- a/src/composer/e-composer-name-header.c
+++ b/src/composer/e-composer-name-header.c
@@ -57,13 +57,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
@@ -72,13 +75,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/src/e-util/e-categories-editor.c b/src/e-util/e-categories-editor.c
index f6e411f..8391824 100644
--- a/src/e-util/e-categories-editor.c
+++ b/src/e-util/e-categories-editor.c
@@ -110,7 +110,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);
@@ -121,9 +132,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/src/e-util/e-dateedit.c b/src/e-util/e-dateedit.c
index 8af28c5..74d7fbb 100644
--- a/src/e-util/e-dateedit.c
+++ b/src/e-util/e-dateedit.c
@@ -1406,6 +1406,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;
@@ -1436,6 +1437,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/src/modules/addressbook/e-book-shell-backend.c b/src/modules/addressbook/e-book-shell-backend.c
index 1c3a712..f908224 100644
--- a/src/modules/addressbook/e-book-shell-backend.c
+++ b/src/modules/addressbook/e-book-shell-backend.c
@@ -89,7 +89,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;
@@ -113,7 +113,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);
@@ -121,7 +122,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
@@ -129,7 +130,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;
@@ -153,7 +154,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);
@@ -161,7 +163,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
@@ -218,14 +220,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/src/modules/addressbook/e-book-shell-view-actions.c
b/src/modules/addressbook/e-book-shell-view-actions.c
index 348a57c..e9eb7e1 100644
--- a/src/modules/addressbook/e-book-shell-view-actions.c
+++ b/src/modules/addressbook/e-book-shell-view-actions.c
@@ -400,6 +400,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",
@@ -704,6 +705,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);
}
@@ -736,6 +738,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/src/modules/addressbook/e-book-shell-view-private.c
b/src/modules/addressbook/e-book-shell-view-private.c
index fa3081f..41df95a 100644
--- a/src/modules/addressbook/e-book-shell-view-private.c
+++ b/src/modules/addressbook/e-book-shell-view-private.c
@@ -53,6 +53,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]