aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2009-12-04 12:58:47 +0000
committerJoshua Lock <josh@linux.intel.com>2009-12-04 14:04:41 +0000
commitd9b3d6b2febf1d0e9ddb1ee83082d243053fb6c7 (patch)
tree5c798ccd459429d4a6c2ef35e8df4c09d5433a08
parent33137a546bc750c7dc04d36543b822efe23db21c (diff)
downloadanjuta-poky-d9b3d6b2febf1d0e9ddb1ee83082d243053fb6c7.tar.gz
anjuta-poky-d9b3d6b2febf1d0e9ddb1ee83082d243053fb6c7.tar.bz2
anjuta-poky-d9b3d6b2febf1d0e9ddb1ee83082d243053fb6c7.zip
Add conditional support for updated interfaces in Anjuta 2.28
Rebased patch from Haito Feng <haito.feng@intel.com> Signed-off-by: Joshua Lock <josh@linux.intel.com>
-rw-r--r--ChangeLog11
-rw-r--r--configure.ac5
-rw-r--r--src/Makefile.am6
-rw-r--r--src/beaver-settings-page.c22
-rw-r--r--src/beaver-target-qemu.c16
-rw-r--r--src/beaver-target.c28
-rw-r--r--src/beaver-util.h6
-rw-r--r--src/beaver.h1
-rw-r--r--src/plugin.c140
9 files changed, 221 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a92252..ec38d00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-04 Haitao Feng <haitao.feng@intel.com>
+ * configure.ac:
+ * src/Makefile.am:
+ * src/beaver-settings-page.c:
+ * src/beaver-target-qemu.c:
+ * src/beaver-target.c:
+ * src/beaver-util.h:
+ * src/beaver.h:
+ * src/plugin.c:
+ Add conditional support for newer versions of the Anjuta interface
+
2008-10-02 Rob Bradford <rob@linux.intel.com>
* configure.ac:
diff --git a/configure.ac b/configure.ac
index a1ad7ee..0d35c49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,11 +23,14 @@ AM_PROG_LIBTOOL
PKG_CHECK_MODULES(GLIB, [glib-2.0])
PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.12.0])
PKG_CHECK_MODULES(LIBANJUTA, [libanjuta-1.0])
+PKG_CHECK_MODULES(GNOME_VFS, [gnome-vfs-2.0])
AC_SUBST(LIBANJUTA_CFLAGS)
AC_SUBST(LIBANJUTA_LIBS)
+AC_SUBST(GNOME_VFS_CFLAGS)
+AC_SUBST(GNOME_VFS_LIBS)
AC_ARG_ENABLE(gdb_integration,
- AS_HELP_STRING([--enable-gdb-integration],
+ AS_HELP_STRING([--enable-gdb-integration],
["Enable experimental gdb integration"]),
[if test "x$enableval" = "xyes"; then
AC_DEFINE(GDB_INTEGRATION, 1, Enable experimental GDB integration)
diff --git a/src/Makefile.am b/src/Makefile.am
index f01fada..25552d4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,7 +33,8 @@ INCLUDES = \
-DANJUTA_UI_DIR=\"$(anjuta_ui_dir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)\" \
-DPACKAGE_SRC_DIR=\"$(srcdir)\" \
- $(LIBANJUTA_CFLAGS)
+ $(LIBANJUTA_CFLAGS) \
+ $(GNOME_VFS_CFLAGS)
# Where to install the plugin
plugindir = $(anjuta_plugin_dir)
@@ -52,7 +53,8 @@ libanjuta_plugin_sdk_la_SOURCES = plugin.c plugin.h \
# Plugin dependencies
libanjuta_plugin_sdk_la_LIBADD = \
- $(LIBANJUTA_LIBS)
+ $(LIBANJUTA_LIBS) \
+ $(GNOME_VFS_LIBS)
# Plugin link flags
libanjuta_plugin_sdk_la_LDFLAGS = -avoid-version -Wl,--no-undefined
diff --git a/src/beaver-settings-page.c b/src/beaver-settings-page.c
index ccf380a..9e20c9b 100644
--- a/src/beaver-settings-page.c
+++ b/src/beaver-settings-page.c
@@ -294,6 +294,16 @@ create_ui (BeaverSettingsPage *page)
* state...Ah, but actually when the widgets are created the first is
* toggled on by default.
*/
+#ifdef ANJUTA_2_28_OR_HIGHER
+ res = anjuta_preferences_register_property_raw (
+ priv->prefs,
+ full_radio,
+ PREFS_PROP_POKY_MODE,
+ NULL,
+ 0,
+ ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE,
+ ANJUTA_PROPERTY_DATA_TYPE_BOOL);
+#else
res = anjuta_preferences_register_property_raw (
priv->prefs,
full_radio,
@@ -302,6 +312,7 @@ create_ui (BeaverSettingsPage *page)
0,
ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE,
ANJUTA_PROPERTY_DATA_TYPE_INT);
+#endif
if (!res)
g_warning ("Error adding preference for mode of operation");
@@ -444,6 +455,16 @@ create_ui (BeaverSettingsPage *page)
* state...Ah, but actually when the widgets are created the first is
* toggled on by default.
*/
+#ifdef ANJUTA_2_28_OR_HIGHER
+ res = anjuta_preferences_register_property_raw (
+ priv->prefs,
+ device_radio,
+ PREFS_PROP_TARGET_MODE,
+ NULL,
+ 0,
+ ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE,
+ ANJUTA_PROPERTY_DATA_TYPE_BOOL);
+#else
res = anjuta_preferences_register_property_raw (
priv->prefs,
device_radio,
@@ -452,6 +473,7 @@ create_ui (BeaverSettingsPage *page)
0,
ANJUTA_PROPERTY_OBJECT_TYPE_TOGGLE,
ANJUTA_PROPERTY_DATA_TYPE_INT);
+#endif
if (!res)
g_warning ("Error adding preference for mode of operation");
diff --git a/src/beaver-target-qemu.c b/src/beaver-target-qemu.c
index a5fb371..41f35fb 100644
--- a/src/beaver-target-qemu.c
+++ b/src/beaver-target-qemu.c
@@ -239,8 +239,9 @@ beaver_target_qemu_start (BeaverTargetQEMU *btq, GError **out_err)
if (priv->kernel && priv->rootfs)
{
gchar *args[] = {QEMU_SCRIPT, priv->kernel, priv->rootfs, NULL};
-#ifdef ANJUTA_2_23_OR_HIGHER
+#ifdef ANJUTA_2_28_OR_HIGHER
if (!anjuta_launcher_execute_v (priv->launcher,
+ NULL,
args,
NULL,
launcher_data_cb,
@@ -249,16 +250,27 @@ beaver_target_qemu_start (BeaverTargetQEMU *btq, GError **out_err)
g_warning ("Error launching QEMU");
return FALSE;
#else
+#ifdef ANJUTA_2_23_TO_26
if (!anjuta_launcher_execute_v (priv->launcher,
args,
+ NULL,
launcher_data_cb,
btq))
{
g_warning ("Error launching QEMU");
return FALSE;
+#else
+ if (!anjuta_launcher_execute_v (priv->launcher,
+ args,
+ launcher_data_cb,
+ btq))
+ {
+ g_warning ("Error launching QEMU");
+ return FALSE;
+#endif
#endif
} else {
- beaver_target_qemu_set_state (BEAVER_TARGET (btq),
+ beaver_target_qemu_set_state (BEAVER_TARGET (btq),
TARGET_STATE_READY);
}
}
diff --git a/src/beaver-target.c b/src/beaver-target.c
index 84c4cc9..f936ea2 100644
--- a/src/beaver-target.c
+++ b/src/beaver-target.c
@@ -321,8 +321,9 @@ _beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
}
}
-#ifdef ANJUTA_2_23_OR_HIGHER
+#ifdef ANJUTA_2_28_OR_HIGHER
if (anjuta_launcher_execute_v (priv->launcher,
+ NULL,
args,
NULL,
launcher_data_cb,
@@ -331,13 +332,24 @@ _beaver_target_run_remote_v (BeaverTarget *target, gchar **in_args,
beaver_target_set_state (target, TARGET_STATE_REMOTE_RUNNING);
return TRUE;
#else
+#ifdef ANJUTA_2_23_TO_26
if (anjuta_launcher_execute_v (priv->launcher,
args,
+ NULL,
launcher_data_cb,
target))
{
beaver_target_set_state (target, TARGET_STATE_REMOTE_RUNNING);
return TRUE;
+#else
+ if (anjuta_launcher_execute_v (priv->launcher,
+ args,
+ launcher_data_cb,
+ target))
+ {
+ beaver_target_set_state (target, TARGET_STATE_REMOTE_RUNNING);
+ return TRUE;
+#endif
#endif
} else {
gchar *debug_str = NULL;
@@ -425,8 +437,9 @@ _beaver_target_remote_debug (BeaverTarget *target, gchar *cmd, gchar *cmd_args,
}
}
-#ifdef ANJUTA_2_23_OR_HIGHER
+#ifdef ANJUTA_2_28_OR_HIGHER
if (anjuta_launcher_execute_v (priv->debug_launcher,
+ NULL,
args,
NULL,
debug_launcher_data_cb,
@@ -435,13 +448,24 @@ _beaver_target_remote_debug (BeaverTarget *target, gchar *cmd, gchar *cmd_args,
beaver_target_set_state (target, TARGET_STATE_BUSY);
return TRUE;
#else
+#ifdef ANJUTA_2_23_TO_26
if (anjuta_launcher_execute_v (priv->debug_launcher,
args,
+ NULL,
debug_launcher_data_cb,
target))
{
beaver_target_set_state (target, TARGET_STATE_BUSY);
return TRUE;
+#else
+ if (anjuta_launcher_execute_v (priv->debug_launcher,
+ args,
+ debug_launcher_data_cb,
+ target))
+ {
+ beaver_target_set_state (target, TARGET_STATE_BUSY);
+ return TRUE;
+#endif
#endif
} else {
gchar *debug_str = NULL;
diff --git a/src/beaver-util.h b/src/beaver-util.h
index cb1f25c..a7c8a61 100644
--- a/src/beaver-util.h
+++ b/src/beaver-util.h
@@ -31,7 +31,11 @@ gchar **beaver_util_strv_joinv (gchar **strv_1, ...);
#ifdef ANJUTA_CHECK_VERSION
#if LIBANJUTA_MAJOR_VERSION >= 2 && LIBANJUTA_MINOR_VERSION >= 23
-#define ANJUTA_2_23_OR_HIGHER
+#if LIBANJUTA_MINOR_VERSION >= 28
+#define ANJUTA_2_28_OR_HIGHER
+#else
+#define ANJUTA_2_23_TO_26
+#endif
#endif
#endif
diff --git a/src/beaver.h b/src/beaver.h
index cc61908..afa8df9 100644
--- a/src/beaver.h
+++ b/src/beaver.h
@@ -22,6 +22,7 @@
#include "beaver-target-qemu.h"
#include "beaver-target-device.h"
#include "beaver-settings-page.h"
+#include "beaver-util.h"
#define PREFS_PROP_SDK_ROOT "sdk.root"
#define PREFS_PROP_TRIPLET "sdk.triplet"
diff --git a/src/plugin.c b/src/plugin.c
index 4536e40..675164e 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -735,11 +735,8 @@ do_local_gdb (AnjutaPluginSdk *sp)
cmd = g_strdup_printf (LOCAL_GDB_COMMAND, sp->triplet,
script_name, sp->gdb_local_path);
cur_dir = g_get_current_dir ();
-#ifdef ANJUTA_2_23_OR_HIGHER
ianjuta_terminal_execute_command (terminal, cur_dir, cmd, NULL, &error);
-#else
- ianjuta_terminal_execute_command (terminal, cur_dir, cmd, NULL, &error);
-#endif
+
if (error != NULL)
{
g_warning ("Error whilst launching local gdb command: %s", error->message);
@@ -1285,10 +1282,116 @@ setup_buildable (AnjutaPluginSdk *sp)
g_free (command);
}
+#ifdef ANJUTA_2_28_OR_HIGHER
+/* Callbacks fired when preferences changed */
+static void
+sdk_root_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gchar *value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+
+ g_free (sp->sdk_root);
+ sp->sdk_root = anjuta_preferences_get (sp->prefs, PREFS_PROP_SDK_ROOT);
+
+ update_environment (sp);
+}
+
+static void
+triplet_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gchar *value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+
+ g_free (sp->triplet);
+ sp->triplet = anjuta_preferences_get (sp->prefs, PREFS_PROP_TRIPLET);
+
+ update_environment (sp);
+ setup_buildable (sp);
+}
+
+static void
+rootfs_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gchar *value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+ gchar *rootfs = NULL;
+
+ if (BEAVER_IS_TARGET_QEMU (sp->target))
+ {
+ rootfs = anjuta_preferences_get (sp->prefs, PREFS_PROP_ROOTFS);
+ g_object_set (sp->target, "rootfs", rootfs, NULL);
+ g_free (rootfs);
+ }
+}
+
+static void
+kernel_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gchar *value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+ gchar *kernel = NULL;
+
+ if (BEAVER_IS_TARGET_QEMU (sp->target))
+ {
+ kernel = anjuta_preferences_get (sp->prefs, PREFS_PROP_KERNEL);
+ g_object_set (sp->target, "kernel", kernel, NULL);
+ g_free (kernel);
+ }
+}
+
+static void
+poky_mode_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gboolean value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+
+ sp->poky_mode = anjuta_preferences_get_bool (sp->prefs, PREFS_PROP_POKY_MODE);
+
+ update_environment (sp);
+}
+
+static void
+poky_root_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gchar *value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+ g_free (sp->poky_root);
+ sp->poky_root = anjuta_preferences_get (sp->prefs, PREFS_PROP_POKY_ROOT);
+
+ update_environment (sp);
+}
+
+static void
+target_mode_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gboolean value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+
+ sp->target_mode = anjuta_preferences_get_bool (sp->prefs, PREFS_PROP_TARGET_MODE);
+
+ setup_target (sp);
+}
+
+static void
+target_ip_preference_notify_cb (AnjutaPreferences *pref, const gchar *key,
+ const gchar *value, gpointer userdata)
+{
+ AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
+ gchar *ip_address = NULL;
+
+ if (sp->target &&
+ BEAVER_IS_TARGET_DEVICE (sp->target))
+ {
+ ip_address = anjuta_preferences_get (sp->prefs, PREFS_PROP_TARGET_IP);
+ g_object_set (sp->target, "ip-address", ip_address, NULL);
+ g_free (ip_address);
+ }
+}
+#else
/* Callbacks fired when preferences changed */
static void
-sdk_root_preference_notify_cb (GConfClient *client, guint cnxn_id,
+sdk_root_preference_notify_cb (GConfClient *client, guint cnxn_id,
GConfEntry *entry, gpointer userdata)
{
AnjutaPluginSdk *sp = (AnjutaPluginSdk *)userdata;
@@ -1391,6 +1494,7 @@ target_ip_preference_notify_cb (GConfClient *client, guint cnxn_id,
g_free (ip_address);
}
}
+#endif
/*
* Callbacks for when a value for "project_root_uri" is added to the shell aka
@@ -1514,6 +1618,24 @@ anjuta_plugin_sdk_activate (AnjutaPlugin *plugin)
gtk_action_set_sensitive (sp->remote_profile_action, FALSE);
gtk_action_set_sensitive (sp->remote_stop_action, FALSE);
+#ifdef ANJUTA_2_28_OR_HIGHER
+ sp->sdk_root_notifyid = anjuta_preferences_notify_add_string (sp->prefs,
+ PREFS_PROP_SDK_ROOT, sdk_root_preference_notify_cb, sp, NULL);
+ sp->triplet_notifyid = anjuta_preferences_notify_add_string (sp->prefs,
+ PREFS_PROP_TRIPLET, triplet_preference_notify_cb, sp, NULL);
+ sp->rootfs_notifyid = anjuta_preferences_notify_add_string (sp->prefs,
+ PREFS_PROP_ROOTFS, rootfs_preference_notify_cb, sp, NULL);
+ sp->kernel_notifyid = anjuta_preferences_notify_add_string (sp->prefs,
+ PREFS_PROP_KERNEL, kernel_preference_notify_cb, sp, NULL);
+ sp->poky_root_notifyid = anjuta_preferences_notify_add_string (sp->prefs,
+ PREFS_PROP_POKY_ROOT, poky_root_preference_notify_cb, sp, NULL);
+ sp->poky_mode_notifyid = anjuta_preferences_notify_add_bool (sp->prefs,
+ PREFS_PROP_POKY_MODE, poky_mode_preference_notify_cb, sp, NULL);
+ sp->target_mode_notifyid = anjuta_preferences_notify_add_bool (sp->prefs,
+ PREFS_PROP_TARGET_MODE, target_mode_preference_notify_cb, sp, NULL);
+ sp->target_ip_notifyid = anjuta_preferences_notify_add_string (sp->prefs,
+ PREFS_PROP_TARGET_IP, target_ip_preference_notify_cb, sp, NULL);
+#else
sp->sdk_root_notifyid = anjuta_preferences_notify_add (sp->prefs,
PREFS_PROP_SDK_ROOT, sdk_root_preference_notify_cb, sp, NULL);
sp->triplet_notifyid = anjuta_preferences_notify_add (sp->prefs,
@@ -1530,14 +1652,20 @@ anjuta_plugin_sdk_activate (AnjutaPlugin *plugin)
PREFS_PROP_TARGET_MODE, target_mode_preference_notify_cb, sp, NULL);
sp->target_ip_notifyid = anjuta_preferences_notify_add (sp->prefs,
PREFS_PROP_TARGET_IP, target_ip_preference_notify_cb, sp, NULL);
+#endif
sp->sdk_root = anjuta_preferences_get (sp->prefs, PREFS_PROP_SDK_ROOT);
sp->triplet = anjuta_preferences_get (sp->prefs, PREFS_PROP_TRIPLET);
sp->poky_root = anjuta_preferences_get (sp->prefs, PREFS_PROP_POKY_ROOT);
- sp->poky_mode = anjuta_preferences_get_int (sp->prefs, PREFS_PROP_POKY_MODE);
+#ifdef ANJUTA_2_28_OR_HIGHER
+ sp->poky_mode = anjuta_preferences_get_bool (sp->prefs, PREFS_PROP_POKY_MODE);
+ sp->target_mode = anjuta_preferences_get_bool (sp->prefs, PREFS_PROP_TARGET_MODE);
+#else
+ sp->poky_mode = anjuta_preferences_get_int (sp->prefs, PREFS_PROP_POKY_MODE);
sp->target_mode = anjuta_preferences_get_int (sp->prefs, PREFS_PROP_TARGET_MODE);
+#endif
setup_target (sp);
update_environment (sp);