From 224f26b84d9c12b0dd1d337f51c14b6ebb901007 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 4 Sep 2011 09:48:24 -0400 Subject: GtkApplication has some new EShell-like features. I pushed a few EShell features up to GtkApplication for GTK+ 3.2, so we can now trim off the redundancies in EShell. 1) GtkApplication has a new "window-added" signal which replaces EShell's own "window-created" signal. 2) GtkApplication has a new "window-removed" signal which replaces EShell's own "window-destroyed" signal. 3) gtk_application_get_windows() now returns a list of windows sorted by most recently focused, replacing e_shell_get_watched_windows(). 4) GtkApplication now provides enough hooks to subclasses that we can remove e_shell_watch_window() and call gtk_application_add_window() directly. --- modules/calendar/e-cal-shell-backend.c | 21 ++++++++++++--------- modules/calendar/e-memo-shell-backend.c | 8 ++++---- modules/calendar/e-task-shell-backend.c | 8 ++++---- 3 files changed, 20 insertions(+), 17 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 96077cf19e..5693994277 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -699,8 +699,8 @@ exit: } static void -cal_shell_backend_window_created_cb (EShellBackend *shell_backend, - GtkWindow *window) +cal_shell_backend_window_added_cb (EShellBackend *shell_backend, + GtkWindow *window) { const gchar *backend_name; @@ -770,8 +770,8 @@ cal_shell_backend_constructed (GObject *object) shell_backend); g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (cal_shell_backend_window_created_cb), + shell, "window-added", + G_CALLBACK (cal_shell_backend_window_added_cb), shell_backend); cal_shell_backend_init_importers (); @@ -943,18 +943,21 @@ e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend, EShellBackend *shell_backend; EShellSidebar *shell_sidebar; GtkWidget *shell_window = NULL; + GtkApplication *application; ECalendar *navigator; - GList *watched_windows; + GList *list; g_return_if_fail (E_IS_CAL_SHELL_BACKEND (cal_shell_backend)); shell_backend = E_SHELL_BACKEND (cal_shell_backend); shell = e_shell_backend_get_shell (shell_backend); - watched_windows = e_shell_get_watched_windows (shell); + + application = GTK_APPLICATION (shell); + list = gtk_application_get_windows (application); /* Try to find an EShellWindow already in calendar view. */ - while (watched_windows != NULL) { - GtkWidget *window = GTK_WIDGET (watched_windows->data); + while (list != NULL) { + GtkWidget *window = GTK_WIDGET (list->data); if (E_IS_SHELL_WINDOW (window)) { const gchar *active_view; @@ -968,7 +971,7 @@ e_cal_shell_backend_open_date_range (ECalShellBackend *cal_shell_backend, } } - watched_windows = g_list_next (watched_windows); + list = g_list_next (list); } /* Otherwise create a new EShellWindow in calendar view. */ diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 7edb82d6bb..ed4e81d559 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -485,8 +485,8 @@ exit: } static void -memo_shell_backend_window_created_cb (EShellBackend *shell_backend, - GtkWindow *window) +memo_shell_backend_window_added_cb (EShellBackend *shell_backend, + GtkWindow *window) { const gchar *module_name; @@ -555,8 +555,8 @@ memo_shell_backend_constructed (GObject *object) shell_backend); g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (memo_shell_backend_window_created_cb), + shell, "window-added", + G_CALLBACK (memo_shell_backend_window_added_cb), shell_backend); /* Chain up to parent's constructed() method. */ diff --git a/modules/calendar/e-task-shell-backend.c b/modules/calendar/e-task-shell-backend.c index f6a5e14588..2fc8ce1e5f 100644 --- a/modules/calendar/e-task-shell-backend.c +++ b/modules/calendar/e-task-shell-backend.c @@ -490,8 +490,8 @@ exit: } static void -task_shell_backend_window_created_cb (EShellBackend *shell_backend, - GtkWindow *window) +task_shell_backend_window_added_cb (EShellBackend *shell_backend, + GtkWindow *window) { const gchar *module_name; @@ -560,8 +560,8 @@ task_shell_backend_constructed (GObject *object) shell_backend); g_signal_connect_swapped ( - shell, "window-created", - G_CALLBACK (task_shell_backend_window_created_cb), + shell, "window-added", + G_CALLBACK (task_shell_backend_window_added_cb), shell_backend); /* Chain up to parent's constructed() method. */ -- cgit v1.2.3