[gnome-control-center] network: Verify command-line arguments
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Verify command-line arguments
- Date: Wed, 3 Oct 2012 12:50:02 +0000 (UTC)
commit c35850649175044aa8d93e217d48884f49ac37fb
Author: Bastien Nocera <hadess hadess net>
Date: Wed Oct 3 14:49:23 2012 +0200
network: Verify command-line arguments
To avoid invalid bug reports ;)
panels/network/cc-network-panel.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index bfe7201..d449f74 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -130,6 +130,22 @@ reset_command_line_args (CcNetworkPanel *self)
g_clear_pointer (&self->priv->arg_access_point, g_free);
}
+static gboolean
+verify_argv (CcNetworkPanel *self,
+ const char **args)
+{
+ switch (self->priv->arg_operation) {
+ case OPERATION_CONNECT_MOBILE:
+ case OPERATION_CONNECT_8021X:
+ case OPERATION_SHOW_DEVICE:
+ if (self->priv->arg_device == NULL)
+ g_warning ("Operation %s requires an object path", args[0]);
+ return FALSE;
+ default:
+ return TRUE;
+ }
+}
+
static void
cc_network_panel_set_property (GObject *object,
guint property_id,
@@ -157,6 +173,11 @@ cc_network_panel_set_property (GObject *object,
if (args[0] && args[1] && args[2])
priv->arg_access_point = g_strdup (args[2]);
+ if (verify_argv (self, (const char **) args) == FALSE) {
+ reset_command_line_args (self);
+ return;
+ }
+
g_debug ("Calling handle_argv() after setting property");
handle_argv (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]