aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Bradford <rob@o-hand.com>2008-04-03 17:22:54 +0000
committerrob <rob@aea7fca7-3721-49c4-ace3-ac8c44b998bb>2008-04-03 17:22:54 +0000
commitd21bbfd9362dade66372d728f94a14d26c407de2 (patch)
tree9a7b4549505c33ad7caf34fcb66d73b2a6b8c40e
parente5a85ca36c2440cb68570ee67a54d26b805987ba (diff)
downloadanjuta-poky-d21bbfd9362dade66372d728f94a14d26c407de2.tar.gz
anjuta-poky-d21bbfd9362dade66372d728f94a14d26c407de2.tar.bz2
anjuta-poky-d21bbfd9362dade66372d728f94a14d26c407de2.zip
2008-04-03 Rob Bradford <rob@openedhand.com>
* src/beaver-target.c: (beaver_target_class_init), (beaver_target_run_remote), (_beaver_target_run_remote), (launcher_child_exited_cb): * src/beaver-target.h: Add a beaver_target_run_remote function that uses the correct environment to programs on the device *without* needing an extra script. Fix the logic in the launcher_child_exited_cb.
-rw-r--r--ChangeLog11
-rw-r--r--src/beaver-target.c35
-rw-r--r--src/beaver-target.h4
3 files changed, 46 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 05b9680..f040562 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-04-03 Rob Bradford <rob@openedhand.com>
+ * src/beaver-target.c: (beaver_target_class_init),
+ (beaver_target_run_remote), (_beaver_target_run_remote),
+ (launcher_child_exited_cb):
+ * src/beaver-target.h:
+ Add a beaver_target_run_remote function that uses the correct
+ environment to programs on the device *without* needing an extra
+ script.
+ Fix the logic in the launcher_child_exited_cb.
+
+2008-04-03 Rob Bradford <rob@openedhand.com>
+
* src/beaver-target-device.c: (beaver_target_device_set_state):
Emit signal on state change.
diff --git a/src/beaver-target.c b/src/beaver-target.c
index 696266d..ac4a3ec 100644
--- a/src/beaver-target.c
+++ b/src/beaver-target.c
@@ -61,8 +61,10 @@ static void launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid,
gint status, gulong time, gpointer userdata);
static void launcher_data_cb (AnjutaLauncher *launcher,
AnjutaLauncherOutputType type, const gchar *chars, gpointer userdata);
-gboolean _beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
+static gboolean _beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
GError **error);
+static gboolean _beaver_target_run_remote (BeaverTarget *target, gchar *cmd,
+ GError **out_err);
static void
beaver_target_get_property (GObject *object, guint property_id,
@@ -129,6 +131,7 @@ beaver_target_class_init (BeaverTargetClass *klass)
object_class->finalize = beaver_target_finalize;
klass->run_remote_v = _beaver_target_run_remote_v;
+ klass->run_remote = _beaver_target_run_remote;
signals[STATE_CHANGED] = g_signal_new ("state-changed",
G_OBJECT_CLASS_TYPE (object_class),
@@ -195,8 +198,33 @@ beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
return BEAVER_TARGET_GET_CLASS (target)->run_remote_v (target, in_args, error);
}
-/* default implementations */
gboolean
+beaver_target_run_remote (BeaverTarget *target, gchar *cmd, GError **error)
+{
+ return BEAVER_TARGET_GET_CLASS (target)->run_remote (target, cmd, error);
+}
+
+/* default implementations */
+static gboolean
+_beaver_target_run_remote (BeaverTarget *target, gchar *cmd, GError **out_err)
+{
+ GError *error = NULL;
+ gchar *args[2] = { 0 };
+ gchar *cmdline = NULL;
+ gboolean res = FALSE;
+
+ cmdline = g_strdup_printf ("DISPLAY=:0 dbus-launch %s", cmd);
+ args[0] = cmdline;
+ args[1] = NULL;
+
+ res = beaver_target_run_remote_v (target, args, &error);
+
+ g_free (cmdline);
+
+ return res;
+}
+
+static gboolean
_beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
GError **out_err)
{
@@ -268,8 +296,7 @@ launcher_child_exited_cb (AnjutaLauncher *launcher, gint child_pid,
{
BeaverTarget *target = BEAVER_TARGET (userdata);
- if (beaver_target_get_state (target) == TARGET_STATE_READY)
- beaver_target_set_state (target, TARGET_STATE_READY);
+ beaver_target_set_state (target, TARGET_STATE_READY);
}
static void
diff --git a/src/beaver-target.h b/src/beaver-target.h
index fbc57c2..0b3bf7f 100644
--- a/src/beaver-target.h
+++ b/src/beaver-target.h
@@ -73,6 +73,8 @@ typedef struct {
gboolean (* run_remote_v) (BeaverTarget *target, gchar **args_in,
GError **error);
+ gboolean (* run_remote) (BeaverTarget *target, gchar *cmd,
+ GError **error);
} BeaverTargetClass;
GType beaver_target_get_type (void);
@@ -83,6 +85,8 @@ const gchar *beaver_target_get_ip_address (BeaverTarget *target);
IAnjutaMessageManager *beaver_target_get_message_manager (BeaverTarget *target);
gboolean beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
GError **error);
+gboolean beaver_target_run_remote (BeaverTarget *target, gchar *cmd,
+ GError **error);
G_END_DECLS