aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/apps_evolution_shell.schemas.in14
-rw-r--r--shell/e-shell-content.c1
-rw-r--r--shell/e-shell-searchbar.c32
-rw-r--r--shell/e-shell-utils.c74
-rw-r--r--shell/e-shell-window-private.c2
-rw-r--r--shell/e-shell-window.c29
-rw-r--r--shell/e-shell.c278
-rw-r--r--shell/e-shell.h6
-rw-r--r--shell/test/e-test-shell-backend.c14
9 files changed, 123 insertions, 327 deletions
diff --git a/shell/apps_evolution_shell.schemas.in b/shell/apps_evolution_shell.schemas.in
index 09c376edda..20e7af463d 100644
--- a/shell/apps_evolution_shell.schemas.in
+++ b/shell/apps_evolution_shell.schemas.in
@@ -58,20 +58,6 @@
</locale>
</schema>
- <!-- Initial GtkFileChooser Folder -->
-
- <schema>
- <key>/schemas/apps/evolution/shell/file_chooser_folder</key>
- <applyto>/apps/evolution/shell/file_chooser_folder</applyto>
- <owner>evolution</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Initial file chooser folder</short>
- <long>Initial folder for GtkFileChooser dialogs.</long>
- </locale>
- </schema>
-
<!-- Offline Mode -->
<schema>
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index c7a41510f2..069e0bfa83 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -40,7 +40,6 @@
#include "filter/e-rule-editor.h"
#include "widgets/misc/e-action-combo-box.h"
#include "widgets/misc/e-alert-bar.h"
-#include "widgets/misc/e-hinted-entry.h"
#include "e-shell-backend.h"
#include "e-shell-searchbar.h"
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 13b0b49349..370d6b4f5e 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -36,7 +36,6 @@
#include "e-util/e-util.h"
#include "widgets/misc/e-action-combo-box.h"
-#include "widgets/misc/e-hinted-entry.h"
#include "e-shell-window-actions.h"
@@ -979,7 +978,7 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
label = GTK_LABEL (widget);
- widget = e_hinted_entry_new ();
+ widget = gtk_entry_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
searchbar->priv->search_entry = widget;
@@ -1168,26 +1167,26 @@ e_shell_searchbar_set_filter_visible (EShellSearchbar *searchbar,
const gchar *
e_shell_searchbar_get_search_hint (EShellSearchbar *searchbar)
{
- EHintedEntry *entry;
+ GtkEntry *entry;
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), NULL);
- entry = E_HINTED_ENTRY (searchbar->priv->search_entry);
+ entry = GTK_ENTRY (searchbar->priv->search_entry);
- return e_hinted_entry_get_hint (entry);
+ return gtk_entry_get_placeholder_text (entry);
}
void
e_shell_searchbar_set_search_hint (EShellSearchbar *searchbar,
const gchar *search_hint)
{
- EHintedEntry *entry;
+ GtkEntry *entry;
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
- entry = E_HINTED_ENTRY (searchbar->priv->search_entry);
+ entry = GTK_ENTRY (searchbar->priv->search_entry);
- e_hinted_entry_set_hint (entry, search_hint);
+ gtk_entry_set_placeholder_text (entry, search_hint);
g_object_notify (G_OBJECT (searchbar), "search-hint");
}
@@ -1233,26 +1232,31 @@ e_shell_searchbar_set_search_option (EShellSearchbar *searchbar,
const gchar *
e_shell_searchbar_get_search_text (EShellSearchbar *searchbar)
{
- EHintedEntry *entry;
+ GtkEntry *entry;
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), NULL);
- entry = E_HINTED_ENTRY (searchbar->priv->search_entry);
+ entry = GTK_ENTRY (searchbar->priv->search_entry);
- return e_hinted_entry_get_text (entry);
+ return gtk_entry_get_text (entry);
}
void
e_shell_searchbar_set_search_text (EShellSearchbar *searchbar,
const gchar *search_text)
{
- EHintedEntry *entry;
+ GtkEntry *entry;
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
- entry = E_HINTED_ENTRY (searchbar->priv->search_entry);
+ entry = GTK_ENTRY (searchbar->priv->search_entry);
- e_hinted_entry_set_text (entry, search_text);
+ /* XXX Really wish gtk_entry_set_text()
+ * would just learn to accept NULL. */
+ if (search_text == NULL)
+ search_text = "";
+
+ gtk_entry_set_text (entry, search_text);
shell_searchbar_update_search_widgets (searchbar);
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index 740960f555..b5a1f490ae 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -65,11 +65,10 @@ e_shell_configure_ui_manager (EShell *shell,
* @customize_data: optional data to pass to @customize_func
*
* Runs a #GtkFileChooserDialog in open mode with the given title and
- * returns the selected #GFile. It automatically remembers the selected
- * folder. If @customize_func is provided, the function is called just
- * prior to running the dialog (the file chooser is the first argument,
- * @customize data is the second). If the user cancels the dialog the
- * function will return %NULL.
+ * returns the selected #GFile. If @customize_func is provided, the
+ * function is called just prior to running the dialog (the file chooser
+ * is the first argument, @customize data is the second). If the user
+ * cancels the dialog the function will return %NULL.
*
* Returns: the #GFile to open, or %NULL
**/
@@ -79,19 +78,13 @@ e_shell_run_open_dialog (EShell *shell,
GtkCallback customize_func,
gpointer customize_data)
{
- EShellSettings *shell_settings;
GtkFileChooser *file_chooser;
GFile *chosen_file = NULL;
GtkWidget *dialog;
GtkWindow *parent;
- const gchar *property_name;
- gchar *uri;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- property_name = "file-chooser-folder";
- shell_settings = e_shell_get_shell_settings (shell);
-
parent = e_shell_get_active_window (shell);
dialog = gtk_file_chooser_dialog_new (
@@ -107,27 +100,13 @@ e_shell_run_open_dialog (EShell *shell,
gtk_file_chooser_set_local_only (file_chooser, FALSE);
- /* Restore the current folder from the previous file chooser. */
- uri = e_shell_settings_get_string (shell_settings, property_name);
- if (uri != NULL)
- gtk_file_chooser_set_current_folder_uri (file_chooser, uri);
- g_free (uri);
-
/* Allow further customizations before running the dialog. */
if (customize_func != NULL)
customize_func (dialog, customize_data);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
- goto exit;
-
- chosen_file = gtk_file_chooser_get_file (file_chooser);
-
- /* Save the current folder for subsequent file choosers. */
- uri = gtk_file_chooser_get_current_folder_uri (file_chooser);
- e_shell_settings_set_string (shell_settings, property_name, uri);
- g_free (uri);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ chosen_file = gtk_file_chooser_get_file (file_chooser);
-exit:
gtk_widget_destroy (dialog);
return chosen_file;
@@ -143,16 +122,15 @@ exit:
* @customize_data: optional data to pass to @customize_func
*
* Runs a #GtkFileChooserDialog in save mode with the given title and
- * returns the selected #GFile. It automatically remembers the selected
- * folder. If @customize_func is provided, the function is called just
- * prior to running the dialog (the file chooser is the first argument,
- * @customize_data is the second). If the user cancels the dialog the
- * function will return %NULL.
+ * returns the selected #GFile. If @customize_func is provided, the
+ * function is called just prior to running the dialog (the file chooser
+ * is the first argument, @customize_data is the second). If the user
+ * cancels the dialog the function will return %NULL.
*
* With non-%NULL @filters will be added also file filters to the dialog.
* The string format is "pat1:mt1;pat2:mt2:...", where 'pat' is a pattern
- * and 'mt' is a MIME type for the pattern to be used.
- * There can be more than one MIME type, those are separated by comma.
+ * and 'mt' is a MIME type for the pattern to be used. There can be more
+ * than one MIME type, those are separated by comma.
*
* Returns: the #GFile to save to, or %NULL
**/
@@ -164,19 +142,13 @@ e_shell_run_save_dialog (EShell *shell,
GtkCallback customize_func,
gpointer customize_data)
{
- EShellSettings *shell_settings;
GtkFileChooser *file_chooser;
GFile *chosen_file = NULL;
GtkWidget *dialog;
GtkWindow *parent;
- const gchar *property_name;
- gchar *uri;
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- property_name = "file-chooser-folder";
- shell_settings = e_shell_get_shell_settings (shell);
-
parent = e_shell_get_active_window (shell);
dialog = gtk_file_chooser_dialog_new (
@@ -193,12 +165,6 @@ e_shell_run_save_dialog (EShell *shell,
gtk_file_chooser_set_local_only (file_chooser, FALSE);
gtk_file_chooser_set_do_overwrite_confirmation (file_chooser, TRUE);
- /* Restore the current folder from the previous file chooser. */
- uri = e_shell_settings_get_string (shell_settings, property_name);
- if (uri != NULL)
- gtk_file_chooser_set_current_folder_uri (file_chooser, uri);
- g_free (uri);
-
if (suggestion != NULL)
gtk_file_chooser_set_current_name (file_chooser, suggestion);
@@ -254,17 +220,9 @@ e_shell_run_save_dialog (EShell *shell,
if (customize_func != NULL)
customize_func (dialog, customize_data);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
- goto exit;
-
- chosen_file = gtk_file_chooser_get_file (file_chooser);
-
- /* Save the current folder for subsequent file choosers. */
- uri = gtk_file_chooser_get_current_folder_uri (file_chooser);
- e_shell_settings_set_string (shell_settings, property_name, uri);
- g_free (uri);
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
+ chosen_file = gtk_file_chooser_get_file (file_chooser);
-exit:
gtk_widget_destroy (dialog);
return chosen_file;
@@ -306,7 +264,9 @@ e_shell_utils_import_uris (EShell *shell,
assistant, "finished",
G_CALLBACK (gtk_widget_destroy), NULL);
- e_shell_watch_window (shell, GTK_WINDOW (assistant));
+ gtk_application_add_window (
+ GTK_APPLICATION (shell),
+ GTK_WINDOW (assistant));
gtk_widget_show (assistant);
} else
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 105e45e6a6..2b86bb1ec3 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -475,7 +475,7 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
e_plugin_ui_register_manager (ui_manager, id, shell_window);
e_plugin_ui_enable_manager (ui_manager, id);
- e_shell_watch_window (shell, window);
+ gtk_application_add_window (GTK_APPLICATION (shell), window);
}
void
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 8e9f39c5ce..1a969de8c9 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -125,17 +125,20 @@ static void
shell_window_update_close_action_cb (EShellWindow *shell_window)
{
EShell *shell;
- GList *watched_windows;
+ GtkApplication *application;
+ GList *list;
gint n_shell_windows = 0;
shell = e_shell_window_get_shell (shell_window);
- watched_windows = e_shell_get_watched_windows (shell);
+
+ application = GTK_APPLICATION (shell);
+ list = gtk_application_get_windows (application);
/* Count the shell windows. */
- while (watched_windows != NULL) {
- if (E_IS_SHELL_WINDOW (watched_windows->data))
+ while (list != NULL) {
+ if (E_IS_SHELL_WINDOW (list->data))
n_shell_windows++;
- watched_windows = g_list_next (watched_windows);
+ list = g_list_next (list);
}
/* Disable Close Window if there's only one shell window.
@@ -171,14 +174,14 @@ shell_window_set_shell (EShellWindow *shell_window,
array = shell_window->priv->signal_handler_ids;
handler_id = g_signal_connect_swapped (
- shell, "window-created",
+ shell, "window-added",
G_CALLBACK (shell_window_update_close_action_cb),
shell_window);
g_array_append_val (array, handler_id);
handler_id = g_signal_connect_swapped (
- shell, "window-destroyed",
+ shell, "window-removed",
G_CALLBACK (shell_window_update_close_action_cb),
shell_window);
@@ -1510,9 +1513,9 @@ e_shell_window_set_toolbar_visible (EShellWindow *shell_window,
* Registers a list of #GtkAction<!-- -->s to appear in
* @shell_window<!-- -->'s "New" menu and toolbar button. This
* function should be called from an #EShell<!-- -->'s
- * #EShell::window-created signal handler. The #EShellBackend calling
- * this function should pass its own name for the @backend_name argument
- * (i.e. the <structfield>name</structfield> field from its own
+ * #GtkApplication::window-added signal handler. The #EShellBackend
+ * calling this function should pass its own name for the @backend_name
+ * argument (i.e. the <structfield>name</structfield> field from its own
* #EShellBackendInfo).
*
* The registered #GtkAction<!-- -->s should be for creating individual
@@ -1597,9 +1600,9 @@ e_shell_window_register_new_item_actions (EShellWindow *shell_window,
* Registers a list of #GtkAction<!-- -->s to appear in
* @shell_window<!-- -->'s "New" menu and toolbar button. This
* function should be called from an #EShell<!-- -->'s
- * #EShell::window-created signal handler. The #EShellBackend calling
- * this function should pass its own name for the @backend_name argument
- * (i.e. the <structfield>name</structfield> field from its own
+ * #GtkApplication::window-added signal handler. The #EShellBackend
+ * calling this function should pass its own name for the @backend_name
+ * argument (i.e. the <structfield>name</structfield> field from its own
* #EShellBackendInfo).
*
* The registered #GtkAction<!-- -->s should be for creating item
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 7ef48c2149..1e8cd3c0f9 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -48,7 +48,6 @@
struct _EShellPrivate {
GQueue alerts;
- GList *watched_windows;
EShellSettings *settings;
GConfClient *gconf_client;
GActionGroup *action_group;
@@ -98,8 +97,6 @@ enum {
PREPARE_FOR_ONLINE,
PREPARE_FOR_QUIT,
QUIT_REQUESTED,
- WINDOW_CREATED,
- WINDOW_DESTROYED,
LAST_SIGNAL
};
@@ -162,86 +159,37 @@ shell_notify_online_cb (EShell *shell)
}
static gboolean
-shell_window_delete_event_cb (EShell *shell,
- GtkWindow *window)
+shell_window_delete_event_cb (GtkWindow *window,
+ GdkEvent *event,
+ GtkApplication *application)
{
/* If other windows are open we can safely close this one. */
- if (g_list_length (shell->priv->watched_windows) > 1)
+ if (g_list_length (gtk_application_get_windows (application)) > 1)
return FALSE;
/* Otherwise we initiate application quit. */
- e_shell_quit (shell, E_SHELL_QUIT_LAST_WINDOW);
+ e_shell_quit (E_SHELL (application), E_SHELL_QUIT_LAST_WINDOW);
return TRUE;
}
-static gboolean
-shell_window_focus_in_event_cb (EShell *shell,
- GdkEventFocus *event,
- GtkWindow *window)
-{
- GList *list, *link;
-
- /* Keep the watched windows list sorted by most recently focused,
- * so the first item in the list should always be the currently
- * focused window. */
-
- list = shell->priv->watched_windows;
- link = g_list_find (list, window);
- g_return_val_if_fail (link != NULL, FALSE);
-
- if (link != list) {
- list = g_list_remove_link (list, link);
- list = g_list_concat (link, list);
- }
-
- shell->priv->watched_windows = list;
-
- return FALSE;
-}
-
-static gboolean
-shell_emit_window_destroyed_cb (EShell *shell)
-{
- g_signal_emit (shell, signals[WINDOW_DESTROYED], 0);
-
- g_object_unref (shell);
-
- return FALSE;
-}
-
-static void
-shell_window_weak_notify_cb (EShell *shell,
- GObject *where_the_object_was)
-{
- GList *list;
-
- list = shell->priv->watched_windows;
- list = g_list_remove (list, where_the_object_was);
- shell->priv->watched_windows = list;
-
- /* Let the watched window finish finalizing itself before we
- * emit the "window-destroyed" signal, which may trigger the
- * application to initiate shutdown. */
- g_idle_add (
- (GSourceFunc) shell_emit_window_destroyed_cb,
- g_object_ref (shell));
-}
-
static void
shell_action_new_window_cb (GSimpleAction *action,
GVariant *parameter,
EShell *shell)
{
- GList *watched_windows;
+ 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);
- watched_windows = e_shell_get_watched_windows (shell);
/* Present the first EShellWindow showing 'view_name'. */
- while (watched_windows != NULL) {
- GtkWindow *window = GTK_WINDOW (watched_windows->data);
+ while (list != NULL) {
+ GtkWindow *window = GTK_WINDOW (list->data);
if (E_IS_SHELL_WINDOW (window)) {
const gchar *active_view;
@@ -254,7 +202,7 @@ shell_action_new_window_cb (GSimpleAction *action,
}
}
- watched_windows = g_list_next (watched_windows);
+ list = g_list_next (list);
}
/* No suitable EShellWindow found, so create one. */
@@ -433,11 +381,14 @@ shell_ready_for_quit (EShell *shell,
EActivity *activity,
gboolean is_last_ref)
{
+ GtkApplication *application;
GList *list;
if (!is_last_ref)
return;
+ application = GTK_APPLICATION (shell);
+
/* Increment the reference count so we can safely emit
* a signal without triggering the toggle reference. */
g_object_ref (activity);
@@ -455,7 +406,7 @@ shell_ready_for_quit (EShell *shell,
* of the watched windows list because the act of destroying a
* watched window will modify the watched windows list, which
* would derail the iteration. */
- list = g_list_copy (e_shell_get_watched_windows (shell));
+ list = g_list_copy (gtk_application_get_windows (application));
g_list_foreach (list, (GFunc) gtk_widget_destroy, NULL);
g_list_free (list);
}
@@ -463,12 +414,15 @@ shell_ready_for_quit (EShell *shell,
static void
shell_prepare_for_quit (EShell *shell)
{
+ GtkApplication *application;
GList *list, *iter;
/* Are preparations already in progress? */
if (shell->priv->preparing_for_quit != NULL)
return;
+ application = GTK_APPLICATION (shell);
+
shell->priv->preparing_for_quit = e_activity_new ();
e_activity_set_text (
@@ -490,7 +444,7 @@ shell_prepare_for_quit (EShell *shell)
g_object_unref (shell->priv->preparing_for_quit);
/* Desensitize all watched windows to prevent user action. */
- list = e_shell_get_watched_windows (shell);
+ list = gtk_application_get_windows (application);
for (iter = list; iter != NULL; iter = iter->next)
gtk_widget_set_sensitive (GTK_WIDGET (iter->data), FALSE);
}
@@ -839,43 +793,50 @@ shell_startup (GApplication *application)
static void
shell_activate (GApplication *application)
{
- EShell *shell;
- GList *watched_windows;
+ GList *list;
/* Do not chain up. Default method just emits a warning. */
- shell = E_SHELL (application);
- watched_windows = e_shell_get_watched_windows (shell);
+ list = gtk_application_get_windows (GTK_APPLICATION (application));
/* Present the first EShellWindow, if found. */
- while (watched_windows != NULL) {
- GtkWindow *window = GTK_WINDOW (watched_windows->data);
+ while (list != NULL) {
+ GtkWindow *window = GTK_WINDOW (list->data);
if (E_IS_SHELL_WINDOW (window)) {
gtk_window_present (window);
return;
}
- watched_windows = g_list_next (watched_windows);
+ list = g_list_next (list);
}
/* No EShellWindow found, so create one. */
- e_shell_create_shell_window (shell, NULL);
+ e_shell_create_shell_window (E_SHELL (application), NULL);
}
static void
-shell_quit_mainloop (GApplication *application)
+shell_window_added (GtkApplication *application,
+ GtkWindow *window)
{
- /* XXX Don't allow GApplication to quit the main loop.
- * We'll do that ourselves until GtkApplication gets
- * a signal equivalent to EShell::window-destroyed. */
-}
+ gchar *role;
-static void
-shell_window_destroyed (EShell *shell)
-{
- if (e_shell_get_watched_windows (shell) == NULL)
- gtk_main_quit ();
+ /* Chain up to parent's window_added() method. */
+ GTK_APPLICATION_CLASS (e_shell_parent_class)->
+ window_added (application, window);
+
+ g_signal_connect (
+ window, "delete-event",
+ G_CALLBACK (shell_window_delete_event_cb), application);
+
+ /* We use the window's own type name and memory
+ * address to form a unique window role for X11. */
+ role = g_strdup_printf (
+ "%s-%" G_GINTPTR_FORMAT,
+ G_OBJECT_TYPE_NAME (window),
+ (gintptr) window);
+ gtk_window_set_role (window, role);
+ g_free (role);
}
static gboolean
@@ -895,6 +856,7 @@ e_shell_class_init (EShellClass *class)
{
GObjectClass *object_class;
GApplicationClass *application_class;
+ GtkApplicationClass *gtk_application_class;
g_type_class_add_private (class, sizeof (EShellPrivate));
@@ -908,9 +870,9 @@ e_shell_class_init (EShellClass *class)
application_class = G_APPLICATION_CLASS (class);
application_class->startup = shell_startup;
application_class->activate = shell_activate;
- application_class->quit_mainloop = shell_quit_mainloop;
- class->window_destroyed = shell_window_destroyed;
+ gtk_application_class = GTK_APPLICATION_CLASS (class);
+ gtk_application_class->window_added = shell_window_added;
/**
* EShell:express-mode
@@ -1184,38 +1146,6 @@ e_shell_class_init (EShellClass *class)
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1,
E_TYPE_SHELL_QUIT_REASON);
-
- /**
- * EShell::window-created
- * @shell: the #EShell which emitted the signal
- * @window: the newly created #GtkWindow
- *
- * Emitted when @shell begins watching a newly created window.
- **/
- signals[WINDOW_CREATED] = g_signal_new (
- "window-created",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EShellClass, window_created),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WINDOW);
-
- /**
- * EShell::window-destroyed
- * @shell: the #EShell which emitted the signal
- *
- * Emitted when a watched is destroyed.
- **/
- signals[WINDOW_DESTROYED] = g_signal_new (
- "window-destroyed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EShellClass, window_destroyed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
}
static void
@@ -1266,10 +1196,6 @@ e_shell_init (EShell *shell)
* otherwise the GConf bindings will not get set up. */
e_shell_settings_install_property_for_key (
- "file-chooser-folder",
- "/apps/evolution/shell/file_chooser_folder");
-
- e_shell_settings_install_property_for_key (
"start-offline",
"/apps/evolution/shell/start_offline");
@@ -1481,9 +1407,9 @@ e_shell_get_gconf_client (EShell *shell)
* @shell: an #EShell
* @view_name: name of the initial shell view, or %NULL
*
- * Creates a new #EShellWindow and emits the #EShell::window-created
- * signal. Use this function instead of e_shell_window_new() so that
- * @shell can track the window.
+ * Creates a new #EShellWindow. Use this function instead of
+ * e_shell_window_new() so that @shell can properly configure
+ * the window.
*
* Returns: a new #EShellWindow
**/
@@ -1619,18 +1545,21 @@ void
e_shell_submit_alert (EShell *shell,
EAlert *alert)
{
+ GtkApplication *application;
GList *list, *iter;
g_return_if_fail (E_IS_SHELL (shell));
g_return_if_fail (E_IS_ALERT (alert));
+ application = GTK_APPLICATION (shell);
+
g_queue_push_tail (&shell->priv->alerts, g_object_ref (alert));
g_signal_connect_swapped (
alert, "response",
G_CALLBACK (shell_alert_response_cb), shell);
- list = e_shell_get_watched_windows (shell);
+ list = gtk_application_get_windows (application);
/* Submit the alert to all available EShellWindows. */
for (iter = list; iter != NULL; iter = g_list_next (iter))
@@ -1640,92 +1569,11 @@ e_shell_submit_alert (EShell *shell,
}
/**
- * e_shell_watch_window:
- * @shell: an #EShell
- * @window: a #GtkWindow
- *
- * Makes @shell "watch" a newly created toplevel window, and emits the
- * #EShell::window-created signal. All #EShellWindow<!-- -->s should be
- * watched, along with any editor or viewer windows that may be shown in
- * response to e_shell_handle_uris(). When the last watched window is
- * closed, Evolution terminates.
- **/
-void
-e_shell_watch_window (EShell *shell,
- GtkWindow *window)
-{
- GList *list;
- gchar *role;
-
- g_return_if_fail (E_IS_SHELL (shell));
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- list = shell->priv->watched_windows;
-
- /* XXX If my suggestion in [1] is accepted for GtkApplication
- * then we can get rid of our own watched_windows list.
- *
- * [1] https://bugzilla.gnome.org/show_bug.cgi?id=624539
- */
-
- /* Ignore duplicates. */
- if (g_list_find (list, window) != NULL)
- return;
-
- list = g_list_prepend (list, window);
- shell->priv->watched_windows = list;
-
- gtk_application_add_window (GTK_APPLICATION (shell), window);
-
- /* We use the window's own type name and memory
- * address to form a unique window role for X11. */
- role = g_strdup_printf (
- "%s-%" G_GINTPTR_FORMAT,
- G_OBJECT_TYPE_NAME (window),
- (gintptr) window);
- gtk_window_set_role (window, role);
- g_free (role);
-
- g_signal_connect_swapped (
- window, "delete-event",
- G_CALLBACK (shell_window_delete_event_cb), shell);
-
- g_signal_connect_swapped (
- window, "focus-in-event",
- G_CALLBACK (shell_window_focus_in_event_cb), shell);
-
- g_object_weak_ref (
- G_OBJECT (window), (GWeakNotify)
- shell_window_weak_notify_cb, shell);
-
- g_signal_emit (shell, signals[WINDOW_CREATED], 0, window);
-}
-
-/**
- * e_shell_get_watched_windows:
- * @shell: an #EShell
- *
- * Returns a list of windows being watched by @shell. The list is sorted
- * by the most recently focused window, such that the first instance is the
- * currently focused window. (Useful for choosing a parent for a transient
- * window.) The list is owned by @shell and should not be modified or freed.
- *
- * Returns: a list of watched windows
- **/
-GList *
-e_shell_get_watched_windows (EShell *shell)
-{
- g_return_val_if_fail (E_IS_SHELL (shell), NULL);
-
- return shell->priv->watched_windows;
-}
-
-/**
* e_shell_get_active_window:
* @shell: an #EShell or %NULL to use the default shell
*
* Returns the most recently focused watched window, according to
- * e_shell_get_watched_windows(). Convenient for finding a parent
+ * gtk_application_get_windows(). Convenient for finding a parent
* for a transient window.
*
* Note the returned window is not necessarily an #EShellWindow.
@@ -1735,22 +1583,24 @@ e_shell_get_watched_windows (EShell *shell)
GtkWindow *
e_shell_get_active_window (EShell *shell)
{
- GList *watched_windows;
+ GtkApplication *application;
+ GList *list;
if (shell == NULL)
shell = e_shell_get_default ();
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- watched_windows = e_shell_get_watched_windows (shell);
+ application = GTK_APPLICATION (shell);
+ list = gtk_application_get_windows (application);
- if (!watched_windows)
+ if (list == NULL)
return NULL;
/* Sanity check */
- g_return_val_if_fail (GTK_IS_WINDOW (watched_windows->data), NULL);
+ g_return_val_if_fail (GTK_IS_WINDOW (list->data), NULL);
- return GTK_WINDOW (watched_windows->data);
+ return GTK_WINDOW (list->data);
}
/**
diff --git a/shell/e-shell.h b/shell/e-shell.h
index ede071e2e3..5110dd4a9c 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -106,9 +106,6 @@ struct _EShellClass {
EActivity *activity);
void (*quit_requested) (EShell *shell,
EShellQuitReason reason);
- void (*window_created) (EShell *shell,
- GtkWindow *window);
- void (*window_destroyed) (EShell *shell);
};
GType e_shell_get_type (void);
@@ -130,9 +127,6 @@ guint e_shell_handle_uris (EShell *shell,
gboolean do_import);
void e_shell_submit_alert (EShell *shell,
EAlert *alert);
-void e_shell_watch_window (EShell *shell,
- GtkWindow *window);
-GList * e_shell_get_watched_windows (EShell *shell);
GtkWindow * e_shell_get_active_window (EShell *shell);
gboolean e_shell_get_meego_mode (EShell *shell);
gboolean e_shell_get_express_mode (EShell *shell);
diff --git a/shell/test/e-test-shell-backend.c b/shell/test/e-test-shell-backend.c
index a30cb8a7b5..79f4aa876f 100644
--- a/shell/test/e-test-shell-backend.c
+++ b/shell/test/e-test-shell-backend.c
@@ -97,8 +97,8 @@ test_shell_backend_handle_uri_cb (EShellBackend *shell_backend,
}
static void
-test_shell_backend_window_created_cb (EShellBackend *shell_backend,
- GtkWindow *window)
+test_shell_backend_window_added_cb (EShellBackend *shell_backend,
+ GtkWindow *window)
{
const gchar *backend_name;
@@ -119,7 +119,7 @@ test_shell_backend_window_created_cb (EShellBackend *shell_backend,
}
static void
-test_shell_backend_window_destroyed_cb (EShellBackend *shell_backend)
+test_shell_backend_window_removed_cb (EShellBackend *shell_backend)
{
g_debug ("%s", G_STRFUNC);
}
@@ -139,13 +139,13 @@ test_shell_backend_constructed (GObject *object)
shell_backend);
g_signal_connect_swapped (
- shell, "window-created",
- G_CALLBACK (test_shell_backend_window_created_cb),
+ shell, "window-added",
+ G_CALLBACK (test_shell_backend_window_added_cb),
shell_backend);
g_signal_connect_swapped (
- shell, "window-destroyed",
- G_CALLBACK (test_shell_backend_window_destroyed_cb),
+ shell, "window-removed",
+ G_CALLBACK (test_shell_backend_window_removed_cb),
shell_backend);
/* Chain up to parent's constructed() method. */