aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-25 12:09:45 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-25 12:09:45 +0800
commit473f8dca644b3f9f48529daeed44de2097ee311d (patch)
treef62588172a49029bdf8df9ce518651906d6c3c8d
parent452650a573432a6416f3f31ec0594b888a52b93f (diff)
downloadgsoc2013-evolution-473f8dca644b3f9f48529daeed44de2097ee311d.tar.gz
gsoc2013-evolution-473f8dca644b3f9f48529daeed44de2097ee311d.tar.zst
gsoc2013-evolution-473f8dca644b3f9f48529daeed44de2097ee311d.zip
Bug 511769 - Poor indication of when network is unavailable
-rw-r--r--shell/e-shell-window-private.c12
-rw-r--r--widgets/misc/e-online-button.c34
2 files changed, 40 insertions, 6 deletions
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index b011bb548f..0012b18b54 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -388,6 +388,10 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
G_OBJECT (shell), "online",
G_OBJECT (action), "visible");
+ e_binding_new (
+ G_OBJECT (shell), "network-available",
+ G_OBJECT (action), "sensitive");
+
action = ACTION (WORK_ONLINE);
e_binding_new_with_negation (
@@ -395,9 +399,17 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
G_OBJECT (action), "visible");
e_binding_new (
+ G_OBJECT (shell), "network-available",
+ G_OBJECT (action), "sensitive");
+
+ e_binding_new (
G_OBJECT (shell), "online",
G_OBJECT (shell_window->priv->online_button), "online");
+ e_binding_new (
+ G_OBJECT (shell), "network-available",
+ G_OBJECT (shell_window->priv->online_button), "sensitive");
+
/* Bind GObject properties to GConf keys. */
bridge = gconf_bridge_get ();
diff --git a/widgets/misc/e-online-button.c b/widgets/misc/e-online-button.c
index c14114b9c3..444296dcef 100644
--- a/widgets/misc/e-online-button.c
+++ b/widgets/misc/e-online-button.c
@@ -24,10 +24,13 @@
((obj), E_TYPE_ONLINE_BUTTON, EOnlineButtonPrivate))
#define ONLINE_TOOLTIP \
- "Evolution is currently online. Click this button to work offline."
+ _("Evolution is currently online. Click this button to work offline.")
#define OFFLINE_TOOLTIP \
- "Evolution is currently offline. Click this button to work online."
+ _("Evolution is currently offline. Click this button to work online.")
+
+#define NETWORK_UNAVAILABLE_TOOLTIP \
+ _("Evolution is currently offline because the network is unavailable.")
struct _EOnlineButtonPrivate {
GtkWidget *image;
@@ -42,6 +45,21 @@ enum {
static gpointer parent_class;
static void
+online_button_update_tooltip (EOnlineButton *button)
+{
+ const gchar *tooltip;
+
+ if (e_online_button_get_online (button))
+ tooltip = ONLINE_TOOLTIP;
+ else if (GTK_WIDGET_SENSITIVE (button))
+ tooltip = OFFLINE_TOOLTIP;
+ else
+ tooltip = NETWORK_UNAVAILABLE_TOOLTIP;
+
+ gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
+}
+
+static void
online_button_set_property (GObject *object,
guint property_id,
const GValue *value,
@@ -130,6 +148,14 @@ online_button_init (EOnlineButton *button)
gtk_container_add (GTK_CONTAINER (button), widget);
button->priv->image = g_object_ref (widget);
gtk_widget_show (widget);
+
+ g_signal_connect (
+ button, "notify::online",
+ G_CALLBACK (online_button_update_tooltip), NULL);
+
+ g_signal_connect (
+ button, "notify::sensitive",
+ G_CALLBACK (online_button_update_tooltip), NULL);
}
GType
@@ -181,7 +207,6 @@ e_online_button_set_online (EOnlineButton *button,
GtkIconTheme *icon_theme;
const gchar *filename;
const gchar *icon_name;
- const gchar *tooltip;
g_return_if_fail (E_IS_ONLINE_BUTTON (button));
@@ -198,8 +223,5 @@ e_online_button_set_online (EOnlineButton *button,
gtk_image_set_from_file (image, filename);
gtk_icon_info_free (icon_info);
- tooltip = _(online ? ONLINE_TOOLTIP : OFFLINE_TOOLTIP);
- gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
-
g_object_notify (G_OBJECT (button), "online");
}