[network-manager-netbook] Rewrite status icon.



commit d78c271639cf055ef05dd48f82e278275dfc45c6
Author: Tambet Ingo <tambet gmail com>
Date:   Fri May 29 15:33:25 2009 +0300

    Rewrite status icon.
    
    A couple of typoes fixed as well.
---
 src/Makefile.am       |    3 +-
 src/nmn-applet.c      |   18 ++-
 src/nmn-status-icon.c |  403 ++++++++++++++++++++++++++++++-------------------
 src/nmn-status-icon.h |    9 +-
 4 files changed, 265 insertions(+), 168 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index fe32130..0ae5707 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,7 +8,8 @@ network_manager_netbook_CPPFLAGS = \
 	$(NMN_CFLAGS) \
 	-I${top_srcdir}/src/gconf-helpers \
 	-I${top_srcdir}/src/wireless-security \
-	-DGLADEDIR=\""$(gladedir)"\"							\
+	-DGLADEDIR=\""$(gladedir)"\" \
+	-DICON_PATH=\""$(pkgdatadir)/icons/"\" \
 	$(NULL)
 
 network_manager_netbook_LDADD = \
diff --git a/src/nmn-applet.c b/src/nmn-applet.c
index 4773726..9fa910a 100644
--- a/src/nmn-applet.c
+++ b/src/nmn-applet.c
@@ -149,7 +149,7 @@ enable_ethernet_setup (NmnApplet *applet)
                       0, 0);
  
     g_signal_connect (priv->enable_ethernet, "switch-flipped", G_CALLBACK (enable_ethernet_toggled), applet);
-    gtk_widget_show (priv->enable_wifi);
+    gtk_widget_show (priv->enable_ethernet);
 
     g_signal_connect (priv->nm_data, "ethernet-toggled", G_CALLBACK (ethernet_toggled), applet);
     ethernet_toggled (priv->nm_data, nmn_nm_data_ethernet_get_active (priv->nm_data), applet);
@@ -207,8 +207,7 @@ enable_flightmode_toggled (NbtkGtkLightSwitch *w,
     NmnAppletPrivate *priv = GET_PRIVATE (user_data);
 
     gtk_widget_set_sensitive (priv->enable_wifi, !active);
-    /* FIXME: Enable/disable 3G is not supported yet */
-    /* gtk_widget_set_sensitive (priv->enable_3g, !active); */
+    gtk_widget_set_sensitive (priv->enable_3g, !active);
 
     nm_client_wireless_set_enabled (NM_CLIENT (priv->nm_data), !active);
 }
@@ -270,6 +269,8 @@ nmn_applet_set_visible (NmnApplet *applet,
                         gboolean visible)
 {
     NmnAppletPrivate *priv = GET_PRIVATE (applet);
+
+    nmn_status_icon_set_active (NMN_STATUS_ICON (priv->status_icon), visible);
     
     if (visible) {
         if (!priv->network_list_populated) {
@@ -350,18 +351,18 @@ nmn_applet_init (NmnApplet *applet)
     priv->nm_data = nmn_nm_data_new (bus);
     dbus_g_connection_unref (bus);
 
-    priv->status_icon = nmn_status_icon_new (NM_CLIENT (priv->nm_data));
+    priv->status_icon = nmn_status_icon_new ();
 
-	dbus_g_connection_register_g_object (nm_object_get_connection (NM_OBJECT (priv->nm_data)),
+    dbus_g_connection_register_g_object (nm_object_get_connection (NM_OBJECT (priv->nm_data)),
 	                                     NM_DBUS_PATH_SETTINGS,
 	                                     G_OBJECT (nmn_nm_data_get_user_settings (priv->nm_data)));
 
+    nmn_status_icon_set_client (NMN_STATUS_ICON (priv->status_icon), NM_CLIENT (priv->nm_data));
+
     priv->builder = gtk_builder_new ();
     gtk_builder_add_from_file (priv->builder, GLADEDIR "/network-manager-netbook.glade", NULL);
 
     priv->pane = GTK_WIDGET (gtk_builder_get_object (priv->builder, "main_container"));
-    gtk_widget_unparent (priv->pane);
-
     priv->list = nmn_networks_new (priv->nm_data);
 
     container = GTK_WIDGET (gtk_builder_get_object (priv->builder, "networks_container"));
@@ -377,7 +378,10 @@ nmn_applet_init (NmnApplet *applet)
     add_new_connection_setup (applet);
 
     priv->plug = nmn_plug_new ();
+    g_object_ref (priv->pane);
+    gtk_widget_unparent (priv->pane);
     nmn_plug_push (NMN_PLUG (priv->plug), priv->pane);
+    g_object_unref (priv->pane);
 }
 
 static void
diff --git a/src/nmn-status-icon.c b/src/nmn-status-icon.c
index 520ebe7..be0843b 100644
--- a/src/nmn-status-icon.c
+++ b/src/nmn-status-icon.c
@@ -10,53 +10,168 @@
 #include "nmn-status-icon.h"
 #include "nmn-icon-cache.h"
 
-G_DEFINE_TYPE (NmnStatusIcon, nmn_status_icon, GTK_TYPE_STATUS_ICON)
-
-enum {
-    PROP_0,
-    PROP_CLIENT,
+typedef enum {
+    STATUS_IMAGE_NO_NETWORK,
+    STATUS_IMAGE_ETHERNET,
+    STATUS_IMAGE_WWAN,
+    STATUS_IMAGE_WIFI_00,
+    STATUS_IMAGE_WIFI_25,
+    STATUS_IMAGE_WIFI_50,
+    STATUS_IMAGE_WIFI_75,
+    STATUS_IMAGE_WIFI_100,
+    STATUS_IMAGE_ACTIVATING,
+} StatusImage;
+
+#define ACTIVATION_STEPS 7
 
-    LAST_PROP
-};
+G_DEFINE_TYPE (NmnStatusIcon, nmn_status_icon, GTK_TYPE_STATUS_ICON)
 
 #define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), NMN_TYPE_STATUS_ICON, NmnStatusIconPrivate))
 
 typedef struct {
     NMClient *client;
+    GHashTable *icon_cache;
+    StatusImage current_image;
+    gboolean active;
+    guint activation_step;
+
+    NMActiveConnection *default_ac;
+    gulong ac_state_changed_id;
 
     guint activation_animation_id;
     guint activation_animation_index;
 } NmnStatusIconPrivate;
 
-static GdkPixbuf *get_active_wifi_icon (NmnStatusIcon *self, NMDeviceWifi *device);
+static StatusImage get_active_wifi_icon (NmnStatusIcon *self, NMDeviceWifi *device);
+
+static char *
+get_icon_filename (StatusImage image,
+                   guint activation_step,
+                   gboolean active)
+{
+    GString *str;
+
+    str = g_string_sized_new (128);
+    g_string_append (str, ICON_PATH);
+
+    switch (image) {
+    case STATUS_IMAGE_NO_NETWORK:
+        g_string_append (str, "nm-no-connection");
+        break;
+    case STATUS_IMAGE_ETHERNET:
+        g_string_append (str, "nm-device-wired");
+        break;
+    case STATUS_IMAGE_WWAN:
+        g_string_append (str, "nm-device-wwan");
+        break;
+    case STATUS_IMAGE_WIFI_00:
+        g_string_append (str, "nm-signal-00");
+        break;
+    case STATUS_IMAGE_WIFI_25:
+        g_string_append (str, "nm-signal-25");
+        break;
+    case STATUS_IMAGE_WIFI_50:
+        g_string_append (str, "nm-signal-50");
+        break;
+    case STATUS_IMAGE_WIFI_75:
+        g_string_append (str, "nm-signal-75");
+        break;
+    case STATUS_IMAGE_WIFI_100:
+        g_string_append (str, "nm-signal-100");
+        break;
+    case STATUS_IMAGE_ACTIVATING:
+        g_string_append_printf (str, "nm-progress-working-%02d", activation_step);
+        break;
+    }
+
+    g_string_append (str, active ? "-active" : "-normal");
+    g_string_append (str, ".png");
+
+    return g_string_free (str, FALSE);
+}
+
+static void
+update_icon (NmnStatusIcon *self, StatusImage image)
+{
+    NmnStatusIconPrivate *priv = GET_PRIVATE (self);
+    char *filename;
+    GdkPixbuf *pixbuf;
+
+    filename = get_icon_filename (image, priv->activation_step, priv->active);
+
+    if (G_UNLIKELY (priv->icon_cache == NULL)) {
+        priv->icon_cache = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
+        pixbuf = NULL;
+    } else {
+        pixbuf = (GdkPixbuf *) g_hash_table_lookup (priv->icon_cache, filename);
+    }
+
+    if (!pixbuf) {
+        GError *error = NULL;
+
+        pixbuf = gdk_pixbuf_new_from_file (filename, &error);
+        if (pixbuf)
+            g_hash_table_insert (priv->icon_cache, filename, pixbuf);
+
+        if (error) {
+            g_warning ("Error loading status icon '%s': %s", filename, error->message);
+            g_error_free (error);
+        }
+    }
+
+    g_free (filename);
+
+    if (pixbuf) {
+        GtkStatusIcon *s = GTK_STATUS_ICON (self);
+
+        priv->current_image = image;
+        if (!(gtk_status_icon_get_storage_type (s) == GTK_IMAGE_PIXBUF &&
+              gtk_status_icon_get_pixbuf (s) == pixbuf))
+
+            gtk_status_icon_set_from_pixbuf (s, pixbuf);
+    }
+}
 
 GtkStatusIcon *
-nmn_status_icon_new (NMClient *client)
+nmn_status_icon_new (void)
 {
-    g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
+    return GTK_STATUS_ICON (g_object_new (NMN_TYPE_STATUS_ICON, NULL));
+}
 
-    return GTK_STATUS_ICON (g_object_new (NMN_TYPE_STATUS_ICON,
-                                          NMN_STATUS_ICON_CLIENT, client,
-                                          NULL));
+void
+nmn_status_icon_set_active (NmnStatusIcon *self,
+                            gboolean active)
+{
+    NmnStatusIconPrivate *priv;
+
+    g_return_if_fail (NMN_IS_STATUS_ICON (self));
+
+    priv = GET_PRIVATE (self);
+    if (priv->active != active) {
+        priv->active = active;
+        update_icon (self, priv->current_image);
+    }
 }
 
-static GdkPixbuf *
+static StatusImage
 get_active_ap_icon (NmnStatusIcon *self, NMAccessPoint *ap)
 {
-    GdkPixbuf *icon;
+    StatusImage icon;
     guint32 strength;
 
     strength = nm_access_point_get_strength (ap);
     strength = CLAMP (strength, 0, 100);
 
-    if (strength > 71)
-        icon = nmn_icon_cache_get ("nm-signal-100");
-    else if (strength > 38)
-        icon = nmn_icon_cache_get ("nm-signal-66");
+    if (strength > 80)
+        icon = STATUS_IMAGE_WIFI_100;
+    else if (strength > 55)
+        icon = STATUS_IMAGE_WIFI_75;
+    else if (strength > 30)
+        icon = STATUS_IMAGE_WIFI_50;
     else if (strength > 5)
-        icon = nmn_icon_cache_get ("nm-signal-33");
+        icon = STATUS_IMAGE_WIFI_25;
     else
-        icon = nmn_icon_cache_get ("nm-signal-00");
+        icon = STATUS_IMAGE_WIFI_00;
 
     return icon;
 }
@@ -65,10 +180,8 @@ static void
 ap_strength_changed (NMAccessPoint *ap, GParamSpec *pspec, gpointer user_data)
 {
     NmnStatusIcon *self = NMN_STATUS_ICON (user_data);
-    GdkPixbuf *icon;
 
-    icon = get_active_ap_icon (self, ap);
-    gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), icon);
+    update_icon (self, get_active_ap_icon (self, ap));
 }
 
 typedef struct {
@@ -101,19 +214,15 @@ device_active_ap_changed (NMDeviceWifi *device, GParamSpec *pspec, gpointer user
 
     /* If the device is still active, it means we've roamed to another AP,
        set up new signal handlers and update the icon */
-    if (nm_device_get_state (NM_DEVICE (device)) == NM_DEVICE_STATE_ACTIVATED) {
-        GdkPixbuf *icon;
-
-        icon = get_active_wifi_icon (self, device);
-        gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), icon);
-    }
+    if (nm_device_get_state (NM_DEVICE (device)) == NM_DEVICE_STATE_ACTIVATED)
+        update_icon (self, get_active_wifi_icon (self, device));
 }
 
-static GdkPixbuf *
+static StatusImage
 get_active_wifi_icon (NmnStatusIcon *self, NMDeviceWifi *device)
 {
     NMAccessPoint *ap;
-    GdkPixbuf *icon;
+    StatusImage icon;
 
     ap = nm_device_wifi_get_active_access_point (device);
     if (ap) {
@@ -138,34 +247,25 @@ get_active_wifi_icon (NmnStatusIcon *self, NMDeviceWifi *device)
 
         icon = get_active_ap_icon (self, ap);
     } else
-        icon = nmn_icon_cache_get ("nm-signal-00");
+        icon = STATUS_IMAGE_WIFI_00;
 
     return icon;
 }
 
-static GdkPixbuf *
-get_active_device_icon (NmnStatusIcon *self)
+static StatusImage
+get_active_device_icon (NmnStatusIcon *self, NMDevice *device)
 {
-    NmnStatusIconPrivate *priv = GET_PRIVATE (self);
-    const GPtrArray *devices;
-    GdkPixbuf *icon = NULL;
-    int i;
-
-    devices = nm_client_get_devices (priv->client);
-    for (i = 0; devices && i < devices->len; i++) {
-        NMDevice *device = NM_DEVICE (g_ptr_array_index (devices, i));
-
-        if (nm_device_get_state (device) != NM_DEVICE_STATE_ACTIVATED)
-            continue;
-
-        if (NM_IS_DEVICE_ETHERNET (device))
-            icon = nmn_icon_cache_get ("nm-device-wired");
-        else if (NM_IS_DEVICE_WIFI (device))
-            icon = get_active_wifi_icon (self, NM_DEVICE_WIFI (device));
-        else if (NM_IS_GSM_DEVICE (device) || NM_IS_CDMA_DEVICE (device))
-            icon = nmn_icon_cache_get ("nm-device-wwan");
-        else
-            g_warning ("Unhandled device type: '%s'", G_OBJECT_TYPE_NAME (device));
+    StatusImage icon;
+
+    if (NM_IS_DEVICE_ETHERNET (device))
+        icon = STATUS_IMAGE_ETHERNET;
+    else if (NM_IS_DEVICE_WIFI (device))
+        icon = get_active_wifi_icon (self, NM_DEVICE_WIFI (device));
+    else if (NM_IS_GSM_DEVICE (device) || NM_IS_CDMA_DEVICE (device))
+        icon = STATUS_IMAGE_WWAN;
+    else {
+        g_warning ("Unhandled device type: '%s'", G_OBJECT_TYPE_NAME (device));
+        icon = STATUS_IMAGE_NO_NETWORK;
     }
 
     return icon;
@@ -176,38 +276,28 @@ activation_animation (gpointer data)
 {
     NmnStatusIcon *self = NMN_STATUS_ICON (data);
     NmnStatusIconPrivate *priv = GET_PRIVATE (self);
-    GdkPixbuf *icon;
-    const char *icon_names[] = { 
-        "nm-stage01-connecting01",
-        "nm-stage01-connecting02",
-        "nm-stage01-connecting03",
-        "nm-stage01-connecting04",
-        NULL
-    };
-
-    if (priv->activation_animation_index > 3)
-        priv->activation_animation_index = 0;
 
-    icon = nmn_icon_cache_get (icon_names[priv->activation_animation_index++]);
-    gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), icon);
+    if (++priv->activation_step > ACTIVATION_STEPS)
+        priv->activation_step = 1;
+
+    update_icon (self, STATUS_IMAGE_ACTIVATING);
 
     return TRUE;
 }
 
+/***********************************************************************************/
+
 static void
-nm_state_changed (NMClient *client,
+ac_state_changed (NMActiveConnection *ac,
                   GParamSpec *pspec,
                   gpointer user_data)
 {
     NmnStatusIcon *self = NMN_STATUS_ICON (user_data);
     NmnStatusIconPrivate *priv = GET_PRIVATE (self);
-    GdkPixbuf *icon;
-    NMState state;
-
-    if (nm_client_get_manager_running (client))
-        state = nm_client_get_state (client);
-    else
-        state = NM_STATE_DISCONNECTED;
+    const GPtrArray *active_devices;
+    NMDevice *device = NULL;
+    StatusImage icon;
+    NMActiveConnectionState state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
 
     /* Cancel any ongoing activation animantion */
     if (priv->activation_animation_id) {
@@ -216,106 +306,113 @@ nm_state_changed (NMClient *client,
         priv->activation_animation_index = 0;
     }
 
+    if (ac) {
+        active_devices = nm_active_connection_get_devices (ac);
+        if (active_devices) {
+            device = NM_DEVICE (g_ptr_array_index (active_devices, 0));
+            state = nm_active_connection_get_state (ac);
+        }
+    }
+
     switch (state) {
-    case NM_STATE_CONNECTING:
-        priv->activation_animation_id = g_timeout_add (500, activation_animation, self);
+    case NM_ACTIVE_CONNECTION_STATE_UNKNOWN:
+        icon = STATUS_IMAGE_NO_NETWORK;;
+        break;
+    case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
+        priv->activation_animation_id = g_timeout_add (200, activation_animation, self);
         activation_animation (self);
         return;
         break;
-	case NM_STATE_CONNECTED:
-        icon = get_active_device_icon (self);
-        break;
-    default:
-        icon = nmn_icon_cache_get ("nm-no-connection");
+    case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
+        icon = get_active_device_icon (self, device);
         break;
     }
 
-    gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), icon);
+    update_icon (self, icon);
 }
 
-static gboolean
-set_initial_state (gpointer data)
+static void
+update_best_ac (NmnStatusIcon *self)
 {
-    NmnStatusIconPrivate *priv = GET_PRIVATE (data);
+    NmnStatusIconPrivate *priv = GET_PRIVATE (self);
+    const GPtrArray *acs;
+    NMActiveConnection *best_ac = NULL;
+    int i;
 
-    nm_state_changed (priv->client, NULL, data);
+    if (nm_client_get_manager_running (priv->client))
+        acs = nm_client_get_active_connections (priv->client);
+    else
+        acs = NULL;
 
-    return FALSE;
-}
+    for (i = 0; acs && i < acs->len; i++) {
+        NMActiveConnection *ac = g_ptr_array_index (acs, i);
 
-/*****************************************************************************/
+        if (nm_active_connection_get_state (ac) == NM_ACTIVE_CONNECTION_STATE_UNKNOWN)
+            continue;
+
+        if (!best_ac ||
+            nm_active_connection_get_state (ac) > nm_active_connection_get_state (best_ac) ||
+            nm_active_connection_get_default (ac) == TRUE)
+            best_ac = ac;
+    }
+
+    if (priv->default_ac && priv->default_ac != best_ac) {
+        g_signal_handler_disconnect (priv->default_ac, priv->ac_state_changed_id);
+        g_object_unref (priv->default_ac);
+        priv->default_ac = NULL;
+    }
+
+    if (best_ac) {
+        priv->default_ac = best_ac;
+        priv->default_ac = g_object_ref (best_ac);
+        priv->ac_state_changed_id = g_signal_connect (best_ac, "notify",
+                                                      G_CALLBACK (ac_state_changed), self);
+    }
+
+    ac_state_changed (best_ac, NULL, self);
+}
 
 static void
-nmn_status_icon_init (NmnStatusIcon *self)
+active_connections_changed (NMClient *client,
+                            GParamSpec *pspec,
+                            gpointer user_data)
 {
+    update_best_ac (NMN_STATUS_ICON (user_data));
 }
 
-static GObject*
-constructor (GType type,
-             guint n_construct_params,
-             GObjectConstructParam *construct_params)
+void
+nmn_status_icon_set_client (NmnStatusIcon *self,
+                            NMClient *client)
 {
-    GObject *object;
     NmnStatusIconPrivate *priv;
 
-    object = G_OBJECT_CLASS (nmn_status_icon_parent_class)->constructor
-        (type, n_construct_params, construct_params);
-
-    if (!object)
-        return NULL;
-
-    priv = GET_PRIVATE (object);
-
-    if (!priv->client) {
-        g_warning ("Missing constructor arguments");
-        g_object_unref (object);
-        return NULL;
-    }
+    g_return_if_fail (NMN_IS_STATUS_ICON (self));
+    g_return_if_fail (NM_IS_CLIENT (client));
 
-    g_signal_connect (priv->client, "notify::state",
-                      G_CALLBACK (nm_state_changed),
-                      object);
+    priv = GET_PRIVATE (self);
+    priv->client = g_object_ref (client);
 
-    g_signal_connect (priv->client, "notify::manager-running",
-                      G_CALLBACK (nm_state_changed),
-                      object);
+    g_signal_connect (priv->client, "notify::" NM_CLIENT_ACTIVE_CONNECTIONS,
+	                  G_CALLBACK (active_connections_changed),
+	                  self);
 
-    g_idle_add (set_initial_state, object);
-
-    return object;
+    update_best_ac (self);
 }
 
-static void
-set_property (GObject *object, guint prop_id,
-              const GValue *value, GParamSpec *pspec)
+/*****************************************************************************/
+
+static gboolean
+set_initial_icon (gpointer data)
 {
-    NmnStatusIconPrivate *priv = GET_PRIVATE (object);
+    update_icon (NMN_STATUS_ICON (data), STATUS_IMAGE_NO_NETWORK);
 
-    switch (prop_id) {
-    case PROP_CLIENT:
-        /* Construct only */
-        priv->client = g_value_dup_object (value);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
+    return FALSE;
 }
 
 static void
-get_property (GObject *object, guint prop_id,
-              GValue *value, GParamSpec *pspec)
+nmn_status_icon_init (NmnStatusIcon *self)
 {
-    NmnStatusIconPrivate *priv = GET_PRIVATE (object);
-
-    switch (prop_id) {
-    case PROP_CLIENT:
-        g_value_set_object (value, priv->client);
-        break;
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-        break;
-    }
+    g_idle_add (set_initial_icon, self);
 }
 
 static void
@@ -328,7 +425,11 @@ finalize (GObject *object)
         priv->activation_animation_id = 0;
     }
 
-    g_object_unref (priv->client);
+    if (priv->icon_cache)
+        g_hash_table_destroy (priv->icon_cache);
+
+    if (priv->client)
+        g_object_unref (priv->client);
 
     G_OBJECT_CLASS (nmn_status_icon_parent_class)->finalize (object);
 }
@@ -340,17 +441,5 @@ nmn_status_icon_class_init (NmnStatusIconClass *class)
 
     g_type_class_add_private (object_class, sizeof (NmnStatusIconPrivate));
 
-    object_class->constructor = constructor;
-    object_class->get_property = get_property;
-    object_class->set_property = set_property;
     object_class->finalize = finalize;
-
-    /* properties */
-    g_object_class_install_property
-        (object_class, PROP_CLIENT,
-         g_param_spec_object (NMN_STATUS_ICON_CLIENT,
-                              "NMClient",
-                              "NMClient",
-                              NM_TYPE_CLIENT,
-                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 }
diff --git a/src/nmn-status-icon.h b/src/nmn-status-icon.h
index 4955ae5..77dfc35 100644
--- a/src/nmn-status-icon.h
+++ b/src/nmn-status-icon.h
@@ -15,8 +15,6 @@ G_BEGIN_DECLS
 #define NMN_IS_STATUS_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NMN_TYPE_STATUS_ICON))
 #define NMN_STATUS_ICON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMN_TYPE_STATUS_ICON, NmnStatusIconClass))
 
-#define NMN_STATUS_ICON_CLIENT "client"
-
 typedef struct {
     GtkStatusIcon parent;
 } NmnStatusIcon;
@@ -27,7 +25,12 @@ typedef struct {
 
 GType nmn_status_icon_get_type (void);
 
-GtkStatusIcon *nmn_status_icon_new (NMClient *client);
+GtkStatusIcon *nmn_status_icon_new        (void);
+void           nmn_status_icon_set_client (NmnStatusIcon *self,
+                                           NMClient *client);
+
+void           nmn_status_icon_set_active (NmnStatusIcon *self,
+                                           gboolean active);
 
 G_END_DECLS
 



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