[evolution/kill-bonobo] Bug 511769 - Poor indication of when network is unavailable
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution/kill-bonobo] Bug 511769 - Poor indication of when network is unavailable
- Date: Tue, 25 Aug 2009 04:10:53 +0000 (UTC)
commit 473f8dca644b3f9f48529daeed44de2097ee311d
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Aug 25 00:09:45 2009 -0400
Bug 511769 - Poor indication of when network is unavailable
shell/e-shell-window-private.c | 12 ++++++++++++
widgets/misc/e-online-button.c | 34 ++++++++++++++++++++++++++++------
2 files changed, 40 insertions(+), 6 deletions(-)
---
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index b011bb5..0012b18 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 c14114b..444296d 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");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]