[evolution/express2-daemon: 8/9] Add a daemon mode to shell. In this mode Evolution's first UI will be considered daemon shell and th
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/express2-daemon: 8/9] Add a daemon mode to shell. In this mode Evolution's first UI will be considered daemon shell and th
- Date: Thu, 17 Jun 2010 08:06:00 +0000 (UTC)
commit cfbe39784a32fe027bcc85d344666c382d1a28c6
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Thu Jun 17 09:05:12 2010 +0530
Add a daemon mode to shell. In this mode Evolution's first UI will be
considered daemon shell and this is hidden at the back.
shell/e-shell.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
shell/e-shell.h | 1 +
shell/main.c | 17 +++++++++++--
3 files changed, 81 insertions(+), 5 deletions(-)
---
diff --git a/shell/e-shell.c b/shell/e-shell.c
index a786bf6..dcf2ce2 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -72,10 +72,13 @@ struct _EShellPrivate {
guint express_mode : 1;
guint meego_mode : 1;
guint small_screen_mode : 1;
+ guint daemon_mode : 1;
+
};
enum {
PROP_0,
+ PROP_DAEMON_MODE,
PROP_EXPRESS_MODE,
PROP_MEEGO_MODE,
PROP_SMALL_SCREEN_MODE,
@@ -108,6 +111,7 @@ static GDebugKey debug_keys[] = {
};
static gpointer default_shell;
+static GtkWidget *daemon_shell = NULL;
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE_WITH_CODE (
@@ -141,8 +145,9 @@ shell_window_delete_event_cb (EShell *shell,
GtkWindow *window)
{
/* If other windows are open we can safely close this one. */
- if (g_list_length (shell->priv->watched_windows) > 1)
+ if (g_list_length (shell->priv->watched_windows) > 1) {
return FALSE;
+ }
/* Otherwise we initiate application quit. */
e_shell_quit (shell);
@@ -477,6 +482,13 @@ shell_set_express_mode (EShell *shell,
}
static void
+shell_set_daemon_mode (EShell *shell,
+ gboolean daemon_mode)
+{
+ shell->priv->daemon_mode = daemon_mode;
+}
+
+static void
shell_set_meego_mode (EShell *shell, gboolean is_meego)
{
shell->priv->meego_mode = is_meego;
@@ -513,6 +525,12 @@ shell_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_DAEMON_MODE:
+ shell_set_daemon_mode (
+ E_SHELL (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_EXPRESS_MODE:
shell_set_express_mode (
E_SHELL (object),
@@ -566,6 +584,12 @@ shell_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_DAEMON_MODE:
+ g_value_set_boolean (
+ value, e_shell_get_daemon_mode (
+ E_SHELL (object)));
+ return;
+
case PROP_EXPRESS_MODE:
g_value_set_boolean (
value, e_shell_get_express_mode (
@@ -836,6 +860,23 @@ e_shell_class_init (EShellClass *class)
G_PARAM_CONSTRUCT_ONLY));
/**
+ * EShell:daemon-mode
+ *
+ * Daemon mode alters Evolution's user interface to be more
+ * usable as a daemon runs in the background.
+ **/
+ g_object_class_install_property (
+ object_class,
+ PROP_DAEMON_MODE,
+ g_param_spec_boolean (
+ "daemon-mode",
+ "Daemon Mode",
+ "Whether daemon mode is enabled",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ /**
* EShell:meego
*
* Are we running under meego - if so, adapt ourselves
@@ -1542,6 +1583,14 @@ e_shell_watch_window (EShell *shell,
g_return_if_fail (E_IS_SHELL (shell));
g_return_if_fail (GTK_IS_WINDOW (window));
+
+ if (shell->priv->daemon_mode && daemon_shell == NULL) {
+ /* We don't watch the daemon shell */
+ daemon_shell = (GtkWidget *)window;
+ } else
+ unique_app_watch_window (UNIQUE_APP (shell), window);
+
+
list = shell->priv->watched_windows;
/* Ignore duplicates. */
@@ -1551,7 +1600,6 @@ e_shell_watch_window (EShell *shell,
list = g_list_prepend (list, window);
shell->priv->watched_windows = list;
- unique_app_watch_window (UNIQUE_APP (shell), window);
/* We use the window's own type name and memory
* address to form a unique window role for X11. */
@@ -1647,6 +1695,22 @@ e_shell_send_receive (EShell *shell,
}
/**
+ * e_shell_get_daemon_mode:
+ * @shell: an #EShell
+ *
+ * Returns %TRUE if Evolution is in daemon mode.
+ *
+ * Returns: %TRUE if Evolution is in daemon mode
+ **/
+gboolean
+e_shell_get_daemon_mode (EShell *shell)
+{
+ g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
+
+ return shell->priv->daemon_mode;
+}
+
+/**
* e_shell_get_express_mode:
* @shell: an #EShell
*
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 0b8c333..58e9fb9 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -110,6 +110,7 @@ void e_shell_send_receive (EShell *shell,
GtkWindow *parent);
gboolean e_shell_get_meego_mode (EShell *shell);
gboolean e_shell_get_express_mode (EShell *shell);
+gboolean e_shell_get_daemon_mode (EShell *shell);
gboolean e_shell_get_small_screen_mode (EShell *shell);
const gchar * e_shell_get_module_directory (EShell *shell);
gboolean e_shell_get_network_available (EShell *shell);
diff --git a/shell/main.c b/shell/main.c
index e327065..41d3f95 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -79,6 +79,7 @@
/* Command-line options. */
static gboolean express_mode = FALSE;
+static gboolean daemon_mode = FALSE;
static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
static gboolean setup_only = FALSE;
@@ -96,6 +97,8 @@ static gchar *requested_view = NULL;
static gchar *evolution_debug_log = NULL;
static gchar **remaining_args;
+static GtkWidget * daemon_shell;
+
static void
categories_icon_theme_hack (void)
{
@@ -249,9 +252,14 @@ idle_cb (gchar **uris)
if (e_shell_handle_uris (shell, uris, import_uris) == 0)
gtk_main_quit ();
} else {
- if (express_mode && requested_view == NULL)
+ if ((express_mode && requested_view == NULL) || daemon_mode)
requested_view = "mail";
- e_shell_create_shell_window (shell, requested_view);
+
+ if (daemon_mode) {
+ daemon_shell = e_shell_create_shell_window (shell, requested_view);
+ gtk_widget_hide (daemon_shell);
+ } else
+ e_shell_create_shell_window (shell, requested_view);
}
/* If another Evolution process is running, we're done. */
@@ -329,6 +337,8 @@ static GOptionEntry entries[] = {
N_("Start in online mode"), NULL },
{ "express", '\0', 0, G_OPTION_ARG_NONE, &express_mode,
N_("Start in \"express\" mode"), NULL },
+ { "daemon", '\0', 0, G_OPTION_ARG_NONE, &daemon_mode,
+ N_("Start in \"daemon\" mode"), NULL },
#ifdef KILL_PROCESS_CMD
{ "force-shutdown", '\0', 0, G_OPTION_ARG_NONE, &force_shutdown,
N_("Forcibly shut down Evolution"), NULL },
@@ -422,6 +432,7 @@ create_default_shell (void)
"module-directory", EVOLUTION_MODULEDIR,
"meego-mode", is_meego,
"express-mode", express_mode,
+ "daemon-mode", daemon_mode,
"small-screen-mode", small_screen,
"online", online,
NULL);
@@ -578,7 +589,7 @@ main (gint argc, gchar **argv)
if (requested_view)
e_shell_set_startup_view(shell, requested_view);
- else if (express_mode)
+ else if (express_mode || daemon_mode)
e_shell_set_startup_view(shell, "mail");
/* Attempt migration -after- loading all modules and plugins,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]