[anjuta] libanjuta: Replace AnjutaPluginDescription by AnjutaPluginHandle in API
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] libanjuta: Replace AnjutaPluginDescription by AnjutaPluginHandle in API
- Date: Sat, 1 Jun 2013 20:29:16 +0000 (UTC)
commit 3d643fa8566093cd6edbc48b13c560ef438c6895
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sun Mar 31 12:22:15 2013 +0200
libanjuta: Replace AnjutaPluginDescription by AnjutaPluginHandle in API
libanjuta/anjuta-plugin-manager.c | 376 +++++++++---------------
libanjuta/anjuta-plugin-manager.h | 30 +-
libanjuta/anjuta-profile-manager.c | 27 +-
libanjuta/anjuta-profile.c | 83 +++---
libanjuta/anjuta-profile.h | 12 +-
plugins/debug-manager/queue.c | 37 +--
plugins/document-manager/plugin.c | 31 +--
plugins/file-loader/plugin.c | 227 +++++++--------
plugins/file-manager/plugin.c | 13 +-
plugins/project-import/plugin.c | 67 ++---
plugins/project-import/project-import-dialog.c | 35 ++-
plugins/project-import/project-import-dialog.h | 3 +-
plugins/project-import/project-import.ui | 4 +-
plugins/project-manager/dialogs.c | 55 ++--
plugins/project-manager/plugin.c | 8 +-
plugins/project-manager/plugin.h | 2 +-
plugins/project-manager/project.c | 30 +--
plugins/project-manager/project.h | 8 +-
plugins/starter/plugin.c | 43 ++-
src/about.c | 10 +-
20 files changed, 491 insertions(+), 610 deletions(-)
---
diff --git a/libanjuta/anjuta-plugin-manager.c b/libanjuta/anjuta-plugin-manager.c
index 46195b1..48d6f06 100644
--- a/libanjuta/anjuta-plugin-manager.c
+++ b/libanjuta/anjuta-plugin-manager.c
@@ -501,7 +501,7 @@ on_plugin_activated (AnjutaPlugin *plugin_object, AnjutaPluginHandle *plugin)
g_hash_table_remove (priv->plugins_cache, plugin);
g_signal_emit_by_name (plugin_manager, "plugin-activated",
- anjuta_plugin_handle_get_description (plugin),
+ plugin,
plugin_object);
}
@@ -522,7 +522,7 @@ on_plugin_deactivated (AnjutaPlugin *plugin_object, AnjutaPluginHandle *plugin)
g_hash_table_remove (priv->activated_plugins, plugin);
g_signal_emit_by_name (plugin_manager, "plugin-deactivated",
- anjuta_plugin_handle_get_description (plugin),
+ plugin,
plugin_object);
}
@@ -1029,33 +1029,30 @@ create_remembered_plugins_tree (void)
static void
foreach_remembered_plugin (gpointer key, gpointer value, gpointer user_data)
{
- AnjutaPluginDescription *desc = (AnjutaPluginDescription *) value;
+ AnjutaPluginHandle *handle = (AnjutaPluginHandle *) value;
GtkListStore *store = GTK_LIST_STORE (user_data);
AnjutaPluginManager *manager = g_object_get_data (G_OBJECT (store),
"plugin-manager");
- AnjutaPluginHandle *plugin =
- g_hash_table_lookup (manager->priv->plugins_by_description, desc);
- g_return_if_fail (plugin != NULL);
- if (anjuta_plugin_handle_get_name (plugin) &&
- anjuta_plugin_handle_get_description (plugin))
+ if (anjuta_plugin_handle_get_name (handle) &&
+ anjuta_plugin_handle_get_description (handle))
{
GtkTreeIter iter;
gchar *text;
text = g_markup_printf_escaped ("<span size=\"larger\" weight=\"bold\">%s</span>\n%s",
- anjuta_plugin_handle_get_name
(plugin),
-
anjuta_plugin_handle_get_about (plugin));
+ anjuta_plugin_handle_get_name
(handle),
+
anjuta_plugin_handle_get_about (handle));
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COL_REM_NAME, text,
COL_REM_PLUGIN_KEY, key,
-1);
- if (anjuta_plugin_handle_get_icon_path (plugin))
+ if (anjuta_plugin_handle_get_icon_path (handle))
{
GdkPixbuf *icon;
- icon = gdk_pixbuf_new_from_file_at_size (anjuta_plugin_handle_get_icon_path (plugin),
+ icon = gdk_pixbuf_new_from_file_at_size (anjuta_plugin_handle_get_icon_path (handle),
32,
32, NULL);
if (icon) {
gtk_list_store_set (store, &iter,
@@ -1343,20 +1340,20 @@ get_plugin_factory (AnjutaPluginManager *plugin_manager,
{
/* Prompt the user to select one of these plugins */
- GList *descs = NULL;
+ GList *handles = NULL;
node = valid_plugins;
while (node)
{
plugin = node->data;
- descs = g_list_prepend (descs, anjuta_plugin_handle_get_description (plugin));
+ handles = g_list_prepend (handles, plugin);
node = g_list_next (node);
}
- descs = g_list_reverse (descs);
+ handles = g_list_reverse (handles);
obj = anjuta_plugin_manager_select_and_activate (plugin_manager,
dgettext (GETTEXT_PACKAGE, "Select a
plugin"),
dgettext (GETTEXT_PACKAGE, "Please select a
plugin to activate"),
- descs);
- g_list_free (descs);
+ handles);
+ g_list_free (handles);
}
g_list_free (valid_plugins);
@@ -1494,20 +1491,20 @@ anjuta_plugin_manager_get_plugin (AnjutaPluginManager *plugin_manager,
{
/* Prompt the user to select one of these plugins */
GObject *obj;
- GList *descs = NULL;
+ GList *handles = NULL;
node = valid_plugins;
while (node)
{
plugin = node->data;
- descs = g_list_prepend (descs, anjuta_plugin_handle_get_description (plugin));
+ handles = g_list_prepend (handles, plugin);
node = g_list_next (node);
}
- descs = g_list_reverse (descs);
+ handles = g_list_reverse (handles);
obj = anjuta_plugin_manager_select_and_activate (plugin_manager,
dgettext (GETTEXT_PACKAGE, "Select
a plugin"),
dgettext (GETTEXT_PACKAGE,
"<b>Please select a plugin to activate</b>"),
- descs);
- g_list_free (descs);
+ handles);
+ g_list_free (handles);
return obj;
}
@@ -1516,44 +1513,35 @@ anjuta_plugin_manager_get_plugin (AnjutaPluginManager *plugin_manager,
}
/**
- * anjuta_plugin_manager_get_plugin_by_id:
+ * anjuta_plugin_manager_get_plugin_by_handle:
* @plugin_manager: A #AnjutaPluginManager object
- * @plugin_id: The plugin id
+ * @handle: A #AnjutaPluginHandle
*
* Searches the currently available plugins to find the one with the
- * specified identifier. If the plugin is not yet loaded, it will be loaded
+ * specified handle. If the plugin is not yet loaded, it will be loaded
* and activated.
*
* Return value: The plugin object (subclass of #AnjutaPlugin)
*/
GObject *
-anjuta_plugin_manager_get_plugin_by_id (AnjutaPluginManager *plugin_manager,
- const gchar *plugin_id)
+anjuta_plugin_manager_get_plugin_by_handle (AnjutaPluginManager *plugin_manager,
+ AnjutaPluginHandle *handle)
{
AnjutaPluginManagerPriv *priv;
- AnjutaPluginHandle *plugin;
-
+ GObject *obj;
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN_MANAGER (plugin_manager), NULL);
- g_return_val_if_fail (plugin_id != NULL, NULL);
-
+ g_return_val_if_fail (handle != NULL, NULL);
+
priv = plugin_manager->priv;
- plugin = g_hash_table_lookup (priv->plugins_by_name, plugin_id);
- if (plugin)
+ obj = g_hash_table_lookup (priv->activated_plugins, handle);
+ if (obj == NULL)
{
- GObject *obj;
- obj = g_hash_table_lookup (priv->activated_plugins, plugin);
- if (obj)
- {
- return obj;
- } else
- {
- plugin_set_update (plugin_manager, plugin, TRUE);
- obj = g_hash_table_lookup (priv->activated_plugins, plugin);
- return obj;
- }
+ plugin_set_update (plugin_manager, handle, TRUE);
+ obj = g_hash_table_lookup (priv->activated_plugins, handle);
}
- g_warning ("No plugin found with id \"%s\".", plugin_id);
- return NULL;
+
+ return obj;
}
static void
@@ -1562,7 +1550,7 @@ on_activated_plugins_foreach (gpointer key, gpointer data, gpointer user_data)
AnjutaPluginHandle *plugin = ANJUTA_PLUGIN_HANDLE (key);
GList **active_plugins = (GList **)user_data;
*active_plugins = g_list_prepend (*active_plugins,
- anjuta_plugin_handle_get_description (plugin));
+ plugin);
}
static void
@@ -1598,41 +1586,30 @@ anjuta_plugin_manager_get_active_plugin_objects (AnjutaPluginManager *plugin_man
}
/**
- * anjuta_plugin_manager_unload_plugin_by_id:
+ * anjuta_plugin_manager_unload_plugin_by_handle:
* @plugin_manager: A #AnjutaPluginManager object
- * @plugin_id: The plugin identifier
+ * @handle: A #AnjutaPluginHandle
*
- * Unload the plugin corresponding to the given identifier. If the plugin is
+ * Unload the plugin corresponding to the given handle. If the plugin is
* already unloaded, nothing will be done.
*
* Return value: %TRUE is the plugin is unloaded. %FALSE if a corresponding
* plugin does not exist or if the plugin cannot be unloaded.
*/
gboolean
-anjuta_plugin_manager_unload_plugin_by_id (AnjutaPluginManager *plugin_manager,
- const gchar *plugin_id)
+anjuta_plugin_manager_unload_plugin_by_handle (AnjutaPluginManager *plugin_manager,
+ AnjutaPluginHandle *handle)
{
AnjutaPluginManagerPriv *priv;
- AnjutaPluginHandle *plugin;
-
+
g_return_val_if_fail (ANJUTA_IS_PLUGIN_MANAGER (plugin_manager), FALSE);
- g_return_val_if_fail (plugin_id != NULL, FALSE);
+ g_return_val_if_fail (handle != NULL, FALSE);
priv = plugin_manager->priv;
-
- plugin = g_hash_table_lookup (priv->plugins_by_name, plugin_id);
- if (plugin)
- {
- plugin_set_update (plugin_manager, plugin, FALSE);
-
- /* Check if the plugin has been indeed unloaded */
- if (!g_hash_table_lookup (priv->activated_plugins, plugin))
- return TRUE;
- else
- return FALSE;
- }
- g_warning ("No plugin found with id \"%s\".", plugin_id);
- return FALSE;
+ plugin_set_update (plugin_manager, handle, FALSE);
+
+ /* Check if the plugin has been indeed unloaded */
+ return g_hash_table_lookup (priv->activated_plugins, handle) == NULL;
}
static gboolean
@@ -1713,9 +1690,7 @@ anjuta_plugin_manager_list_query (AnjutaPluginManager *plugin_manager,
while (available)
{
AnjutaPluginHandle *plugin = available->data;
- AnjutaPluginDescription *desc =
- anjuta_plugin_handle_get_description (plugin);
- selected_plugins = g_list_prepend (selected_plugins, desc);
+ selected_plugins = g_list_prepend (selected_plugins, plugin);
available = g_list_next (available);
}
return g_list_reverse (selected_plugins);
@@ -1807,7 +1782,7 @@ anjuta_plugin_manager_list_query (AnjutaPluginManager *plugin_manager,
}
if (satisfied)
{
- selected_plugins = g_list_prepend (selected_plugins, desc);
+ selected_plugins = g_list_prepend (selected_plugins, plugin);
/* DEBUG_PRINT ("Satisfied, Adding %s",
anjuta_plugin_handle_get_name (plugin));*/
}
@@ -1889,7 +1864,7 @@ anjuta_plugin_manager_query (AnjutaPluginManager *plugin_manager,
enum {
PIXBUF_COLUMN,
PLUGIN_COLUMN,
- PLUGIN_DESCRIPTION_COLUMN,
+ PLUGIN_HANDLE_COLUMN,
N_COLUMNS
};
@@ -1942,19 +1917,19 @@ on_plugin_list_selection_changed (GtkTreeSelection *tree_selection,
* @plugin_manager: #AnjutaPluginManager object
* @title: Title of the dialog
* @description: label shown on the dialog
- * @plugin_descriptions: List of #AnjutaPluginDescription
+ * @plugin_handles: List of #AnjutaPluginHandle
*
* Show a dialog where the user can choose between the given plugins
*
- * Returns: The chosen plugin description
+ * Returns: The chosen plugin handle
*/
-AnjutaPluginDescription *
+AnjutaPluginHandle *
anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
gchar *title, gchar *description,
- GList *plugin_descriptions)
+ GList *plugin_handles)
{
- AnjutaPluginDescription *desc;
AnjutaPluginManagerPriv *priv;
+ AnjutaPluginHandle *handle;
GtkWidget *dlg;
GtkTreeModel *model;
GtkWidget *view;
@@ -1974,11 +1949,11 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (description != NULL, NULL);
- g_return_val_if_fail (plugin_descriptions != NULL, NULL);
+ g_return_val_if_fail (plugin_handles != NULL, NULL);
priv = plugin_manager->priv;
- if (g_list_length (plugin_descriptions) <= 0)
+ if (g_list_length (plugin_handles) <= 0)
return NULL;
dlg = gtk_dialog_new_with_buttons (title, GTK_WINDOW (priv->shell),
@@ -2049,90 +2024,73 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
gtk_box_pack_start (GTK_BOX (content_area), remember_checkbox,
FALSE, FALSE, 0);
- node = plugin_descriptions;
+ node = plugin_handles;
while (node)
{
+ const gchar *filename;
GdkPixbuf *icon_pixbuf = NULL;
- gchar *plugin_name = NULL;
- gchar *plugin_desc = NULL;
- gchar *icon_filename = NULL;
- gchar *location = NULL;
-
- desc = (AnjutaPluginDescription*)node->data;
-
- if (anjuta_plugin_description_get_string (desc,
- "Anjuta
Plugin",
- "Icon",
-
&icon_filename))
+ const gchar *name = NULL;
+ AnjutaPluginDescription *desc;
+
+ handle = (AnjutaPluginHandle*)node->data;
+
+ filename = anjuta_plugin_handle_get_icon_path (handle);
+ if (filename != NULL)
{
- gchar *icon_path = NULL;
- icon_path = g_strconcat (PACKAGE_PIXMAPS_DIR"/",
- icon_filename, NULL);
- g_free (icon_filename);
- /* DEBUG_PRINT ("Icon: %s", icon_path); */
- icon_pixbuf =
- gdk_pixbuf_new_from_file (icon_path, NULL);
- if (icon_pixbuf == NULL)
- {
- g_warning ("Plugin pixmap not found: %s", plugin_name);
- }
- g_free (icon_path);
+ icon_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ if (!icon_pixbuf)
+ g_warning ("Plugin does not define Icon: No such file %s",
+ filename);
}
else
{
g_warning ("Plugin does not define Icon attribute");
}
- if (!anjuta_plugin_description_get_locale_string (desc,
-
"Anjuta Plugin",
-
"Name",
-
&plugin_name))
- {
- g_warning ("Plugin does not define Name attribute");
- }
- if (!anjuta_plugin_description_get_locale_string (desc,
-
"Anjuta Plugin",
-
"Description",
-
&plugin_desc))
- {
- g_warning ("Plugin does not define Description attribute");
- }
- if (plugin_name && plugin_desc)
+
+ name = anjuta_plugin_handle_get_name (handle);
+ desc = anjuta_plugin_handle_get_description (handle);
+ if ((name != NULL) && (desc != NULL))
{
+ gchar *plugin_desc;
GtkTreeIter iter;
gchar *text;
- if (!anjuta_plugin_description_get_string (desc,
-
"Anjuta Plugin",
-
"Location",
-
&location))
+ if (!anjuta_plugin_description_get_locale_string (desc,
+ "Anjuta Plugin",
+ "Description",
+ &plugin_desc))
{
- g_warning ("Plugin does not define Location attribute");
+ g_warning ("Plugin does not define Description attribute");
}
-
-
- text = g_markup_printf_escaped ("<span size=\"larger\"
weight=\"bold\">%s</span>\n%s", plugin_name, plugin_desc);
+ text = g_markup_printf_escaped ("<span size=\"larger\"
weight=\"bold\">%s</span>\n%s", name, plugin_desc);
+ g_free (plugin_desc);
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
PLUGIN_COLUMN, text,
- PLUGIN_DESCRIPTION_COLUMN, desc, -1);
+ PLUGIN_HANDLE_COLUMN, handle, -1);
if (icon_pixbuf) {
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
PIXBUF_COLUMN, icon_pixbuf, -1);
- g_object_unref (icon_pixbuf);
}
g_free (text);
-
- selection_ids = g_list_prepend (selection_ids, location);
+
+ selection_ids = g_list_prepend (selection_ids, (gpointer)anjuta_plugin_handle_get_id
(handle));
+ }
+ else
+ {
+ g_warning ("Plugin does not define Name attribute");
}
- g_free (plugin_name);
- g_free (plugin_desc);
+
+ if (icon_pixbuf)
+ g_object_unref (icon_pixbuf);
+
node = g_list_next (node);
}
/* Prepare remembering key */
selection_ids = g_list_sort (selection_ids,
- (GCompareFunc)strcmp);
+ (GCompareFunc)strcmp);
node = selection_ids;
while (node)
{
@@ -2140,16 +2098,15 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
g_string_append (remember_key, ",");
node = g_list_next (node);
}
- g_list_foreach (selection_ids, (GFunc) g_free, NULL);
g_list_free (selection_ids);
/* Find if the selection is remembered */
- desc = g_hash_table_lookup (priv->remember_plugins, remember_key->str);
- if (desc)
+ handle = g_hash_table_lookup (priv->remember_plugins, remember_key->str);
+ if (handle)
{
g_string_free (remember_key, TRUE);
gtk_widget_destroy (dlg);
- return desc;
+ return handle;
}
/* Prompt dialog */
@@ -2162,8 +2119,8 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
&selected))
{
gtk_tree_model_get (model, &selected,
- PLUGIN_DESCRIPTION_COLUMN, &desc, -1);
- if (desc)
+ PLUGIN_HANDLE_COLUMN, &handle, -1);
+ if (handle)
{
/* Remember selection */
if (gtk_toggle_button_get_active
@@ -2172,11 +2129,11 @@ anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
/* DEBUG_PRINT ("Remembering selection '%s'",
remember_key->str);*/
g_hash_table_insert (priv->remember_plugins,
- g_strdup
(remember_key->str), desc);
+ g_strdup
(remember_key->str), handle);
}
g_string_free (remember_key, TRUE);
gtk_widget_destroy (dlg);
- return desc;
+ return handle;
}
}
break;
@@ -2190,45 +2147,33 @@ GObject*
anjuta_plugin_manager_select_and_activate (AnjutaPluginManager *plugin_manager,
gchar *title,
gchar *description,
- GList *plugin_descriptions)
+ GList *plugin_handles)
{
- AnjutaPluginDescription *d;
+ AnjutaPluginHandle *handle;
+ GObject *plugin = NULL;
g_return_val_if_fail (ANJUTA_IS_PLUGIN_MANAGER (plugin_manager), NULL);
-
- d = anjuta_plugin_manager_select (plugin_manager, title, description,
- plugin_descriptions);
- if (d)
- {
- GObject *plugin = NULL;
- gchar *location = NULL;
-
- anjuta_plugin_description_get_string (d,
- "Anjuta Plugin",
- "Location",
- &location);
- g_return_val_if_fail (location != NULL, NULL);
- plugin =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager, location);
- g_free (location);
- return plugin;
- }
- return NULL;
+
+ handle = anjuta_plugin_manager_select (plugin_manager, title, description,
+ plugin_handles);
+ plugin = anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, handle);
+
+ return plugin;
}
/*
- * anjuta_plugin_manager_get_plugin_description:
+ * anjuta_plugin_manager_get_plugin_handle:
* @plugin_manager: #AnjutaPluginManager object
* @plugin: #AnjutaPlugin object
*
- * Get the description corresponding to the plugin or %NULL if the plugin is not
+ * Get the handle corresponding to the plugin or %NULL if the plugin is not
* activated.
*
- * Returns: (transfer none) (allow-none): A #AnjutaPluginDescription or %NULL.
+ * Returns: (transfer none) (allow-none): A #AnjutaPluginHandle or %NULL.
*/
-AnjutaPluginDescription*
-anjuta_plugin_manager_get_plugin_description (AnjutaPluginManager *plugin_manager,
- GObject *plugin)
+AnjutaPluginHandle*
+anjuta_plugin_manager_get_plugin_handle (AnjutaPluginManager *plugin_manager,
+ GObject *plugin)
{
GHashTableIter iter;
gpointer key, value;
@@ -2238,7 +2183,7 @@ anjuta_plugin_manager_get_plugin_description (AnjutaPluginManager *plugin_manage
{
if (G_OBJECT(value) == plugin)
{
- return anjuta_plugin_handle_get_description (ANJUTA_PLUGIN_HANDLE (key));
+ return ANJUTA_PLUGIN_HANDLE (key);
}
}
@@ -2265,7 +2210,7 @@ anjuta_plugin_manager_init (AnjutaPluginManager *object)
NULL, g_object_unref);
object->priv->remember_plugins = g_hash_table_new_full (g_str_hash,
g_str_equal,
-
g_free, NULL);
+
NULL, NULL);
}
static void
@@ -2374,7 +2319,7 @@ anjuta_plugin_manager_get_property (GObject *object, guint prop_id,
}
static void
anjuta_plugin_manager_plugin_activated (AnjutaPluginManager *self,
- AnjutaPluginDescription*
plugin_desc,
+ AnjutaPluginHandle* handle,
GObject *plugin)
{
/* TODO: Add default signal handler implementation here */
@@ -2382,7 +2327,7 @@ anjuta_plugin_manager_plugin_activated (AnjutaPluginManager *self,
static void
anjuta_plugin_manager_plugin_deactivated (AnjutaPluginManager *self,
- AnjutaPluginDescription*
plugin_desc,
+ AnjutaPluginHandle* handle,
GObject *plugin)
{
/* TODO: Add default signal handler implementation here */
@@ -2552,7 +2497,6 @@ anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager,
GList *plugins_to_activate)
{
AnjutaPluginManagerPriv *priv;
- GdkPixbuf *icon_pixbuf;
GList *node;
priv = plugin_manager->priv;
@@ -2567,40 +2511,27 @@ anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager,
node = plugins_to_activate;
while (node)
{
- AnjutaPluginDescription *d;
- gchar *plugin_id;
- gchar *icon_filename, *label;
- gchar *icon_path = NULL;
-
- d = node->data;
+ AnjutaPluginHandle *handle;
+ const gchar *filename;
+ GdkPixbuf *icon_pixbuf = NULL;
+ const gchar *name;
+ gchar*label= NULL;
- icon_pixbuf = NULL;
- label = NULL;
- if (anjuta_plugin_description_get_string (d, "Anjuta Plugin",
- "Icon",
- &icon_filename))
+ handle = node->data;
+
+ filename = anjuta_plugin_handle_get_icon_path (handle);
+ if (filename != NULL)
{
- gchar *title /*, *description */;
- anjuta_plugin_description_get_locale_string (d, "Anjuta Plugin",
-
"Name",
-
&title);
- /*
- anjuta_plugin_description_get_locale_string (d, "Anjuta Plugin",
-
"Description",
-
&description);
- */
- icon_path = g_strconcat (PACKAGE_PIXMAPS_DIR"/",
- icon_filename, NULL);
- /* DEBUG_PRINT ("Icon: %s", icon_path); */
- /* Avoid space in translated string */
- label = g_strconcat (dgettext (GETTEXT_PACKAGE, "Loading:"), " ", title, "...", NULL);
- icon_pixbuf = gdk_pixbuf_new_from_file (icon_path, NULL);
+ icon_pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
if (!icon_pixbuf)
g_warning ("Plugin does not define Icon: No such file %s",
- icon_path);
- g_free (icon_path);
- g_free (icon_filename);
- g_free (title);
+ filename);
+ }
+
+ name = anjuta_plugin_handle_get_name (handle);
+ if (name != NULL)
+ {
+ label = g_strconcat (dgettext (GETTEXT_PACKAGE, "Loading:"), " ", name, "...", NULL);
}
anjuta_status_progress_tick (ANJUTA_STATUS (priv->status),
@@ -2608,15 +2539,9 @@ anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager,
g_free (label);
if (icon_pixbuf)
g_object_unref (icon_pixbuf);
-
- if (anjuta_plugin_description_get_string (d, "Anjuta Plugin",
- "Location",
&plugin_id))
- {
- /* Activate the plugin */
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
- plugin_id);
- g_free (plugin_id);
- }
+
+ /* Activate the plugin */
+ anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, handle);
node = g_list_next (node);
}
@@ -2628,15 +2553,13 @@ anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager,
static void
on_collect (gpointer key, gpointer value, gpointer user_data)
{
- gchar *id;
+ const gchar *id;
gchar *query = (gchar*) key;
- AnjutaPluginDescription *desc = (AnjutaPluginDescription *) value;
+ AnjutaPluginHandle *handle = (AnjutaPluginHandle *) value;
GString *write_buffer = (GString *) user_data;
- anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Location",
- &id);
+ id = anjuta_plugin_handle_get_id (handle);
g_string_append_printf (write_buffer, "%s=%s;", query, id);
- g_free (id);
}
/**
@@ -2707,20 +2630,13 @@ anjuta_plugin_manager_set_remembered_plugins (AnjutaPluginManager *plugin_manage
strv_keyvals = g_strsplit (*line_idx, "=", -1);
if (strv_keyvals && strv_keyvals[0] && strv_keyvals[1])
{
- AnjutaPluginHandle *plugin;
- plugin = g_hash_table_lookup (priv->plugins_by_name,
+ AnjutaPluginHandle *handle;
+ handle = g_hash_table_lookup (priv->plugins_by_name,
strv_keyvals[1]);
- if (plugin)
+ if (handle)
{
- AnjutaPluginDescription *desc;
- desc = anjuta_plugin_handle_get_description (plugin);
- /*
- DEBUG_PRINT ("Restoring remember plugin: %s=%s",
- strv_keyvals[0],
- strv_keyvals[1]);
- */
g_hash_table_insert (priv->remember_plugins,
- g_strdup (strv_keyvals[0]), desc);
+ g_strdup (strv_keyvals[0]), handle);
}
g_strfreev (strv_keyvals);
}
diff --git a/libanjuta/anjuta-plugin-manager.h b/libanjuta/anjuta-plugin-manager.h
index 0ce86e6..52f492f 100644
--- a/libanjuta/anjuta-plugin-manager.h
+++ b/libanjuta/anjuta-plugin-manager.h
@@ -23,7 +23,7 @@
#include <glib-object.h>
#include <libanjuta/anjuta-status.h>
-#include <libanjuta/anjuta-plugin-description.h>
+#include <libanjuta/anjuta-plugin-handle.h>
G_BEGIN_DECLS
@@ -57,10 +57,10 @@ struct _AnjutaPluginManagerClass
/* Signals */
void(* plugin_activated) (AnjutaPluginManager *self,
- AnjutaPluginDescription* plugin_desc,
+ AnjutaPluginHandle* handle,
GObject *plugin);
void(* plugin_deactivated) (AnjutaPluginManager *self,
- AnjutaPluginDescription* plugin_desc,
+ AnjutaPluginHandle* handle,
GObject *plugin);
};
@@ -81,12 +81,12 @@ gboolean anjuta_plugin_manager_is_active_plugin (AnjutaPluginManager *plugin_man
const gchar *iface_name);
GObject* anjuta_plugin_manager_get_plugin (AnjutaPluginManager *plugin_manager,
const gchar *iface_name);
-GObject* anjuta_plugin_manager_get_plugin_by_id (AnjutaPluginManager *plugin_manager,
- const gchar
*plugin_id);
+GObject* anjuta_plugin_manager_get_plugin_by_handle (AnjutaPluginManager *plugin_manager,
+
AnjutaPluginHandle *handle);
gboolean anjuta_plugin_manager_unload_plugin (AnjutaPluginManager *plugin_manager,
GObject
*plugin_object);
-gboolean anjuta_plugin_manager_unload_plugin_by_id (AnjutaPluginManager *plugin_manager,
- const
gchar *plugin_id);
+gboolean anjuta_plugin_manager_unload_plugin_by_handle (AnjutaPluginManager *plugin_manager,
+
AnjutaPluginHandle *handle);
GList* anjuta_plugin_manager_get_active_plugins (AnjutaPluginManager *plugin_manager);
GList* anjuta_plugin_manager_get_active_plugin_objects (AnjutaPluginManager *plugin_manager);
@@ -107,20 +107,20 @@ GList* anjuta_plugin_manager_list_query (AnjutaPluginManager *plugin_manager,
GList *attribute_values);
/* Returns the plugin description that has been selected from the list */
-AnjutaPluginDescription* anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
-
gchar *title, gchar *description,
-
GList *plugin_descriptions);
+AnjutaPluginHandle* anjuta_plugin_manager_select (AnjutaPluginManager *plugin_manager,
+ gchar *title, gchar *description,
+ GList *plugin_handles);
GObject* anjuta_plugin_manager_select_and_activate (AnjutaPluginManager *plugin_manager,
-
gchar *title, gchar *description,
- GList *plugin_descriptions);
+ gchar *title, gchar *description,
+ GList *plugin_handles);
-AnjutaPluginDescription* anjuta_plugin_manager_get_plugin_description (AnjutaPluginManager *plugin_manager,
-
GObject *plugin);
+AnjutaPluginHandle* anjuta_plugin_manager_get_plugin_handle (AnjutaPluginManager *plugin_manager,
+ GObject *plugin);
void anjuta_plugin_manager_activate_plugins (AnjutaPluginManager *plugin_manager,
- GList *plugin_descs);
+ GList *plugin_handles);
void anjuta_plugin_manager_unload_all_plugins (AnjutaPluginManager *plugin_manager);
diff --git a/libanjuta/anjuta-profile-manager.c b/libanjuta/anjuta-profile-manager.c
index 1a1593b..73926c5 100644
--- a/libanjuta/anjuta-profile-manager.c
+++ b/libanjuta/anjuta-profile-manager.c
@@ -71,7 +71,7 @@ static guint profile_manager_signals[LAST_SIGNAL] = { 0 };
static void
on_plugin_activated (AnjutaPluginManager *plugin_manager,
- AnjutaPluginDescription *plugin_desc,
+ AnjutaPluginHandle *plugin_handle,
GObject *plugin_object,
AnjutaProfileManager *profile_manager)
{
@@ -82,18 +82,20 @@ on_plugin_activated (AnjutaPluginManager *plugin_manager,
{
/* Add it current profile */
gboolean exclude;
+ AnjutaPluginDescription *desc;
- if (!anjuta_plugin_description_get_boolean (plugin_desc, "Anjuta Plugin",
"ExcludeFromSession", &exclude) || !exclude)
+ desc = anjuta_plugin_handle_get_description (plugin_handle);
+ if (!anjuta_plugin_description_get_boolean (desc, "Anjuta Plugin", "ExcludeFromSession",
&exclude) || !exclude)
{
anjuta_profile_add_plugin (ANJUTA_PROFILE (priv->profiles->data),
- plugin_desc);
+ plugin_handle);
}
}
}
static void
on_plugin_deactivated (AnjutaPluginManager *plugin_manager,
- AnjutaPluginDescription *plugin_desc,
+ AnjutaPluginHandle *plugin_handle,
GObject *plugin_object,
AnjutaProfileManager *profile_manager)
{
@@ -104,7 +106,7 @@ on_plugin_deactivated (AnjutaPluginManager *plugin_manager,
{
/* Remove from current profile */
anjuta_profile_remove_plugin (ANJUTA_PROFILE (priv->profiles->data),
- plugin_desc);
+ plugin_handle);
}
}
@@ -359,18 +361,11 @@ anjuta_profile_manager_load_profile (AnjutaProfileManager *profile_manager,
node = plugins_to_deactivate;
while (node)
{
- AnjutaPluginDescription *desc;
- gchar *plugin_id = NULL;
-
- desc = (AnjutaPluginDescription *)node->data;
- anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
- "Location",
&plugin_id);
- g_assert (plugin_id != NULL);
-
- /* DEBUG_PRINT ("Profile: deactivating %s", plugin_id); */
+ AnjutaPluginHandle *handle;
- anjuta_plugin_manager_unload_plugin_by_id (priv->plugin_manager,
- plugin_id);
+ handle = (AnjutaPluginHandle *)node->data;
+ anjuta_plugin_manager_unload_plugin_by_handle (priv->plugin_manager,
+ handle);
node = g_list_next (node);
}
diff --git a/libanjuta/anjuta-profile.c b/libanjuta/anjuta-profile.c
index a089f88..8e19c19 100644
--- a/libanjuta/anjuta-profile.c
+++ b/libanjuta/anjuta-profile.c
@@ -213,13 +213,13 @@ anjuta_profile_get_property (GObject *object, guint prop_id,
static void
anjuta_profile_plugin_added (AnjutaProfile *self,
- AnjutaPluginDescription *plugin)
+ AnjutaPluginHandle *plugin)
{
}
static void
anjuta_profile_plugin_removed (AnjutaProfile *self,
- AnjutaPluginDescription *plugin)
+ AnjutaPluginHandle *plugin)
{
}
@@ -289,7 +289,7 @@ anjuta_profile_class_init (AnjutaProfileClass *klass)
/**
* AnjutaProfile::plugin-added:
* @profile: a #AnjutaProfile object.
- * @plugin: the new plugin as a #AnjutaPluginDescription.
+ * @plugin: the new plugin as a #AnjutaPluginHandle.
*
* Emitted when a plugin is added in the list.
*/
@@ -306,7 +306,7 @@ anjuta_profile_class_init (AnjutaProfileClass *klass)
/**
* AnjutaProfile::plugin-removed:
* @profile: a #AnjutaProfile object.
- * @plugin: the removed plugin as a #AnjutaPluginDescription.
+ * @plugin: the removed plugin as a #AnjutaPluginHandle.
*
* Emitted when a plugin is removed from the list.
*/
@@ -437,13 +437,13 @@ anjuta_profile_get_name (AnjutaProfile *profile)
/**
* anjuta_profile_add_plugin:
* @profile: a #AnjutaProfile object.
- * @plugin: a #AnjutaPluginDescription.
+ * @plugin: a #AnjutaPluginHandle.
*
* Add one plugin into the profile plugin list.
*/
void
anjuta_profile_add_plugin (AnjutaProfile *profile,
- AnjutaPluginDescription *plugin)
+ AnjutaPluginHandle *plugin)
{
AnjutaProfilePriv *priv;
g_return_if_fail (ANJUTA_IS_PROFILE (profile));
@@ -460,13 +460,13 @@ anjuta_profile_add_plugin (AnjutaProfile *profile,
/**
* anjuta_profile_remove_plugin:
* @profile: a #AnjutaProfile object.
- * @plugin: a #AnjutaPluginDescription.
+ * @plugin: a #AnjutaPluginHandle.
*
* Remove one plugin from the profile plugin list.
*/
void
anjuta_profile_remove_plugin (AnjutaProfile *profile,
- AnjutaPluginDescription *plugin)
+ AnjutaPluginHandle *plugin)
{
AnjutaProfilePriv *priv;
g_return_if_fail (ANJUTA_IS_PROFILE (profile));
@@ -483,7 +483,7 @@ anjuta_profile_remove_plugin (AnjutaProfile *profile,
/**
* anjuta_profile_has_plugin:
* @profile: a #AnjutaProfile object
- * @plugin: a #AnjutaPluginDescription
+ * @plugin: a #AnjutaPluginHandle
*
* Check if a plugin is included in the profile plugin list.
*
@@ -491,7 +491,7 @@ anjuta_profile_remove_plugin (AnjutaProfile *profile,
*/
gboolean
anjuta_profile_has_plugin (AnjutaProfile *profile,
- AnjutaPluginDescription *plugin)
+ AnjutaPluginHandle *plugin)
{
AnjutaProfilePriv *priv;
g_return_val_if_fail (ANJUTA_IS_PROFILE (profile), FALSE);
@@ -520,10 +520,10 @@ anjuta_profile_get_plugins (AnjutaProfile *profile)
static GList*
anjuta_profile_select_plugins (AnjutaProfile *profile,
- GList *descs_list)
+ GList *handles_list)
{
GList *selected_plugins = NULL;
- GList *node = descs_list;
+ GList *node = handles_list;
AnjutaProfilePriv *priv;
priv = profile->priv;
@@ -537,13 +537,13 @@ anjuta_profile_select_plugins (AnjutaProfile *profile,
}
else
{
- AnjutaPluginDescription* d;
- d = anjuta_plugin_manager_select (priv->plugin_manager,
- _("Select a
plugin"),
- _("Please select a
plugin from the list"),
- descs);
- if (d)
- selected_plugins = g_list_prepend (selected_plugins, d);
+ AnjutaPluginHandle* handle;
+ handle = anjuta_plugin_manager_select (priv->plugin_manager,
+ _("Select a plugin"),
+ _("Please select a plugin from the list"),
+ descs);
+ if (handle)
+ selected_plugins = g_list_prepend (selected_plugins, handle);
}
node = g_list_next (node);
}
@@ -558,7 +558,7 @@ anjuta_profile_read_plugins_from_xml (AnjutaProfile *profile,
gchar *read_buf;
gsize size;
xmlDocPtr xml_doc;
- GList *descs_list = NULL;
+ GList *handles_list = NULL;
GList *not_found_names = NULL;
GList *not_found_urls = NULL;
gboolean parse_error;
@@ -666,16 +666,16 @@ anjuta_profile_read_plugins_from_xml (AnjutaProfile *profile,
}
else
{
- GList *plugin_descs;
+ GList *plugin_handles;
- plugin_descs =
+ plugin_handles =
anjuta_plugin_manager_list_query
(profile->priv->plugin_manager,
groups,
attribs,
values);
- if (plugin_descs)
+ if (plugin_handles)
{
- descs_list = g_list_prepend (descs_list,
plugin_descs);
+ handles_list = g_list_prepend (handles_list,
plugin_handles);
}
else if (mandatory)
{
@@ -709,9 +709,9 @@ anjuta_profile_read_plugins_from_xml (AnjutaProfile *profile,
uri);
g_free (uri);
- g_list_foreach (descs_list, (GFunc)g_list_free, NULL);
- g_list_free (descs_list);
- descs_list = NULL;
+ g_list_foreach (handles_list, (GFunc)g_list_free, NULL);
+ g_list_free (handles_list);
+ handles_list = NULL;
}
else if (not_found_names)
{
@@ -744,16 +744,16 @@ anjuta_profile_read_plugins_from_xml (AnjutaProfile *profile,
g_free (uri);
g_string_free (mesg, TRUE);
- g_list_foreach (descs_list, (GFunc)g_list_free, NULL);
- g_list_free (descs_list);
- descs_list = NULL;
+ g_list_foreach (handles_list, (GFunc)g_list_free, NULL);
+ g_list_free (handles_list);
+ handles_list = NULL;
}
g_list_foreach (not_found_names, (GFunc)g_free, NULL);
g_list_free (not_found_names);
g_list_foreach (not_found_urls, (GFunc)g_free, NULL);
g_list_free (not_found_urls);
- return descs_list;
+ return handles_list;
}
/**
@@ -774,24 +774,24 @@ anjuta_profile_add_plugins_from_xml (AnjutaProfile *profile,
GError **error)
{
AnjutaProfilePriv *priv;
- GList *descs_list = NULL;
+ GList *handles_list = NULL;
g_return_val_if_fail (ANJUTA_IS_PROFILE (profile), FALSE);
priv = profile->priv;
- descs_list = anjuta_profile_read_plugins_from_xml (profile, profile_xml_file, error);
+ handles_list = anjuta_profile_read_plugins_from_xml (profile, profile_xml_file, error);
- if (descs_list)
+ if (handles_list)
{
GList *selected_plugins = NULL;
GList *node;
/* Now everything okay. Select the plugins */
- descs_list = g_list_reverse (descs_list);
+ handles_list = g_list_reverse (handles_list);
selected_plugins =
- anjuta_profile_select_plugins (profile, descs_list);
- g_list_foreach (descs_list, (GFunc)g_list_free, NULL);
- g_list_free (descs_list);
+ anjuta_profile_select_plugins (profile, handles_list);
+ g_list_foreach (handles_list, (GFunc)g_list_free, NULL);
+ g_list_free (handles_list);
node = selected_plugins;
while (node)
@@ -814,7 +814,7 @@ anjuta_profile_add_plugins_from_xml (AnjutaProfile *profile,
g_list_free (selected_plugins);
}
- return descs_list != NULL;
+ return handles_list != NULL;
}
/**
@@ -838,6 +838,7 @@ anjuta_profile_to_xml (AnjutaProfile *profile)
str = g_string_new ("<?xml version=\"1.0\"?>\n<anjuta>\n");
for (node = priv->plugins; node != NULL; node = g_list_next (node))
{
+ AnjutaPluginHandle *handle;
AnjutaPluginDescription *desc;
gboolean user_activatable = TRUE;
gchar *name = NULL, *plugin_id = NULL;
@@ -847,8 +848,8 @@ anjuta_profile_to_xml (AnjutaProfile *profile)
/* Do not save plugin in the exclude list */
continue;
}
-
- desc = (AnjutaPluginDescription *)node->data;
+ handle = (AnjutaPluginHandle *)node->data;
+ desc = anjuta_plugin_handle_get_description(handle);
if (anjuta_plugin_description_get_boolean (desc, "Anjuta Plugin",
"UserActivatable", &user_activatable)
&& !user_activatable)
diff --git a/libanjuta/anjuta-profile.h b/libanjuta/anjuta-profile.h
index b46f340..392942f 100644
--- a/libanjuta/anjuta-profile.h
+++ b/libanjuta/anjuta-profile.h
@@ -23,7 +23,7 @@
#include <glib-object.h>
#include <gio/gio.h>
-#include <libanjuta/anjuta-plugin-description.h>
+#include <libanjuta/anjuta-plugin-handle.h>
#include <libanjuta/anjuta-plugin-manager.h>
G_BEGIN_DECLS
@@ -68,9 +68,9 @@ struct _AnjutaProfileClass
/* Signals */
void(* plugin_added) (AnjutaProfile *self,
- AnjutaPluginDescription *plugin);
+ AnjutaPluginHandle *plugin);
void(* plugin_removed) (AnjutaProfile *self,
- AnjutaPluginDescription *plugin);
+ AnjutaPluginHandle *plugin);
void(* changed) (AnjutaProfile *self, GList *plugins);
void(* descoped) (AnjutaProfile *self);
void(* scoped) (AnjutaProfile *self);
@@ -94,15 +94,15 @@ AnjutaProfile* anjuta_profile_new (const gchar *name,
AnjutaPluginManager *plugin_manager);
const gchar *anjuta_profile_get_name (AnjutaProfile *profile);
void anjuta_profile_add_plugin (AnjutaProfile *profile,
- AnjutaPluginDescription *plugin);
+ AnjutaPluginHandle *plugin);
void anjuta_profile_remove_plugin (AnjutaProfile *profile,
- AnjutaPluginDescription *plugin);
+ AnjutaPluginHandle *plugin);
gboolean anjuta_profile_add_plugins_from_xml (AnjutaProfile *profile,
GFile*
profile_xml_file,
gboolean
exclude_from_sync,
GError **error);
gboolean anjuta_profile_has_plugin (AnjutaProfile *profile,
- AnjutaPluginDescription *plugin);
+ AnjutaPluginHandle *plugin);
GList* anjuta_profile_get_plugins (AnjutaProfile *profile);
void anjuta_profile_set_sync_file (AnjutaProfile *profile,
diff --git a/plugins/debug-manager/queue.c b/plugins/debug-manager/queue.c
index 1273994..57099c8 100644
--- a/plugins/debug-manager/queue.c
+++ b/plugins/debug-manager/queue.c
@@ -486,8 +486,8 @@ static gboolean
dma_debugger_activate_plugin (DmaDebuggerQueue* self, const gchar *mime_type)
{
AnjutaPluginManager *plugin_manager;
- AnjutaPluginDescription *plugin;
- GList *descs = NULL;
+ AnjutaPluginHandle *plugin;
+ GList *plugins = NULL;
gchar *value;
/* Get list of debugger plugins */
@@ -495,19 +495,19 @@ dma_debugger_activate_plugin (DmaDebuggerQueue* self, const gchar *mime_type)
if (mime_type == NULL)
{
/* User has to select the right debugger */
- descs = anjuta_plugin_manager_query (plugin_manager,
- "Anjuta Plugin","Interfaces", "IAnjutaDebugger", NULL);
+ plugins = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta Plugin","Interfaces", "IAnjutaDebugger", NULL);
}
else
{
/* Propose only debugger supporting correct mime type */
- descs = anjuta_plugin_manager_query (plugin_manager,
- "Anjuta Plugin","Interfaces", "IAnjutaDebugger",
- "File Loader", "SupportedMimeTypes", mime_type,
- NULL);
+ plugins = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta Plugin","Interfaces", "IAnjutaDebugger",
+ "File Loader", "SupportedMimeTypes", mime_type,
+ NULL);
}
- if (descs == NULL)
+ if (plugins == NULL)
{
/* No plugin found */
anjuta_util_dialog_error (GTK_WINDOW (ANJUTA_PLUGIN (self->plugin)->shell),
@@ -515,29 +515,24 @@ dma_debugger_activate_plugin (DmaDebuggerQueue* self, const gchar *mime_type)
return FALSE;
}
- else if (g_list_length (descs) == 1)
+ else if (g_list_length (plugins) == 1)
{
/* Only one plugin found, use it */
- plugin = (AnjutaPluginDescription *)descs->data;
+ plugin = (AnjutaPluginHandle *)plugins->data;
}
else
{
/* Ask the user to select one plugin */
plugin = anjuta_plugin_manager_select (plugin_manager,
- _("Select a plugin"),
- _("Please select a plugin to activate"),
- descs);
+ _("Select a plugin"),
+ _("Please select a plugin to activate"),
+ plugins);
}
if (plugin != NULL)
{
- /* Get debugger location */
- value = NULL;
- anjuta_plugin_description_get_string (plugin, "Anjuta Plugin", "Location", &value);
- g_return_val_if_fail (value != NULL, FALSE);
-
/* Get debugger interface */
- self->debugger = (IAnjutaDebugger *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
value);
+ self->debugger = (IAnjutaDebugger *)anjuta_plugin_manager_get_plugin_by_handle
(plugin_manager, plugin);
self->support = 0;
/* Check if register interface is available */
@@ -554,8 +549,6 @@ dma_debugger_activate_plugin (DmaDebuggerQueue* self, const gchar *mime_type)
}
/* Check if variable interface is available */
self->support |= IANJUTA_IS_DEBUGGER_VARIABLE(self->debugger) ? HAS_VARIABLE : 0;
-
- g_free (value);
return TRUE;
}
diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c
index bdb7606..8b75fd8 100644
--- a/plugins/document-manager/plugin.c
+++ b/plugins/document-manager/plugin.c
@@ -1060,20 +1060,20 @@ on_support_plugin_deactivated (AnjutaPlugin* plugin, DocmanPlugin* docman_plugin
}
static GList*
-load_new_support_plugins (DocmanPlugin* docman_plugin, GList* new_plugin_ids,
+load_new_support_plugins (DocmanPlugin* docman_plugin, GList* new_plugin_handle,
AnjutaPluginManager* plugin_manager)
{
GList* node;
GList* needed_plugins = NULL;
- for (node = new_plugin_ids; node != NULL; node = g_list_next (node))
+ for (node = new_plugin_handle; node != NULL; node = g_list_next (node))
{
- gchar* plugin_id = node->data;
- GObject* new_plugin = anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
-
plugin_id);
+ AnjutaPluginHandle *handle = (AnjutaPluginHandle *)node->data;
+ GObject* new_plugin = anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
+ handle);
GList* item = g_list_find (docman_plugin->support_plugins, new_plugin);
if (!item)
{
- DEBUG_PRINT ("Loading plugin: %s", plugin_id);
+ DEBUG_PRINT ("Loading plugin: %s", anjuta_plugin_handle_get_id (handle));
g_signal_connect (new_plugin, "deactivated",
G_CALLBACK (on_support_plugin_deactivated),
docman_plugin);
}
@@ -1113,7 +1113,7 @@ update_language_plugin (AnjutaDocman *docman, IAnjutaDocument *doc,
{
AnjutaPluginManager *plugin_manager;
IAnjutaLanguage *lang_manager;
- GList *new_support_plugins, *support_plugin_descs, *needed_plugins, *node;
+ GList *new_support_plugins, *needed_plugins, *node;
const gchar *language;
lang_manager = anjuta_shell_get_interface (plugin->shell,
@@ -1139,26 +1139,13 @@ update_language_plugin (AnjutaDocman *docman, IAnjutaDocument *doc,
/* Load current language editor support plugins */
plugin_manager = anjuta_shell_get_plugin_manager (plugin->shell, NULL);
- support_plugin_descs = anjuta_plugin_manager_query (plugin_manager,
+ new_support_plugins = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
"Interfaces",
"IAnjutaLanguageSupport",
"Language Support",
"Languages",
language, NULL);
- new_support_plugins = NULL;
- for (node = support_plugin_descs; node != NULL; node = g_list_next (node))
- {
- gchar *plugin_id;
-
- AnjutaPluginDescription *desc = node->data;
-
- anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Location",
- &plugin_id);
-
- new_support_plugins = g_list_append (new_support_plugins, plugin_id);
- }
- g_list_free (support_plugin_descs);
/* Load new plugins */
needed_plugins =
@@ -1172,7 +1159,7 @@ update_language_plugin (AnjutaDocman *docman, IAnjutaDocument *doc,
g_list_free (docman_plugin->support_plugins);
docman_plugin->support_plugins = needed_plugins;
- anjuta_util_glist_strings_free (new_support_plugins);
+ g_list_free (new_support_plugins);
}
else
{
diff --git a/plugins/file-loader/plugin.c b/plugins/file-loader/plugin.c
index de60d70..9eaedeb 100644
--- a/plugins/file-loader/plugin.c
+++ b/plugins/file-loader/plugin.c
@@ -48,8 +48,10 @@ sort_wizards(gconstpointer wizard1, gconstpointer wizard2)
{
gchar* name1 = NULL, *name2 = NULL;
gint ret;
- AnjutaPluginDescription* desc1 = (AnjutaPluginDescription*) wizard1;
- AnjutaPluginDescription* desc2 = (AnjutaPluginDescription*) wizard2;
+ AnjutaPluginHandle* handle1 = (AnjutaPluginHandle*) wizard1;
+ AnjutaPluginHandle* handle2 = (AnjutaPluginHandle*) wizard2;
+ AnjutaPluginDescription* desc1 = anjuta_plugin_handle_get_description (handle1);
+ AnjutaPluginDescription* desc2 = anjuta_plugin_handle_get_description (handle2);
if ((anjuta_plugin_description_get_locale_string (desc1, "Wizard",
"Title", &name1) ||
@@ -129,7 +131,7 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
const gchar *mime_type)
{
AnjutaPluginManager *plugin_manager;
- GList *plugin_descs = NULL;
+ GList *plugin_handles = NULL;
gchar *content_type;
g_return_val_if_fail (mime_type != NULL, NULL);
@@ -138,7 +140,7 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
NULL);
/* Check an exact match */
- plugin_descs = anjuta_plugin_manager_query (plugin_manager,
+ plugin_handles = anjuta_plugin_manager_query (plugin_manager,
"Anjuta
Plugin",
"Interfaces",
"IAnjutaFile",
"File Loader",
@@ -148,20 +150,24 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
/* Check for plugins supporting one supertype */
content_type = g_content_type_from_mime_type (mime_type);
- if (plugin_descs == NULL)
+ if (plugin_handles == NULL)
{
GList *node;
- GList *loader_descs = NULL;
+ GList *loader_handles = NULL;
- loader_descs = anjuta_plugin_manager_query (plugin_manager,
- "Anjuta
Plugin",
+ loader_handles = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta
Plugin",
"Interfaces",
"IAnjutaFile",
NULL);
- for (node = g_list_first (loader_descs); node != NULL; node = g_list_next (node))
+ for (node = g_list_first (loader_handles); node != NULL; node = g_list_next (node))
{
gchar *value;
+ AnjutaPluginHandle *handle;
+ AnjutaPluginDescription *desc;
- if (anjuta_plugin_description_get_string ((AnjutaPluginDescription *)node->data,
+ handle = (AnjutaPluginHandle *)node->data;
+ desc = anjuta_plugin_handle_get_description (handle);
+ if (anjuta_plugin_description_get_string (desc,
"File Loader", "SupportedMimeTypes", &value))
{
gchar **split_value;
@@ -178,11 +184,7 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
if (g_content_type_is_a (content_type, supertype))
{
- gchar *loc;
- anjuta_plugin_description_get_string
((AnjutaPluginDescription *)node->data,
-
"Anjuta Plugin", "Location", &loc);
-
- plugin_descs = g_list_prepend (plugin_descs,
node->data);
+ plugin_handles = g_list_prepend (plugin_handles,
handle);
g_free (supertype);
@@ -195,12 +197,12 @@ get_available_plugins_for_mime (AnjutaPlugin* plugin,
g_strfreev (split_value);
}
}
- g_list_free (loader_descs);
- plugin_descs = g_list_reverse (plugin_descs);
+ g_list_free (loader_handles);
+ plugin_handles = g_list_reverse (plugin_handles);
}
g_free (content_type);
- return plugin_descs;
+ return plugin_handles;
}
static gboolean
@@ -251,7 +253,7 @@ static void
open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
const gchar *mime_type)
{
- GList *plugin_descs, *snode;
+ GList *plugin_handles, *snode;
GList *mime_apps, *node;
GAppInfo *mime_app;
@@ -298,14 +300,16 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
col ++;
/* Open with plugins menu items */
- plugin_descs = get_available_plugins_for_mime (ANJUTA_PLUGIN (plugin), mime_type);
- snode = plugin_descs;
+ plugin_handles = get_available_plugins_for_mime (ANJUTA_PLUGIN (plugin), mime_type);
+ snode = plugin_handles;
while (snode)
{
gchar *name;
+ AnjutaPluginHandle *handle;
AnjutaPluginDescription *desc;
- desc = (AnjutaPluginDescription *)(snode->data);
+ handle = (AnjutaPluginHandle *)(snode->data);
+ desc = anjuta_plugin_handle_get_description (handle);
name = NULL;
@@ -372,37 +376,28 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
g_warning ("No document manager plugin!!");
}
}
- else if (option < (g_list_length (plugin_descs) + 1))
+ else if (option < (g_list_length (plugin_handles) + 1))
{
- AnjutaPluginDescription *desc;
- gchar *location = NULL;
+ AnjutaPluginHandle *handle;
+ GObject *loaded_plugin;
option--;
- desc = g_list_nth_data (plugin_descs, option);
- anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
- "Location",
&location);
- g_assert (location != NULL);
- if (location != NULL)
- {
- GObject *loaded_plugin;
+ handle = (AnjutaPluginHandle *)g_list_nth_data (plugin_handles, option);
- loaded_plugin =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
-
location);
- if (loaded_plugin)
- {
- GFile* file = g_file_new_for_uri (uri);
- ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, NULL);
- update_recent_file (plugin, uri, mime_type, TRUE);
- g_object_unref (file);
- }
- else
- {
- anjuta_util_dialog_error (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
- "Failed to activate
plugin: %s",
- location);
- }
- g_free (location);
+ loaded_plugin =anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
+ handle);
+ if (loaded_plugin)
+ {
+ GFile* file = g_file_new_for_uri (uri);
+ ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, NULL);
+ update_recent_file (plugin, uri, mime_type, TRUE);
+ g_object_unref (file);
+ }
+ else
+ {
+ anjuta_util_dialog_error (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
+ "Failed to activate plugin:
%s",
+
anjuta_plugin_handle_get_name (handle));
}
}
else
@@ -410,7 +405,7 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
GList *uris = NULL;
GError *error = NULL;
- option -= (g_list_length (plugin_descs) + 2);
+ option -= (g_list_length (plugin_handles) + 2);
mime_app = g_list_nth_data (mime_apps, option);
uris = g_list_prepend (uris, (gpointer)uri);
g_app_info_launch_uris(mime_app, uris, NULL, &error);
@@ -425,8 +420,8 @@ open_with_dialog (AnjutaFileLoaderPlugin *plugin, const gchar *uri,
}
g_list_foreach (mime_apps, (GFunc) g_object_unref, NULL);
g_list_free (mime_apps);
- if (plugin_descs)
- g_list_free (plugin_descs);
+ if (plugin_handles)
+ g_list_free (plugin_handles);
gtk_widget_destroy (dialog);
}
@@ -675,23 +670,17 @@ on_activate_wizard (GtkMenuItem *menuitem,
AnjutaFileLoaderPlugin *loader)
{
AnjutaPluginManager *plugin_manager;
- AnjutaPluginDescription *desc;
+ AnjutaPluginHandle *handle;
- desc = g_object_get_data (G_OBJECT (menuitem), "__plugin_desc");
+ handle = g_object_get_data (G_OBJECT (menuitem), "__plugin_handle");
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (loader)->shell,
NULL);
- if (desc)
+ if (handle)
{
- gchar *id;
GObject *plugin;
- if (anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
- "Location",
&id))
- {
- plugin =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager, id);
- ianjuta_wizard_activate (IANJUTA_WIZARD (plugin), NULL);
- }
+ plugin = anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, handle);
+ ianjuta_wizard_activate (IANJUTA_WIZARD (plugin), NULL);
}
}
@@ -703,7 +692,7 @@ on_create_submenu (gpointer user_data)
GList *node;
gint count;
GtkWidget *submenu = NULL;
- GList *plugin_descs = NULL;
+ GList *plugin_handles = NULL;
loader = ANJUTA_PLUGIN_FILE_LOADER (user_data);
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (loader)->shell,
@@ -711,21 +700,23 @@ on_create_submenu (gpointer user_data)
submenu = gtk_menu_new ();
gtk_widget_show (submenu);
- plugin_descs = anjuta_plugin_manager_query (plugin_manager,
+ plugin_handles = anjuta_plugin_manager_query (plugin_manager,
"Anjuta
Plugin",
"Interfaces",
"IAnjutaWizard",
NULL);
- plugin_descs = g_list_sort(plugin_descs, sort_wizards);
- node = plugin_descs;
+ plugin_handles = g_list_sort(plugin_handles, sort_wizards);
+ node = plugin_handles;
count = 0;
while (node)
{
+ AnjutaPluginHandle *handle;
AnjutaPluginDescription *desc;
GtkWidget *menuitem;
GtkWidget *icon;
gchar *str, *icon_path, *name;
- desc = node->data;
+ handle = node->data;
+ desc = anjuta_plugin_handle_get_description (handle);
icon = NULL;
name = NULL;
@@ -772,7 +763,7 @@ on_create_submenu (gpointer user_data)
menuitem = gtk_image_menu_item_new_with_mnemonic (name);
g_free(name);
gtk_widget_show (menuitem);
- g_object_set_data (G_OBJECT (menuitem), "__plugin_desc", desc);
+ g_object_set_data (G_OBJECT (menuitem), "__plugin_handle", handle);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (on_activate_wizard),
loader);
@@ -783,7 +774,7 @@ on_create_submenu (gpointer user_data)
}
node = g_list_next (node);
}
- g_list_free (plugin_descs);
+ g_list_free (plugin_handles);
return submenu;
}
@@ -792,49 +783,40 @@ open_uri_with (AnjutaFileLoaderPlugin *plugin, GtkMenuItem *menuitem,
const gchar *uri)
{
GAppInfo *app;
- AnjutaPluginDescription *desc;
+ AnjutaPluginHandle *handle;
const gchar *mime_type;
/* Open with plugin */
- desc = (AnjutaPluginDescription*) g_object_get_data (G_OBJECT (menuitem),
-
"desc");
+ handle = (AnjutaPluginHandle*) g_object_get_data (G_OBJECT (menuitem),
+ "handle");
mime_type = (const gchar*) g_object_get_data (G_OBJECT (menuitem),
"mime_type");
- if (desc)
+ if (handle)
{
AnjutaPluginManager *plugin_manager;
- gchar *location = NULL;
+ GObject *loaded_plugin;
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (plugin)->shell,
NULL);
- anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
- "Location",
&location);
- g_assert (location != NULL);
- if (location != NULL)
- {
- GObject *loaded_plugin;
- loaded_plugin =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
-
location);
- if (loaded_plugin)
- {
- GFile* file = g_file_new_for_uri (uri);
- GError *error = NULL;
+ loaded_plugin = anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
+ handle);
+ if (loaded_plugin)
+ {
+ GFile* file = g_file_new_for_uri (uri);
+ GError *error = NULL;
- ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, &error);
- g_object_unref (file);
- update_recent_file (plugin, uri, mime_type, error == NULL);
- g_free (error);
- }
- else
- {
- anjuta_util_dialog_error (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
- _("Failed to activate
plugin: %s"),
- location);
- }
- g_free (location);
+ ianjuta_file_open (IANJUTA_FILE (loaded_plugin), file, &error);
+ g_object_unref (file);
+ update_recent_file (plugin, uri, mime_type, error == NULL);
+ g_free (error);
+ }
+ else
+ {
+ anjuta_util_dialog_error (GTK_WINDOW (ANJUTA_PLUGIN(plugin)->shell),
+ _("Failed to activate plugin: %s"),
+ anjuta_plugin_handle_get_name
(handle));
}
}
else
@@ -942,7 +924,7 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
gpointer callback_data)
{
GList *mime_apps;
- GList *plugin_descs;
+ GList *plugin_handles;
GList *node;
GtkWidget *menu, *menuitem;
gchar *mime_type;
@@ -961,13 +943,15 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
return FALSE;
/* Open with plugins menu items */
- plugin_descs = get_available_plugins_for_mime (ANJUTA_PLUGIN (plugin), mime_type);
- for (node = plugin_descs; node != NULL; node = g_list_next (node))
+ plugin_handles = get_available_plugins_for_mime (ANJUTA_PLUGIN (plugin), mime_type);
+ for (node = plugin_handles; node != NULL; node = g_list_next (node))
{
gchar *name;
+ AnjutaPluginHandle *handle;
AnjutaPluginDescription *desc;
- desc = (AnjutaPluginDescription *)(node->data);
+ handle = (AnjutaPluginHandle *)(node->data);
+ desc = anjuta_plugin_handle_get_description (handle);
name = NULL;
anjuta_plugin_description_get_locale_string (desc, "File Loader",
"Title", &name);
@@ -982,18 +966,18 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
"Location",
&name);
}
menuitem = gtk_menu_item_new_with_label (name);
- g_object_set_data (G_OBJECT (menuitem), "desc", (gpointer)(desc));
+ g_object_set_data (G_OBJECT (menuitem), "handle", handle);
g_object_set_data (G_OBJECT (menuitem), "mime_type", mime_type);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (callback), callback_data);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_free (name);
}
- g_list_free (plugin_descs);
+ g_list_free (plugin_handles);
/* Open with applications */
mime_apps = g_app_info_get_all_for_type (mime_type);
- if (plugin_descs && mime_apps)
+ if (plugin_handles && mime_apps)
{
menuitem = gtk_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
@@ -1022,7 +1006,7 @@ create_open_with_submenu (AnjutaFileLoaderPlugin *plugin, GtkWidget *parentmenu,
gtk_widget_show_all (menu);
- if ((mime_apps != NULL) || (plugin_descs != NULL))
+ if ((mime_apps != NULL) || (plugin_handles != NULL))
{
g_object_set_data_full (G_OBJECT (menu), "mime_type", (gpointer)mime_type, g_free);
@@ -1403,7 +1387,7 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
gchar *mime_type;
AnjutaStatus *status;
AnjutaPluginManager *plugin_manager;
- GList *plugin_descs = NULL;
+ GList *plugin_handles = NULL;
GObject *plugin = NULL;
gchar *uri = g_file_get_uri (file);
@@ -1431,9 +1415,9 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
DEBUG_PRINT ("Opening URI: %s", uri);
- plugin_descs = get_available_plugins_for_mime (ANJUTA_PLUGIN (loader), mime_type);
+ plugin_handles = get_available_plugins_for_mime (ANJUTA_PLUGIN (loader), mime_type);
- if (g_list_length (plugin_descs) > 1)
+ if (g_list_length (plugin_handles) > 1)
{
gchar* basename = g_path_get_basename (uri);
/* %s is name of file that will be opened */
@@ -1443,22 +1427,15 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
anjuta_plugin_manager_select_and_activate (plugin_manager,
_("Open With"),
message,
-
plugin_descs);
+
plugin_handles);
g_free (basename);
g_free (message);
}
- else if (g_list_length (plugin_descs) == 1)
+ else if (g_list_length (plugin_handles) == 1)
{
- gchar *location = NULL;
-
- AnjutaPluginDescription *desc = plugin_descs->data;
- anjuta_plugin_description_get_string (desc, "Anjuta Plugin",
- "Location",
&location);
- g_return_val_if_fail (location != NULL, NULL);
- plugin =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
-
location);
- g_free (location);
+ AnjutaPluginHandle *handle = plugin_handles->data;
+ plugin = anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
+ handle);
}
else
{
@@ -1499,8 +1476,8 @@ iloader_load (IAnjutaFileLoader *loader, GFile* file,
update_recent_file (ANJUTA_PLUGIN_FILE_LOADER (loader), uri, mime_type, error == NULL);
}
- if (plugin_descs)
- g_list_free (plugin_descs);
+ if (plugin_handles)
+ g_list_free (plugin_handles);
g_free (mime_type);
g_free (uri);
diff --git a/plugins/file-manager/plugin.c b/plugins/file-manager/plugin.c
index 252cd97..2ebaf75 100644
--- a/plugins/file-manager/plugin.c
+++ b/plugins/file-manager/plugin.c
@@ -172,26 +172,23 @@ get_vcs_plugin(AnjutaFileManager* file_manager, const gchar* root_uri)
{
/* Load current language editor support plugins */
AnjutaPluginManager* plugin_manager = anjuta_shell_get_plugin_manager
(ANJUTA_PLUGIN(file_manager)->shell, NULL);
- GList* plugin_descs = anjuta_plugin_manager_query (plugin_manager,
+ GList* plugin_handles = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
"Interfaces",
"IAnjutaVcs",
"Vcs",
"System",
vcs_system, NULL);
- if (plugin_descs)
+ if (plugin_handles)
{
- gchar* plugin_id;
- anjuta_plugin_description_get_string (plugin_descs->data, "Anjuta Plugin", "Location",
-
&plugin_id);
- ivcs = IANJUTA_VCS(anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
-
plugin_id));
+ ivcs = IANJUTA_VCS(anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
+ (AnjutaPluginHandle
*)plugin_handles->data));
g_signal_connect (G_OBJECT (ivcs), "status_changed",
G_CALLBACK (refresh_signal_cb),
file_manager);
- g_list_free (plugin_descs);
+ g_list_free (plugin_handles);
}
}
return ivcs;
diff --git a/plugins/project-import/plugin.c b/plugins/project-import/plugin.c
index d90fcc7..36d98b7 100644
--- a/plugins/project-import/plugin.c
+++ b/plugins/project-import/plugin.c
@@ -42,17 +42,19 @@
static gpointer parent_class;
static gboolean
-project_import_generate_file (AnjutaPluginDescription *backend, ProjectImportDialog *import_dialog,
+project_import_generate_file (AnjutaPluginHandle *backend, ProjectImportDialog *import_dialog,
GFile *project_file)
{
/* Of course we could do some more intelligent stuff here
* and check which plugins are really needed */
-
+
+ AnjutaPluginDescription *desc;
GFile* source_file = NULL;
gchar *backend_id = NULL;
GError* error = NULL;
- if (!anjuta_plugin_description_get_string (backend, "Project", "Supported-Project-Types",
&backend_id))
+ desc = anjuta_plugin_handle_get_description (backend);
+ if (!anjuta_plugin_description_get_string (desc, "Project", "Supported-Project-Types", &backend_id))
{
if (!strcmp (backend_id, "automake"))
source_file = g_file_new_for_path (AM_PROJECT_FILE);
@@ -160,8 +162,8 @@ project_import_generate_file (AnjutaPluginDescription *backend, ProjectImportDia
gchar *name = NULL;
gchar *plugin_id = NULL;
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Name",
&name);
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location",
&plugin_id);
+ anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Name", &name);
+ anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Location",
&plugin_id);
str = g_string_new (NULL);
g_string_printf (str, "<plugin name= \"%s\"\n"
@@ -237,47 +239,44 @@ project_import_import_project (AnjutaProjectImportPlugin *import_plugin, Project
GFile *source_dir)
{
AnjutaPluginManager *plugin_manager;
- GList *descs = NULL;
- GList *desc;
- AnjutaPluginDescription *backend;
+ GList *handles = NULL;
+ GList *node;
+ AnjutaPluginHandle *backend;
gchar *name, *project_file_name;
/* Search for all valid project backend */
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN(import_plugin)->shell, NULL);
- descs = anjuta_plugin_manager_query (plugin_manager,
- "Anjuta Plugin",
- "Interfaces",
- "IAnjutaProjectBackend",
- NULL);
- for (desc = g_list_first (descs); desc != NULL;) {
+ handles = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta Plugin",
+ "Interfaces",
+ "IAnjutaProjectBackend",
+ NULL);
+ for (node = g_list_first (handles); node != NULL;) {
IAnjutaProjectBackend *plugin;
- gchar *location = NULL;
GList *next;
- backend = (AnjutaPluginDescription *)desc->data;
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location", &location);
- plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
location);
- g_free (location);
+ backend = (AnjutaPluginHandle *)node->data;
+ plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
backend);
- next = g_list_next (desc);
+ next = g_list_next (node);
/* Probe the project directory to find if the backend can handle it */
if (ianjuta_project_backend_probe (plugin, source_dir, NULL) <= 0)
{
/* Remove invalid backend */
- descs = g_list_delete_link (descs, desc);
+ handles = g_list_delete_link (handles, node);
}
- desc = next;
+ node = next;
}
- if (descs == NULL)
+ if (handles == NULL)
{
backend = NULL;
}
- else if (g_list_next (descs) == NULL)
+ else if (g_list_next (handles) == NULL)
{
- backend = (AnjutaPluginDescription *)descs->data;
+ backend = (AnjutaPluginHandle *)handles->data;
}
else
{
@@ -287,13 +286,13 @@ project_import_import_project (AnjutaProjectImportPlugin *import_plugin, Project
g_free (path);
- backend = anjuta_plugin_manager_select (plugin_manager,
- _("Open With"),
- message,
- descs);
+ backend = anjuta_plugin_manager_select (plugin_manager,
+ _("Open With"),
+ message,
+ handles);
g_free (message);
}
- g_list_free (descs);
+ g_list_free (handles);
if (backend == NULL)
{
@@ -392,7 +391,8 @@ project_import_checkout_project (AnjutaProjectImportPlugin *import_plugin,
{
CheckoutData *ch_data;
AnjutaAsyncNotify *async_notify;
- gchar *vcs_uri, *plugin_id, *name;
+ AnjutaPluginHandle *plugin_handle;
+ gchar *vcs_uri, *name;
GFile *dest_dir, *checkout_dir;
AnjutaPluginManager *plugin_manager;
IAnjutaVcs *ivcs;
@@ -415,10 +415,10 @@ project_import_checkout_project (AnjutaProjectImportPlugin *import_plugin,
ch_data);
vcs_uri = project_import_dialog_get_vcs_uri (import_dialog);
- plugin_id = project_import_dialog_get_vcs_id (import_dialog);
+ plugin_handle = project_import_dialog_get_vcs_id (import_dialog);
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN (import_plugin)->shell, NULL);
- ivcs = IANJUTA_VCS (anjuta_plugin_manager_get_plugin_by_id (plugin_manager, plugin_id));
+ ivcs = IANJUTA_VCS (anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, plugin_handle));
err = NULL;
ianjuta_vcs_checkout (ivcs, vcs_uri, checkout_dir, NULL, async_notify, &err);
@@ -439,7 +439,6 @@ project_import_checkout_project (AnjutaProjectImportPlugin *import_plugin,
cleanup:
g_free (vcs_uri);
- g_free (plugin_id);
}
static void
diff --git a/plugins/project-import/project-import-dialog.c b/plugins/project-import/project-import-dialog.c
index 80a69ed..5387ba1 100644
--- a/plugins/project-import/project-import-dialog.c
+++ b/plugins/project-import/project-import-dialog.c
@@ -152,12 +152,12 @@ vcs_radio_toggled (GtkToggleButton *button, gpointer user_data)
gtk_widget_set_sensitive (priv->import_button, FALSE);
}
-gchar *
+AnjutaPluginHandle *
project_import_dialog_get_vcs_id (ProjectImportDialog *import_dialog)
{
ProjectImportDialogPrivate *priv = GET_PRIVATE (import_dialog);
GtkTreeIter iter;
- gchar *vcs_id;
+ AnjutaPluginHandle *vcs_handle;
g_assert (PROJECT_IS_IMPORT_DIALOG (import_dialog));
@@ -165,9 +165,9 @@ project_import_dialog_get_vcs_id (ProjectImportDialog *import_dialog)
return NULL;
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->vcs_combo), &iter);
- gtk_tree_model_get (GTK_TREE_MODEL (priv->vcs_store), &iter, 1, &vcs_id, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->vcs_store), &iter, 1, &vcs_handle, -1);
- return vcs_id;
+ return vcs_handle;
}
gchar *
@@ -224,7 +224,7 @@ project_import_dialog_new (AnjutaPluginManager *plugin_manager, const gchar *nam
{
ProjectImportDialog *import_dialog;
ProjectImportDialogPrivate *priv;
- GList *plugin_descs, *l_iter;
+ GList *plugin_handles, *l_iter;
import_dialog = g_object_new (PROJECT_IMPORT_TYPE_DIALOG, NULL);
priv = GET_PRIVATE (import_dialog);
@@ -234,23 +234,28 @@ project_import_dialog_new (AnjutaPluginManager *plugin_manager, const gchar *nam
if (dir)
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (priv->source_dir_button), dir, NULL);
- plugin_descs = anjuta_plugin_manager_query (plugin_manager,
- "Anjuta Plugin",
- "Interfaces",
- "IAnjutaVcs",
- NULL);
- for (l_iter = plugin_descs; l_iter; l_iter = l_iter->next)
+ plugin_handles = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta Plugin",
+ "Interfaces",
+ "IAnjutaVcs",
+ NULL);
+ for (l_iter = plugin_handles; l_iter; l_iter = l_iter->next)
{
gchar *vcs_name, *plugin_id;
GtkTreeIter iter;
+ AnjutaPluginHandle *handle;
+ AnjutaPluginDescription *desc;
+
+ handle = (AnjutaPluginHandle *)l_iter->data;
+ desc = anjuta_plugin_handle_get_description (handle);
- anjuta_plugin_description_get_string (l_iter->data, "Vcs", "System",
+ anjuta_plugin_description_get_string (desc, "Vcs", "System",
&vcs_name);
- anjuta_plugin_description_get_string (l_iter->data, "Anjuta Plugin", "Location",
+ anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Location",
&plugin_id);
gtk_list_store_append (priv->vcs_store, &iter);
- gtk_list_store_set (priv->vcs_store, &iter, 0, vcs_name, 1, plugin_id, -1);
+ gtk_list_store_set (priv->vcs_store, &iter, 0, vcs_name, 1, handle, -1);
g_free (vcs_name);
g_free (plugin_id);
@@ -258,7 +263,7 @@ project_import_dialog_new (AnjutaPluginManager *plugin_manager, const gchar *nam
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->vcs_combo), 0);
}
- g_list_free (plugin_descs);
+ g_list_free (plugin_handles);
return import_dialog;
}
diff --git a/plugins/project-import/project-import-dialog.h b/plugins/project-import/project-import-dialog.h
index b0c2609..a69ff70 100644
--- a/plugins/project-import/project-import-dialog.h
+++ b/plugins/project-import/project-import-dialog.h
@@ -29,6 +29,7 @@
#include <glib-object.h>
#include <libanjuta/anjuta-plugin.h>
+#include <libanjuta/anjuta-plugin-handle.h>
G_BEGIN_DECLS
@@ -62,7 +63,7 @@ GFile *project_import_dialog_get_source_dir (ProjectImportDialog *import_dialog)
GFile *project_import_dialog_get_dest_dir (ProjectImportDialog *import_dialog);
gchar * project_import_dialog_get_vcs_uri (ProjectImportDialog *import_dialog);
-gchar *project_import_dialog_get_vcs_id (ProjectImportDialog *import_dialog);
+AnjutaPluginHandle *project_import_dialog_get_vcs_id (ProjectImportDialog *import_dialog);
G_END_DECLS
diff --git a/plugins/project-import/project-import.ui b/plugins/project-import/project-import.ui
index 280fd64..e5a93b0 100644
--- a/plugins/project-import/project-import.ui
+++ b/plugins/project-import/project-import.ui
@@ -5,8 +5,8 @@
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
- <!-- column-name gchararray2 -->
- <column type="gchararray"/>
+ <!-- column-name gpointer2 -->
+ <column type="gpointer"/>
</columns>
</object>
<object class="GtkWindow" id="window1">
diff --git a/plugins/project-manager/dialogs.c b/plugins/project-manager/dialogs.c
index ba3f485..0e417df 100644
--- a/plugins/project-manager/dialogs.c
+++ b/plugins/project-manager/dialogs.c
@@ -56,7 +56,7 @@
typedef struct _PropertiesTable
{
AnjutaPmProject *project;
- AnjutaPluginDescription *new_backend;
+ AnjutaPluginHandle *new_backend;
GtkWidget *dialog;
GtkWidget *table;
GtkWidget *head;
@@ -597,48 +597,45 @@ on_change_project_backend (GtkButton *button,
{
PropertiesTable *table = (PropertiesTable *)user_data;
AnjutaPluginManager *plugin_manager;
- GList *descs = NULL;
- GList *desc;
- AnjutaPluginDescription *backend;
+ GList *handles = NULL;
+ GList *node;
+ AnjutaPluginHandle *backend;
/* Search for all valid project backend */
plugin_manager = anjuta_shell_get_plugin_manager (ANJUTA_PLUGIN(table->project->plugin)->shell, NULL);
- descs = anjuta_plugin_manager_query (plugin_manager,
+ handles = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
"Interfaces",
"IAnjutaProjectBackend",
NULL);
- for (desc = g_list_first (descs); desc != NULL;) {
+ for (node = g_list_first (handles); node != NULL;) {
IAnjutaProjectBackend *plugin;
- gchar *location = NULL;
GList *next;
- backend = (AnjutaPluginDescription *)desc->data;
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location", &location);
- plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager,
location);
- g_free (location);
+ backend = (AnjutaPluginHandle *)node->data;
+ plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
backend);
- next = g_list_next (desc);
+ next = g_list_next (node);
/* Probe the project directory to find if the backend can handle it */
if (ianjuta_project_backend_probe (plugin, anjuta_project_node_get_file (table->node), NULL)
<= 0)
{
/* Remove invalid backend */
- descs = g_list_delete_link (descs, desc);
+ handles = g_list_delete_link (handles, node);
}
- desc = next;
+ node = next;
}
- if (descs != NULL)
+ if (handles != NULL)
{
/* Move the current backend at the beginning of the list */
backend = anjuta_pm_project_get_backend (table->project);
- for (desc = g_list_first (descs); desc != NULL; desc = g_list_next (desc)) {
- if (desc->data == backend)
+ for (node = g_list_first (handles); node != NULL; node = g_list_next (node)) {
+ if (node->data == backend)
{
- descs = g_list_remove_link (descs, desc);
- descs = g_list_concat (desc, descs);
+ handles = g_list_remove_link (handles, node);
+ handles = g_list_concat (node, handles);
break;
}
}
@@ -647,18 +644,15 @@ on_change_project_backend (GtkButton *button,
gchar* message = g_strdup_printf (_("Please select a project backend to use."));
backend = anjuta_plugin_manager_select (plugin_manager,
- _("Open With"),
- message,
- descs);
+ _("Open With"),
+ message,
+ handles);
g_free (message);
- g_list_free (descs);
+ g_list_free (handles);
if (backend != NULL)
{
- gchar *name;
- anjuta_plugin_description_get_locale_string (backend, "Anjuta Plugin", "Name", &name);
- gtk_button_set_label (button, name);
- g_free (name);
+ gtk_button_set_label (button, anjuta_plugin_handle_get_name (backend));
table->new_backend = backend;
}
}
@@ -734,16 +728,13 @@ update_properties (PropertiesTable *table)
if ((anjuta_project_node_get_node_type (table->node) == ANJUTA_PROJECT_ROOT) ||
((anjuta_project_node_get_full_type (table->node) & ANJUTA_PROJECT_ID_MASK) ==
ANJUTA_PROJECT_ROOT_GROUP))
{
- AnjutaPluginDescription *backend;
+ AnjutaPluginHandle *backend;
backend = anjuta_pm_project_get_backend (table->project);
if (backend)
{
- gchar *name;
-
- anjuta_plugin_description_get_locale_string (backend, "Anjuta Plugin", "Name", &name);
+ const gchar *name = anjuta_plugin_handle_get_name (backend);
add_button (_("Backend:"), name, G_CALLBACK (on_change_project_backend), table,
table->head, &head_pos);
- g_free (name);
}
}
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 5329b63..a0a510f 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -379,7 +379,7 @@ get_plugin_parent_window (ProjectManagerPlugin *plugin)
}
gboolean
-change_project_backend (ProjectManagerPlugin *plugin, AnjutaPluginDescription *backend)
+change_project_backend (ProjectManagerPlugin *plugin, AnjutaPluginHandle *backend)
{
gchar *content;
gsize length;
@@ -421,9 +421,11 @@ change_project_backend (ProjectManagerPlugin *plugin, AnjutaPluginDescription *b
GFileOutputStream *stream;
gchar *name = NULL;
gchar *plugin_id = NULL;
+ AnjutaPluginDescription *desc;
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Name", &name);
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location",
&plugin_id);
+ desc = anjuta_plugin_handle_get_description (backend);
+ anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Name", &name);
+ anjuta_plugin_description_get_string (desc, "Anjuta Plugin", "Location", &plugin_id);
str = g_string_new (NULL);
g_string_printf (str, "<plugin name= \"%s\"\n"
diff --git a/plugins/project-manager/plugin.h b/plugins/project-manager/plugin.h
index b31552e..46b03b9 100644
--- a/plugins/project-manager/plugin.h
+++ b/plugins/project-manager/plugin.h
@@ -88,7 +88,7 @@ struct _ProjectManagerPluginClass{
};
GtkWindow* get_plugin_parent_window (ProjectManagerPlugin *plugin);
-gboolean change_project_backend (ProjectManagerPlugin *plugin, AnjutaPluginDescription *backend);
+gboolean change_project_backend (ProjectManagerPlugin *plugin, AnjutaPluginHandle *backend);
#endif
diff --git a/plugins/project-manager/project.c b/plugins/project-manager/project.c
index 6444f76..d2e3b62 100644
--- a/plugins/project-manager/project.c
+++ b/plugins/project-manager/project.c
@@ -120,17 +120,14 @@ on_node_changed (IAnjutaProject *sender, AnjutaProjectNode *node, GError *error,
*---------------------------------------------------------------------------*/
gboolean
-anjuta_pm_project_load_with_backend (AnjutaPmProject *project, GFile *file, AnjutaPluginDescription
*backend, GError **error)
+anjuta_pm_project_load_with_backend (AnjutaPmProject *project, GFile *file, AnjutaPluginHandle *backend,
GError **error)
{
AnjutaPluginManager *plugin_manager;
- gchar *location = NULL;
IAnjutaProjectBackend *plugin;
GValue value = {0, };
- anjuta_plugin_description_get_string (backend, "Anjuta Plugin", "Location", &location);
plugin_manager = anjuta_shell_get_plugin_manager (project->plugin->shell, NULL);
- plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id (plugin_manager, location);
- g_free (location);
+ plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_handle (plugin_manager,
backend);
DEBUG_PRINT ("%s", "Creating new gbf project\n");
@@ -184,7 +181,7 @@ anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error)
AnjutaPluginManager *plugin_manager;
GList *desc;
IAnjutaProjectBackend *backend;
- AnjutaPluginDescription *backend_desc;
+ AnjutaPluginHandle *backend_handle;
gint found = 0;
g_return_val_if_fail (file != NULL, FALSE);
@@ -194,23 +191,20 @@ anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error)
if (!anjuta_plugin_manager_is_active_plugin (plugin_manager, "IAnjutaProjectBackend"))
{
- GList *descs = NULL;
+ GList *handles = NULL;
- descs = anjuta_plugin_manager_query (plugin_manager,
+ handles = anjuta_plugin_manager_query (plugin_manager,
"Anjuta Plugin",
"Interfaces",
"IAnjutaProjectBackend",
NULL);
backend = NULL;
- for (desc = g_list_first (descs); desc != NULL; desc = g_list_next (desc)) {
- gchar *location = NULL;
+ for (desc = g_list_first (handles); desc != NULL; desc = g_list_next (desc)) {
IAnjutaProjectBackend *plugin;
gint backend_val;
- backend_desc = (AnjutaPluginDescription *)desc->data;
- anjuta_plugin_description_get_string (backend_desc, "Anjuta Plugin", "Location",
&location);
- plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_id
(plugin_manager, location);
- g_free (location);
+ backend_handle = (AnjutaPluginHandle *)desc->data;
+ plugin = (IAnjutaProjectBackend *)anjuta_plugin_manager_get_plugin_by_handle
(plugin_manager, backend_handle);
backend_val = ianjuta_project_backend_probe (plugin, file, NULL);
if (backend_val > found)
@@ -220,7 +214,7 @@ anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error)
found = backend_val;
}
}
- g_list_free (descs);
+ g_list_free (handles);
}
else
{
@@ -239,9 +233,9 @@ anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error)
return FALSE;
}
- backend_desc = anjuta_plugin_manager_get_plugin_description (plugin_manager, G_OBJECT(backend));
+ backend_handle = anjuta_plugin_manager_get_plugin_handle (plugin_manager, G_OBJECT(backend));
- return anjuta_pm_project_load_with_backend (project, file, backend_desc, error);
+ return anjuta_pm_project_load_with_backend (project, file, backend_handle, error);
}
gboolean
@@ -418,7 +412,7 @@ anjuta_pm_project_is_open (AnjutaPmProject *project)
return (project->project != NULL) && (project->root != NULL);
}
-AnjutaPluginDescription *
+AnjutaPluginHandle *
anjuta_pm_project_get_backend (AnjutaPmProject *project)
{
return project->backend;
diff --git a/plugins/project-manager/project.h b/plugins/project-manager/project.h
index 4c4f031..c35fbcd 100644
--- a/plugins/project-manager/project.h
+++ b/plugins/project-manager/project.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
#include <libanjuta/anjuta-plugin.h>
#include <libanjuta/anjuta-project.h>
-#include <libanjuta/anjuta-plugin-description.h>
+#include <libanjuta/anjuta-plugin-handle.h>
#include <libanjuta/interfaces/ianjuta-project.h>
#include "project-model.h"
@@ -58,7 +58,7 @@ struct _AnjutaPmProject
AnjutaPlugin *plugin;
IAnjutaProject *project;
- AnjutaPluginDescription *backend;
+ AnjutaPluginHandle *backend;
AnjutaProjectNode *root;
@@ -78,7 +78,7 @@ AnjutaPmProject* anjuta_pm_project_new (AnjutaPlugin *plugin);
void anjuta_pm_project_free (AnjutaPmProject* project);
gboolean anjuta_pm_project_load (AnjutaPmProject *project, GFile *file, GError **error);
-gboolean anjuta_pm_project_load_with_backend (AnjutaPmProject *project, GFile *file, AnjutaPluginDescription
*backend, GError **error);
+gboolean anjuta_pm_project_load_with_backend (AnjutaPmProject *project, GFile *file, AnjutaPluginHandle
*backend, GError **error);
gboolean anjuta_pm_project_unload (AnjutaPmProject *project, GError **error);
gboolean anjuta_pm_project_refresh (AnjutaPmProject *project, GError **error);
@@ -96,7 +96,7 @@ gboolean anjuta_pm_project_remove_data (AnjutaPmProject *project, GbfTreeData *d
gboolean anjuta_pm_project_is_open (AnjutaPmProject *project);
-AnjutaPluginDescription *anjuta_pm_project_get_backend (AnjutaPmProject *project);
+AnjutaPluginHandle *anjuta_pm_project_get_backend (AnjutaPmProject *project);
IAnjutaProject *anjuta_pm_project_get_project (AnjutaPmProject *project);
GbfProjectModel *anjuta_pm_project_get_model (AnjutaPmProject *project);
diff --git a/plugins/starter/plugin.c b/plugins/starter/plugin.c
index e8ba6ec..3117580 100644
--- a/plugins/starter/plugin.c
+++ b/plugins/starter/plugin.c
@@ -73,12 +73,22 @@ on_new_project_clicked (GtkButton *button, gpointer user_data)
AnjutaPluginManager* plugin_manager =
anjuta_shell_get_plugin_manager (anjuta_plugin_get_shell (plugin),
NULL);
-
- GObject* wizard =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager, PROJECT_WIZARD_ID);
+ GList *plugin_handles = NULL;
+
+ plugin_handles = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta Plugin",
+ "Location",
+ PROJECT_WIZARD_ID,
+ NULL);
- if (wizard)
- ianjuta_wizard_activate (IANJUTA_WIZARD (wizard), NULL);
+ if (plugin_handles != NULL)
+ {
+ GObject* wizard =
+ anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, (AnjutaPluginHandle
*)plugin_handles->data);
+ if (wizard)
+ ianjuta_wizard_activate (IANJUTA_WIZARD (wizard), NULL);
+ }
+ g_list_free (plugin_handles);
}
void
@@ -88,11 +98,22 @@ on_import_project_clicked (GtkButton *button, gpointer user_data)
AnjutaPluginManager* plugin_manager =
anjuta_shell_get_plugin_manager (anjuta_plugin_get_shell (plugin),
NULL);
- GObject* wizard =
- anjuta_plugin_manager_get_plugin_by_id (plugin_manager, PROJECT_IMPORT_ID);
+ GList *plugin_handles = NULL;
- if (wizard)
- ianjuta_wizard_activate (IANJUTA_WIZARD (wizard), NULL);
+ plugin_handles = anjuta_plugin_manager_query (plugin_manager,
+ "Anjuta Plugin",
+ "Location",
+ PROJECT_IMPORT_ID,
+ NULL);
+
+ if (plugin_handles != NULL)
+ {
+ GObject* wizard =
+ anjuta_plugin_manager_get_plugin_by_handle (plugin_manager, (AnjutaPluginHandle
*)plugin_handles->data);
+ if (wizard)
+ ianjuta_wizard_activate (IANJUTA_WIZARD (wizard), NULL);
+ }
+ g_list_free (plugin_handles);
}
static void
diff --git a/src/about.c b/src/about.c
index ac8a4cb..fbe0113 100644
--- a/src/about.c
+++ b/src/about.c
@@ -289,7 +289,7 @@ void
about_create_plugins_submenu (AnjutaShell *shell, GtkWidget *menuitem)
{
GtkWidget *submenu;
- GList *plugin_descs, *node;
+ GList *plugin_handles, *node;
g_return_if_fail (ANJUTA_IS_SHELL (shell));
g_return_if_fail (GTK_IS_MENU_ITEM (menuitem));
@@ -298,15 +298,16 @@ about_create_plugins_submenu (AnjutaShell *shell, GtkWidget *menuitem)
gtk_widget_show (submenu);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
- plugin_descs =
+ plugin_handles =
anjuta_plugin_manager_query (anjuta_shell_get_plugin_manager (shell, NULL),
NULL, NULL, NULL, NULL);
- node = plugin_descs;
+ node = plugin_handles;
while (node)
{
gchar *label;
GtkWidget *item;
- AnjutaPluginDescription *desc = node->data;
+ AnjutaPluginHandle *handle = (AnjutaPluginHandle *)node->data;
+ AnjutaPluginDescription *desc = anjuta_plugin_handle_get_description (handle);
if (anjuta_plugin_description_get_locale_string (desc, "Anjuta Plugin",
"Name", &label))
{
@@ -332,4 +333,5 @@ about_create_plugins_submenu (AnjutaShell *shell, GtkWidget *menuitem)
}
node = g_list_next (node);
}
+ g_list_free (plugin_handles);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]