[evolution/wip/webkit2] Bug 755743 - Cannot open new window from overview
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Bug 755743 - Cannot open new window from overview
- Date: Thu, 3 Mar 2016 13:43:58 +0000 (UTC)
commit 50339157b56485aabb8eccc0a6b53dee223cadd1
Author: Milan Crha <mcrha redhat com>
Date: Fri Jan 15 15:13:19 2016 +0100
Bug 755743 - Cannot open new window from overview
data/evolution.desktop.in.in | 5 +++
shell/e-shell.c | 64 +++++++++++++++++++++++-------------------
shell/main.c | 12 ++++++--
3 files changed, 49 insertions(+), 32 deletions(-)
---
diff --git a/data/evolution.desktop.in.in b/data/evolution.desktop.in.in
index 05c3aa7..b9a95aa 100644
--- a/data/evolution.desktop.in.in
+++ b/data/evolution.desktop.in.in
@@ -4,6 +4,7 @@ _GenericName=Groupware Suite
_X-GNOME-FullName=Evolution Mail and Calendar
_Comment=Manage your email, contacts and schedule
_Keywords=email;calendar;contact;addressbook;task;
+Actions=new-window;
Exec=evolution %U
Icon=evolution
Terminal=false
@@ -17,3 +18,7 @@ X-GNOME-Bugzilla-Version= BASE_VERSION@.x
X-GNOME-Bugzilla-OtherBinaries=evolution-addressbook-factory;evolution-calendar-factory;evolution-source-registry;evolution-user-prompter;
X-GNOME-UsesNotifications=true
MimeType=text/calendar;text/x-vcard;text/directory;application/mbox;message/rfc822;x-scheme-handler/mailto;
+
+[Desktop Action new-window]
+_Name=New Window
+Exec=evolution -c current
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 312ba68..9afe778 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -180,30 +180,47 @@ shell_action_new_window_cb (GSimpleAction *action,
EShell *shell)
{
GtkApplication *application;
- GList *list;
const gchar *view_name;
application = GTK_APPLICATION (shell);
- list = gtk_application_get_windows (application);
- view_name = g_variant_get_string (parameter, NULL);
+ view_name = parameter ? g_variant_get_string (parameter, NULL) : NULL;
+ if (view_name && !*view_name)
+ view_name = NULL;
- /* Present the first EShellWindow showing 'view_name'. */
- while (list != NULL) {
- GtkWindow *window = GTK_WINDOW (list->data);
+ if (view_name) {
+ GList *list;
+ gboolean get_current = g_strcmp0 (view_name, "current") == 0;
- if (E_IS_SHELL_WINDOW (window)) {
- const gchar *active_view;
+ list = gtk_application_get_windows (application);
- active_view = e_shell_window_get_active_view (
- E_SHELL_WINDOW (window));
- if (g_strcmp0 (active_view, view_name) == 0) {
- gtk_window_present (window);
- return;
+ /* Present the first EShellWindow showing 'view_name'. */
+ while (list != NULL) {
+ GtkWindow *window = GTK_WINDOW (list->data);
+
+ if (E_IS_SHELL_WINDOW (window)) {
+ const gchar *active_view;
+
+ active_view = e_shell_window_get_active_view (
+ E_SHELL_WINDOW (window));
+ if (g_strcmp0 (active_view, view_name) == 0) {
+ gtk_window_present (window);
+ return;
+ } else if (get_current && active_view) {
+ view_name = active_view;
+ break;
+ }
}
+
+ list = g_list_next (list);
}
+ } else {
+ GtkWindow *window;
- list = g_list_next (list);
+ window = e_shell_get_active_window (shell);
+
+ if (E_IS_SHELL_WINDOW (window))
+ view_name = e_shell_window_get_active_view (E_SHELL_WINDOW (window));
}
/* No suitable EShellWindow found, so create one. */
@@ -263,7 +280,7 @@ shell_add_actions (GApplication *application)
/* Add actions that remote instances can invoke. */
- action = g_simple_action_new ("new-window", G_VARIANT_TYPE_STRING);
+ action = g_simple_action_new ("create-from-remote", G_VARIANT_TYPE_STRING);
g_signal_connect (
action, "activate",
G_CALLBACK (shell_action_new_window_cb), application);
@@ -1160,15 +1177,7 @@ shell_app_menu_activate_cb (GSimpleAction *action,
g_return_if_fail (name != NULL);
if (g_str_equal (name, "new-window")) {
- GtkWindow *window;
-
- window = e_shell_get_active_window (shell);
-
- if (E_IS_SHELL_WINDOW (window))
- e_shell_create_shell_window (shell,
- e_shell_window_get_active_view (E_SHELL_WINDOW (window)));
- else
- e_shell_create_shell_window (shell, NULL);
+ shell_action_new_window_cb (action, parameter, shell);
} else if (g_str_equal (name, "preferences")) {
e_shell_utils_run_preferences (shell);
} else if (g_str_equal (name, "quick-reference")) {
@@ -1177,8 +1186,6 @@ shell_app_menu_activate_cb (GSimpleAction *action,
e_shell_utils_run_help_contents (shell);
} else if (g_str_equal (name, "about")) {
e_shell_utils_run_help_about (shell);
- } else if (g_str_equal (name, "quit")) {
- e_shell_quit (shell, E_SHELL_QUIT_ACTION);
} else {
g_warning ("%s: Unknown app-menu action '%s'", G_STRFUNC, name);
}
@@ -1192,8 +1199,7 @@ shell_create_app_menu (GtkApplication *application)
{ "preferences", shell_app_menu_activate_cb, NULL, NULL, NULL },
{ "quick-reference", shell_app_menu_activate_cb, NULL, NULL, NULL },
{ "help", shell_app_menu_activate_cb, NULL, NULL, NULL },
- { "about", shell_app_menu_activate_cb, NULL, NULL, NULL },
- { "quit", shell_app_menu_activate_cb, NULL, NULL, NULL }
+ { "about", shell_app_menu_activate_cb, NULL, NULL, NULL }
};
GMenu *app_menu, *section;
@@ -2294,7 +2300,7 @@ remote: /* Send a message to the other Evolution process. */
if (view_name != NULL) {
g_action_group_activate_action (
- G_ACTION_GROUP (shell), "new-window",
+ G_ACTION_GROUP (shell), "create-from-remote",
g_variant_new_string (view_name));
} else
g_application_activate (G_APPLICATION (shell));
diff --git a/shell/main.c b/shell/main.c
index 46dcd23..60255b5 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -606,9 +606,15 @@ main (gint argc,
goto exit;
}
- if (g_application_get_is_remote (G_APPLICATION (shell)) &&
- remaining_args && *remaining_args) {
- e_shell_handle_uris (shell, (const gchar * const *) remaining_args, import_uris);
+ if (g_application_get_is_remote (G_APPLICATION (shell))) {
+ if (remaining_args && *remaining_args)
+ e_shell_handle_uris (shell, (const gchar * const *) remaining_args, import_uris);
+
+ /* This will be redirected to the previously run instance,
+ because this instance is remote. */
+ if (requested_view && *requested_view)
+ e_shell_create_shell_window (shell, requested_view);
+
goto exit;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]