[gnome-control-center] network: remove evil tabs
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: remove evil tabs
- Date: Mon, 24 Jan 2011 20:47:53 +0000 (UTC)
commit 308db2da1ad68fd23bf8503411ef68d3a0cde553
Author: William Jon McCann <jmccann redhat com>
Date: Mon Jan 24 15:46:58 2011 -0500
network: remove evil tabs
The control center style does not use tabs.
panels/network/cc-network-panel.c | 3060 +++++++++++++-------------
panels/network/cc-network-panel.h | 26 +-
panels/network/panel-cell-renderer-mode.c | 96 +-
panels/network/panel-cell-renderer-mode.h | 30 +-
panels/network/panel-cell-renderer-signal.c | 122 +-
panels/network/panel-cell-renderer-signal.h | 30 +-
panels/network/panel-common.c | 344 ++--
panels/network/panel-common.h | 56 +-
8 files changed, 1882 insertions(+), 1882 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 4b7d181..2f83666 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -29,137 +29,137 @@
G_DEFINE_DYNAMIC_TYPE (CcNetworkPanel, cc_network_panel, CC_TYPE_PANEL)
#define NETWORK_PANEL_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_NETWORK_PANEL, CcNetworkPanelPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_NETWORK_PANEL, CcNetworkPanelPrivate))
struct _CcNetworkPanelPrivate
{
- GCancellable *cancellable;
- gchar *current_device;
- GDBusProxy *proxy;
- GPtrArray *devices;
- GSettings *proxy_settings;
- GtkBuilder *builder;
+ GCancellable *cancellable;
+ gchar *current_device;
+ GDBusProxy *proxy;
+ GPtrArray *devices;
+ GSettings *proxy_settings;
+ GtkBuilder *builder;
};
typedef struct {
- CcNetworkPanel *panel;
- gchar *active_access_point;
- gchar *device_id;
- gchar *ip4_config;
- gchar *ip6_config;
- gchar *modem_imei;
- gchar *operator_name;
- gchar *udi;
- GDBusProxy *proxy;
- GDBusProxy *proxy_additional;
- GDBusProxy *proxy_ip4;
- GDBusProxy *proxy_ip6;
- guint device_add_refcount;
- guint type;
+ CcNetworkPanel *panel;
+ gchar *active_access_point;
+ gchar *device_id;
+ gchar *ip4_config;
+ gchar *ip6_config;
+ gchar *modem_imei;
+ gchar *operator_name;
+ gchar *udi;
+ GDBusProxy *proxy;
+ GDBusProxy *proxy_additional;
+ GDBusProxy *proxy_ip4;
+ GDBusProxy *proxy_ip6;
+ guint device_add_refcount;
+ guint type;
} PanelDeviceItem;
typedef struct {
- gchar *access_point;
- gchar *active_access_point;
- guint strength;
- guint mode;
- CcNetworkPanel *panel;
+ gchar *access_point;
+ gchar *active_access_point;
+ guint strength;
+ guint mode;
+ CcNetworkPanel *panel;
} PanelAccessPointItem;
enum {
- PANEL_DEVICES_COLUMN_ICON,
- PANEL_DEVICES_COLUMN_TITLE,
- PANEL_DEVICES_COLUMN_ID,
- PANEL_DEVICES_COLUMN_SORT,
- PANEL_DEVICES_COLUMN_TOOLTIP,
- PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE,
- PANEL_DEVICES_COLUMN_LAST
+ PANEL_DEVICES_COLUMN_ICON,
+ PANEL_DEVICES_COLUMN_TITLE,
+ PANEL_DEVICES_COLUMN_ID,
+ PANEL_DEVICES_COLUMN_SORT,
+ PANEL_DEVICES_COLUMN_TOOLTIP,
+ PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE,
+ PANEL_DEVICES_COLUMN_LAST
};
enum {
- PANEL_WIRELESS_COLUMN_ID,
- PANEL_WIRELESS_COLUMN_TITLE,
- PANEL_WIRELESS_COLUMN_SORT,
- PANEL_WIRELESS_COLUMN_STRENGTH,
- PANEL_WIRELESS_COLUMN_MODE,
- PANEL_WIRELESS_COLUMN_LAST
+ PANEL_WIRELESS_COLUMN_ID,
+ PANEL_WIRELESS_COLUMN_TITLE,
+ PANEL_WIRELESS_COLUMN_SORT,
+ PANEL_WIRELESS_COLUMN_STRENGTH,
+ PANEL_WIRELESS_COLUMN_MODE,
+ PANEL_WIRELESS_COLUMN_LAST
};
-static void panel_device_refresh_item_ui (PanelDeviceItem *item);
+static void panel_device_refresh_item_ui (PanelDeviceItem *item);
static void
cc_network_panel_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
}
static void
cc_network_panel_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- switch (property_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
- }
+ switch (property_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
}
static void
cc_network_panel_dispose (GObject *object)
{
- CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv;
-
- if (priv->proxy_settings) {
- g_object_unref (priv->proxy_settings);
- priv->proxy_settings = NULL;
- }
- if (priv->cancellable != NULL) {
- g_cancellable_cancel (priv->cancellable);
- g_object_unref (priv->cancellable);
- priv->cancellable = NULL;
- }
- if (priv->builder != NULL) {
- g_object_unref (priv->builder);
- priv->builder = NULL;
- }
- if (priv->proxy != NULL) {
- g_object_unref (priv->proxy);
- priv->proxy = NULL;
- }
-
- G_OBJECT_CLASS (cc_network_panel_parent_class)->dispose (object);
+ CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv;
+
+ if (priv->proxy_settings) {
+ g_object_unref (priv->proxy_settings);
+ priv->proxy_settings = NULL;
+ }
+ if (priv->cancellable != NULL) {
+ g_cancellable_cancel (priv->cancellable);
+ g_object_unref (priv->cancellable);
+ priv->cancellable = NULL;
+ }
+ if (priv->builder != NULL) {
+ g_object_unref (priv->builder);
+ priv->builder = NULL;
+ }
+ if (priv->proxy != NULL) {
+ g_object_unref (priv->proxy);
+ priv->proxy = NULL;
+ }
+
+ G_OBJECT_CLASS (cc_network_panel_parent_class)->dispose (object);
}
static void
cc_network_panel_finalize (GObject *object)
{
- CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv;
+ CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (object)->priv;
- g_free (priv->current_device);
- g_ptr_array_unref (priv->devices);
+ g_free (priv->current_device);
+ g_ptr_array_unref (priv->devices);
- G_OBJECT_CLASS (cc_network_panel_parent_class)->finalize (object);
+ G_OBJECT_CLASS (cc_network_panel_parent_class)->finalize (object);
}
static void
cc_network_panel_class_init (CcNetworkPanelClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (CcNetworkPanelPrivate));
+ g_type_class_add_private (klass, sizeof (CcNetworkPanelPrivate));
- object_class->get_property = cc_network_panel_get_property;
- object_class->set_property = cc_network_panel_set_property;
- object_class->dispose = cc_network_panel_dispose;
- object_class->finalize = cc_network_panel_finalize;
+ object_class->get_property = cc_network_panel_get_property;
+ object_class->set_property = cc_network_panel_set_property;
+ object_class->dispose = cc_network_panel_dispose;
+ object_class->finalize = cc_network_panel_finalize;
}
static void
@@ -172,8 +172,8 @@ cc_network_panel_class_finalize (CcNetworkPanelClass *klass)
**/
static void
panel_settings_changed (GSettings *settings,
- const gchar *key,
- CcNetworkPanel *panel)
+ const gchar *key,
+ CcNetworkPanel *panel)
{
}
@@ -183,26 +183,26 @@ panel_settings_changed (GSettings *settings,
static void
panel_proxy_mode_combo_setup_widgets (CcNetworkPanel *panel, guint value)
{
- GtkWidget *widget;
-
- /* hide or show the PAC text box */
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "hbox_proxy_url"));
- gtk_widget_set_visible (widget, value == 2);
-
- /* hide or show the manual entry text boxes */
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "hbox_proxy_http"));
- gtk_widget_set_visible (widget, value == 1);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "hbox_proxy_shttp"));
- gtk_widget_set_visible (widget, value == 1);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "hbox_proxy_ftp"));
- gtk_widget_set_visible (widget, value == 1);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "hbox_proxy_socks"));
- gtk_widget_set_visible (widget, value == 1);
+ GtkWidget *widget;
+
+ /* hide or show the PAC text box */
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "hbox_proxy_url"));
+ gtk_widget_set_visible (widget, value == 2);
+
+ /* hide or show the manual entry text boxes */
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "hbox_proxy_http"));
+ gtk_widget_set_visible (widget, value == 1);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "hbox_proxy_shttp"));
+ gtk_widget_set_visible (widget, value == 1);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "hbox_proxy_ftp"));
+ gtk_widget_set_visible (widget, value == 1);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "hbox_proxy_socks"));
+ gtk_widget_set_visible (widget, value == 1);
}
/**
@@ -211,27 +211,27 @@ panel_proxy_mode_combo_setup_widgets (CcNetworkPanel *panel, guint value)
static void
panel_proxy_mode_combo_changed_cb (GtkWidget *widget, CcNetworkPanel *panel)
{
- gboolean ret;
- gint value;
- GtkTreeIter iter;
- GtkTreeModel *model;
-
- /* no selection */
- ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
- if (!ret)
- return;
-
- /* get entry */
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
- gtk_tree_model_get (model, &iter,
- 1, &value,
- -1);
-
- /* set */
- g_settings_set_enum (panel->priv->proxy_settings, "mode", value);
-
- /* hide or show the correct widgets */
- panel_proxy_mode_combo_setup_widgets (panel, value);
+ gboolean ret;
+ gint value;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ /* no selection */
+ ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);
+ if (!ret)
+ return;
+
+ /* get entry */
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
+ gtk_tree_model_get (model, &iter,
+ 1, &value,
+ -1);
+
+ /* set */
+ g_settings_set_enum (panel->priv->proxy_settings, "mode", value);
+
+ /* hide or show the correct widgets */
+ panel_proxy_mode_combo_setup_widgets (panel, value);
}
/**
@@ -240,51 +240,51 @@ panel_proxy_mode_combo_changed_cb (GtkWidget *widget, CcNetworkPanel *panel)
static void
panel_set_value_for_combo (CcNetworkPanel *panel, GtkComboBox *combo_box, gint value)
{
- gboolean ret;
- gint value_tmp;
- GtkTreeIter iter;
- GtkTreeModel *model;
-
- /* get entry */
- model = gtk_combo_box_get_model (combo_box);
- ret = gtk_tree_model_get_iter_first (model, &iter);
- if (!ret)
- return;
-
- /* try to make the UI match the setting */
- do {
- gtk_tree_model_get (model, &iter,
- 1, &value_tmp,
- -1);
- if (value == value_tmp) {
- gtk_combo_box_set_active_iter (combo_box, &iter);
- break;
- }
- } while (gtk_tree_model_iter_next (model, &iter));
-
- /* hide or show the correct widgets */
- panel_proxy_mode_combo_setup_widgets (panel, value);
+ gboolean ret;
+ gint value_tmp;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+
+ /* get entry */
+ model = gtk_combo_box_get_model (combo_box);
+ ret = gtk_tree_model_get_iter_first (model, &iter);
+ if (!ret)
+ return;
+
+ /* try to make the UI match the setting */
+ do {
+ gtk_tree_model_get (model, &iter,
+ 1, &value_tmp,
+ -1);
+ if (value == value_tmp) {
+ gtk_combo_box_set_active_iter (combo_box, &iter);
+ break;
+ }
+ } while (gtk_tree_model_iter_next (model, &iter));
+
+ /* hide or show the correct widgets */
+ panel_proxy_mode_combo_setup_widgets (panel, value);
}
static void
panel_free_device_item (PanelDeviceItem *item)
{
- g_object_unref (item->panel);
- g_object_unref (item->proxy);
- if (item->proxy_additional != NULL)
- g_object_unref (item->proxy_additional);
- if (item->proxy_ip4 != NULL)
- g_object_unref (item->proxy_ip4);
- if (item->proxy_ip6 != NULL)
- g_object_unref (item->proxy_ip6);
- g_free (item->device_id);
- g_free (item->active_access_point);
- g_free (item->udi);
- g_free (item->operator_name);
- g_free (item->ip4_config);
- g_free (item->ip6_config);
- g_free (item->modem_imei);
- g_free (item);
+ g_object_unref (item->panel);
+ g_object_unref (item->proxy);
+ if (item->proxy_additional != NULL)
+ g_object_unref (item->proxy_additional);
+ if (item->proxy_ip4 != NULL)
+ g_object_unref (item->proxy_ip4);
+ if (item->proxy_ip6 != NULL)
+ g_object_unref (item->proxy_ip6);
+ g_free (item->device_id);
+ g_free (item->active_access_point);
+ g_free (item->udi);
+ g_free (item->operator_name);
+ g_free (item->ip4_config);
+ g_free (item->ip6_config);
+ g_free (item->modem_imei);
+ g_free (item);
}
/**
@@ -293,30 +293,30 @@ panel_free_device_item (PanelDeviceItem *item)
static void
panel_add_device_to_listview (PanelDeviceItem *item)
{
- GtkListStore *liststore_devices;
- GtkTreeIter iter;
- gchar *title = NULL;
- CcNetworkPanelPrivate *priv = item->panel->priv;
-
- g_debug ("device %s type %i", item->device_id, item->type);
-
- /* make title a bit bigger */
- title = g_strdup_printf ("<span size=\"large\">%s</span>",
- panel_device_type_to_localized_string (item->type));
-
- liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_devices"));
- gtk_list_store_append (liststore_devices, &iter);
- gtk_list_store_set (liststore_devices,
- &iter,
- PANEL_DEVICES_COLUMN_ICON, panel_device_type_to_icon_name (item->type),
- PANEL_DEVICES_COLUMN_SORT, panel_device_type_to_sortable_string (item->type),
- PANEL_DEVICES_COLUMN_TITLE, title,
- PANEL_DEVICES_COLUMN_ID, item->device_id,
- PANEL_DEVICES_COLUMN_TOOLTIP, NULL,
- PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, item,
- -1);
- g_free (title);
+ GtkListStore *liststore_devices;
+ GtkTreeIter iter;
+ gchar *title = NULL;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
+
+ g_debug ("device %s type %i", item->device_id, item->type);
+
+ /* make title a bit bigger */
+ title = g_strdup_printf ("<span size=\"large\">%s</span>",
+ panel_device_type_to_localized_string (item->type));
+
+ liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ "liststore_devices"));
+ gtk_list_store_append (liststore_devices, &iter);
+ gtk_list_store_set (liststore_devices,
+ &iter,
+ PANEL_DEVICES_COLUMN_ICON, panel_device_type_to_icon_name (item->type),
+ PANEL_DEVICES_COLUMN_SORT, panel_device_type_to_sortable_string (item->type),
+ PANEL_DEVICES_COLUMN_TITLE, title,
+ PANEL_DEVICES_COLUMN_ID, item->device_id,
+ PANEL_DEVICES_COLUMN_TOOLTIP, NULL,
+ PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, item,
+ -1);
+ g_free (title);
}
/**
@@ -325,86 +325,86 @@ panel_add_device_to_listview (PanelDeviceItem *item)
static void
panel_got_proxy_access_point_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- gchar *ssid = NULL;
- gchar tmp;
- GDBusProxy *proxy;
- GError *error = NULL;
- gsize len;
- GtkListStore *liststore_wireless_network;
- GtkTreeIter treeiter;
- GtkWidget *widget;
- guint i = 0;
- GVariantIter iter;
- GVariant *variant_mode = NULL;
- GVariant *variant_ssid = NULL;
- GVariant *variant_strength = NULL;
- PanelAccessPointItem *ap_item = (PanelAccessPointItem *) user_data;
- CcNetworkPanelPrivate *priv = ap_item->panel->priv;
-
- proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (proxy == NULL) {
- g_printerr ("Error creating proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get the strength */
- variant_strength = g_dbus_proxy_get_cached_property (proxy, "Strength");
- ap_item->strength = g_variant_get_byte (variant_strength);
-
- /* get the mode */
- variant_mode = g_dbus_proxy_get_cached_property (proxy, "Mode");
- ap_item->mode = g_variant_get_uint32 (variant_mode);
-
- /* get the (non NULL terminated, urgh) SSID */
- variant_ssid = g_dbus_proxy_get_cached_property (proxy, "Ssid");
- len = g_variant_iter_init (&iter, variant_ssid);
- if (len == 0) {
- g_warning ("invalid ssid?!");
- goto out;
- }
-
- /* decode each byte */
- ssid = g_new0 (gchar, len + 1);
- while (g_variant_iter_loop (&iter, "y", &tmp))
- ssid[i++] = tmp;
- g_debug ("adding access point %s (%i%%) [%i]", ssid, ap_item->strength, ap_item->mode);
-
- /* add to the model */
- liststore_wireless_network = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_wireless_network"));
- gtk_list_store_append (liststore_wireless_network, &treeiter);
- gtk_list_store_set (liststore_wireless_network,
- &treeiter,
- PANEL_WIRELESS_COLUMN_ID, ap_item->access_point,
- PANEL_WIRELESS_COLUMN_TITLE, ssid,
- PANEL_WIRELESS_COLUMN_SORT, ssid,
- PANEL_WIRELESS_COLUMN_STRENGTH, ap_item->strength,
- PANEL_WIRELESS_COLUMN_MODE, ap_item->mode,
- -1);
-
- /* is this what we're on already? */
- if (g_strcmp0 (ap_item->access_point,
- ap_item->active_access_point) == 0) {
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "combobox_network_name"));
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &treeiter);
- }
+ gchar *ssid = NULL;
+ gchar tmp;
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ gsize len;
+ GtkListStore *liststore_wireless_network;
+ GtkTreeIter treeiter;
+ GtkWidget *widget;
+ guint i = 0;
+ GVariantIter iter;
+ GVariant *variant_mode = NULL;
+ GVariant *variant_ssid = NULL;
+ GVariant *variant_strength = NULL;
+ PanelAccessPointItem *ap_item = (PanelAccessPointItem *) user_data;
+ CcNetworkPanelPrivate *priv = ap_item->panel->priv;
+
+ proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (proxy == NULL) {
+ g_printerr ("Error creating proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get the strength */
+ variant_strength = g_dbus_proxy_get_cached_property (proxy, "Strength");
+ ap_item->strength = g_variant_get_byte (variant_strength);
+
+ /* get the mode */
+ variant_mode = g_dbus_proxy_get_cached_property (proxy, "Mode");
+ ap_item->mode = g_variant_get_uint32 (variant_mode);
+
+ /* get the (non NULL terminated, urgh) SSID */
+ variant_ssid = g_dbus_proxy_get_cached_property (proxy, "Ssid");
+ len = g_variant_iter_init (&iter, variant_ssid);
+ if (len == 0) {
+ g_warning ("invalid ssid?!");
+ goto out;
+ }
+
+ /* decode each byte */
+ ssid = g_new0 (gchar, len + 1);
+ while (g_variant_iter_loop (&iter, "y", &tmp))
+ ssid[i++] = tmp;
+ g_debug ("adding access point %s (%i%%) [%i]", ssid, ap_item->strength, ap_item->mode);
+
+ /* add to the model */
+ liststore_wireless_network = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ "liststore_wireless_network"));
+ gtk_list_store_append (liststore_wireless_network, &treeiter);
+ gtk_list_store_set (liststore_wireless_network,
+ &treeiter,
+ PANEL_WIRELESS_COLUMN_ID, ap_item->access_point,
+ PANEL_WIRELESS_COLUMN_TITLE, ssid,
+ PANEL_WIRELESS_COLUMN_SORT, ssid,
+ PANEL_WIRELESS_COLUMN_STRENGTH, ap_item->strength,
+ PANEL_WIRELESS_COLUMN_MODE, ap_item->mode,
+ -1);
+
+ /* is this what we're on already? */
+ if (g_strcmp0 (ap_item->access_point,
+ ap_item->active_access_point) == 0) {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "combobox_network_name"));
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &treeiter);
+ }
out:
- g_free (ap_item->access_point);
- g_free (ap_item->active_access_point);
- g_object_unref (ap_item->panel);
- g_free (ap_item);
- g_free (ssid);
- if (variant_ssid != NULL)
- g_variant_unref (variant_ssid);
- if (variant_strength != NULL)
- g_variant_unref (variant_strength);
- if (variant_mode != NULL)
- g_variant_unref (variant_mode);
- if (proxy != NULL)
- g_object_unref (proxy);
- return;
+ g_free (ap_item->access_point);
+ g_free (ap_item->active_access_point);
+ g_object_unref (ap_item->panel);
+ g_free (ap_item);
+ g_free (ssid);
+ if (variant_ssid != NULL)
+ g_variant_unref (variant_ssid);
+ if (variant_strength != NULL)
+ g_variant_unref (variant_strength);
+ if (variant_mode != NULL)
+ g_variant_unref (variant_mode);
+ if (proxy != NULL)
+ g_object_unref (proxy);
+ return;
}
@@ -414,22 +414,22 @@ out:
static void
panel_get_access_point_data (PanelDeviceItem *item, const gchar *access_point_id)
{
- PanelAccessPointItem *ap_item;
-
- ap_item = g_new0 (PanelAccessPointItem, 1);
- ap_item->access_point = g_strdup (access_point_id);
- ap_item->active_access_point = g_strdup (item->active_access_point);
- ap_item->panel = g_object_ref (item->panel);
-
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- access_point_id,
- "org.freedesktop.NetworkManager.AccessPoint",
- item->panel->priv->cancellable,
- panel_got_proxy_access_point_cb,
- ap_item);
+ PanelAccessPointItem *ap_item;
+
+ ap_item = g_new0 (PanelAccessPointItem, 1);
+ ap_item->access_point = g_strdup (access_point_id);
+ ap_item->active_access_point = g_strdup (item->active_access_point);
+ ap_item->panel = g_object_ref (item->panel);
+
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ access_point_id,
+ "org.freedesktop.NetworkManager.AccessPoint",
+ item->panel->priv->cancellable,
+ panel_got_proxy_access_point_cb,
+ ap_item);
}
/**
@@ -438,43 +438,43 @@ panel_get_access_point_data (PanelDeviceItem *item, const gchar *access_point_id
static void
panel_get_access_points_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- const gchar *object_path;
- GError *error = NULL;
- gsize len;
- GVariantIter iter;
- GVariant *result = NULL;
- GVariant *test;
- GtkListStore *liststore_wireless_network;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
- CcNetworkPanelPrivate *priv = item->panel->priv;
-
- result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
- if (result == NULL) {
- g_printerr ("Error getting access points: %s\n", error->message);
- g_error_free (error);
- return;
- }
-
- /* clear list of access points */
- liststore_wireless_network = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_wireless_network"));
- gtk_list_store_clear (liststore_wireless_network);
-
- test = g_variant_get_child_value (result, 0);
- len = g_variant_iter_init (&iter, test);
- if (len == 0) {
- g_warning ("no access points?!");
- goto out;
- }
-
- /* for each entry in the array */
- while (g_variant_iter_loop (&iter, "o", &object_path)) {
- g_debug ("adding access point %s", object_path);
- panel_get_access_point_data (item, object_path);
- }
+ const gchar *object_path;
+ GError *error = NULL;
+ gsize len;
+ GVariantIter iter;
+ GVariant *result = NULL;
+ GVariant *test;
+ GtkListStore *liststore_wireless_network;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
+
+ result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
+ if (result == NULL) {
+ g_printerr ("Error getting access points: %s\n", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* clear list of access points */
+ liststore_wireless_network = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ "liststore_wireless_network"));
+ gtk_list_store_clear (liststore_wireless_network);
+
+ test = g_variant_get_child_value (result, 0);
+ len = g_variant_iter_init (&iter, test);
+ if (len == 0) {
+ g_warning ("no access points?!");
+ goto out;
+ }
+
+ /* for each entry in the array */
+ while (g_variant_iter_loop (&iter, "o", &object_path)) {
+ g_debug ("adding access point %s", object_path);
+ panel_get_access_point_data (item, object_path);
+ }
out:
- g_variant_unref (result);
- g_variant_unref (test);
+ g_variant_unref (result);
+ g_variant_unref (test);
}
/**
@@ -483,41 +483,41 @@ out:
static void
panel_got_device_proxy_additional_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- GError *error = NULL;
- GVariant *result = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- item->proxy_additional = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (item->proxy_additional == NULL) {
- g_printerr ("Error creating additional proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* async populate the list of access points */
- if (item->type == NM_DEVICE_TYPE_WIFI) {
-
- /* get the currently active access point */
- result = g_dbus_proxy_get_cached_property (item->proxy_additional, "ActiveAccessPoint");
- item->active_access_point = g_variant_dup_string (result, NULL);
-
- g_dbus_proxy_call (item->proxy_additional,
- "GetAccessPoints",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- item->panel->priv->cancellable,
- panel_get_access_points_cb,
- item);
- }
-
- /* add device if there are no more pending actions */
- if (--item->device_add_refcount == 0)
- panel_add_device_to_listview (item);
+ GError *error = NULL;
+ GVariant *result = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ item->proxy_additional = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (item->proxy_additional == NULL) {
+ g_printerr ("Error creating additional proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* async populate the list of access points */
+ if (item->type == NM_DEVICE_TYPE_WIFI) {
+
+ /* get the currently active access point */
+ result = g_dbus_proxy_get_cached_property (item->proxy_additional, "ActiveAccessPoint");
+ item->active_access_point = g_variant_dup_string (result, NULL);
+
+ g_dbus_proxy_call (item->proxy_additional,
+ "GetAccessPoints",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ item->panel->priv->cancellable,
+ panel_get_access_points_cb,
+ item);
+ }
+
+ /* add device if there are no more pending actions */
+ if (--item->device_add_refcount == 0)
+ panel_add_device_to_listview (item);
out:
- if (result != NULL)
- g_variant_unref (result);
- return;
+ if (result != NULL)
+ g_variant_unref (result);
+ return;
}
/**
@@ -526,27 +526,27 @@ out:
static void
panel_get_registration_info_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- gchar *operator_code = NULL;
- GError *error = NULL;
- guint registration_status;
- GVariant *result = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
- if (result == NULL) {
- g_printerr ("Error getting registration info: %s\n", error->message);
- g_error_free (error);
- return;
- }
-
- /* get values */
- g_variant_get (result, "((uss))",
- ®istration_status,
- &operator_code,
- &item->operator_name);
-
- g_free (operator_code);
- g_variant_unref (result);
+ gchar *operator_code = NULL;
+ GError *error = NULL;
+ guint registration_status;
+ GVariant *result = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
+ if (result == NULL) {
+ g_printerr ("Error getting registration info: %s\n", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* get values */
+ g_variant_get (result, "((uss))",
+ ®istration_status,
+ &operator_code,
+ &item->operator_name);
+
+ g_free (operator_code);
+ g_variant_unref (result);
}
/**
@@ -554,40 +554,40 @@ panel_get_registration_info_cb (GObject *source_object, GAsyncResult *res, gpoin
**/
static void
panel_got_device_proxy_modem_manager_gsm_network_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
- GError *error = NULL;
- GVariant *result = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- item->proxy_additional = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (item->proxy_additional == NULL) {
- g_printerr ("Error creating additional proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get the currently active access point */
- result = g_dbus_proxy_get_cached_property (item->proxy_additional, "AccessTechnology");
-// item->active_access_point = g_variant_dup_string (result, NULL);
-
- g_dbus_proxy_call (item->proxy_additional,
- "GetRegistrationInfo",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- item->panel->priv->cancellable,
- panel_get_registration_info_cb,
- item);
-
- /* add device if there are no more pending actions */
- if (--item->device_add_refcount == 0)
- panel_add_device_to_listview (item);
+ GError *error = NULL;
+ GVariant *result = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ item->proxy_additional = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (item->proxy_additional == NULL) {
+ g_printerr ("Error creating additional proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get the currently active access point */
+ result = g_dbus_proxy_get_cached_property (item->proxy_additional, "AccessTechnology");
+// item->active_access_point = g_variant_dup_string (result, NULL);
+
+ g_dbus_proxy_call (item->proxy_additional,
+ "GetRegistrationInfo",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ item->panel->priv->cancellable,
+ panel_get_registration_info_cb,
+ item);
+
+ /* add device if there are no more pending actions */
+ if (--item->device_add_refcount == 0)
+ panel_add_device_to_listview (item);
out:
- if (result != NULL)
- g_variant_unref (result);
- return;
+ if (result != NULL)
+ g_variant_unref (result);
+ return;
}
/**
@@ -595,31 +595,31 @@ out:
**/
static void
panel_got_device_proxy_modem_manager_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
- GError *error = NULL;
- GVariant *result = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- item->proxy_additional = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (item->proxy_additional == NULL) {
- g_printerr ("Error creating additional proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get the IMEI */
- result = g_dbus_proxy_get_cached_property (item->proxy_additional, "EquipmentIdentifier");
- item->modem_imei = g_variant_dup_string (result, NULL);
-
- /* add device if there are no more pending actions */
- if (--item->device_add_refcount == 0)
- panel_add_device_to_listview (item);
+ GError *error = NULL;
+ GVariant *result = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ item->proxy_additional = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (item->proxy_additional == NULL) {
+ g_printerr ("Error creating additional proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get the IMEI */
+ result = g_dbus_proxy_get_cached_property (item->proxy_additional, "EquipmentIdentifier");
+ item->modem_imei = g_variant_dup_string (result, NULL);
+
+ /* add device if there are no more pending actions */
+ if (--item->device_add_refcount == 0)
+ panel_add_device_to_listview (item);
out:
- if (result != NULL)
- g_variant_unref (result);
- return;
+ if (result != NULL)
+ g_variant_unref (result);
+ return;
}
/**
@@ -627,16 +627,16 @@ out:
**/
static void
panel_device_properties_changed_cb (GDBusProxy *proxy,
- GVariant *changed_properties,
- const gchar* const *invalidated_properties,
- gpointer user_data)
+ GVariant *changed_properties,
+ const gchar* const *invalidated_properties,
+ gpointer user_data)
{
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
- CcNetworkPanelPrivate *priv = item->panel->priv;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
- /* only refresh the selected device */
- if (g_strcmp0 (priv->current_device, item->device_id) == 0)
- panel_device_refresh_item_ui (item);
+ /* only refresh the selected device */
+ if (g_strcmp0 (priv->current_device, item->device_id) == 0)
+ panel_device_refresh_item_ui (item);
}
/**
@@ -644,24 +644,24 @@ panel_device_properties_changed_cb (GDBusProxy *proxy,
**/
static void
panel_got_device_proxy_ip4_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
- GError *error = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- item->proxy_ip4 = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (item->proxy_ip4 == NULL) {
- g_printerr ("Error creating ip4 proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* add device if there are no more pending actions */
- if (--item->device_add_refcount == 0)
- panel_add_device_to_listview (item);
+ GError *error = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ item->proxy_ip4 = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (item->proxy_ip4 == NULL) {
+ g_printerr ("Error creating ip4 proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* add device if there are no more pending actions */
+ if (--item->device_add_refcount == 0)
+ panel_add_device_to_listview (item);
out:
- return;
+ return;
}
/**
@@ -669,24 +669,24 @@ out:
**/
static void
panel_got_device_proxy_ip6_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
- GError *error = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- item->proxy_ip6 = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (item->proxy_ip6 == NULL) {
- g_printerr ("Error creating ip6 proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* add device if there are no more pending actions */
- if (--item->device_add_refcount == 0)
- panel_add_device_to_listview (item);
+ GError *error = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ item->proxy_ip6 = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (item->proxy_ip6 == NULL) {
+ g_printerr ("Error creating ip6 proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* add device if there are no more pending actions */
+ if (--item->device_add_refcount == 0)
+ panel_add_device_to_listview (item);
out:
- return;
+ return;
}
/**
@@ -694,126 +694,126 @@ out:
**/
static void
panel_got_device_proxy_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
- GError *error = NULL;
- GVariant *variant_ip4 = NULL;
- GVariant *variant_ip6 = NULL;
- GVariant *variant_type = NULL;
- GVariant *variant_udi = NULL;
- PanelDeviceItem *item = (PanelDeviceItem *) user_data;
-
- item->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (item->proxy == NULL) {
- g_printerr ("Error creating proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get the UDI, so we can query ModemManager devices */
- variant_udi = g_dbus_proxy_get_cached_property (item->proxy, "Udi");
- g_variant_get (variant_udi, "s", &item->udi);
-
- /* get the IP object paths */
- variant_ip4 = g_dbus_proxy_get_cached_property (item->proxy, "Ip4Config");
- g_variant_get (variant_ip4, "o", &item->ip4_config);
- variant_ip6 = g_dbus_proxy_get_cached_property (item->proxy, "Ip6Config");
- g_variant_get (variant_ip6, "o", &item->ip6_config);
-
- /* get the IP information */
- if (g_strcmp0 (item->ip4_config, "/") != 0) {
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- item->ip4_config,
- "org.freedesktop.NetworkManager.IP4Config",
- item->panel->priv->cancellable,
- panel_got_device_proxy_ip4_cb,
- item);
- }
- if (g_strcmp0 (item->ip6_config, "/") != 0) {
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- item->ip6_config,
- "org.freedesktop.NetworkManager.IP6Config",
- item->panel->priv->cancellable,
- panel_got_device_proxy_ip6_cb,
- item);
- }
-
- /* get the additional interface for this device type */
- variant_type = g_dbus_proxy_get_cached_property (item->proxy, "DeviceType");
- g_variant_get (variant_type, "u", &item->type);
- if (item->type == NM_DEVICE_TYPE_ETHERNET) {
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- item->device_id,
- "org.freedesktop.NetworkManager.Device.Wired",
- item->panel->priv->cancellable,
- panel_got_device_proxy_additional_cb,
- item);
- } else if (item->type == NM_DEVICE_TYPE_WIFI) {
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- item->device_id,
- "org.freedesktop.NetworkManager.Device.Wireless",
- item->panel->priv->cancellable,
- panel_got_device_proxy_additional_cb,
- item);
- } else if (item->type == NM_DEVICE_TYPE_GSM ||
- item->type == NM_DEVICE_TYPE_CDMA) {
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.ModemManager",
- item->udi,
- "org.freedesktop.ModemManager.Modem",
- item->panel->priv->cancellable,
- panel_got_device_proxy_modem_manager_cb,
- item);
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.ModemManager",
- item->udi,
- "org.freedesktop.ModemManager.Modem.Gsm.Network",
- item->panel->priv->cancellable,
- panel_got_device_proxy_modem_manager_gsm_network_cb,
- item);
- }
-
- /* add device if there are no more pending actions */
- if (--item->device_add_refcount == 0)
- panel_add_device_to_listview (item);
-
- /* we want to update the UI */
- g_signal_connect (item->proxy, "g-properties-changed",
- G_CALLBACK (panel_device_properties_changed_cb),
- item);
+ GError *error = NULL;
+ GVariant *variant_ip4 = NULL;
+ GVariant *variant_ip6 = NULL;
+ GVariant *variant_type = NULL;
+ GVariant *variant_udi = NULL;
+ PanelDeviceItem *item = (PanelDeviceItem *) user_data;
+
+ item->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (item->proxy == NULL) {
+ g_printerr ("Error creating proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get the UDI, so we can query ModemManager devices */
+ variant_udi = g_dbus_proxy_get_cached_property (item->proxy, "Udi");
+ g_variant_get (variant_udi, "s", &item->udi);
+
+ /* get the IP object paths */
+ variant_ip4 = g_dbus_proxy_get_cached_property (item->proxy, "Ip4Config");
+ g_variant_get (variant_ip4, "o", &item->ip4_config);
+ variant_ip6 = g_dbus_proxy_get_cached_property (item->proxy, "Ip6Config");
+ g_variant_get (variant_ip6, "o", &item->ip6_config);
+
+ /* get the IP information */
+ if (g_strcmp0 (item->ip4_config, "/") != 0) {
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ item->ip4_config,
+ "org.freedesktop.NetworkManager.IP4Config",
+ item->panel->priv->cancellable,
+ panel_got_device_proxy_ip4_cb,
+ item);
+ }
+ if (g_strcmp0 (item->ip6_config, "/") != 0) {
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ item->ip6_config,
+ "org.freedesktop.NetworkManager.IP6Config",
+ item->panel->priv->cancellable,
+ panel_got_device_proxy_ip6_cb,
+ item);
+ }
+
+ /* get the additional interface for this device type */
+ variant_type = g_dbus_proxy_get_cached_property (item->proxy, "DeviceType");
+ g_variant_get (variant_type, "u", &item->type);
+ if (item->type == NM_DEVICE_TYPE_ETHERNET) {
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ item->device_id,
+ "org.freedesktop.NetworkManager.Device.Wired",
+ item->panel->priv->cancellable,
+ panel_got_device_proxy_additional_cb,
+ item);
+ } else if (item->type == NM_DEVICE_TYPE_WIFI) {
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ item->device_id,
+ "org.freedesktop.NetworkManager.Device.Wireless",
+ item->panel->priv->cancellable,
+ panel_got_device_proxy_additional_cb,
+ item);
+ } else if (item->type == NM_DEVICE_TYPE_GSM ||
+ item->type == NM_DEVICE_TYPE_CDMA) {
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.ModemManager",
+ item->udi,
+ "org.freedesktop.ModemManager.Modem",
+ item->panel->priv->cancellable,
+ panel_got_device_proxy_modem_manager_cb,
+ item);
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.ModemManager",
+ item->udi,
+ "org.freedesktop.ModemManager.Modem.Gsm.Network",
+ item->panel->priv->cancellable,
+ panel_got_device_proxy_modem_manager_gsm_network_cb,
+ item);
+ }
+
+ /* add device if there are no more pending actions */
+ if (--item->device_add_refcount == 0)
+ panel_add_device_to_listview (item);
+
+ /* we want to update the UI */
+ g_signal_connect (item->proxy, "g-properties-changed",
+ G_CALLBACK (panel_device_properties_changed_cb),
+ item);
out:
- if (variant_ip4 != NULL)
- g_variant_unref (variant_ip4);
- if (variant_ip6 != NULL)
- g_variant_unref (variant_ip6);
- if (variant_udi != NULL)
- g_variant_unref (variant_udi);
- if (variant_type != NULL)
- g_variant_unref (variant_type);
- return;
+ if (variant_ip4 != NULL)
+ g_variant_unref (variant_ip4);
+ if (variant_ip6 != NULL)
+ g_variant_unref (variant_ip6);
+ if (variant_udi != NULL)
+ g_variant_unref (variant_udi);
+ if (variant_type != NULL)
+ g_variant_unref (variant_type);
+ return;
}
/**
@@ -822,27 +822,27 @@ out:
static void
panel_add_device (CcNetworkPanel *panel, const gchar *device_id)
{
- PanelDeviceItem *item;
-
- /* create temp device */
- item = g_new0 (PanelDeviceItem, 1);
- item->panel = g_object_ref (panel);
- item->device_id = g_strdup (device_id);
-
- /* add to array */
- g_ptr_array_add (panel->priv->devices, item);
-
- /* get initial device state */
- item->device_add_refcount++;
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- device_id,
- "org.freedesktop.NetworkManager.Device",
- panel->priv->cancellable,
- panel_got_device_proxy_cb,
- item);
+ PanelDeviceItem *item;
+
+ /* create temp device */
+ item = g_new0 (PanelDeviceItem, 1);
+ item->panel = g_object_ref (panel);
+ item->device_id = g_strdup (device_id);
+
+ /* add to array */
+ g_ptr_array_add (panel->priv->devices, item);
+
+ /* get initial device state */
+ item->device_add_refcount++;
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ device_id,
+ "org.freedesktop.NetworkManager.Device",
+ panel->priv->cancellable,
+ panel_got_device_proxy_cb,
+ item);
}
/**
@@ -851,41 +851,41 @@ panel_add_device (CcNetworkPanel *panel, const gchar *device_id)
static void
panel_remove_device (CcNetworkPanel *panel, const gchar *device_id)
{
- gboolean ret;
- gchar *id_tmp;
- GtkTreeIter iter;
- GtkTreeModel *model;
- guint i;
- PanelDeviceItem *item;
-
- /* remove device from array */
- for (i=0; i<panel->priv->devices->len; i++) {
- item = g_ptr_array_index (panel->priv->devices, i);
- if (g_strcmp0 (item->device_id, device_id) == 0) {
- g_ptr_array_remove_index_fast (panel->priv->devices, i);
- break;
- }
- }
-
- /* remove device from model */
- model = GTK_TREE_MODEL (gtk_builder_get_object (panel->priv->builder,
- "liststore_devices"));
- ret = gtk_tree_model_get_iter_first (model, &iter);
- if (!ret)
- return;
-
- /* get the other elements */
- do {
- gtk_tree_model_get (model, &iter,
- PANEL_DEVICES_COLUMN_ID, &id_tmp,
- -1);
- if (g_strcmp0 (id_tmp, device_id) == 0) {
- gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
- g_free (id_tmp);
- break;
- }
- g_free (id_tmp);
- } while (gtk_tree_model_iter_next (model, &iter));
+ gboolean ret;
+ gchar *id_tmp;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ guint i;
+ PanelDeviceItem *item;
+
+ /* remove device from array */
+ for (i=0; i<panel->priv->devices->len; i++) {
+ item = g_ptr_array_index (panel->priv->devices, i);
+ if (g_strcmp0 (item->device_id, device_id) == 0) {
+ g_ptr_array_remove_index_fast (panel->priv->devices, i);
+ break;
+ }
+ }
+
+ /* remove device from model */
+ model = GTK_TREE_MODEL (gtk_builder_get_object (panel->priv->builder,
+ "liststore_devices"));
+ ret = gtk_tree_model_get_iter_first (model, &iter);
+ if (!ret)
+ return;
+
+ /* get the other elements */
+ do {
+ gtk_tree_model_get (model, &iter,
+ PANEL_DEVICES_COLUMN_ID, &id_tmp,
+ -1);
+ if (g_strcmp0 (id_tmp, device_id) == 0) {
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ g_free (id_tmp);
+ break;
+ }
+ g_free (id_tmp);
+ } while (gtk_tree_model_iter_next (model, &iter));
}
/**
@@ -894,36 +894,36 @@ panel_remove_device (CcNetworkPanel *panel, const gchar *device_id)
static void
panel_get_devices_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- CcNetworkPanel *panel = CC_NETWORK_PANEL (user_data);
- const gchar *object_path;
- GError *error = NULL;
- gsize len;
- GVariantIter iter;
- GVariant *child;
- GVariant *result;
-
- result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
- if (result == NULL) {
- g_printerr ("Error getting devices: %s\n", error->message);
- g_error_free (error);
- return;
- }
-
- child = g_variant_get_child_value (result, 0);
- len = g_variant_iter_init (&iter, child);
- if (len == 0) {
- g_warning ("no devices?!");
- goto out;
- }
-
- /* for each entry in the array */
- while (g_variant_iter_loop (&iter, "o", &object_path)) {
- g_debug ("adding network device %s", object_path);
- panel_add_device (panel, object_path);
- }
+ CcNetworkPanel *panel = CC_NETWORK_PANEL (user_data);
+ const gchar *object_path;
+ GError *error = NULL;
+ gsize len;
+ GVariantIter iter;
+ GVariant *child;
+ GVariant *result;
+
+ result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
+ if (result == NULL) {
+ g_printerr ("Error getting devices: %s\n", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ child = g_variant_get_child_value (result, 0);
+ len = g_variant_iter_init (&iter, child);
+ if (len == 0) {
+ g_warning ("no devices?!");
+ goto out;
+ }
+
+ /* for each entry in the array */
+ while (g_variant_iter_loop (&iter, "o", &object_path)) {
+ g_debug ("adding network device %s", object_path);
+ panel_add_device (panel, object_path);
+ }
out:
- g_variant_unref (result);
- g_variant_unref (child);
+ g_variant_unref (result);
+ g_variant_unref (child);
}
@@ -932,35 +932,35 @@ out:
**/
static void
panel_dbus_manager_signal_cb (GDBusProxy *proxy,
- gchar *sender_name,
- gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
+ gchar *sender_name,
+ gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
{
- gchar *object_path = NULL;
- CcNetworkPanel *panel = CC_NETWORK_PANEL (user_data);
-
- /* get the new state */
- if (g_strcmp0 (signal_name, "StateChanged") == 0) {
- g_debug ("ensure devices are correct");
- goto out;
- }
-
- /* device added or removed */
- if (g_strcmp0 (signal_name, "DeviceAdded") == 0) {
- g_variant_get (parameters, "(o)", &object_path);
- panel_add_device (panel, object_path);
- goto out;
- }
-
- /* device added or removed */
- if (g_strcmp0 (signal_name, "DeviceRemoved") == 0) {
- g_variant_get (parameters, "(o)", &object_path);
- panel_remove_device (panel, object_path);
- goto out;
- }
+ gchar *object_path = NULL;
+ CcNetworkPanel *panel = CC_NETWORK_PANEL (user_data);
+
+ /* get the new state */
+ if (g_strcmp0 (signal_name, "StateChanged") == 0) {
+ g_debug ("ensure devices are correct");
+ goto out;
+ }
+
+ /* device added or removed */
+ if (g_strcmp0 (signal_name, "DeviceAdded") == 0) {
+ g_variant_get (parameters, "(o)", &object_path);
+ panel_add_device (panel, object_path);
+ goto out;
+ }
+
+ /* device added or removed */
+ if (g_strcmp0 (signal_name, "DeviceRemoved") == 0) {
+ g_variant_get (parameters, "(o)", &object_path);
+ panel_remove_device (panel, object_path);
+ goto out;
+ }
out:
- g_free (object_path);
+ g_free (object_path);
}
/**
@@ -969,33 +969,33 @@ out:
static void
panel_got_network_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
- GError *error = NULL;
- CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (user_data)->priv;
-
- priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (priv->proxy == NULL) {
- g_printerr ("Error creating proxy: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* we want to change the UI in reflection to device events */
- g_signal_connect (priv->proxy,
- "g-signal",
- G_CALLBACK (panel_dbus_manager_signal_cb),
- user_data);
-
- /* get the new state */
- g_dbus_proxy_call (priv->proxy,
- "GetDevices",
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- priv->cancellable,
- panel_get_devices_cb,
- user_data);
+ GError *error = NULL;
+ CcNetworkPanelPrivate *priv = CC_NETWORK_PANEL (user_data)->priv;
+
+ priv->proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (priv->proxy == NULL) {
+ g_printerr ("Error creating proxy: %s\n", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* we want to change the UI in reflection to device events */
+ g_signal_connect (priv->proxy,
+ "g-signal",
+ G_CALLBACK (panel_dbus_manager_signal_cb),
+ user_data);
+
+ /* get the new state */
+ g_dbus_proxy_call (priv->proxy,
+ "GetDevices",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ priv->cancellable,
+ panel_get_devices_cb,
+ user_data);
out:
- return;
+ return;
}
/**
@@ -1004,35 +1004,35 @@ out:
static void
panel_add_devices_columns (CcNetworkPanel *panel, GtkTreeView *treeview)
{
- CcNetworkPanelPrivate *priv = panel->priv;
- GtkCellRenderer *renderer;
- GtkListStore *liststore_devices;
- GtkTreeViewColumn *column;
-
- /* image */
- renderer = gtk_cell_renderer_pixbuf_new ();
- g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DND, NULL);
- column = gtk_tree_view_column_new_with_attributes ("", renderer,
- "icon-name", PANEL_DEVICES_COLUMN_ICON,
- NULL);
- gtk_tree_view_append_column (treeview, column);
-
- /* column for text */
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "wrap-mode", PANGO_WRAP_WORD,
- NULL);
- column = gtk_tree_view_column_new_with_attributes ("", renderer,
- "markup", PANEL_DEVICES_COLUMN_TITLE,
- NULL);
- gtk_tree_view_column_set_sort_column_id (column, PANEL_DEVICES_COLUMN_SORT);
- liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
- "liststore_devices"));
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (liststore_devices),
- PANEL_DEVICES_COLUMN_SORT,
- GTK_SORT_ASCENDING);
- gtk_tree_view_append_column (treeview, column);
- gtk_tree_view_column_set_expand (column, TRUE);
+ CcNetworkPanelPrivate *priv = panel->priv;
+ GtkCellRenderer *renderer;
+ GtkListStore *liststore_devices;
+ GtkTreeViewColumn *column;
+
+ /* image */
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ g_object_set (renderer, "stock-size", GTK_ICON_SIZE_DND, NULL);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "icon-name", PANEL_DEVICES_COLUMN_ICON,
+ NULL);
+ gtk_tree_view_append_column (treeview, column);
+
+ /* column for text */
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (renderer,
+ "wrap-mode", PANGO_WRAP_WORD,
+ NULL);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "markup", PANEL_DEVICES_COLUMN_TITLE,
+ NULL);
+ gtk_tree_view_column_set_sort_column_id (column, PANEL_DEVICES_COLUMN_SORT);
+ liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
+ "liststore_devices"));
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (liststore_devices),
+ PANEL_DEVICES_COLUMN_SORT,
+ GTK_SORT_ASCENDING);
+ gtk_tree_view_append_column (treeview, column);
+ gtk_tree_view_column_set_expand (column, TRUE);
}
/**
@@ -1041,10 +1041,10 @@ panel_add_devices_columns (CcNetworkPanel *panel, GtkTreeView *treeview)
static void
panel_set_label_for_variant_string (GtkWidget *widget, GVariant *variant)
{
- gchar *tmp;
- g_variant_get (variant, "s", &tmp);
- gtk_label_set_label (GTK_LABEL (widget), tmp);
- g_free (tmp);
+ gchar *tmp;
+ g_variant_get (variant, "s", &tmp);
+ gtk_label_set_label (GTK_LABEL (widget), tmp);
+ g_free (tmp);
}
/**
@@ -1053,18 +1053,18 @@ panel_set_label_for_variant_string (GtkWidget *widget, GVariant *variant)
static void
panel_set_label_for_variant_speed (GtkWidget *widget, GVariant *variant)
{
- guint speed;
- gchar *tmp;
-
- /* format with correct scale */
- g_variant_get (variant, "u", &speed);
- if (speed < 1000) {
- tmp = g_strdup_printf (_("%i Mb/s"), speed);
- } else {
- tmp = g_strdup_printf (_("%i Gb/s"), speed / 1000);
- }
- gtk_label_set_label (GTK_LABEL (widget), tmp);
- g_free (tmp);
+ guint speed;
+ gchar *tmp;
+
+ /* format with correct scale */
+ g_variant_get (variant, "u", &speed);
+ if (speed < 1000) {
+ tmp = g_strdup_printf (_("%i Mb/s"), speed);
+ } else {
+ tmp = g_strdup_printf (_("%i Gb/s"), speed / 1000);
+ }
+ gtk_label_set_label (GTK_LABEL (widget), tmp);
+ g_free (tmp);
}
/**
@@ -1073,18 +1073,18 @@ panel_set_label_for_variant_speed (GtkWidget *widget, GVariant *variant)
static void
panel_set_label_for_variant_bitrate (GtkWidget *widget, GVariant *variant)
{
- guint bitrate;
- gchar *tmp;
-
- /* format with correct scale */
- g_variant_get (variant, "u", &bitrate);
- if (bitrate < 1000) {
- tmp = g_strdup_printf (_("%i kb/s"), bitrate);
- } else {
- tmp = g_strdup_printf (_("%i Mb/s"), bitrate / 1000);
- }
- gtk_label_set_label (GTK_LABEL (widget), tmp);
- g_free (tmp);
+ guint bitrate;
+ gchar *tmp;
+
+ /* format with correct scale */
+ g_variant_get (variant, "u", &bitrate);
+ if (bitrate < 1000) {
+ tmp = g_strdup_printf (_("%i kb/s"), bitrate);
+ } else {
+ tmp = g_strdup_printf (_("%i Mb/s"), bitrate / 1000);
+ }
+ gtk_label_set_label (GTK_LABEL (widget), tmp);
+ g_free (tmp);
}
/**
@@ -1093,10 +1093,10 @@ panel_set_label_for_variant_bitrate (GtkWidget *widget, GVariant *variant)
static void
panel_set_label_for_variant_ipv4 (GtkWidget *widget, GVariant *variant)
{
- gchar *ip_str;
- ip_str = panel_ipv4_to_string (variant);
- gtk_label_set_label (GTK_LABEL (widget), ip_str);
- g_free (ip_str);
+ gchar *ip_str;
+ ip_str = panel_ipv4_to_string (variant);
+ gtk_label_set_label (GTK_LABEL (widget), ip_str);
+ g_free (ip_str);
}
/**
@@ -1108,59 +1108,59 @@ panel_set_label_for_variant_ipv4 (GtkWidget *widget, GVariant *variant)
static gboolean
panel_set_label_for_variant_ipv4_array_array (GtkWidget *widget, GVariant *variant)
{
- gboolean ret;
- gchar *tmp;
- gsize len;
- GString *string;
- guint i;
- GVariantIter iter;
- GVariant *outer;
- GVariant *value;
-
- string = g_string_new ("");
-
- /* get an iter of the outer array */
- len = g_variant_iter_init (&iter, variant);
-
- /* unwrap the outer array */
- outer = g_variant_iter_next_value (&iter);
- while (outer != NULL) {
-
- /* unwrap the inner array */
- len = g_variant_n_children (outer);
- if (len == 0) {
- g_warning ("invalid ipv4 address on inner?!");
- goto out;
- }
- for (i=0; i<len; i++) {
- value = g_variant_get_child_value (outer, i);
- tmp = panel_ipv4_to_string (value);
-
- /* ignore invalid entries: TODO why? */
- if (g_str_has_suffix (tmp, ".0")) {
- g_debug ("ignoring IP %s", tmp);
- } else {
- g_debug ("got IP %s", tmp);
- g_string_append_printf (string,
- "%s, ",
- tmp);
- }
- g_free (tmp);
- g_variant_unref (value);
- }
- outer = g_variant_iter_next_value (&iter);
- }
-
- /* remove trailing space comma */
- if (string->len > 2)
- g_string_set_size (string, string->len - 2);
-
- /* set label */
- gtk_label_set_label (GTK_LABEL (widget), string->str);
+ gboolean ret;
+ gchar *tmp;
+ gsize len;
+ GString *string;
+ guint i;
+ GVariantIter iter;
+ GVariant *outer;
+ GVariant *value;
+
+ string = g_string_new ("");
+
+ /* get an iter of the outer array */
+ len = g_variant_iter_init (&iter, variant);
+
+ /* unwrap the outer array */
+ outer = g_variant_iter_next_value (&iter);
+ while (outer != NULL) {
+
+ /* unwrap the inner array */
+ len = g_variant_n_children (outer);
+ if (len == 0) {
+ g_warning ("invalid ipv4 address on inner?!");
+ goto out;
+ }
+ for (i=0; i<len; i++) {
+ value = g_variant_get_child_value (outer, i);
+ tmp = panel_ipv4_to_string (value);
+
+ /* ignore invalid entries: TODO why? */
+ if (g_str_has_suffix (tmp, ".0")) {
+ g_debug ("ignoring IP %s", tmp);
+ } else {
+ g_debug ("got IP %s", tmp);
+ g_string_append_printf (string,
+ "%s, ",
+ tmp);
+ }
+ g_free (tmp);
+ g_variant_unref (value);
+ }
+ outer = g_variant_iter_next_value (&iter);
+ }
+
+ /* remove trailing space comma */
+ if (string->len > 2)
+ g_string_set_size (string, string->len - 2);
+
+ /* set label */
+ gtk_label_set_label (GTK_LABEL (widget), string->str);
out:
- ret = string->len > 0;
- g_string_free (string, TRUE);
- return ret;
+ ret = string->len > 0;
+ g_string_free (string, TRUE);
+ return ret;
}
/**
@@ -1171,45 +1171,45 @@ out:
static void
panel_set_label_for_variant_ipv4_array (GtkWidget *widget, GVariant *variant)
{
- gchar *tmp;
- gsize len;
- GString *string;
- guint i;
- GVariant *value;
-
- string = g_string_new ("");
-
- /* unwrap the array */
- len = g_variant_n_children (variant);
- if (len == 0) {
- g_warning ("invalid ipv4 address on inner?!");
- goto out;
- }
- for (i=0; i<len; i++) {
- value = g_variant_get_child_value (variant, i);
- tmp = panel_ipv4_to_string (value);
-
- /* ignore invalid entries: TODO why? */
- if (g_str_has_suffix (tmp, ".0")) {
- g_debug ("ignoring IP %s", tmp);
- } else {
- g_debug ("got IP %s", tmp);
- g_string_append_printf (string,
- "%s, ",
- tmp);
- }
- g_free (tmp);
- g_variant_unref (value);
- }
-
- /* remove trailing space comma */
- if (string->len > 2)
- g_string_set_size (string, string->len - 2);
-
- /* set label */
- gtk_label_set_label (GTK_LABEL (widget), string->str);
+ gchar *tmp;
+ gsize len;
+ GString *string;
+ guint i;
+ GVariant *value;
+
+ string = g_string_new ("");
+
+ /* unwrap the array */
+ len = g_variant_n_children (variant);
+ if (len == 0) {
+ g_warning ("invalid ipv4 address on inner?!");
+ goto out;
+ }
+ for (i=0; i<len; i++) {
+ value = g_variant_get_child_value (variant, i);
+ tmp = panel_ipv4_to_string (value);
+
+ /* ignore invalid entries: TODO why? */
+ if (g_str_has_suffix (tmp, ".0")) {
+ g_debug ("ignoring IP %s", tmp);
+ } else {
+ g_debug ("got IP %s", tmp);
+ g_string_append_printf (string,
+ "%s, ",
+ tmp);
+ }
+ g_free (tmp);
+ g_variant_unref (value);
+ }
+
+ /* remove trailing space comma */
+ if (string->len > 2)
+ g_string_set_size (string, string->len - 2);
+
+ /* set label */
+ gtk_label_set_label (GTK_LABEL (widget), string->str);
out:
- g_string_free (string, TRUE);
+ g_string_free (string, TRUE);
}
/**
@@ -1221,47 +1221,47 @@ out:
static gboolean
panel_set_label_for_variant_ipv6_prefixed_array (GtkWidget *widget, GVariant *variant)
{
- GString *string;
- gchar *tmp;
- GVariant *outer;
- GVariantIter iter;
- gsize len;
- GVariant *address;
- guint32 prefix;
- gboolean ret = FALSE;
-
- string = g_string_new ("");
-
- /* get an iter of the outer array */
- len = g_variant_iter_init (&iter, variant);
- if (len == 0) {
- g_debug ("no ipv6 address");
- goto out;
- }
-
- /* unwrap the outer array */
- outer = g_variant_iter_next_value (&iter);
- while (outer != NULL) {
-
- /* format the address and add to the string */
- address = g_variant_get_child_value (outer, 0);
- tmp = panel_ipv6_to_string (address);
- g_variant_get_child (outer, 1, "u", &prefix);
- g_string_append_printf (string, "%s/%i, ", tmp, prefix);
-
- outer = g_variant_iter_next_value (&iter);
- }
-
- /* remove trailing space comma */
- if (string->len > 2)
- g_string_set_size (string, string->len - 2);
-
- /* set label */
- gtk_label_set_label (GTK_LABEL (widget), string->str);
+ GString *string;
+ gchar *tmp;
+ GVariant *outer;
+ GVariantIter iter;
+ gsize len;
+ GVariant *address;
+ guint32 prefix;
+ gboolean ret = FALSE;
+
+ string = g_string_new ("");
+
+ /* get an iter of the outer array */
+ len = g_variant_iter_init (&iter, variant);
+ if (len == 0) {
+ g_debug ("no ipv6 address");
+ goto out;
+ }
+
+ /* unwrap the outer array */
+ outer = g_variant_iter_next_value (&iter);
+ while (outer != NULL) {
+
+ /* format the address and add to the string */
+ address = g_variant_get_child_value (outer, 0);
+ tmp = panel_ipv6_to_string (address);
+ g_variant_get_child (outer, 1, "u", &prefix);
+ g_string_append_printf (string, "%s/%i, ", tmp, prefix);
+
+ outer = g_variant_iter_next_value (&iter);
+ }
+
+ /* remove trailing space comma */
+ if (string->len > 2)
+ g_string_set_size (string, string->len - 2);
+
+ /* set label */
+ gtk_label_set_label (GTK_LABEL (widget), string->str);
out:
- ret = string->len > 0;
- g_string_free (string, TRUE);
- return ret;
+ ret = string->len > 0;
+ g_string_free (string, TRUE);
+ return ret;
}
/**
@@ -1273,43 +1273,43 @@ out:
static gboolean
panel_set_label_for_variant_ipv6_array (GtkWidget *widget, GVariant *variant)
{
- gboolean ret = FALSE;
- GString *string;
- gchar *tmp;
- GVariantIter iter;
- gsize len;
- GVariant *address;
-
- string = g_string_new ("");
-
- /* get an iter of the outer array */
- len = g_variant_iter_init (&iter, variant);
- if (len == 0) {
- g_debug ("no ipv6 address");
- goto out;
- }
-
- /* unwrap the outer array */
- address = g_variant_iter_next_value (&iter);
- while (address != NULL) {
-
- /* format the address and add to the string */
- tmp = panel_ipv6_to_string (address);
- g_string_append_printf (string, "%s, ", tmp);
-
- address = g_variant_iter_next_value (&iter);
- }
-
- /* remove trailing space comma */
- if (string->len > 2)
- g_string_set_size (string, string->len - 2);
-
- /* set label */
- gtk_label_set_label (GTK_LABEL (widget), string->str);
+ gboolean ret = FALSE;
+ GString *string;
+ gchar *tmp;
+ GVariantIter iter;
+ gsize len;
+ GVariant *address;
+
+ string = g_string_new ("");
+
+ /* get an iter of the outer array */
+ len = g_variant_iter_init (&iter, variant);
+ if (len == 0) {
+ g_debug ("no ipv6 address");
+ goto out;
+ }
+
+ /* unwrap the outer array */
+ address = g_variant_iter_next_value (&iter);
+ while (address != NULL) {
+
+ /* format the address and add to the string */
+ tmp = panel_ipv6_to_string (address);
+ g_string_append_printf (string, "%s, ", tmp);
+
+ address = g_variant_iter_next_value (&iter);
+ }
+
+ /* remove trailing space comma */
+ if (string->len > 2)
+ g_string_set_size (string, string->len - 2);
+
+ /* set label */
+ gtk_label_set_label (GTK_LABEL (widget), string->str);
out:
- ret = string->len > 0;
- g_string_free (string, TRUE);
- return ret;
+ ret = string->len > 0;
+ g_string_free (string, TRUE);
+ return ret;
}
/**
@@ -1318,139 +1318,139 @@ out:
static void
panel_populate_wired_device (PanelDeviceItem *item)
{
- gboolean ret;
- GtkWidget *widget;
- GVariant *hw_address;
- GVariant *ip4 = NULL;
- GVariant *ip6 = NULL;
- GVariant *nameservers = NULL;
- GVariant *routes = NULL;
- GVariant *speed;
- CcNetworkPanelPrivate *priv = item->panel->priv;
-
- /* set IPv6 */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_ip6"));
- if (item->proxy_ip6 != NULL) {
- gtk_widget_show (widget);
-
- /* array of (ipdata, prefix, route) */
- ip6 = g_dbus_proxy_get_cached_property (item->proxy_ip6,
- "Addresses");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_ip6"));
- panel_set_label_for_variant_ipv6_prefixed_array (widget, ip6);
-
- /* array of (ipdata, prefix, route) */
- routes = g_dbus_proxy_get_cached_property (item->proxy_ip6,
- "Routes");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_route"));
- ret = panel_set_label_for_variant_ipv6_prefixed_array (widget, routes);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_route"));
- gtk_widget_set_visible (widget, ret);
-
- /* array of ipdata */
- nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip6,
- "Nameservers");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_dns"));
- ret = panel_set_label_for_variant_ipv6_array (widget, nameservers);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_dns"));
- gtk_widget_set_visible (widget, ret);
-
- /* Domains = array of string */
- //no widget
-
- /* i'm not sure how to get this yet */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_subnet"));
- gtk_widget_hide (widget);
- } else {
- gtk_widget_hide (widget);
- }
-
- /* set IPv4 */
- if (item->proxy_ip4 != NULL) {
- /* array of (array of uint32) */
- ip4 = g_dbus_proxy_get_cached_property (item->proxy_ip4,
- "Addresses");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_ip4"));
- panel_set_label_for_variant_ipv4_array_array (widget, ip4);
-
- /* array of (array of uint32) */
- routes = g_dbus_proxy_get_cached_property (item->proxy_ip4,
- "Routes");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_route"));
- ret = panel_set_label_for_variant_ipv4_array_array (widget, routes);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_route"));
- gtk_widget_set_visible (widget, ret);
-
- /* array of uint32 */
- nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip4,
- "Nameservers");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_dns"));
- panel_set_label_for_variant_ipv4_array (widget, nameservers);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_dns"));
- gtk_widget_show (widget);
-
- /* Domains = array of string */
- //no widget
- /* WinsServers = array of uint32 */
- //no widget
-
- /* i'm not sure how to get this yet */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_subnet"));
- gtk_widget_hide (widget);
-
- } else {
- ip4 = g_dbus_proxy_get_cached_property (item->proxy,
- "Ip4Address");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_ip4"));
- panel_set_label_for_variant_ipv4 (widget, ip4);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_route"));
- gtk_widget_hide (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_dns"));
- gtk_widget_hide (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wired_subnet"));
- gtk_widget_hide (widget);
- }
-
- /* set MAC */
- hw_address = g_dbus_proxy_get_cached_property (item->proxy_additional,
- "HwAddress");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_mac"));
- panel_set_label_for_variant_string (widget, hw_address);
-
- /* set speed */
- speed = g_dbus_proxy_get_cached_property (item->proxy_additional, "Speed");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wired_speed"));
- panel_set_label_for_variant_speed (widget, speed);
-
- if (ip4 != NULL)
- g_variant_unref (ip4);
- if (ip6 != NULL)
- g_variant_unref (ip6);
- if (routes != NULL)
- g_variant_unref (routes);
- if (nameservers != NULL)
- g_variant_unref (nameservers);
- g_variant_unref (hw_address);
- g_variant_unref (speed);
+ gboolean ret;
+ GtkWidget *widget;
+ GVariant *hw_address;
+ GVariant *ip4 = NULL;
+ GVariant *ip6 = NULL;
+ GVariant *nameservers = NULL;
+ GVariant *routes = NULL;
+ GVariant *speed;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
+
+ /* set IPv6 */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_ip6"));
+ if (item->proxy_ip6 != NULL) {
+ gtk_widget_show (widget);
+
+ /* array of (ipdata, prefix, route) */
+ ip6 = g_dbus_proxy_get_cached_property (item->proxy_ip6,
+ "Addresses");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_ip6"));
+ panel_set_label_for_variant_ipv6_prefixed_array (widget, ip6);
+
+ /* array of (ipdata, prefix, route) */
+ routes = g_dbus_proxy_get_cached_property (item->proxy_ip6,
+ "Routes");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_route"));
+ ret = panel_set_label_for_variant_ipv6_prefixed_array (widget, routes);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_route"));
+ gtk_widget_set_visible (widget, ret);
+
+ /* array of ipdata */
+ nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip6,
+ "Nameservers");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_dns"));
+ ret = panel_set_label_for_variant_ipv6_array (widget, nameservers);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_dns"));
+ gtk_widget_set_visible (widget, ret);
+
+ /* Domains = array of string */
+ //no widget
+
+ /* i'm not sure how to get this yet */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_subnet"));
+ gtk_widget_hide (widget);
+ } else {
+ gtk_widget_hide (widget);
+ }
+
+ /* set IPv4 */
+ if (item->proxy_ip4 != NULL) {
+ /* array of (array of uint32) */
+ ip4 = g_dbus_proxy_get_cached_property (item->proxy_ip4,
+ "Addresses");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_ip4"));
+ panel_set_label_for_variant_ipv4_array_array (widget, ip4);
+
+ /* array of (array of uint32) */
+ routes = g_dbus_proxy_get_cached_property (item->proxy_ip4,
+ "Routes");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_route"));
+ ret = panel_set_label_for_variant_ipv4_array_array (widget, routes);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_route"));
+ gtk_widget_set_visible (widget, ret);
+
+ /* array of uint32 */
+ nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip4,
+ "Nameservers");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_dns"));
+ panel_set_label_for_variant_ipv4_array (widget, nameservers);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_dns"));
+ gtk_widget_show (widget);
+
+ /* Domains = array of string */
+ //no widget
+ /* WinsServers = array of uint32 */
+ //no widget
+
+ /* i'm not sure how to get this yet */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_subnet"));
+ gtk_widget_hide (widget);
+
+ } else {
+ ip4 = g_dbus_proxy_get_cached_property (item->proxy,
+ "Ip4Address");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_ip4"));
+ panel_set_label_for_variant_ipv4 (widget, ip4);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_route"));
+ gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_dns"));
+ gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wired_subnet"));
+ gtk_widget_hide (widget);
+ }
+
+ /* set MAC */
+ hw_address = g_dbus_proxy_get_cached_property (item->proxy_additional,
+ "HwAddress");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_mac"));
+ panel_set_label_for_variant_string (widget, hw_address);
+
+ /* set speed */
+ speed = g_dbus_proxy_get_cached_property (item->proxy_additional, "Speed");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wired_speed"));
+ panel_set_label_for_variant_speed (widget, speed);
+
+ if (ip4 != NULL)
+ g_variant_unref (ip4);
+ if (ip6 != NULL)
+ g_variant_unref (ip6);
+ if (routes != NULL)
+ g_variant_unref (routes);
+ if (nameservers != NULL)
+ g_variant_unref (nameservers);
+ g_variant_unref (hw_address);
+ g_variant_unref (speed);
}
/**
@@ -1459,125 +1459,125 @@ panel_populate_wired_device (PanelDeviceItem *item)
static void
panel_populate_wireless_device (PanelDeviceItem *item)
{
- gboolean ret;
- GtkWidget *widget;
- GVariant *bitrate;
- GVariant *hw_address;
- GVariant *ip4;
- GVariant *ip6;
- GVariant *nameservers = NULL;
- GVariant *routes = NULL;
- CcNetworkPanelPrivate *priv = item->panel->priv;
-
- /* set IPv6 */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_ip6"));
- if (item->proxy_ip6 != NULL) {
- gtk_widget_show (widget);
-
- /* array of (ipdata, prefix, route) */
- ip6 = g_dbus_proxy_get_cached_property (item->proxy_ip6,
- "Addresses");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_ip6"));
- panel_set_label_for_variant_ipv6_prefixed_array (widget, ip6);
-
- /* array of (ipdata, prefix, route) */
- routes = g_dbus_proxy_get_cached_property (item->proxy_ip6,
- "Routes");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_route"));
- ret = panel_set_label_for_variant_ipv6_prefixed_array (widget, routes);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_route"));
- gtk_widget_set_visible (widget, ret);
-
- /* array of ipdata */
- nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip6,
- "Nameservers");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_dns"));
- ret = panel_set_label_for_variant_ipv6_array (widget, nameservers);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_dns"));
- gtk_widget_set_visible (widget, ret);
-
- /* Domains = array of string */
- //no widget
- } else {
- gtk_widget_hide (widget);
- }
-
- /* set IPv4 */
- if (item->proxy_ip4 != NULL) {
- /* array of (array of uint32) */
- ip4 = g_dbus_proxy_get_cached_property (item->proxy_ip4,
- "Addresses");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_ip4"));
- panel_set_label_for_variant_ipv4_array_array (widget, ip4);
-
- /* array of (array of uint32) */
- routes = g_dbus_proxy_get_cached_property (item->proxy_ip4,
- "Routes");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_route"));
- panel_set_label_for_variant_ipv4_array_array (widget, routes);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_route"));
- gtk_widget_show (widget);
-
- /* array of uint32 */
- nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip4,
- "Nameservers");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_dns"));
- panel_set_label_for_variant_ipv4_array (widget, nameservers);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_dns"));
- gtk_widget_show (widget);
-
- /* Domains = array of string */
- //no widget
- /* WinsServers = array of uint32 */
- //no widget
-
- } else {
- ip4 = g_dbus_proxy_get_cached_property (item->proxy,
- "Ip4Address");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_ip4"));
- panel_set_label_for_variant_ipv4 (widget, ip4);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_route"));
- gtk_widget_hide (widget);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_wireless_dns"));
- gtk_widget_hide (widget);
- }
-
- /* set MAC */
- hw_address = g_dbus_proxy_get_cached_property (item->proxy_additional,
- "HwAddress");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_mac"));
- panel_set_label_for_variant_string (widget, hw_address);
-
- /* set speed */
- bitrate = g_dbus_proxy_get_cached_property (item->proxy_additional, "Bitrate");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_speed"));
- panel_set_label_for_variant_bitrate (widget, bitrate);
-
- g_variant_unref (ip4);
- if (ip6 != NULL)
- g_variant_unref (ip6);
- if (routes != NULL)
- g_variant_unref (routes);
- if (nameservers != NULL)
- g_variant_unref (nameservers);
- g_variant_unref (hw_address);
- g_variant_unref (bitrate);
+ gboolean ret;
+ GtkWidget *widget;
+ GVariant *bitrate;
+ GVariant *hw_address;
+ GVariant *ip4;
+ GVariant *ip6;
+ GVariant *nameservers = NULL;
+ GVariant *routes = NULL;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
+
+ /* set IPv6 */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_ip6"));
+ if (item->proxy_ip6 != NULL) {
+ gtk_widget_show (widget);
+
+ /* array of (ipdata, prefix, route) */
+ ip6 = g_dbus_proxy_get_cached_property (item->proxy_ip6,
+ "Addresses");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_ip6"));
+ panel_set_label_for_variant_ipv6_prefixed_array (widget, ip6);
+
+ /* array of (ipdata, prefix, route) */
+ routes = g_dbus_proxy_get_cached_property (item->proxy_ip6,
+ "Routes");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_route"));
+ ret = panel_set_label_for_variant_ipv6_prefixed_array (widget, routes);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_route"));
+ gtk_widget_set_visible (widget, ret);
+
+ /* array of ipdata */
+ nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip6,
+ "Nameservers");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_dns"));
+ ret = panel_set_label_for_variant_ipv6_array (widget, nameservers);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_dns"));
+ gtk_widget_set_visible (widget, ret);
+
+ /* Domains = array of string */
+ //no widget
+ } else {
+ gtk_widget_hide (widget);
+ }
+
+ /* set IPv4 */
+ if (item->proxy_ip4 != NULL) {
+ /* array of (array of uint32) */
+ ip4 = g_dbus_proxy_get_cached_property (item->proxy_ip4,
+ "Addresses");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_ip4"));
+ panel_set_label_for_variant_ipv4_array_array (widget, ip4);
+
+ /* array of (array of uint32) */
+ routes = g_dbus_proxy_get_cached_property (item->proxy_ip4,
+ "Routes");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_route"));
+ panel_set_label_for_variant_ipv4_array_array (widget, routes);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_route"));
+ gtk_widget_show (widget);
+
+ /* array of uint32 */
+ nameservers = g_dbus_proxy_get_cached_property (item->proxy_ip4,
+ "Nameservers");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_dns"));
+ panel_set_label_for_variant_ipv4_array (widget, nameservers);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_dns"));
+ gtk_widget_show (widget);
+
+ /* Domains = array of string */
+ //no widget
+ /* WinsServers = array of uint32 */
+ //no widget
+
+ } else {
+ ip4 = g_dbus_proxy_get_cached_property (item->proxy,
+ "Ip4Address");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_ip4"));
+ panel_set_label_for_variant_ipv4 (widget, ip4);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_route"));
+ gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_wireless_dns"));
+ gtk_widget_hide (widget);
+ }
+
+ /* set MAC */
+ hw_address = g_dbus_proxy_get_cached_property (item->proxy_additional,
+ "HwAddress");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_mac"));
+ panel_set_label_for_variant_string (widget, hw_address);
+
+ /* set speed */
+ bitrate = g_dbus_proxy_get_cached_property (item->proxy_additional, "Bitrate");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_speed"));
+ panel_set_label_for_variant_bitrate (widget, bitrate);
+
+ g_variant_unref (ip4);
+ if (ip6 != NULL)
+ g_variant_unref (ip6);
+ if (routes != NULL)
+ g_variant_unref (routes);
+ if (nameservers != NULL)
+ g_variant_unref (nameservers);
+ g_variant_unref (hw_address);
+ g_variant_unref (bitrate);
}
/**
@@ -1586,30 +1586,30 @@ panel_populate_wireless_device (PanelDeviceItem *item)
static void
panel_populate_mobilebb_device (PanelDeviceItem *item)
{
- GtkWidget *widget;
- GVariant *ip4;
- CcNetworkPanelPrivate *priv = item->panel->priv;
-
- /* set IP */
- ip4 = g_dbus_proxy_get_cached_property (item->proxy, "Ip4Address");
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_wireless_ip"));
- panel_set_label_for_variant_ipv4 (widget, ip4);
-
- /* use data from ModemManager */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_mobilebb_provider"));
- gtk_label_set_text (GTK_LABEL (widget), item->operator_name);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_mobilebb_imei"));
- gtk_label_set_text (GTK_LABEL (widget), item->modem_imei);
-
- /* I'm not sure where to get this data from */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_mobilebb_speed"));
- gtk_widget_set_visible (widget, FALSE);
-
- g_variant_unref (ip4);
+ GtkWidget *widget;
+ GVariant *ip4;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
+
+ /* set IP */
+ ip4 = g_dbus_proxy_get_cached_property (item->proxy, "Ip4Address");
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_wireless_ip"));
+ panel_set_label_for_variant_ipv4 (widget, ip4);
+
+ /* use data from ModemManager */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_mobilebb_provider"));
+ gtk_label_set_text (GTK_LABEL (widget), item->operator_name);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_mobilebb_imei"));
+ gtk_label_set_text (GTK_LABEL (widget), item->modem_imei);
+
+ /* I'm not sure where to get this data from */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_mobilebb_speed"));
+ gtk_widget_set_visible (widget, FALSE);
+
+ g_variant_unref (ip4);
}
/**
@@ -1618,61 +1618,61 @@ panel_populate_mobilebb_device (PanelDeviceItem *item)
static void
panel_device_refresh_item_ui (PanelDeviceItem *item)
{
- GtkWidget *widget;
- guint state;
- GVariant *variant_id;
- GVariant *variant_state;
- CcNetworkPanelPrivate *priv = item->panel->priv;
-
- /* we have a new device */
- g_debug ("selected device is: %s", item->device_id);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_device_header"));
- gtk_widget_set_visible (widget, TRUE);
-
- variant_id = g_dbus_proxy_get_cached_property (item->proxy, "Interface");
-// g_variant_get (variant_id, "s", &interface);
-
- variant_state = g_dbus_proxy_get_cached_property (item->proxy, "State");
- g_variant_get (variant_state, "u", &state);
-
- g_debug ("device %s type %i @ %s", item->device_id, item->type, item->udi);
-
- /* set device icon */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "image_device"));
- gtk_image_set_from_icon_name (GTK_IMAGE (widget),
- panel_device_type_to_icon_name (item->type),
- GTK_ICON_SIZE_DIALOG);
-
- /* set device kind */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_device"));
- gtk_label_set_label (GTK_LABEL (widget),
- panel_device_type_to_localized_string (item->type));
-
- /* set device state */
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "label_status"));
- gtk_label_set_label (GTK_LABEL (widget),
- panel_device_state_to_localized_string (state));
-
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "notebook_types"));
- if (item->type == NM_DEVICE_TYPE_ETHERNET) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
- panel_populate_wired_device (item);
- } else if (item->type == NM_DEVICE_TYPE_WIFI) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
- panel_populate_wireless_device (item);
- } else if (item->type == NM_DEVICE_TYPE_GSM ||
- item->type == NM_DEVICE_TYPE_CDMA) {
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 4);
- panel_populate_mobilebb_device (item);
- }
-
- g_variant_unref (variant_state);
- g_variant_unref (variant_id);
+ GtkWidget *widget;
+ guint state;
+ GVariant *variant_id;
+ GVariant *variant_state;
+ CcNetworkPanelPrivate *priv = item->panel->priv;
+
+ /* we have a new device */
+ g_debug ("selected device is: %s", item->device_id);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_device_header"));
+ gtk_widget_set_visible (widget, TRUE);
+
+ variant_id = g_dbus_proxy_get_cached_property (item->proxy, "Interface");
+// g_variant_get (variant_id, "s", &interface);
+
+ variant_state = g_dbus_proxy_get_cached_property (item->proxy, "State");
+ g_variant_get (variant_state, "u", &state);
+
+ g_debug ("device %s type %i @ %s", item->device_id, item->type, item->udi);
+
+ /* set device icon */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "image_device"));
+ gtk_image_set_from_icon_name (GTK_IMAGE (widget),
+ panel_device_type_to_icon_name (item->type),
+ GTK_ICON_SIZE_DIALOG);
+
+ /* set device kind */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_device"));
+ gtk_label_set_label (GTK_LABEL (widget),
+ panel_device_type_to_localized_string (item->type));
+
+ /* set device state */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "label_status"));
+ gtk_label_set_label (GTK_LABEL (widget),
+ panel_device_state_to_localized_string (state));
+
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "notebook_types"));
+ if (item->type == NM_DEVICE_TYPE_ETHERNET) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0);
+ panel_populate_wired_device (item);
+ } else if (item->type == NM_DEVICE_TYPE_WIFI) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
+ panel_populate_wireless_device (item);
+ } else if (item->type == NM_DEVICE_TYPE_GSM ||
+ item->type == NM_DEVICE_TYPE_CDMA) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 4);
+ panel_populate_mobilebb_device (item);
+ }
+
+ g_variant_unref (variant_state);
+ g_variant_unref (variant_id);
}
/**
@@ -1681,46 +1681,46 @@ panel_device_refresh_item_ui (PanelDeviceItem *item)
static void
panel_devices_treeview_clicked_cb (GtkTreeSelection *selection, CcNetworkPanel *panel)
{
- GtkTreeIter iter;
- GtkTreeModel *model;
- GtkWidget *widget;
- PanelDeviceItem *item;
- CcNetworkPanelPrivate *priv = panel->priv;
-
- /* will only work in single or browse selection mode! */
- if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
- g_debug ("no row selected");
- goto out;
- }
-
- /* get id */
- gtk_tree_model_get (model, &iter,
- PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, &item,
- -1);
-
- /* this is the proxy settings device */
- if (item == NULL) {
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "hbox_device_header"));
- gtk_widget_set_visible (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
- "notebook_types"));
- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
-
- /* save so we ignore */
- g_free (priv->current_device);
- priv->current_device = NULL;
- goto out;
- }
-
- /* save so we can update */
- g_free (priv->current_device);
- priv->current_device = g_strdup (item->device_id);
-
- /* refresh item */
- panel_device_refresh_item_ui (item);
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ GtkWidget *widget;
+ PanelDeviceItem *item;
+ CcNetworkPanelPrivate *priv = panel->priv;
+
+ /* will only work in single or browse selection mode! */
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ g_debug ("no row selected");
+ goto out;
+ }
+
+ /* get id */
+ gtk_tree_model_get (model, &iter,
+ PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, &item,
+ -1);
+
+ /* this is the proxy settings device */
+ if (item == NULL) {
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "hbox_device_header"));
+ gtk_widget_set_visible (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "notebook_types"));
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
+
+ /* save so we ignore */
+ g_free (priv->current_device);
+ priv->current_device = NULL;
+ goto out;
+ }
+
+ /* save so we can update */
+ g_free (priv->current_device);
+ priv->current_device = g_strdup (item->device_id);
+
+ /* refresh item */
+ panel_device_refresh_item_ui (item);
out:
- return;
+ return;
}
/**
@@ -1729,26 +1729,26 @@ out:
static void
panel_add_proxy_device (CcNetworkPanel *panel)
{
- gchar *title;
- GtkListStore *liststore_devices;
- GtkTreeIter iter;
-
- liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (panel->priv->builder,
- "liststore_devices"));
- title = g_strdup_printf ("<span size=\"large\">%s</span>",
- _("Network proxy"));
-
- gtk_list_store_append (liststore_devices, &iter);
- gtk_list_store_set (liststore_devices,
- &iter,
- PANEL_DEVICES_COLUMN_ICON, "preferences-system-network",
- PANEL_DEVICES_COLUMN_TITLE, title,
- PANEL_DEVICES_COLUMN_ID, NULL,
- PANEL_DEVICES_COLUMN_SORT, "9",
- PANEL_DEVICES_COLUMN_TOOLTIP, _("Set the system proxy settings"),
- PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, NULL,
- -1);
- g_free (title);
+ gchar *title;
+ GtkListStore *liststore_devices;
+ GtkTreeIter iter;
+
+ liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (panel->priv->builder,
+ "liststore_devices"));
+ title = g_strdup_printf ("<span size=\"large\">%s</span>",
+ _("Network proxy"));
+
+ gtk_list_store_append (liststore_devices, &iter);
+ gtk_list_store_set (liststore_devices,
+ &iter,
+ PANEL_DEVICES_COLUMN_ICON, "preferences-system-network",
+ PANEL_DEVICES_COLUMN_TITLE, title,
+ PANEL_DEVICES_COLUMN_ID, NULL,
+ PANEL_DEVICES_COLUMN_SORT, "9",
+ PANEL_DEVICES_COLUMN_TOOLTIP, _("Set the system proxy settings"),
+ PANEL_DEVICES_COLUMN_COMPOSITE_DEVICE, NULL,
+ -1);
+ g_free (title);
}
/**
@@ -1757,194 +1757,194 @@ panel_add_proxy_device (CcNetworkPanel *panel)
static void
cc_network_panel_init (CcNetworkPanel *panel)
{
- GError *error;
- gint value;
- GSettings *settings_tmp;
- GtkAdjustment *adjustment;
- GtkCellRenderer *renderer;
- GtkComboBox *combobox;
- GtkTreePath *path;
- GtkTreeSelection *selection;
- GtkTreeSortable *sortable;
- GtkWidget *widget;
-
- panel->priv = NETWORK_PANEL_PRIVATE (panel);
-
- panel->priv->builder = gtk_builder_new ();
-
- error = NULL;
- gtk_builder_add_from_file (panel->priv->builder,
- GNOMECC_UI_DIR "/network.ui",
- &error);
- if (error != NULL) {
- g_warning ("Could not load interface file: %s", error->message);
- g_error_free (error);
- return;
- }
-
- panel->priv->cancellable = g_cancellable_new ();
- panel->priv->devices = g_ptr_array_new_with_free_func ((GDestroyNotify )panel_free_device_item);
-
- /* get initial icon state */
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- "org.freedesktop.NetworkManager",
- "/org/freedesktop/NetworkManager",
- "org.freedesktop.NetworkManager",
- panel->priv->cancellable,
- panel_got_network_proxy_cb,
- panel);
-
- panel->priv->proxy_settings = g_settings_new ("org.gnome.system.proxy");
- g_signal_connect (panel->priv->proxy_settings,
- "changed",
- G_CALLBACK (panel_settings_changed),
- panel);
-
- /* actions */
- value = g_settings_get_enum (panel->priv->proxy_settings, "mode");
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "combobox_proxy_mode"));
- panel_set_value_for_combo (panel, GTK_COMBO_BOX (widget), value);
- g_signal_connect (widget, "changed",
- G_CALLBACK (panel_proxy_mode_combo_changed_cb),
- panel);
-
- /* bind the proxy values */
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "entry_proxy_url"));
- g_settings_bind (panel->priv->proxy_settings, "autoconfig-url",
- widget, "text",
- G_SETTINGS_BIND_DEFAULT);
-
- /* bind the proxy values */
- settings_tmp = g_settings_new ("org.gnome.system.proxy.http");
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "entry_proxy_http"));
- g_settings_bind (settings_tmp, "host",
- widget, "text",
- G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
- "adjustment_proxy_port_http"));
- g_settings_bind (settings_tmp, "port",
- adjustment, "value",
- G_SETTINGS_BIND_DEFAULT);
- g_object_unref (settings_tmp);
-
- /* bind the proxy values */
- settings_tmp = g_settings_new ("org.gnome.system.proxy.https");
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "entry_proxy_https"));
- g_settings_bind (settings_tmp, "host",
- widget, "text",
- G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
- "adjustment_proxy_port_https"));
- g_settings_bind (settings_tmp, "port",
- adjustment, "value",
- G_SETTINGS_BIND_DEFAULT);
- g_object_unref (settings_tmp);
-
- /* bind the proxy values */
- settings_tmp = g_settings_new ("org.gnome.system.proxy.ftp");
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "entry_proxy_ftp"));
- g_settings_bind (settings_tmp, "host",
- widget, "text",
- G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
- "adjustment_proxy_port_ftp"));
- g_settings_bind (settings_tmp, "port",
- adjustment, "value",
- G_SETTINGS_BIND_DEFAULT);
- g_object_unref (settings_tmp);
-
- /* bind the proxy values */
- settings_tmp = g_settings_new ("org.gnome.system.proxy.socks");
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "entry_proxy_socks"));
- g_settings_bind (settings_tmp, "host",
- widget, "text",
- G_SETTINGS_BIND_DEFAULT);
- adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
- "adjustment_proxy_port_socks"));
- g_settings_bind (settings_tmp, "port",
- adjustment, "value",
- G_SETTINGS_BIND_DEFAULT);
- g_object_unref (settings_tmp);
-
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "treeview_devices"));
- panel_add_devices_columns (panel, GTK_TREE_VIEW (widget));
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
- g_signal_connect (selection, "changed",
- G_CALLBACK (panel_devices_treeview_clicked_cb), panel);
-
- /* add the virtual proxy device */
- panel_add_proxy_device (panel);
-
- /* select the proxy device */
- path = gtk_tree_path_new_from_string ("0");
- gtk_tree_selection_select_path (selection, path);
- gtk_tree_path_free (path);
-
- /* setup wireless combobox model */
- combobox = GTK_COMBO_BOX (gtk_builder_get_object (panel->priv->builder,
- "combobox_network_name"));
-
- renderer = panel_cell_renderer_mode_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
- renderer,
- FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
- "mode", PANEL_WIRELESS_COLUMN_MODE,
- NULL);
-
- /* sort networks in drop down */
- sortable = GTK_TREE_SORTABLE (gtk_builder_get_object (panel->priv->builder,
- "liststore_wireless_network"));
- gtk_tree_sortable_set_sort_column_id (sortable,
- PANEL_WIRELESS_COLUMN_SORT,
- GTK_SORT_ASCENDING);
-
- renderer = panel_cell_renderer_signal_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
- renderer,
- FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
- "signal", PANEL_WIRELESS_COLUMN_STRENGTH,
- NULL);
-
- /* disable for now */
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "add_toolbutton"));
- gtk_widget_set_sensitive (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "remove_toolbutton"));
- gtk_widget_set_sensitive (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "button_unlock"));
- gtk_widget_set_sensitive (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "switch_flight_mode"));
- gtk_widget_set_sensitive (widget, FALSE);
-
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "notebook_types"));
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
-
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "vbox1"));
- gtk_widget_reparent (widget, (GtkWidget *) panel);
+ GError *error;
+ gint value;
+ GSettings *settings_tmp;
+ GtkAdjustment *adjustment;
+ GtkCellRenderer *renderer;
+ GtkComboBox *combobox;
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeSortable *sortable;
+ GtkWidget *widget;
+
+ panel->priv = NETWORK_PANEL_PRIVATE (panel);
+
+ panel->priv->builder = gtk_builder_new ();
+
+ error = NULL;
+ gtk_builder_add_from_file (panel->priv->builder,
+ GNOMECC_UI_DIR "/network.ui",
+ &error);
+ if (error != NULL) {
+ g_warning ("Could not load interface file: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ panel->priv->cancellable = g_cancellable_new ();
+ panel->priv->devices = g_ptr_array_new_with_free_func ((GDestroyNotify )panel_free_device_item);
+
+ /* get initial icon state */
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ "/org/freedesktop/NetworkManager",
+ "org.freedesktop.NetworkManager",
+ panel->priv->cancellable,
+ panel_got_network_proxy_cb,
+ panel);
+
+ panel->priv->proxy_settings = g_settings_new ("org.gnome.system.proxy");
+ g_signal_connect (panel->priv->proxy_settings,
+ "changed",
+ G_CALLBACK (panel_settings_changed),
+ panel);
+
+ /* actions */
+ value = g_settings_get_enum (panel->priv->proxy_settings, "mode");
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "combobox_proxy_mode"));
+ panel_set_value_for_combo (panel, GTK_COMBO_BOX (widget), value);
+ g_signal_connect (widget, "changed",
+ G_CALLBACK (panel_proxy_mode_combo_changed_cb),
+ panel);
+
+ /* bind the proxy values */
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "entry_proxy_url"));
+ g_settings_bind (panel->priv->proxy_settings, "autoconfig-url",
+ widget, "text",
+ G_SETTINGS_BIND_DEFAULT);
+
+ /* bind the proxy values */
+ settings_tmp = g_settings_new ("org.gnome.system.proxy.http");
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "entry_proxy_http"));
+ g_settings_bind (settings_tmp, "host",
+ widget, "text",
+ G_SETTINGS_BIND_DEFAULT);
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
+ "adjustment_proxy_port_http"));
+ g_settings_bind (settings_tmp, "port",
+ adjustment, "value",
+ G_SETTINGS_BIND_DEFAULT);
+ g_object_unref (settings_tmp);
+
+ /* bind the proxy values */
+ settings_tmp = g_settings_new ("org.gnome.system.proxy.https");
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "entry_proxy_https"));
+ g_settings_bind (settings_tmp, "host",
+ widget, "text",
+ G_SETTINGS_BIND_DEFAULT);
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
+ "adjustment_proxy_port_https"));
+ g_settings_bind (settings_tmp, "port",
+ adjustment, "value",
+ G_SETTINGS_BIND_DEFAULT);
+ g_object_unref (settings_tmp);
+
+ /* bind the proxy values */
+ settings_tmp = g_settings_new ("org.gnome.system.proxy.ftp");
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "entry_proxy_ftp"));
+ g_settings_bind (settings_tmp, "host",
+ widget, "text",
+ G_SETTINGS_BIND_DEFAULT);
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
+ "adjustment_proxy_port_ftp"));
+ g_settings_bind (settings_tmp, "port",
+ adjustment, "value",
+ G_SETTINGS_BIND_DEFAULT);
+ g_object_unref (settings_tmp);
+
+ /* bind the proxy values */
+ settings_tmp = g_settings_new ("org.gnome.system.proxy.socks");
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "entry_proxy_socks"));
+ g_settings_bind (settings_tmp, "host",
+ widget, "text",
+ G_SETTINGS_BIND_DEFAULT);
+ adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (panel->priv->builder,
+ "adjustment_proxy_port_socks"));
+ g_settings_bind (settings_tmp, "port",
+ adjustment, "value",
+ G_SETTINGS_BIND_DEFAULT);
+ g_object_unref (settings_tmp);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "treeview_devices"));
+ panel_add_devices_columns (panel, GTK_TREE_VIEW (widget));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (panel_devices_treeview_clicked_cb), panel);
+
+ /* add the virtual proxy device */
+ panel_add_proxy_device (panel);
+
+ /* select the proxy device */
+ path = gtk_tree_path_new_from_string ("0");
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+
+ /* setup wireless combobox model */
+ combobox = GTK_COMBO_BOX (gtk_builder_get_object (panel->priv->builder,
+ "combobox_network_name"));
+
+ renderer = panel_cell_renderer_mode_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
+ renderer,
+ FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
+ "mode", PANEL_WIRELESS_COLUMN_MODE,
+ NULL);
+
+ /* sort networks in drop down */
+ sortable = GTK_TREE_SORTABLE (gtk_builder_get_object (panel->priv->builder,
+ "liststore_wireless_network"));
+ gtk_tree_sortable_set_sort_column_id (sortable,
+ PANEL_WIRELESS_COLUMN_SORT,
+ GTK_SORT_ASCENDING);
+
+ renderer = panel_cell_renderer_signal_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
+ renderer,
+ FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
+ "signal", PANEL_WIRELESS_COLUMN_STRENGTH,
+ NULL);
+
+ /* disable for now */
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "add_toolbutton"));
+ gtk_widget_set_sensitive (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "remove_toolbutton"));
+ gtk_widget_set_sensitive (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "button_unlock"));
+ gtk_widget_set_sensitive (widget, FALSE);
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "switch_flight_mode"));
+ gtk_widget_set_sensitive (widget, FALSE);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "notebook_types"));
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+
+ widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
+ "vbox1"));
+ gtk_widget_reparent (widget, (GtkWidget *) panel);
}
void
cc_network_panel_register (GIOModule *module)
{
- cc_network_panel_register_type (G_TYPE_MODULE (module));
- g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
- CC_TYPE_NETWORK_PANEL,
- "network", 0);
+ cc_network_panel_register_type (G_TYPE_MODULE (module));
+ g_io_extension_point_implement (CC_SHELL_PANEL_EXTENSION_POINT,
+ CC_TYPE_NETWORK_PANEL,
+ "network", 0);
}
diff --git a/panels/network/cc-network-panel.h b/panels/network/cc-network-panel.h
index 9e349df..7bb8157 100644
--- a/panels/network/cc-network-panel.h
+++ b/panels/network/cc-network-panel.h
@@ -29,24 +29,24 @@ G_BEGIN_DECLS
#define CC_TYPE_NETWORK_PANEL cc_network_panel_get_type()
#define CC_NETWORK_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- CC_TYPE_NETWORK_PANEL, CcNetworkPanel))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ CC_TYPE_NETWORK_PANEL, CcNetworkPanel))
#define CC_NETWORK_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- CC_TYPE_NETWORK_PANEL, CcNetworkPanelClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ CC_TYPE_NETWORK_PANEL, CcNetworkPanelClass))
#define CC_IS_NETWORK_PANEL(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- CC_TYPE_NETWORK_PANEL))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ CC_TYPE_NETWORK_PANEL))
#define CC_IS_NETWORK_PANEL_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- CC_TYPE_NETWORK_PANEL))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ CC_TYPE_NETWORK_PANEL))
#define CC_NETWORK_PANEL_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- CC_TYPE_NETWORK_PANEL, CcNetworkPanelClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ CC_TYPE_NETWORK_PANEL, CcNetworkPanelClass))
typedef struct _CcNetworkPanel CcNetworkPanel;
typedef struct _CcNetworkPanelClass CcNetworkPanelClass;
@@ -54,13 +54,13 @@ typedef struct _CcNetworkPanelPrivate CcNetworkPanelPrivate;
struct _CcNetworkPanel
{
- CcPanel parent;
- CcNetworkPanelPrivate *priv;
+ CcPanel parent;
+ CcNetworkPanelPrivate *priv;
};
struct _CcNetworkPanelClass
{
- CcPanelClass parent_class;
+ CcPanelClass parent_class;
};
GType cc_network_panel_get_type (void) G_GNUC_CONST;
diff --git a/panels/network/panel-cell-renderer-mode.c b/panels/network/panel-cell-renderer-mode.c
index f514cec..c213d21 100644
--- a/panels/network/panel-cell-renderer-mode.c
+++ b/panels/network/panel-cell-renderer-mode.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard hughsie com>
*
@@ -28,9 +28,9 @@
#include "panel-cell-renderer-mode.h"
enum {
- PROP_0,
- PROP_MODE,
- PROP_LAST
+ PROP_0,
+ PROP_MODE,
+ PROP_LAST
};
G_DEFINE_TYPE (PanelCellRendererMode, panel_cell_renderer_mode, GTK_TYPE_CELL_RENDERER_PIXBUF)
@@ -42,18 +42,18 @@ static gpointer parent_class = NULL;
**/
static void
panel_cell_renderer_mode_get_property (GObject *object, guint param_id,
- GValue *value, GParamSpec *pspec)
+ GValue *value, GParamSpec *pspec)
{
- PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
-
- switch (param_id) {
- case PROP_MODE:
- g_value_set_uint (value, renderer->mode);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
+ PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
+
+ switch (param_id) {
+ case PROP_MODE:
+ g_value_set_uint (value, renderer->mode);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
}
/**
@@ -62,12 +62,12 @@ panel_cell_renderer_mode_get_property (GObject *object, guint param_id,
static void
panel_cell_renderer_set_name (PanelCellRendererMode *renderer)
{
- const gchar *icon_name = NULL;
+ const gchar *icon_name = NULL;
- if (renderer->mode == NM_802_11_MODE_ADHOC)
- icon_name = "network-workgroup";
+ if (renderer->mode == NM_802_11_MODE_ADHOC)
+ icon_name = "network-workgroup";
- g_object_set (renderer, "icon-name", icon_name, NULL);
+ g_object_set (renderer, "icon-name", icon_name, NULL);
}
/**
@@ -75,19 +75,19 @@ panel_cell_renderer_set_name (PanelCellRendererMode *renderer)
**/
static void
panel_cell_renderer_mode_set_property (GObject *object, guint param_id,
- const GValue *value, GParamSpec *pspec)
+ const GValue *value, GParamSpec *pspec)
{
- PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
-
- switch (param_id) {
- case PROP_MODE:
- renderer->mode = g_value_get_uint (value);
- panel_cell_renderer_set_name (renderer);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
+ PanelCellRendererMode *renderer = PANEL_CELL_RENDERER_MODE (object);
+
+ switch (param_id) {
+ case PROP_MODE:
+ renderer->mode = g_value_get_uint (value);
+ panel_cell_renderer_set_name (renderer);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
}
/**
@@ -96,10 +96,10 @@ panel_cell_renderer_mode_set_property (GObject *object, guint param_id,
static void
panel_cell_renderer_finalize (GObject *object)
{
- PanelCellRendererMode *renderer;
- renderer = PANEL_CELL_RENDERER_MODE (object);
- g_free (renderer->icon_name);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ PanelCellRendererMode *renderer;
+ renderer = PANEL_CELL_RENDERER_MODE (object);
+ g_free (renderer->icon_name);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
@@ -108,19 +108,19 @@ panel_cell_renderer_finalize (GObject *object)
static void
panel_cell_renderer_mode_class_init (PanelCellRendererModeClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = panel_cell_renderer_finalize;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = panel_cell_renderer_finalize;
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (class);
- object_class->get_property = panel_cell_renderer_mode_get_property;
- object_class->set_property = panel_cell_renderer_mode_set_property;
+ object_class->get_property = panel_cell_renderer_mode_get_property;
+ object_class->set_property = panel_cell_renderer_mode_set_property;
- g_object_class_install_property (object_class, PROP_MODE,
- g_param_spec_uint ("mode", NULL,
- NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_MODE,
+ g_param_spec_uint ("mode", NULL,
+ NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
}
/**
@@ -129,8 +129,8 @@ panel_cell_renderer_mode_class_init (PanelCellRendererModeClass *class)
static void
panel_cell_renderer_mode_init (PanelCellRendererMode *renderer)
{
- renderer->mode = 0;
- renderer->icon_name = NULL;
+ renderer->mode = 0;
+ renderer->icon_name = NULL;
}
/**
@@ -139,6 +139,6 @@ panel_cell_renderer_mode_init (PanelCellRendererMode *renderer)
GtkCellRenderer *
panel_cell_renderer_mode_new (void)
{
- return g_object_new (PANEL_TYPE_CELL_RENDERER_MODE, NULL);
+ return g_object_new (PANEL_TYPE_CELL_RENDERER_MODE, NULL);
}
diff --git a/panels/network/panel-cell-renderer-mode.h b/panels/network/panel-cell-renderer-mode.h
index 0827cfb..973ec18 100644
--- a/panels/network/panel-cell-renderer-mode.h
+++ b/panels/network/panel-cell-renderer-mode.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard hughsie com>
*
@@ -27,32 +27,32 @@
#include "panel-common.h"
-#define PANEL_TYPE_CELL_RENDERER_MODE (panel_cell_renderer_mode_get_type())
-#define PANEL_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererMode))
-#define PANEL_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
-#define PANEL_IS_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_MODE))
-#define PANEL_IS_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_MODE))
-#define PANEL_CELL_RENDERER_MODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
+#define PANEL_TYPE_CELL_RENDERER_MODE (panel_cell_renderer_mode_get_type())
+#define PANEL_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererMode))
+#define PANEL_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
+#define PANEL_IS_CELL_RENDERER_MODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_MODE))
+#define PANEL_IS_CELL_RENDERER_MODE_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_MODE))
+#define PANEL_CELL_RENDERER_MODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_MODE, PanelCellRendererModeClass))
G_BEGIN_DECLS
-typedef struct _PanelCellRendererMode PanelCellRendererMode;
-typedef struct _PanelCellRendererModeClass PanelCellRendererModeClass;
+typedef struct _PanelCellRendererMode PanelCellRendererMode;
+typedef struct _PanelCellRendererModeClass PanelCellRendererModeClass;
struct _PanelCellRendererMode
{
- GtkCellRendererPixbuf parent;
- guint mode;
- gchar *icon_name;
+ GtkCellRendererPixbuf parent;
+ guint mode;
+ gchar *icon_name;
};
struct _PanelCellRendererModeClass
{
- GtkCellRendererPixbufClass parent_class;
+ GtkCellRendererPixbufClass parent_class;
};
-GType panel_cell_renderer_mode_get_type (void);
-GtkCellRenderer *panel_cell_renderer_mode_new (void);
+GType panel_cell_renderer_mode_get_type (void);
+GtkCellRenderer *panel_cell_renderer_mode_new (void);
G_END_DECLS
diff --git a/panels/network/panel-cell-renderer-signal.c b/panels/network/panel-cell-renderer-signal.c
index 23b1df1..73b42a3 100644
--- a/panels/network/panel-cell-renderer-signal.c
+++ b/panels/network/panel-cell-renderer-signal.c
@@ -1,4 +1,4 @@
-/* -*- Signal: C; tab-width: 8; indent-tabs-signal: t; c-basic-offset: 8 -*-
+/* -*- Mode: C; tab-width: 8; indent-tabs-signal: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard hughsie com>
*
@@ -28,9 +28,9 @@
#include "panel-cell-renderer-signal.h"
enum {
- PROP_0,
- PROP_SIGNAL,
- PROP_LAST
+ PROP_0,
+ PROP_SIGNAL,
+ PROP_LAST
};
G_DEFINE_TYPE (PanelCellRendererSignal, panel_cell_renderer_signal, GTK_TYPE_CELL_RENDERER_PIXBUF)
@@ -42,18 +42,18 @@ static gpointer parent_class = NULL;
**/
static void
panel_cell_renderer_signal_get_property (GObject *object, guint param_id,
- GValue *value, GParamSpec *pspec)
+ GValue *value, GParamSpec *pspec)
{
- PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
-
- switch (param_id) {
- case PROP_SIGNAL:
- g_value_set_uint (value, renderer->signal);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
+ PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
+
+ switch (param_id) {
+ case PROP_SIGNAL:
+ g_value_set_uint (value, renderer->signal);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
}
/**
@@ -62,23 +62,23 @@ panel_cell_renderer_signal_get_property (GObject *object, guint param_id,
static void
panel_cell_renderer_set_name (PanelCellRendererSignal *renderer)
{
- const gchar *icon_name = NULL;
- GIcon *icon;
-
- if (renderer->signal < 20)
- icon_name = "network-wireless-signal-none-symbolic";
- else if (renderer->signal < 40)
- icon_name = "network-wireless-signal-weak-symbolic";
- else if (renderer->signal < 50)
- icon_name = "network-wireless-signal-ok-symbolic";
- else if (renderer->signal < 80)
- icon_name = "network-wireless-signal-good-symbolic";
- else
- icon_name = "network-wireless-signal-excellent-symbolic";
-
- icon = g_themed_icon_new_with_default_fallbacks (icon_name);
- g_object_set (renderer, "gicon", icon, NULL);
- g_object_unref (icon);
+ const gchar *icon_name = NULL;
+ GIcon *icon;
+
+ if (renderer->signal < 20)
+ icon_name = "network-wireless-signal-none-symbolic";
+ else if (renderer->signal < 40)
+ icon_name = "network-wireless-signal-weak-symbolic";
+ else if (renderer->signal < 50)
+ icon_name = "network-wireless-signal-ok-symbolic";
+ else if (renderer->signal < 80)
+ icon_name = "network-wireless-signal-good-symbolic";
+ else
+ icon_name = "network-wireless-signal-excellent-symbolic";
+
+ icon = g_themed_icon_new_with_default_fallbacks (icon_name);
+ g_object_set (renderer, "gicon", icon, NULL);
+ g_object_unref (icon);
}
/**
@@ -86,19 +86,19 @@ panel_cell_renderer_set_name (PanelCellRendererSignal *renderer)
**/
static void
panel_cell_renderer_signal_set_property (GObject *object, guint param_id,
- const GValue *value, GParamSpec *pspec)
+ const GValue *value, GParamSpec *pspec)
{
- PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
-
- switch (param_id) {
- case PROP_SIGNAL:
- renderer->signal = g_value_get_uint (value);
- panel_cell_renderer_set_name (renderer);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
+ PanelCellRendererSignal *renderer = PANEL_CELL_RENDERER_SIGNAL (object);
+
+ switch (param_id) {
+ case PROP_SIGNAL:
+ renderer->signal = g_value_get_uint (value);
+ panel_cell_renderer_set_name (renderer);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
}
/**
@@ -107,10 +107,10 @@ panel_cell_renderer_signal_set_property (GObject *object, guint param_id,
static void
panel_cell_renderer_finalize (GObject *object)
{
- PanelCellRendererSignal *renderer;
- renderer = PANEL_CELL_RENDERER_SIGNAL (object);
- g_free (renderer->icon_name);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ PanelCellRendererSignal *renderer;
+ renderer = PANEL_CELL_RENDERER_SIGNAL (object);
+ g_free (renderer->icon_name);
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
/**
@@ -119,19 +119,19 @@ panel_cell_renderer_finalize (GObject *object)
static void
panel_cell_renderer_signal_class_init (PanelCellRendererSignalClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = panel_cell_renderer_finalize;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ object_class->finalize = panel_cell_renderer_finalize;
- parent_class = g_type_class_peek_parent (class);
+ parent_class = g_type_class_peek_parent (class);
- object_class->get_property = panel_cell_renderer_signal_get_property;
- object_class->set_property = panel_cell_renderer_signal_set_property;
+ object_class->get_property = panel_cell_renderer_signal_get_property;
+ object_class->set_property = panel_cell_renderer_signal_set_property;
- g_object_class_install_property (object_class, PROP_SIGNAL,
- g_param_spec_uint ("signal", NULL,
- NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_SIGNAL,
+ g_param_spec_uint ("signal", NULL,
+ NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
}
/**
@@ -140,8 +140,8 @@ panel_cell_renderer_signal_class_init (PanelCellRendererSignalClass *class)
static void
panel_cell_renderer_signal_init (PanelCellRendererSignal *renderer)
{
- renderer->signal = 0;
- renderer->icon_name = NULL;
+ renderer->signal = 0;
+ renderer->icon_name = NULL;
}
/**
@@ -150,6 +150,6 @@ panel_cell_renderer_signal_init (PanelCellRendererSignal *renderer)
GtkCellRenderer *
panel_cell_renderer_signal_new (void)
{
- return g_object_new (PANEL_TYPE_CELL_RENDERER_SIGNAL, NULL);
+ return g_object_new (PANEL_TYPE_CELL_RENDERER_SIGNAL, NULL);
}
diff --git a/panels/network/panel-cell-renderer-signal.h b/panels/network/panel-cell-renderer-signal.h
index f63d10d..c01c5aa 100644
--- a/panels/network/panel-cell-renderer-signal.h
+++ b/panels/network/panel-cell-renderer-signal.h
@@ -1,4 +1,4 @@
-/* -*- Signal: C; tab-width: 8; indent-tabs-signal: t; c-basic-offset: 8 -*-
+/* -*- Mode: C; tab-width: 8; indent-tabs-signal: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard hughsie com>
*
@@ -27,32 +27,32 @@
#include "panel-common.h"
-#define PANEL_TYPE_CELL_RENDERER_SIGNAL (panel_cell_renderer_signal_get_type())
-#define PANEL_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignal))
-#define PANEL_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
-#define PANEL_IS_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL))
-#define PANEL_IS_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL))
-#define PANEL_CELL_RENDERER_SIGNAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
+#define PANEL_TYPE_CELL_RENDERER_SIGNAL (panel_cell_renderer_signal_get_type())
+#define PANEL_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignal))
+#define PANEL_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_CAST((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
+#define PANEL_IS_CELL_RENDERER_SIGNAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL))
+#define PANEL_IS_CELL_RENDERER_SIGNAL_CLASS(cls) (G_TYPE_CHECK_CLASS_TYPE((cls), PANEL_TYPE_CELL_RENDERER_SIGNAL))
+#define PANEL_CELL_RENDERER_SIGNAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PANEL_TYPE_CELL_RENDERER_SIGNAL, PanelCellRendererSignalClass))
G_BEGIN_DECLS
-typedef struct _PanelCellRendererSignal PanelCellRendererSignal;
-typedef struct _PanelCellRendererSignalClass PanelCellRendererSignalClass;
+typedef struct _PanelCellRendererSignal PanelCellRendererSignal;
+typedef struct _PanelCellRendererSignalClass PanelCellRendererSignalClass;
struct _PanelCellRendererSignal
{
- GtkCellRendererPixbuf parent;
- guint signal;
- gchar *icon_name;
+ GtkCellRendererPixbuf parent;
+ guint signal;
+ gchar *icon_name;
};
struct _PanelCellRendererSignalClass
{
- GtkCellRendererPixbufClass parent_class;
+ GtkCellRendererPixbufClass parent_class;
};
-GType panel_cell_renderer_signal_get_type (void);
-GtkCellRenderer *panel_cell_renderer_signal_new (void);
+GType panel_cell_renderer_signal_get_type (void);
+GtkCellRenderer *panel_cell_renderer_signal_new (void);
G_END_DECLS
diff --git a/panels/network/panel-common.c b/panels/network/panel-common.c
index 2c2237e..0123d12 100644
--- a/panels/network/panel-common.c
+++ b/panels/network/panel-common.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard hughsie com>
*
@@ -34,22 +34,22 @@
const gchar *
panel_device_type_to_icon_name (guint type)
{
- const gchar *value = NULL;
- switch (type) {
- case NM_DEVICE_TYPE_ETHERNET:
- value = "network-wired";
- break;
- case NM_DEVICE_TYPE_WIFI:
- case NM_DEVICE_TYPE_GSM:
- case NM_DEVICE_TYPE_CDMA:
- case NM_DEVICE_TYPE_BLUETOOTH:
- case NM_DEVICE_TYPE_MESH:
- value = "network-wireless";
- break;
- default:
- break;
- }
- return value;
+ const gchar *value = NULL;
+ switch (type) {
+ case NM_DEVICE_TYPE_ETHERNET:
+ value = "network-wired";
+ break;
+ case NM_DEVICE_TYPE_WIFI:
+ case NM_DEVICE_TYPE_GSM:
+ case NM_DEVICE_TYPE_CDMA:
+ case NM_DEVICE_TYPE_BLUETOOTH:
+ case NM_DEVICE_TYPE_MESH:
+ value = "network-wireless";
+ break;
+ default:
+ break;
+ }
+ return value;
}
/**
@@ -58,38 +58,38 @@ panel_device_type_to_icon_name (guint type)
const gchar *
panel_device_type_to_localized_string (guint type)
{
- const gchar *value = NULL;
- switch (type) {
- case NM_DEVICE_TYPE_UNKNOWN:
- /* TRANSLATORS: device type */
- value = _("Unknown");
- break;
- case NM_DEVICE_TYPE_ETHERNET:
- /* TRANSLATORS: device type */
- value = _("Wired");
- break;
- case NM_DEVICE_TYPE_WIFI:
- /* TRANSLATORS: device type */
- value = _("Wireless");
- break;
- case NM_DEVICE_TYPE_GSM:
- case NM_DEVICE_TYPE_CDMA:
- /* TRANSLATORS: device type */
- value = _("Mobile broadband");
- break;
- case NM_DEVICE_TYPE_BLUETOOTH:
- /* TRANSLATORS: device type */
- value = _("Bluetooth");
- break;
- case NM_DEVICE_TYPE_MESH:
- /* TRANSLATORS: device type */
- value = _("Mesh");
- break;
+ const gchar *value = NULL;
+ switch (type) {
+ case NM_DEVICE_TYPE_UNKNOWN:
+ /* TRANSLATORS: device type */
+ value = _("Unknown");
+ break;
+ case NM_DEVICE_TYPE_ETHERNET:
+ /* TRANSLATORS: device type */
+ value = _("Wired");
+ break;
+ case NM_DEVICE_TYPE_WIFI:
+ /* TRANSLATORS: device type */
+ value = _("Wireless");
+ break;
+ case NM_DEVICE_TYPE_GSM:
+ case NM_DEVICE_TYPE_CDMA:
+ /* TRANSLATORS: device type */
+ value = _("Mobile broadband");
+ break;
+ case NM_DEVICE_TYPE_BLUETOOTH:
+ /* TRANSLATORS: device type */
+ value = _("Bluetooth");
+ break;
+ case NM_DEVICE_TYPE_MESH:
+ /* TRANSLATORS: device type */
+ value = _("Mesh");
+ break;
- default:
- break;
- }
- return value;
+ default:
+ break;
+ }
+ return value;
}
/**
@@ -100,29 +100,29 @@ panel_device_type_to_localized_string (guint type)
const gchar *
panel_device_type_to_sortable_string (guint type)
{
- const gchar *value = NULL;
- switch (type) {
- case NM_DEVICE_TYPE_ETHERNET:
- value = "1";
- break;
- case NM_DEVICE_TYPE_WIFI:
- value = "2";
- break;
- case NM_DEVICE_TYPE_GSM:
- case NM_DEVICE_TYPE_CDMA:
- value = "3";
- break;
- case NM_DEVICE_TYPE_BLUETOOTH:
- value = "4";
- break;
- case NM_DEVICE_TYPE_MESH:
- value = "5";
- break;
- default:
- value = "6";
- break;
- }
- return value;
+ const gchar *value = NULL;
+ switch (type) {
+ case NM_DEVICE_TYPE_ETHERNET:
+ value = "1";
+ break;
+ case NM_DEVICE_TYPE_WIFI:
+ value = "2";
+ break;
+ case NM_DEVICE_TYPE_GSM:
+ case NM_DEVICE_TYPE_CDMA:
+ value = "3";
+ break;
+ case NM_DEVICE_TYPE_BLUETOOTH:
+ value = "4";
+ break;
+ case NM_DEVICE_TYPE_MESH:
+ value = "5";
+ break;
+ default:
+ value = "6";
+ break;
+ }
+ return value;
}
/**
@@ -131,24 +131,24 @@ panel_device_type_to_sortable_string (guint type)
const gchar *
panel_ap_mode_to_localized_string (guint mode)
{
- const gchar *value = NULL;
- switch (mode) {
- case NM_802_11_MODE_UNKNOWN:
- /* TRANSLATORS: AP type */
- value = _("Unknown");
- break;
- case NM_802_11_MODE_ADHOC:
- /* TRANSLATORS: AP type */
- value = _("Ad-hoc");
- break;
- case NM_802_11_MODE_INFRA:
- /* TRANSLATORS: AP type */
- value = _("Infrastructure");
- break;
- default:
- break;
- }
- return value;
+ const gchar *value = NULL;
+ switch (mode) {
+ case NM_802_11_MODE_UNKNOWN:
+ /* TRANSLATORS: AP type */
+ value = _("Unknown");
+ break;
+ case NM_802_11_MODE_ADHOC:
+ /* TRANSLATORS: AP type */
+ value = _("Ad-hoc");
+ break;
+ case NM_802_11_MODE_INFRA:
+ /* TRANSLATORS: AP type */
+ value = _("Infrastructure");
+ break;
+ default:
+ break;
+ }
+ return value;
}
/**
@@ -157,52 +157,52 @@ panel_ap_mode_to_localized_string (guint mode)
const gchar *
panel_device_state_to_localized_string (guint type)
{
- const gchar *value = NULL;
- switch (type) {
- case NM_DEVICE_STATE_UNKNOWN:
- /* TRANSLATORS: device status */
- value = _("Status unknown");
- break;
- case NM_DEVICE_STATE_UNMANAGED:
- /* TRANSLATORS: device status */
- value = _("Unmanaged");
- break;
- case NM_DEVICE_STATE_UNAVAILABLE:
- /* TRANSLATORS: device status */
- value = _("Unavailable");
- break;
- case NM_DEVICE_STATE_DISCONNECTED:
- /* TRANSLATORS: device status */
- value = _("Disconnected");
- break;
- case NM_DEVICE_STATE_PREPARE:
- /* TRANSLATORS: device status */
- value = _("Preparing connection");
- break;
- case NM_DEVICE_STATE_CONFIG:
- /* TRANSLATORS: device status */
- value = _("Configuring connection");
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- /* TRANSLATORS: device status */
- value = _("Authenticating");
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- /* TRANSLATORS: device status */
- value = _("Getting network address");
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- /* TRANSLATORS: device status */
- value = _("Connected");
- break;
- case NM_DEVICE_STATE_FAILED:
- /* TRANSLATORS: device status */
- value = _("Failed to connect");
- break;
- default:
- break;
- }
- return value;
+ const gchar *value = NULL;
+ switch (type) {
+ case NM_DEVICE_STATE_UNKNOWN:
+ /* TRANSLATORS: device status */
+ value = _("Status unknown");
+ break;
+ case NM_DEVICE_STATE_UNMANAGED:
+ /* TRANSLATORS: device status */
+ value = _("Unmanaged");
+ break;
+ case NM_DEVICE_STATE_UNAVAILABLE:
+ /* TRANSLATORS: device status */
+ value = _("Unavailable");
+ break;
+ case NM_DEVICE_STATE_DISCONNECTED:
+ /* TRANSLATORS: device status */
+ value = _("Disconnected");
+ break;
+ case NM_DEVICE_STATE_PREPARE:
+ /* TRANSLATORS: device status */
+ value = _("Preparing connection");
+ break;
+ case NM_DEVICE_STATE_CONFIG:
+ /* TRANSLATORS: device status */
+ value = _("Configuring connection");
+ break;
+ case NM_DEVICE_STATE_NEED_AUTH:
+ /* TRANSLATORS: device status */
+ value = _("Authenticating");
+ break;
+ case NM_DEVICE_STATE_IP_CONFIG:
+ /* TRANSLATORS: device status */
+ value = _("Getting network address");
+ break;
+ case NM_DEVICE_STATE_ACTIVATED:
+ /* TRANSLATORS: device status */
+ value = _("Connected");
+ break;
+ case NM_DEVICE_STATE_FAILED:
+ /* TRANSLATORS: device status */
+ value = _("Failed to connect");
+ break;
+ default:
+ break;
+ }
+ return value;
}
/**
@@ -211,16 +211,16 @@ panel_device_state_to_localized_string (guint type)
gchar *
panel_ipv4_to_string (GVariant *variant)
{
- gchar *ip_str;
- guint32 ip;
+ gchar *ip_str;
+ guint32 ip;
- g_variant_get (variant, "u", &ip);
- ip_str = g_strdup_printf ("%i.%i.%i.%i",
- ip & 0x000000ff,
- (ip & 0x0000ff00) / 0x100,
- (ip & 0x00ff0000) / 0x10000,
- (ip & 0xff000000) / 0x1000000);
- return ip_str;
+ g_variant_get (variant, "u", &ip);
+ ip_str = g_strdup_printf ("%i.%i.%i.%i",
+ ip & 0x000000ff,
+ (ip & 0x0000ff00) / 0x100,
+ (ip & 0x00ff0000) / 0x10000,
+ (ip & 0xff000000) / 0x1000000);
+ return ip_str;
}
/**
@@ -232,34 +232,34 @@ panel_ipv4_to_string (GVariant *variant)
gchar *
panel_ipv6_to_string (GVariant *variant)
{
- gchar tmp1;
- gchar tmp2;
- guint i = 0;
- gboolean ret = FALSE;
- GString *string;
+ gchar tmp1;
+ gchar tmp2;
+ guint i = 0;
+ gboolean ret = FALSE;
+ GString *string;
- if (g_variant_n_children (variant) != 16)
- return NULL;
+ if (g_variant_n_children (variant) != 16)
+ return NULL;
- string = g_string_new ("");
- for (i=0; i<16; i+=2) {
- g_variant_get_child (variant, i+0, "y", &tmp1);
- g_variant_get_child (variant, i+1, "y", &tmp2);
- if (tmp1 == 0 && tmp2 == 0) {
- if (!ret) {
- g_string_append (string, ":");
- ret = TRUE;
- }
- } else {
- g_string_append_printf (string,
- "%x%x%x%x:",
- (tmp1 & 0xf0) / 16,
- tmp1 & 0x0f,
- (tmp2 & 0xf0) / 16,
- tmp2 & 0x0f);
- ret = FALSE;
- }
- }
- g_string_set_size (string, string->len - 1);
- return g_string_free (string, FALSE);
+ string = g_string_new ("");
+ for (i=0; i<16; i+=2) {
+ g_variant_get_child (variant, i+0, "y", &tmp1);
+ g_variant_get_child (variant, i+1, "y", &tmp2);
+ if (tmp1 == 0 && tmp2 == 0) {
+ if (!ret) {
+ g_string_append (string, ":");
+ ret = TRUE;
+ }
+ } else {
+ g_string_append_printf (string,
+ "%x%x%x%x:",
+ (tmp1 & 0xf0) / 16,
+ tmp1 & 0x0f,
+ (tmp2 & 0xf0) / 16,
+ tmp2 & 0x0f);
+ ret = FALSE;
+ }
+ }
+ g_string_set_size (string, string->len - 1);
+ return g_string_free (string, FALSE);
}
diff --git a/panels/network/panel-common.h b/panels/network/panel-common.h
index f903af1..c769887 100644
--- a/panels/network/panel-common.h
+++ b/panels/network/panel-common.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2010 Richard Hughes <richard hughsie com>
*
@@ -27,41 +27,41 @@
G_BEGIN_DECLS
typedef enum {
- NM_DEVICE_TYPE_UNKNOWN,
- NM_DEVICE_TYPE_ETHERNET,
- NM_DEVICE_TYPE_WIFI,
- NM_DEVICE_TYPE_GSM,
- NM_DEVICE_TYPE_CDMA,
- NM_DEVICE_TYPE_BLUETOOTH,
- NM_DEVICE_TYPE_MESH
+ NM_DEVICE_TYPE_UNKNOWN,
+ NM_DEVICE_TYPE_ETHERNET,
+ NM_DEVICE_TYPE_WIFI,
+ NM_DEVICE_TYPE_GSM,
+ NM_DEVICE_TYPE_CDMA,
+ NM_DEVICE_TYPE_BLUETOOTH,
+ NM_DEVICE_TYPE_MESH
} NMDeviceType;
typedef enum {
- NM_DEVICE_STATE_UNKNOWN,
- NM_DEVICE_STATE_UNMANAGED,
- NM_DEVICE_STATE_UNAVAILABLE,
- NM_DEVICE_STATE_DISCONNECTED,
- NM_DEVICE_STATE_PREPARE,
- NM_DEVICE_STATE_CONFIG,
- NM_DEVICE_STATE_NEED_AUTH,
- NM_DEVICE_STATE_IP_CONFIG,
- NM_DEVICE_STATE_ACTIVATED,
- NM_DEVICE_STATE_FAILED
+ NM_DEVICE_STATE_UNKNOWN,
+ NM_DEVICE_STATE_UNMANAGED,
+ NM_DEVICE_STATE_UNAVAILABLE,
+ NM_DEVICE_STATE_DISCONNECTED,
+ NM_DEVICE_STATE_PREPARE,
+ NM_DEVICE_STATE_CONFIG,
+ NM_DEVICE_STATE_NEED_AUTH,
+ NM_DEVICE_STATE_IP_CONFIG,
+ NM_DEVICE_STATE_ACTIVATED,
+ NM_DEVICE_STATE_FAILED
} NMDeviceState;
typedef enum {
- NM_802_11_MODE_UNKNOWN = 0,
- NM_802_11_MODE_ADHOC,
- NM_802_11_MODE_INFRA
+ NM_802_11_MODE_UNKNOWN = 0,
+ NM_802_11_MODE_ADHOC,
+ NM_802_11_MODE_INFRA
} NM80211Mode;
-const gchar *panel_device_type_to_icon_name (guint type);
-const gchar *panel_device_type_to_localized_string (guint type);
-const gchar *panel_device_type_to_sortable_string (guint type);
-const gchar *panel_ap_mode_to_localized_string (guint mode);
-const gchar *panel_device_state_to_localized_string (guint type);
-gchar *panel_ipv4_to_string (GVariant *variant);
-gchar *panel_ipv6_to_string (GVariant *variant);
+const gchar *panel_device_type_to_icon_name (guint type);
+const gchar *panel_device_type_to_localized_string (guint type);
+const gchar *panel_device_type_to_sortable_string (guint type);
+const gchar *panel_ap_mode_to_localized_string (guint mode);
+const gchar *panel_device_state_to_localized_string (guint type);
+gchar *panel_ipv4_to_string (GVariant *variant);
+gchar *panel_ipv6_to_string (GVariant *variant);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]