[network-manager-netbook/MplPanelClient] Some UI changes.
- From: Tambet Ingo <tambeti src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [network-manager-netbook/MplPanelClient] Some UI changes.
- Date: Tue, 10 Nov 2009 14:22:36 +0000 (UTC)
commit 4feb5152cea4291c7a28e37c6f11a38a7060edb6
Author: Tambet Ingo <tambet gmail com>
Date: Fri Sep 25 11:45:12 2009 +0300
Some UI changes.
src/nmn-ethernet-item.c | 2 +
src/nmn-network-item.c | 90 +++++++++++++++++++++++++++++++++++++++++++++--
src/nmn-network-item.h | 1 +
src/nmn-serial-item.c | 2 +
src/nmn-wifi-item.c | 2 +
5 files changed, 94 insertions(+), 3 deletions(-)
---
diff --git a/src/nmn-ethernet-item.c b/src/nmn-ethernet-item.c
index 5f8c110..5717bac 100644
--- a/src/nmn-ethernet-item.c
+++ b/src/nmn-ethernet-item.c
@@ -17,6 +17,7 @@
* (C) Copyright 2009 Novell, Inc.
*/
+#include <glib/gi18n.h>
#include <NetworkManager.h>
#include <nm-connection.h>
#include <nm-setting-connection.h>
@@ -62,6 +63,7 @@ nmn_ethernet_item_new (NmnNMData *nm_data,
return GTK_WIDGET (g_object_new (NMN_TYPE_ETHERNET_ITEM,
NMN_NETWORK_ITEM_NM_DATA, nm_data,
NMN_NETWORK_ITEM_DEVICE, device,
+ NMN_NETWORK_ITEM_TYPE_STRING, _("Wired"),
NULL));
}
diff --git a/src/nmn-network-item.c b/src/nmn-network-item.c
index ddc41ac..3f121d5 100644
--- a/src/nmn-network-item.c
+++ b/src/nmn-network-item.c
@@ -41,6 +41,7 @@ enum {
PROP_DEVICE,
PROP_CONNECTION,
PROP_AC,
+ PROP_TYPE_STRING,
LAST_PROP
};
@@ -75,6 +76,9 @@ typedef struct {
NMDevice *device;
NMSettingsConnectionInterface *connection;
NMActiveConnection *ac;
+ char *type_str;
+
+ GdkColor prelight_color;
gulong connection_updated_id;
gulong connection_removed_id;
@@ -459,7 +463,43 @@ nmn_network_item_set_security (NmnNetworkItem *self,
static void
nmn_network_item_delete (NmnNetworkItem *self)
{
- g_signal_emit (self, signals[DELETE], 0);
+ NmnNetworkItemPrivate *priv = GET_PRIVATE (self);
+ GtkDialog *dialog;
+ GtkWidget *label;
+ const char *name;
+ char *label_text;
+
+ dialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_("Really remove?"),
+ NULL,
+ GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL));
+
+ gtk_dialog_set_has_separator (dialog, FALSE);
+ gtk_dialog_set_default_response (dialog, GTK_RESPONSE_ACCEPT);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_DELETE);
+
+ name = gtk_label_get_text (GTK_LABEL (priv->name));
+ label_text = g_strdup_printf (_("Do you want to remove the '%s' %s network? "
+ "This\nwill forget the password and you will"
+ " no longer be\nautomatically connected to "
+ "'%s'."),
+ name, priv->type_str, name);
+ label = gtk_label_new (label_text);
+
+ gtk_box_set_spacing (GTK_BOX (dialog->vbox), 12);
+ gtk_box_pack_start (GTK_BOX (dialog->vbox), label, TRUE, TRUE, 6);
+ gtk_widget_show_all (GTK_WIDGET (dialog));
+
+ if (gtk_dialog_run (dialog) == GTK_RESPONSE_ACCEPT)
+ g_signal_emit (self, signals[DELETE], 0);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
}
void
@@ -478,7 +518,9 @@ nmn_network_item_set_delete_visible (NmnNetworkItem *item,
button = gtk_button_new ();
gtk_button_set_image (GTK_BUTTON (button),
- gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON));
+ gtk_image_new_from_icon_name ("edit-clear", GTK_ICON_SIZE_MENU));
+
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_image_position (GTK_BUTTON (button), GTK_POS_RIGHT);
gtk_widget_set_tooltip_text (button, "Remove connection");
@@ -647,6 +689,26 @@ nmn_network_item_get_priority (NmnNetworkItem *self)
return NMN_NETWORK_ITEM_GET_CLASS (self)->get_priority (self);
}
+static gboolean
+enter_notify_event (GtkWidget *widget,
+ GdkEventCrossing *event)
+{
+ NmnNetworkItemPrivate *priv = GET_PRIVATE (widget);
+
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &priv->prelight_color);
+
+ return TRUE;
+}
+
+static gboolean
+leave_notify_event (GtkWidget *widget,
+ GdkEventCrossing *event)
+{
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, NULL);
+
+ return TRUE;
+}
+
static void
item_init (NmnItem *item_class)
{
@@ -712,6 +774,8 @@ nmn_network_item_init (NmnNetworkItem *item)
priv->remove = NULL;
+ gdk_color_parse ("#cbcbcb", &priv->prelight_color);
+
gtk_widget_show_all (GTK_WIDGET (priv->vbox));
}
@@ -731,7 +795,7 @@ constructor (GType type,
priv = GET_PRIVATE (object);
- if (!priv->nm_data || !priv->device) {
+ if (!priv->nm_data || !priv->device || !priv->type_str) {
g_warning ("%s: Missing constructor arguments", G_STRLOC);
g_object_unref (object);
return NULL;
@@ -770,6 +834,10 @@ set_property (GObject *object, guint prop_id,
nmn_network_item_set_active_connection (NMN_NETWORK_ITEM (object),
(NMActiveConnection *) g_value_get_object (value));
break;
+ case PROP_TYPE_STRING:
+ /* Construct only */
+ priv->type_str = g_value_dup_string (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -801,6 +869,9 @@ get_property (GObject *object, guint prop_id,
case PROP_AC:
g_value_set_object (value, priv->ac);
break;
+ case PROP_TYPE_STRING:
+ g_value_set_string (value, priv->type_str);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -816,6 +887,8 @@ dispose (GObject *object)
if (priv->disposed)
return;
+ g_free (priv->type_str);
+
nmn_network_item_set_active_connection (self, NULL);
if (priv->device)
@@ -835,6 +908,7 @@ static void
nmn_network_item_class_init (NmnNetworkItemClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
g_type_class_add_private (object_class, sizeof (NmnNetworkItemPrivate));
@@ -848,6 +922,9 @@ nmn_network_item_class_init (NmnNetworkItemClass *class)
class->delete = item_delete;
class->get_priority = get_priority;
+ widget_class->enter_notify_event = enter_notify_event;
+ widget_class->leave_notify_event = leave_notify_event;
+
/* properties */
g_object_class_override_property (object_class,
NMN_ITEM_PROP_NAME,
@@ -889,6 +966,13 @@ nmn_network_item_class_init (NmnNetworkItemClass *class)
NM_TYPE_ACTIVE_CONNECTION,
G_PARAM_READWRITE));
+ g_object_class_install_property
+ (object_class, PROP_TYPE_STRING,
+ g_param_spec_string (NMN_NETWORK_ITEM_TYPE_STRING,
+ "Type string",
+ "Type string",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/* Signals */
signals[CONNECT_REQUESTED] = g_signal_new
diff --git a/src/nmn-network-item.h b/src/nmn-network-item.h
index 1d215ec..6c45d10 100644
--- a/src/nmn-network-item.h
+++ b/src/nmn-network-item.h
@@ -38,6 +38,7 @@
#define NMN_NETWORK_ITEM_DEVICE "device"
#define NMN_NETWORK_ITEM_CONNECTION "connection"
#define NMN_NETWORK_ITEM_AC "active-connection"
+#define NMN_NETWORK_ITEM_TYPE_STRING "type-string"
typedef enum {
NMN_NETWORK_ITEM_STATUS_DISCONNECTED,
diff --git a/src/nmn-serial-item.c b/src/nmn-serial-item.c
index 033741c..4727420 100644
--- a/src/nmn-serial-item.c
+++ b/src/nmn-serial-item.c
@@ -17,6 +17,7 @@
* (C) Copyright 2009 Novell, Inc.
*/
+#include <glib/gi18n.h>
#include <NetworkManager.h>
#include <nm-connection.h>
#include <nm-setting-connection.h>
@@ -66,6 +67,7 @@ nmn_serial_item_new (NmnNMData *nm_data,
return GTK_WIDGET (g_object_new (NMN_TYPE_SERIAL_ITEM,
NMN_NETWORK_ITEM_NM_DATA, nm_data,
NMN_NETWORK_ITEM_DEVICE, device,
+ NMN_NETWORK_ITEM_TYPE_STRING, _("3G"),
NULL));
}
diff --git a/src/nmn-wifi-item.c b/src/nmn-wifi-item.c
index dc452f1..df9ffb9 100644
--- a/src/nmn-wifi-item.c
+++ b/src/nmn-wifi-item.c
@@ -18,6 +18,7 @@
*/
#include <string.h>
+#include <glib/gi18n.h>
#include <NetworkManager.h>
#include <nm-connection.h>
#include <nm-setting-connection.h>
@@ -63,6 +64,7 @@ nmn_wifi_item_new (NmnNMData *nm_data,
NMN_NETWORK_ITEM_NM_DATA, nm_data,
NMN_NETWORK_ITEM_DEVICE, device,
NMN_WIFI_ITEM_ACCESS_POINT, ap,
+ NMN_NETWORK_ITEM_TYPE_STRING, _("WiFi"),
NULL));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]