evolution r37293 - in branches/kill-bonobo: doc/reference/shell doc/reference/shell/tmpl mail shell



Author: mbarnes
Date: Thu Feb 19 05:52:33 2009
New Revision: 37293
URL: http://svn.gnome.org/viewvc/evolution?rev=37293&view=rev

Log:
Rename EShell:online-mode to EShell:online and update docs.
Use EBindings instead of a notify callback to keep other widgets and
actions synchronized with EShell:online.  Cleaner and less error prone.


Modified:
   branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
   branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml
   branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml
   branches/kill-bonobo/mail/e-mail-shell-module.c
   branches/kill-bonobo/mail/mail-session.c
   branches/kill-bonobo/shell/e-shell-window-actions.c
   branches/kill-bonobo/shell/e-shell-window-private.c
   branches/kill-bonobo/shell/e-shell-window.c
   branches/kill-bonobo/shell/e-shell.c
   branches/kill-bonobo/shell/e-shell.h
   branches/kill-bonobo/shell/main.c

Modified: branches/kill-bonobo/doc/reference/shell/eshell-sections.txt
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/eshell-sections.txt	(original)
+++ branches/kill-bonobo/doc/reference/shell/eshell-sections.txt	Thu Feb 19 05:52:33 2009
@@ -16,8 +16,8 @@
 e_shell_send_receive
 e_shell_get_network_available
 e_shell_set_network_available
-e_shell_get_online_mode
-e_shell_set_online_mode
+e_shell_get_online
+e_shell_set_online
 e_shell_get_preferences_window
 e_shell_event
 e_shell_is_busy

Modified: branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml	(original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/e-shell.sgml	Thu Feb 19 05:52:33 2009
@@ -84,7 +84,7 @@
 
 </para>
 
-<!-- ##### ARG EShell:online-mode ##### -->
+<!-- ##### ARG EShell:online ##### -->
 <para>
 
 </para>
@@ -150,6 +150,15 @@
 @Returns: 
 
 
+<!-- ##### FUNCTION e_shell_get_gconf_client ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
+
 <!-- ##### FUNCTION e_shell_create_shell_window ##### -->
 <para>
 
@@ -215,7 +224,7 @@
 @network_available: 
 
 
-<!-- ##### FUNCTION e_shell_get_online_mode ##### -->
+<!-- ##### FUNCTION e_shell_get_online ##### -->
 <para>
 
 </para>
@@ -224,13 +233,13 @@
 @Returns: 
 
 
-<!-- ##### FUNCTION e_shell_set_online_mode ##### -->
+<!-- ##### FUNCTION e_shell_set_online ##### -->
 <para>
 
 </para>
 
 @shell: 
- online_mode: 
+ online: 
 
 
 <!-- ##### FUNCTION e_shell_get_preferences_window ##### -->

Modified: branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml
==============================================================================
--- branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml	(original)
+++ branches/kill-bonobo/doc/reference/shell/tmpl/eshell-unused.sgml	Thu Feb 19 05:52:33 2009
@@ -433,6 +433,12 @@
 @minor: 
 @revision: 
 
+<!-- ##### ARG EShell:online-mode ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### ARG EShell:settings ##### -->
 <para>
 
@@ -1799,6 +1805,14 @@
 @shell: 
 @Returns: 
 
+<!-- ##### FUNCTION e_shell_get_online_mode ##### -->
+<para>
+
+</para>
+
+ shell: 
+ Returns: 
+
 <!-- ##### FUNCTION e_shell_get_settings ##### -->
 <para>
 
@@ -1901,6 +1915,14 @@
 @shell: 
 @status: 
 
+<!-- ##### FUNCTION e_shell_set_online_mode ##### -->
+<para>
+
+</para>
+
+ shell: 
+ online_mode: 
+
 <!-- ##### FUNCTION e_shell_upgrade_attempt ##### -->
 <para>
 

Modified: branches/kill-bonobo/mail/e-mail-shell-module.c
==============================================================================
--- branches/kill-bonobo/mail/e-mail-shell-module.c	(original)
+++ branches/kill-bonobo/mail/e-mail-shell-module.c	Thu Feb 19 05:52:33 2009
@@ -557,13 +557,13 @@
 }
 
 static void
-mail_shell_module_notify_online_mode_cb (EShell *shell,
-                                         GParamSpec *pspec,
-                                         EShellModule *shell_module)
+mail_shell_module_notify_online_cb (EShell *shell,
+                                    GParamSpec *pspec,
+                                    EShellModule *shell_module)
 {
 	gboolean online;
 
-	online = e_shell_get_online_mode (shell);
+	online = e_shell_get_online (shell);
 	camel_session_set_online (session, online);
 }
 
@@ -873,8 +873,8 @@
 	folder_tree_model = em_folder_tree_model_new (shell_module);
 
 	g_signal_connect (
-		shell, "notify::online-mode",
-		G_CALLBACK (mail_shell_module_notify_online_mode_cb),
+		shell, "notify::online",
+		G_CALLBACK (mail_shell_module_notify_online_cb),
 		shell_module);
 
 	g_signal_connect (

Modified: branches/kill-bonobo/mail/mail-session.c
==============================================================================
--- branches/kill-bonobo/mail/mail-session.c	(original)
+++ branches/kill-bonobo/mail/mail-session.c	Thu Feb 19 05:52:33 2009
@@ -711,13 +711,13 @@
 {
 	EShell *shell;
 	GConfClient *gconf;
-	gboolean online_mode;
+	gboolean online;
 	const gchar *data_dir;
 
 	mail_shell_module = shell_module;
 
 	shell = e_shell_module_get_shell (shell_module);
-	online_mode = e_shell_get_online_mode (shell);
+	online = e_shell_get_online (shell);
 
 	data_dir = e_get_user_data_dir ();
 	if (camel_init (data_dir, TRUE) != 0)
@@ -740,7 +740,7 @@
 								session, NULL, NULL);
 	session->junk_plugin = NULL;
 
-	camel_session_set_online ((CamelSession *) session, online_mode);
+	camel_session_set_online ((CamelSession *) session, online);
 	mail_config_reload_junk_headers ();
 }
 

Modified: branches/kill-bonobo/shell/e-shell-window-actions.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-actions.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-actions.c	Thu Feb 19 05:52:33 2009
@@ -1360,7 +1360,7 @@
 	EShell *shell;
 
 	shell = e_shell_window_get_shell (shell_window);
-	e_shell_set_online_mode (shell, FALSE);
+	e_shell_set_online (shell, FALSE);
 }
 
 /**
@@ -1378,7 +1378,7 @@
 	EShell *shell;
 
 	shell = e_shell_window_get_shell (shell_window);
-	e_shell_set_online_mode (shell, TRUE);
+	e_shell_set_online (shell, TRUE);
 }
 
 /**

Modified: branches/kill-bonobo/shell/e-shell-window-private.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window-private.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window-private.c	Thu Feb 19 05:52:33 2009
@@ -336,6 +336,7 @@
 	EShell *shell;
 	GConfBridge *bridge;
 	GtkActionGroup *action_group;
+	GtkAction *action;
 	GObject *object;
 	const gchar *key;
 
@@ -369,6 +370,30 @@
 		G_OBJECT (shell_settings), "disable-save-to-disk",
 		G_OBJECT (action_group), "sensitive");
 
+	/* Bind GObject properties to GObject properties. */
+
+	action = ACTION (SEND_RECEIVE);
+
+	e_binding_new (
+		G_OBJECT (shell), "online",
+		G_OBJECT (action), "sensitive");
+
+	action = ACTION (WORK_OFFLINE);
+
+	e_binding_new (
+		G_OBJECT (shell), "online",
+		G_OBJECT (action), "visible");
+
+	action = ACTION (WORK_ONLINE);
+
+	e_binding_new_with_negation (
+		G_OBJECT (shell), "online",
+		G_OBJECT (action), "visible");
+
+	e_binding_new (
+		G_OBJECT (shell), "online",
+		G_OBJECT (shell_window->priv->online_button), "online");
+
 	/* Bind GObject properties to GConf keys. */
 
 	bridge = gconf_bridge_get ();

Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window.c	Thu Feb 19 05:52:33 2009
@@ -106,32 +106,6 @@
 }
 
 static void
-shell_window_online_mode_notify_cb (EShell *shell,
-                                    GParamSpec *pspec,
-                                    EShellWindow *shell_window)
-{
-	GtkAction *action;
-	EOnlineButton *online_button;
-	gboolean online_mode;
-
-	online_mode = e_shell_get_online_mode (shell);
-
-	action = ACTION (SEND_RECEIVE);
-	gtk_action_set_sensitive (action, online_mode);
-
-	action = ACTION (WORK_OFFLINE);
-	gtk_action_set_sensitive (action, TRUE);
-	gtk_action_set_visible (action, online_mode);
-
-	action = ACTION (WORK_ONLINE);
-	gtk_action_set_sensitive (action, TRUE);
-	gtk_action_set_visible (action, !online_mode);
-
-	online_button = E_ONLINE_BUTTON (shell_window->priv->online_button);
-	e_online_button_set_online (online_button, online_mode);
-}
-
-static void
 shell_window_update_close_action_cb (EShellWindow *shell_window)
 {
 	EShell *shell;
@@ -172,13 +146,6 @@
 
 	array = shell_window->priv->signal_handler_ids;
 
-	handler_id = g_signal_connect (
-		shell, "notify::online-mode",
-		G_CALLBACK (shell_window_online_mode_notify_cb),
-		shell_window);
-
-	g_array_append_val (array, handler_id);
-
 	handler_id = g_signal_connect_swapped (
 		shell, "window-created",
 		G_CALLBACK (shell_window_update_close_action_cb),
@@ -193,7 +160,7 @@
 
 	g_array_append_val (array, handler_id);
 
-	g_object_notify (G_OBJECT (shell), "online-mode");
+	g_object_notify (G_OBJECT (shell), "online");
 }
 
 static void

Modified: branches/kill-bonobo/shell/e-shell.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell.c	(original)
+++ branches/kill-bonobo/shell/e-shell.c	Thu Feb 19 05:52:33 2009
@@ -51,14 +51,14 @@
 
 	guint auto_reconnect	: 1;
 	guint network_available	: 1;
-	guint online_mode	: 1;
+	guint online		: 1;
 	guint safe_mode		: 1;
 };
 
 enum {
 	PROP_0,
 	PROP_NETWORK_AVAILABLE,
-	PROP_ONLINE_MODE,
+	PROP_ONLINE,
 	PROP_SHELL_SETTINGS
 };
 
@@ -103,11 +103,11 @@
 }
 
 static void
-shell_notify_online_mode_cb (EShell *shell)
+shell_notify_online_cb (EShell *shell)
 {
 	gboolean online;
 
-	online = e_shell_get_online_mode (shell);
+	online = e_shell_get_online (shell);
 	e_passwords_set_online (online);
 }
 
@@ -175,8 +175,8 @@
 		G_OBJECT (activity), (GToggleNotify)
 		shell_ready_for_offline, shell);
 
-	shell->priv->online_mode = FALSE;
-	g_object_notify (G_OBJECT (shell), "online-mode");
+	shell->priv->online = FALSE;
+	g_object_notify (G_OBJECT (shell), "online");
 
 	g_message ("Offline preparations complete.");
 }
@@ -222,8 +222,8 @@
 		G_OBJECT (activity), (GToggleNotify)
 		shell_ready_for_online, shell);
 
-	shell->priv->online_mode = TRUE;
-	g_object_notify (G_OBJECT (shell), "online-mode");
+	shell->priv->online = TRUE;
+	g_object_notify (G_OBJECT (shell), "online");
 
 	g_message ("Online preparations complete.");
 }
@@ -409,8 +409,8 @@
 				g_value_get_boolean (value));
 			return;
 
-		case PROP_ONLINE_MODE:
-			e_shell_set_online_mode (
+		case PROP_ONLINE:
+			e_shell_set_online (
 				E_SHELL (object),
 				g_value_get_boolean (value));
 			return;
@@ -432,9 +432,9 @@
 				E_SHELL (object)));
 			return;
 
-		case PROP_ONLINE_MODE:
+		case PROP_ONLINE:
 			g_value_set_boolean (
-				value, e_shell_get_online_mode (
+				value, e_shell_get_online (
 				E_SHELL (object)));
 			return;
 
@@ -615,16 +615,16 @@
 			G_PARAM_CONSTRUCT));
 
 	/**
-	 * EShell:online-mode
+	 * EShell:online
 	 *
 	 * Whether the shell is online.
 	 **/
 	g_object_class_install_property (
 		object_class,
-		PROP_ONLINE_MODE,
+		PROP_ONLINE,
 		g_param_spec_boolean (
-			"online-mode",
-			_("Online Mode"),
+			"online",
+			_("Online"),
 			_("Whether the shell is online"),
 			FALSE,
 			G_PARAM_READWRITE |
@@ -848,8 +848,8 @@
 	shell_parse_debug_string (shell);
 
 	g_signal_connect (
-		shell, "notify::online-mode",
-		G_CALLBACK (shell_notify_online_mode_cb), NULL);
+		shell, "notify::online",
+		G_CALLBACK (shell_notify_online_cb), NULL);
 
 	e_shell_settings_bind_to_gconf (
 		shell->priv->settings, "disable-application-handlers",
@@ -1264,9 +1264,9 @@
  *
  * Sets whether a network is available.  This is usually called in
  * response to a status change signal from NetworkManager.  If the
- * network becomes unavailable while #EShell:online-mode is %TRUE,
- * the @shell will force #EShell:online-mode to %FALSE until the
- * network becomes available again.
+ * network becomes unavailable while #EShell:online is %TRUE, the
+ * @shell will force #EShell:online to %FALSE until the network
+ * becomes available again.
  **/
 void
 e_shell_set_network_available (EShell *shell,
@@ -1282,52 +1282,52 @@
 
 	/* If we're being forced offline, perhaps due to a network outage,
 	 * reconnect automatically when the network becomes available. */
-	if (!network_available && shell->priv->online_mode) {
+	if (!network_available && shell->priv->online) {
 		g_message ("Network disconnected.  Forced offline.");
-		e_shell_set_online_mode (shell, FALSE);
+		e_shell_set_online (shell, FALSE);
 		shell->priv->auto_reconnect = TRUE;
 	} else if (network_available && shell->priv->auto_reconnect) {
 		g_message ("Connection established.  Going online.");
-		e_shell_set_online_mode (shell, TRUE);
+		e_shell_set_online (shell, TRUE);
 		shell->priv->auto_reconnect = FALSE;
 	}
 }
 
 /**
- * e_shell_get_online_mode:
+ * e_shell_get_online:
  * @shell: an #EShell
  *
- * Returns %TRUE if Evolution is in online mode, %FALSE if Evolution is
- * offline.  Evolution may be offline because the user elected to work
- * offline, or because the network has become unavailable.
+ * Returns %TRUE if Evolution is online, %FALSE if Evolution is offline.
+ * Evolution may be offline because the user elected to work offline, or
+ * because the network has become unavailable.
  *
- * Returns: %TRUE if Evolution is in online mode
+ * Returns: %TRUE if Evolution is online
  **/
 gboolean
-e_shell_get_online_mode (EShell *shell)
+e_shell_get_online (EShell *shell)
 {
 	g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
 
-	return shell->priv->online_mode;
+	return shell->priv->online;
 }
 
 /**
- * e_shell_set_online_mode:
+ * e_shell_set_online:
  * @shell: an #EShell
- * @online_mode: whether to put Evolution in online mode
+ * @online: %TRUE to go online, %FALSE to go offline
  *
  * Asynchronously places Evolution in online or offline mode.
  **/
 void
-e_shell_set_online_mode (EShell *shell,
-                         gboolean online_mode)
+e_shell_set_online (EShell *shell,
+                    gboolean online)
 {
 	g_return_if_fail (E_IS_SHELL (shell));
 
-	if (online_mode == shell->priv->online_mode)
+	if (online == shell->priv->online)
 		return;
 
-	if (online_mode)
+	if (online)
 		shell_prepare_for_online (shell);
 	else
 		shell_prepare_for_offline (shell);

Modified: branches/kill-bonobo/shell/e-shell.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell.h	(original)
+++ branches/kill-bonobo/shell/e-shell.h	Thu Feb 19 05:52:33 2009
@@ -99,9 +99,9 @@
 gboolean	e_shell_get_network_available	(EShell *shell);
 void		e_shell_set_network_available	(EShell *shell,
 						 gboolean network_available);
-gboolean	e_shell_get_online_mode		(EShell *shell);
-void		e_shell_set_online_mode		(EShell *shell,
-						 gboolean online_mode);
+gboolean	e_shell_get_online		(EShell *shell);
+void		e_shell_set_online		(EShell *shell,
+						 gboolean online);
 GtkWidget *	e_shell_get_preferences_window	(void);
 void		e_shell_event			(EShell *shell,
 						 const gchar *event_name,

Modified: branches/kill-bonobo/shell/main.c
==============================================================================
--- branches/kill-bonobo/shell/main.c	(original)
+++ branches/kill-bonobo/shell/main.c	Thu Feb 19 05:52:33 2009
@@ -578,7 +578,7 @@
 	EShell *shell;
 	GConfClient *conf_client;
 	GnomeClient *master_client;
-	gboolean online_mode = TRUE;
+	gboolean online = TRUE;
 	gchar *startup_id;
 	GError *error = NULL;
 
@@ -586,9 +586,9 @@
 	master_client = gnome_master_client ();
 
 	if (start_online)
-		online_mode = TRUE;
+		online = TRUE;
 	else if (start_offline)
-		online_mode = FALSE;
+		online = FALSE;
 	else {
 		const gchar *key;
 		gboolean value;
@@ -596,7 +596,7 @@
 		key = "/apps/evolution/shell/start_offline";
 		value = gconf_client_get_bool (conf_client, key, &error);
 		if (error == NULL)
-			online_mode = !value;
+			online = !value;
 		else {
 			g_warning ("%s", error->message);
 			g_error_free (error);
@@ -608,7 +608,7 @@
 	shell = g_object_new (
 		E_TYPE_SHELL,
 		"name", "org.gnome.evolution",
-		"online-mode", online_mode,
+		"online", online,
 		"startup-id", startup_id,
 		NULL);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]