[network-manager-netbook/MplPanelClient] Update the panel icon tooltip based on state.
- From: Tambet Ingo <tambeti src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [network-manager-netbook/MplPanelClient] Update the panel icon tooltip based on state.
- Date: Fri, 13 Nov 2009 09:25:20 +0000 (UTC)
commit 5f3c9a89ce8ff33b91efbb9b2455d34b24b24268
Author: Tambet Ingo <tambet gmail com>
Date: Fri Nov 13 11:12:50 2009 +0200
Update the panel icon tooltip based on state.
src/nmn-status-icon.c | 40 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/src/nmn-status-icon.c b/src/nmn-status-icon.c
index f2c8c09..958ffb8 100644
--- a/src/nmn-status-icon.c
+++ b/src/nmn-status-icon.c
@@ -18,12 +18,14 @@
*/
#include <string.h>
+#include <glib/gi18n.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <nm-device-ethernet.h>
#include <nm-device-wifi.h>
#include <nm-gsm-device.h>
#include <nm-cdma-device.h>
+#include <nm-utils.h>
#include "nmn-status-icon.h"
#include "nmn-icon-cache.h"
@@ -54,6 +56,15 @@ nmn_status_icon_new (void)
}
static void
+update_tooltip (NmnStatusIcon *self, const char *text)
+{
+ NmnStatusIconPrivate *priv = GET_PRIVATE (self);
+
+ if (priv->panel_client)
+ mpl_panel_client_request_tooltip (priv->panel_client, text);
+}
+
+static void
update_icon (NmnStatusIcon *self, const char *image)
{
NmnStatusIconPrivate *priv = GET_PRIVATE (self);
@@ -118,6 +129,7 @@ icon_handler_pending_activation_new (NmnStatusIcon *icon)
handler->animation_id = g_timeout_add (200, activation_animation, handler);
activation_animation (handler);
+ update_tooltip (icon, _("networks - connecting"));
return (NmnIconHandler *) handler;
}
@@ -133,6 +145,7 @@ icon_handler_ethernet_new (NmnStatusIcon *icon)
handler = g_new0 (NmnIconHandler, 1);
handler->destroy = g_free;
update_icon (icon, "device-wired");
+ update_tooltip (icon, _("networks - wired"));
return handler;
}
@@ -203,6 +216,22 @@ active_ap_changed (NMDeviceWifi *device, GParamSpec *pspec, gpointer user_data)
handler->ap = nm_device_wifi_get_active_access_point (device);
if (handler->ap) {
+ const GByteArray *ssid;
+ char *id;
+ char *tip;
+
+ ssid = nm_access_point_get_ssid (handler->ap);
+ if (ssid)
+ id = nm_utils_ssid_to_utf8 ((char *) ssid->data, ssid->len);
+ else
+ id = g_strdup (_("(Hidden"));
+
+ tip = g_strdup_printf (_("networks - %s - wifi"), id);
+ g_free (id);
+
+ update_tooltip (((NmnIconHandler *) handler)->icon, tip);
+ g_free (tip);
+
handler->ap_strength_id = g_signal_connect (handler->ap, "notify::" NM_ACCESS_POINT_STRENGTH,
G_CALLBACK (ap_strength_changed), handler);
}
@@ -247,6 +276,7 @@ icon_handler_3g_new (NmnStatusIcon *icon)
handler = g_new0 (NmnIconHandler, 1);
handler->destroy = g_free;
+ update_tooltip (icon, _("networks - 3G"));
update_icon (icon, "device-wwan");
return handler;
@@ -318,8 +348,10 @@ update_best_ac (NmnStatusIcon *self)
if (best_ac)
priv->ac_icon_handler = icon_handler_create (self, best_ac);
- if (!priv->ac_icon_handler)
+ if (!priv->ac_icon_handler) {
+ update_tooltip (self, _("networks - not connected"));
update_icon (self, "no-connection");
+ }
}
static void
@@ -411,6 +443,7 @@ nmn_status_icon_set_panel_client (NmnStatusIcon *self,
priv->panel_client = g_object_ref (panel_client);
+ update_tooltip (self, _("networks - not connected"));
update_icon (self, "no-connection");
}
@@ -419,7 +452,10 @@ nmn_status_icon_set_panel_client (NmnStatusIcon *self,
static gboolean
set_initial_icon (gpointer data)
{
- update_icon (NMN_STATUS_ICON (data), "no-connection");
+ NmnStatusIcon *self = NMN_STATUS_ICON (data);
+
+ update_tooltip (self, _("networks - not connected"));
+ update_icon (self, "no-connection");
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]