This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 ChangeLog               |    7 ++++
 acinclude.m4            |   15 ++++++++
 applet/main.c           |   33 +++++++++++++++++-
 applet/status.c         |    4 +-
 common/Makefile.am      |    2 +-
 common/connman-client.c |   45 ++++++++++++++++++++++++-
 common/connman-client.h |   14 ++++++++
 common/connman-dbus.c   |   85 +++++++++++++++++++++++++++++++++++++++-------
 common/connman-dbus.h   |    2 +
 configure.ac            |    8 ++---
 properties/ethernet.c   |   19 ++++++++++-
 properties/main.c       |   73 +++++++++++++++++++++++++++++-----------
 12 files changed, 263 insertions(+), 44 deletions(-)

New commits:
commit 602470caa376f894752d52ef03ad30b8fcc10e80
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 07:04:33 2009 +0100

    Release 0.2

commit e51337a483972d86119fc66d76b77d40e94b96b7
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 07:00:32 2009 +0100

    Just include marshaller code directly

commit 4c43b78c69c04a968ae34cd960e45dd05074919b
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:55:30 2009 +0100

    Fix unsigned comparison warning

commit f66d3c8d202b1afe13150b6c33dac60edbf9f131
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:54:07 2009 +0100

    Add support for verbose compiler warnings

commit 676615cf1dd3a3302f801ef8cffca62399d82ea6
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:51:09 2009 +0100

    Show error if security settings are missing

commit 2ac5cc417601c4ef2db17f7ee18b77d89b9e590c
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:47:16 2009 +0100

    Add functions for getting security details and passphrase

commit 6ccedbcbd6026351a0bec9a492f971baa2d5192e
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:33:56 2009 +0100

    Handle device state, address and Ethernet policy

commit 145daf50985e483bf334e4e00c8109bb697d017a
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:29:54 2009 +0100

    Add support for tracking device policy

commit ab127783f549f29a39b8ccdbce2b18a0fcae67cd
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:24:01 2009 +0100

    Add support for storing current address

commit 7c1bdf0e3ef4d2d9672a1bb3bb0c97dcd362ae67
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:12:29 2009 +0100

    Only mark connected device as active

commit 61fb22ba19948be73cae8a1407dc8a0f555f8e3d
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:10:55 2009 +0100

    Disable dialog with advanced properties for now

commit a20eecab7d6de4c892b20a0fe5685dd3459957ab
Author: Marcel Holtmann <[email protected]>
Date:   Mon Jan 12 06:00:23 2009 +0100

    Mark devices as connected


Diff in this email is a maximum of 400 lines.
diff --git a/ChangeLog b/ChangeLog
index ba27052..5d48025 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,2 +1,9 @@
+ver 0.2:
+       Add error checks for failed property calls.
+       Add support for marking devices as connected.
+       Add support for setting Ethernet device policy.
+       Add support for showing assigned IPv4 address.
+       Add support for checking WiFi security details.
+
 ver 0.1:
        Initial public release.
diff --git a/acinclude.m4 b/acinclude.m4
index 95486c3..4594073 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -9,3 +9,18 @@ AC_DEFUN([AC_PROG_CC_PIE], [
                rm -rf conftest*
        ])
 ])
+
+AC_DEFUN([COMPILER_FLAGS], [
+       if (test "${CFLAGS}" = ""); then
+               CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2"
+       fi
+       if (test "$USE_MAINTAINER_MODE" = "yes"); then
+               CFLAGS+=" -Werror -Wextra"
+               CFLAGS+=" -Wno-unused-parameter"
+               CFLAGS+=" -Wno-missing-field-initializers"
+               CFLAGS+=" -Wdeclaration-after-statement"
+               CFLAGS+=" -Wmissing-declarations"
+               CFLAGS+=" -Wredundant-decls"
+               CFLAGS+=" -Wcast-align"
+       fi
+])
diff --git a/applet/main.c b/applet/main.c
index 75ba582..7b43c13 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -98,11 +98,42 @@ static void settings_callback(GtkWidget *item, gpointer 
user_data)
                g_printerr("Couldn't execute command: %s\n", command);
 }
 
+static void show_error_dialog(const gchar *message)
+{
+       GtkWidget *dialog;
+
+       dialog = gtk_message_dialog_new_with_markup(NULL, GTK_DIALOG_MODAL,
+                                       GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                                               "%s", message);
+
+       gtk_dialog_run(GTK_DIALOG(dialog));
+
+       gtk_widget_destroy(dialog);
+}
+
 static void activate_callback(GtkWidget *item, gpointer user_data)
 {
        const gchar *path = user_data;
+       guint security;
+       gchar *passphrase;
+
+       security = connman_client_get_security(client, path);
+       if (security == CONNMAN_SECURITY_UNKNOWN)
+               return;
+
+       if (security == CONNMAN_SECURITY_NONE) {
+               connman_client_connect(client, path);
+               return;
+       }
+
+       passphrase = connman_client_get_passphrase(client, path);
+       if (passphrase != NULL) {
+               g_free(passphrase);
+               connman_client_connect(client, path);
+               return;
+       }
 
-       connman_client_connect(client, path);
+       show_error_dialog("Security settings for network are missing");
 }
 
 static GtkWidget *create_popupmenu(void)
diff --git a/applet/status.c b/applet/status.c
index bd19da9..423252c 100644
--- a/applet/status.c
+++ b/applet/status.c
@@ -57,7 +57,7 @@ static IconAnimation *icon_animation_load(GtkIconTheme 
*icontheme,
                                        const gchar *pattern, guint count)
 {
        IconAnimation *animation;
-       int i;
+       unsigned int i;
 
        animation = g_new0(IconAnimation, 1);
 
@@ -122,7 +122,7 @@ static void icon_animation_stop(IconAnimation *animation)
 
 static void icon_animation_free(IconAnimation *animation)
 {
-       int i;
+       unsigned int i;
 
        gtk_status_icon_set_visible(statusicon, FALSE);
 
diff --git a/common/Makefile.am b/common/Makefile.am
index 139897e..ff3a996 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -16,7 +16,7 @@ BUILT_SOURCES = marshal.h marshal.c \
                        connman-dbus-glue.h \
                                instance-glue.h
 
-nodist_libcommon_a_SOURCES = $(BUILT_SOURCES)
+nodist_libcommon_a_SOURCES = connman-dbus-glue.h instance-glue.h
 
 CLEANFILES = $(BUILT_SOURCES)
 
diff --git a/common/connman-client.c b/common/connman-client.c
index 18e7f09..96b5b2c 100644
--- a/common/connman-client.c
+++ b/common/connman-client.c
@@ -28,6 +28,7 @@
 #include "connman-client.h"
 
 #include "marshal.h"
+#include "marshal.c"
 
 #ifdef DEBUG
 #define DBG(fmt, arg...) printf("%s:%s() " fmt "\n", __FILE__, __FUNCTION__ , 
## arg)
@@ -80,7 +81,9 @@ static void connman_client_init(ConnmanClient *client)
        priv->store = gtk_tree_store_new(_CONNMAN_NUM_COLUMNS, G_TYPE_OBJECT,
                        G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT,
                        G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
-                       G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING);
+                       G_TYPE_UINT, G_TYPE_UINT, G_TYPE_STRING,
+                                       G_TYPE_STRING, G_TYPE_STRING,
+                                                               G_TYPE_UINT);
 
        g_object_set_data(G_OBJECT(priv->store), "State", g_strdup("offline"));
 
@@ -452,6 +455,46 @@ void connman_client_disconnect(ConnmanClient *client, 
const gchar *network)
        g_object_unref(proxy);
 }
 
+guint connman_client_get_security(ConnmanClient *client, const gchar *network)
+{
+       ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
+       GtkTreeIter iter;
+       guint security;
+
+       DBG("client %p", client);
+
+       if (network == NULL)
+               return CONNMAN_SECURITY_UNKNOWN;
+
+       if (connman_dbus_get_iter(priv->store, network, &iter) == FALSE)
+               return CONNMAN_SECURITY_UNKNOWN;
+
+       gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+                               CONNMAN_COLUMN_SECURITY, &security, -1);
+
+       return security;
+}
+
+gchar *connman_client_get_passphrase(ConnmanClient *client, const gchar 
*network)
+{
+       ConnmanClientPrivate *priv = CONNMAN_CLIENT_GET_PRIVATE(client);
+       GtkTreeIter iter;
+       gchar *passphrase;
+
+       DBG("client %p", client);
+
+       if (network == NULL)
+               return NULL;
+
+       if (connman_dbus_get_iter(priv->store, network, &iter) == FALSE)
+               return NULL;
+
+       gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
+                               CONNMAN_COLUMN_PASSPHRASE, &passphrase, -1);
+
+       return passphrase;
+}
+
 void connman_client_set_callback(ConnmanClient *client,
                                        ConnmanClientCallback callback)
 {
diff --git a/common/connman-client.h b/common/connman-client.h
index 019c797..a265b5a 100644
--- a/common/connman-client.h
+++ b/common/connman-client.h
@@ -67,6 +67,9 @@ void connman_client_propose_scan(ConnmanClient *client, const 
gchar *device);
 void connman_client_connect(ConnmanClient *client, const gchar *network);
 void connman_client_disconnect(ConnmanClient *client, const gchar *network);
 
+guint connman_client_get_security(ConnmanClient *client, const gchar *network);
+gchar *connman_client_get_passphrase(ConnmanClient *client, const gchar 
*network);
+
 typedef void (* ConnmanClientCallback) (const char *status, void *user_data);
 
 void connman_client_set_callback(ConnmanClient *client,
@@ -83,6 +86,9 @@ enum {
        CONNMAN_COLUMN_STRENGTH,        /* G_TYPE_UINT    */
        CONNMAN_COLUMN_SECURITY,        /* G_TYPE_UINT    */
        CONNMAN_COLUMN_PASSPHRASE,      /* G_TYPE_STRING  */
+       CONNMAN_COLUMN_NETWORK,
+       CONNMAN_COLUMN_ADDRESS,
+       CONNMAN_COLUMN_POLICY,
        _CONNMAN_NUM_COLUMNS
 };
 
@@ -95,6 +101,14 @@ enum {
 };
 
 enum {
+       CONNMAN_POLICY_UNKNOWN,
+       CONNMAN_POLICY_IGNORE,
+       CONNMAN_POLICY_OFF,
+       CONNMAN_POLICY_AUTO,
+       CONNMAN_POLICY_MANUAL,
+};
+
+enum {
        CONNMAN_SECURITY_UNKNOWN,
        CONNMAN_SECURITY_NONE,
        CONNMAN_SECURITY_WEP,
diff --git a/common/connman-dbus.c b/common/connman-dbus.c
index fac128b..ccab204 100644
--- a/common/connman-dbus.c
+++ b/common/connman-dbus.c
@@ -102,7 +102,14 @@ static gboolean compare_proxy(GtkTreeStore *store, 
GtkTreeIter *iter,
 static gboolean get_iter_from_proxy(GtkTreeStore *store,
                                        GtkTreeIter *iter, DBusGProxy *proxy)
 {
-       const char *path = dbus_g_proxy_get_path(proxy);
+       const char *path;
+
+       if (proxy == NULL)
+               return FALSE;
+
+       path = dbus_g_proxy_get_path(proxy);
+       if (path == NULL)
+               return FALSE;
 
        return iter_search(store, iter, NULL, compare_proxy, path);
 }
@@ -110,6 +117,9 @@ static gboolean get_iter_from_proxy(GtkTreeStore *store,
 static gboolean get_iter_from_path(GtkTreeStore *store,
                                        GtkTreeIter *iter, const char *path)
 {
+       if (path == NULL)
+               return FALSE;
+
        return iter_search(store, iter, NULL, compare_proxy, path);
 }
 
@@ -127,6 +137,12 @@ DBusGProxy *connman_dbus_get_proxy(GtkTreeStore *store, 
const gchar *path)
        return proxy;
 }
 
+gboolean connman_dbus_get_iter(GtkTreeStore *store, const gchar *path,
+                                                       GtkTreeIter *iter)
+{
+       return get_iter_from_path(store, iter, path);
+}
+
 static void iterate_list(const GValue *value, gpointer user_data)
 {
        GSList **list = user_data;
@@ -224,9 +240,27 @@ static const gchar *type2icon(guint type)
                return "network-wireless";
        case CONNMAN_TYPE_BLUETOOTH:
                return "bluetooth";
-       default:
-               return NULL;
        }
+
+       return NULL;
+}
+
+static guint get_policy(const GValue *value)
+{
+       const char *policy = value ? g_value_get_string(value) : NULL;
+
+       if (policy == NULL)
+               return CONNMAN_POLICY_UNKNOWN;
+       else if (g_str_equal(policy, "ignore") == TRUE)
+               return CONNMAN_POLICY_IGNORE;
+       else if (g_str_equal(policy, "off") == TRUE)
+               return CONNMAN_POLICY_OFF;
+       else if (g_str_equal(policy, "auto") == TRUE)
+               return CONNMAN_POLICY_AUTO;
+       else if (g_str_equal(policy, "manual") == TRUE)
+               return CONNMAN_POLICY_MANUAL;
+
+       return CONNMAN_POLICY_UNKNOWN;
 }
 
 static guint get_security(const GValue *value)
@@ -364,6 +398,10 @@ static void device_changed(DBusGProxy *proxy, const char 
*property,
                return;
 
        if (g_str_equal(property, "Powered") == TRUE) {
+               guint policy = get_policy(value);
+               gtk_tree_store_set(store, &iter,
+                                       CONNMAN_COLUMN_POLICY, policy, -1);
+       } else if (g_str_equal(property, "Powered") == TRUE) {
                gboolean powered = g_value_get_boolean(value);
                gtk_tree_store_set(store, &iter,
                                        CONNMAN_COLUMN_ENABLED, powered, -1);
@@ -378,7 +416,7 @@ static void device_properties(DBusGProxy *proxy, GHashTable 
*hash,
        const char *path = dbus_g_proxy_get_path(proxy);
        GValue *value;
        const gchar *name, *icon;
-       guint type;
+       guint type, policy;
        gboolean powered;
        GtkTreeIter iter;
 
@@ -394,10 +432,13 @@ static void device_properties(DBusGProxy *proxy, 
GHashTable *hash,
        type = get_type(value);
        icon = type2icon(type);
 
+       value = g_hash_table_lookup(hash, "Policy");
+       policy = get_policy(value);
+
        value = g_hash_table_lookup(hash, "Powered");
        powered = value ? g_value_get_boolean(value) : FALSE;
 
-       DBG("name %s type %d", name, type);
+       DBG("name %s type %d icon %s", name, type, icon);
 
        if (get_iter_from_proxy(store, &iter, proxy) == FALSE) {
                gtk_tree_store_insert_with_values(store, &iter, NULL, -1,
@@ -405,7 +446,8 @@ static void device_properties(DBusGProxy *proxy, GHashTable 
*hash,
                                        CONNMAN_COLUMN_NAME, name,
                                        CONNMAN_COLUMN_ICON, icon,
                                        CONNMAN_COLUMN_TYPE, type,
-                                       CONNMAN_COLUMN_ENABLED, powered, -1);
+                                       CONNMAN_COLUMN_ENABLED, powered,
+                                       CONNMAN_COLUMN_POLICY, policy, -1);
 
                dbus_g_proxy_add_signal(proxy, "PropertyChanged",
                                G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
@@ -416,7 +458,8 @@ static void device_properties(DBusGProxy *proxy, GHashTable 
*hash,
                                        CONNMAN_COLUMN_NAME, name,
                                        CONNMAN_COLUMN_ICON, icon,
                                        CONNMAN_COLUMN_TYPE, type,
-                                       CONNMAN_COLUMN_ENABLED, powered, -1);
+                                       CONNMAN_COLUMN_ENABLED, powered,
+                                       CONNMAN_COLUMN_POLICY, policy, -1);
 
        value = g_hash_table_lookup(hash, "Networks");
        if (value != NULL)
@@ -456,6 +499,7 @@ static void connection_properties(DBusGProxy *proxy, 
GHashTable *hash,
        GValue *value;
        guint type, strength;
        gboolean enabled;
+       const char *device, *address;
        GtkTreeIter iter;
 
        if (error != NULL || hash == NULL)
@@ -470,14 +514,18 @@ static void connection_properties(DBusGProxy *proxy, 
GHashTable *hash,
        value = g_hash_table_lookup(hash, "Default");
        enabled = value ? g_value_get_boolean(value) : FALSE;
 
-       DBG("type %d", type);
+       value = g_hash_table_lookup(hash, "IPv4.Address");
+       address = value ? g_value_get_string(value) : NULL;
+
+       DBG("type %d address %s", type, address);
 
        if (get_iter_from_proxy(store, &iter, proxy) == FALSE) {
                gtk_tree_store_insert_with_values(store, &iter, NULL, -1,
                                        CONNMAN_COLUMN_PROXY, proxy,
                                        CONNMAN_COLUMN_TYPE, type,
                                        CONNMAN_COLUMN_ENABLED, enabled,
-                                       CONNMAN_COLUMN_STRENGTH, strength, -1);
+                                       CONNMAN_COLUMN_STRENGTH, strength,
+                                       CONNMAN_COLUMN_ADDRESS, address, -1);
 
                dbus_g_proxy_add_signal(proxy, "PropertyChanged",
                                G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
@@ -489,6 +537,17 @@ static void connection_properties(DBusGProxy *proxy, 
GHashTable *hash,
                                        CONNMAN_COLUMN_ENABLED, enabled,
                                        CONNMAN_COLUMN_STRENGTH, strength, -1);
 
+       value = g_hash_table_lookup(hash, "Device");
+       device = value ? g_value_get_boxed(value) : NULL;
+
+       DBG("device %s", device);
+
+       if (get_iter_from_path(store, &iter, device) == TRUE) {
+               gtk_tree_store_set(store, &iter,
+                                       CONNMAN_COLUMN_INRANGE, TRUE,
+                                       CONNMAN_COLUMN_ADDRESS, address, -1);
+       }
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to