aboutsummaryrefslogtreecommitdiffstats
path: root/src/beaver-target-device.c
diff options
context:
space:
mode:
authorRob Bradford <rob@o-hand.com>2008-03-19 17:34:29 +0000
committerrob <rob@aea7fca7-3721-49c4-ace3-ac8c44b998bb>2008-03-19 17:34:29 +0000
commitf64af586c47da0488cbb9341dee38c724540a552 (patch)
treea02ef75b9be0e6688e3cb59af8b3553051fcc750 /src/beaver-target-device.c
parent107a1184727588931965abd9dda9d212e7d852b9 (diff)
downloadanjuta-poky-f64af586c47da0488cbb9341dee38c724540a552.tar.gz
anjuta-poky-f64af586c47da0488cbb9341dee38c724540a552.tar.bz2
anjuta-poky-f64af586c47da0488cbb9341dee38c724540a552.zip
2008-03-19 Rob Bradford <rob@openedhand.com>
* src/Makefile.am: * src/beaver-settings-page.c: (radio_toggled_cb), (create_ui): * src/beaver-target-device.c: (beaver_target_device_get_property), (beaver_target_device_set_property), (beaver_target_device_dispose), (beaver_target_device_finalize), (beaver_target_device_set_state), (beaver_target_device_get_state), (beaver_target_device_get_ip_address), (beaver_target_device_class_init), (beaver_target_device_init), (beaver_target_device_new): * src/beaver-target-device.h: * src/beaver.h: * src/plugin.c: (update_state), (setup_target), (rootfs_preference_notify_cb), (kernel_preference_notify_cb), (target_mode_preference_notify_cb), (target_ip_preference_notify_cb), (target_state_changed_cb), (anjuta_plugin_sdk_activate), (anjuta_plugin_sdk_deactivate): * src/plugin.h: Add support for using an external device.
Diffstat (limited to 'src/beaver-target-device.c')
-rw-r--r--src/beaver-target-device.c129
1 files changed, 129 insertions, 0 deletions
diff --git a/src/beaver-target-device.c b/src/beaver-target-device.c
new file mode 100644
index 0000000..fe684b6
--- /dev/null
+++ b/src/beaver-target-device.c
@@ -0,0 +1,129 @@
+#include "beaver-target-device.h"
+
+G_DEFINE_TYPE (BeaverTargetDevice, beaver_target_device, BEAVER_TYPE_TARGET)
+
+#define TARGET_DEVICE_PRIVATE(o) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), BEAVER_TYPE_TARGET_DEVICE, BeaverTargetDevicePrivate))
+
+typedef struct _BeaverTargetDevicePrivate BeaverTargetDevicePrivate;
+
+struct _BeaverTargetDevicePrivate {
+ BeaverTargetState state;
+ gchar *ip_address;
+};
+
+enum
+{
+ PROP_0 = 0,
+ PROP_IP_ADDRESS
+};
+
+static void
+beaver_target_device_get_property (GObject *object, guint property_id,
+ GValue *value, GParamSpec *pspec)
+{
+ BeaverTargetDevicePrivate *priv = TARGET_DEVICE_PRIVATE (object);
+
+ switch (property_id) {
+ case PROP_IP_ADDRESS:
+ g_value_set_string (value, priv->ip_address);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+beaver_target_device_set_property (GObject *object, guint property_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ BeaverTargetDevicePrivate *priv = TARGET_DEVICE_PRIVATE (object);
+
+ switch (property_id) {
+ case PROP_IP_ADDRESS:
+ g_free (priv->ip_address);
+
+ priv->ip_address = g_value_dup_string (value);
+
+ if (priv->ip_address)
+ priv->state = TARGET_STATE_READY;
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+beaver_target_device_dispose (GObject *object)
+{
+ if (G_OBJECT_CLASS (beaver_target_device_parent_class)->dispose)
+ G_OBJECT_CLASS (beaver_target_device_parent_class)->dispose (object);
+}
+
+static void
+beaver_target_device_finalize (GObject *object)
+{
+ if (G_OBJECT_CLASS (beaver_target_device_parent_class)->finalize)
+ G_OBJECT_CLASS (beaver_target_device_parent_class)->finalize (object);
+}
+
+static void
+beaver_target_device_set_state (BeaverTarget *target, BeaverTargetState state)
+{
+ BeaverTargetDevicePrivate *priv = TARGET_DEVICE_PRIVATE (target);
+
+ priv->state = state;
+}
+
+static BeaverTargetState
+beaver_target_device_get_state (BeaverTarget *target)
+{
+ BeaverTargetDevicePrivate *priv = TARGET_DEVICE_PRIVATE (target);
+
+ return priv->state;
+}
+
+static const gchar *
+beaver_target_device_get_ip_address (BeaverTarget *target)
+{
+ BeaverTargetDevicePrivate *priv = TARGET_DEVICE_PRIVATE (target);
+
+ return priv->ip_address;
+}
+
+static void
+beaver_target_device_class_init (BeaverTargetDeviceClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ BeaverTargetClass *target_class = BEAVER_TARGET_CLASS (klass);
+ GParamSpec *pspec = NULL;
+
+ g_type_class_add_private (klass, sizeof (BeaverTargetDevicePrivate));
+
+ object_class->get_property = beaver_target_device_get_property;
+ object_class->set_property = beaver_target_device_set_property;
+ object_class->dispose = beaver_target_device_dispose;
+ object_class->finalize = beaver_target_device_finalize;
+
+ target_class->get_state = beaver_target_device_get_state;
+ target_class->set_state = beaver_target_device_set_state;
+ target_class->get_ip_address = beaver_target_device_get_ip_address;
+
+ pspec = g_param_spec_string ("ip-address", "ip-address", "ip-address",
+ NULL, G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_IP_ADDRESS, pspec);
+}
+
+static void
+beaver_target_device_init (BeaverTargetDevice *self)
+{
+}
+
+BeaverTarget *
+beaver_target_device_new (AnjutaShell *shell)
+{
+ return g_object_new (BEAVER_TYPE_TARGET_DEVICE,
+ "shell", shell,
+ NULL);
+}
+