When quitting, remember plugin filenames that couldn't be loaded at
startup as well as active plugins. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2493 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
baa27abbe9
commit
f37439c56f
@ -11,6 +11,9 @@
|
|||||||
Move plugin keyfile pref saving and loading to plugins.c.
|
Move plugin keyfile pref saving and loading to plugins.c.
|
||||||
* src/plugindata.h, src/geany.h, src/plugins.c, src/main.c:
|
* src/plugindata.h, src/geany.h, src/plugins.c, src/main.c:
|
||||||
Remove active_plugins from GeanyApp.
|
Remove active_plugins from GeanyApp.
|
||||||
|
* src/plugins.c, NEWS:
|
||||||
|
When quitting, remember plugin filenames that couldn't be loaded at
|
||||||
|
startup as well as active plugins.
|
||||||
|
|
||||||
|
|
||||||
2008-04-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
2008-04-15 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
|
||||||
|
2
NEWS
2
NEWS
@ -37,6 +37,8 @@ Geany 0.14 (TBA)
|
|||||||
* Add a HTML Characters keybinding to show the dialog.
|
* Add a HTML Characters keybinding to show the dialog.
|
||||||
* Add File Browser keybindings to focus the Path Entry and File List
|
* Add File Browser keybindings to focus the Path Entry and File List
|
||||||
* Rename VCDiff plugin Version Diff.
|
* Rename VCDiff plugin Version Diff.
|
||||||
|
* When quitting, remember plugin filenames that couldn't be loaded at
|
||||||
|
startup as well as active plugins.
|
||||||
|
|
||||||
Plugin API:
|
Plugin API:
|
||||||
* Add PLUGIN_KEY_GROUP and keybindings_set_item() to setup a keybinding
|
* Add PLUGIN_KEY_GROUP and keybindings_set_item() to setup a keybinding
|
||||||
|
@ -85,7 +85,10 @@ Plugin;
|
|||||||
static GList *plugin_list = NULL;
|
static GList *plugin_list = NULL;
|
||||||
static GList *active_plugin_list = NULL; /* list of only actually loaded plugins, always valid */
|
static GList *active_plugin_list = NULL; /* list of only actually loaded plugins, always valid */
|
||||||
static gchar **active_plugins_pref = NULL; /* list of plugin filenames to load at startup */
|
static gchar **active_plugins_pref = NULL; /* list of plugin filenames to load at startup */
|
||||||
|
static GList *failed_plugins_list = NULL; /* plugins the user wants active but can't be used */
|
||||||
|
|
||||||
static GtkWidget *separator = NULL;
|
static GtkWidget *separator = NULL;
|
||||||
|
|
||||||
static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data);
|
static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
@ -597,13 +600,19 @@ load_active_plugins()
|
|||||||
{
|
{
|
||||||
guint i, len;
|
guint i, len;
|
||||||
|
|
||||||
if (active_plugins_pref == NULL || (len = g_strv_length(active_plugins_pref)) == 0)
|
len = g_strv_length(active_plugins_pref);
|
||||||
|
if (active_plugins_pref == NULL || len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if (NZV(active_plugins_pref[i]))
|
const gchar *fname = active_plugins_pref[i];
|
||||||
plugin_new(active_plugins_pref[i], TRUE, FALSE);
|
|
||||||
|
if (NZV(fname))
|
||||||
|
{
|
||||||
|
if (plugin_new(fname, TRUE, FALSE) == NULL)
|
||||||
|
failed_plugins_list = g_list_append(failed_plugins_list, g_strdup(fname));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +622,6 @@ load_plugins_from_path(const gchar *path)
|
|||||||
{
|
{
|
||||||
GSList *list, *item;
|
GSList *list, *item;
|
||||||
gchar *fname, *tmp;
|
gchar *fname, *tmp;
|
||||||
Plugin *plugin;
|
|
||||||
|
|
||||||
list = utils_get_file_list(path, NULL, NULL);
|
list = utils_get_file_list(path, NULL, NULL);
|
||||||
|
|
||||||
@ -624,7 +632,7 @@ load_plugins_from_path(const gchar *path)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL);
|
fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL);
|
||||||
plugin = plugin_new(fname, FALSE, TRUE);
|
plugin_new(fname, FALSE, TRUE);
|
||||||
g_free(fname);
|
g_free(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,19 +703,30 @@ static void update_active_plugins_pref(void)
|
|||||||
{
|
{
|
||||||
gint i = 0;
|
gint i = 0;
|
||||||
GList *list;
|
GList *list;
|
||||||
|
gsize count = g_list_length(active_plugin_list) + g_list_length(failed_plugins_list);
|
||||||
|
|
||||||
g_strfreev(active_plugins_pref);
|
g_strfreev(active_plugins_pref);
|
||||||
|
|
||||||
if (active_plugin_list == NULL)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
active_plugins_pref = NULL;
|
active_plugins_pref = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
active_plugins_pref = g_new0(gchar*, g_list_length(active_plugin_list) + 1);
|
active_plugins_pref = g_new0(gchar*, count + 1);
|
||||||
|
|
||||||
for (list = g_list_first(active_plugin_list); list != NULL; list = list->next)
|
for (list = g_list_first(active_plugin_list); list != NULL; list = list->next)
|
||||||
{
|
{
|
||||||
active_plugins_pref[i] = g_strdup(((Plugin*)list->data)->filename);
|
Plugin *plugin = list->data;
|
||||||
|
|
||||||
|
active_plugins_pref[i] = g_strdup(plugin->filename);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
for (list = g_list_first(failed_plugins_list); list != NULL; list = list->next)
|
||||||
|
{
|
||||||
|
const gchar *fname = list->data;
|
||||||
|
|
||||||
|
active_plugins_pref[i] = g_strdup(fname);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
active_plugins_pref[i] = NULL;
|
active_plugins_pref[i] = NULL;
|
||||||
@ -740,6 +759,11 @@ void plugins_load_prefs(GKeyFile *config)
|
|||||||
|
|
||||||
void plugins_free(void)
|
void plugins_free(void)
|
||||||
{
|
{
|
||||||
|
if (failed_plugins_list != NULL)
|
||||||
|
{
|
||||||
|
g_list_foreach(failed_plugins_list, (GFunc) g_free, NULL);
|
||||||
|
g_list_free(failed_plugins_list);
|
||||||
|
}
|
||||||
if (active_plugin_list != NULL)
|
if (active_plugin_list != NULL)
|
||||||
{
|
{
|
||||||
g_list_foreach(active_plugin_list, (GFunc) plugin_free, GINT_TO_POINTER(PLUGIN_FREE_ALL));
|
g_list_foreach(active_plugin_list, (GFunc) plugin_free, GINT_TO_POINTER(PLUGIN_FREE_ALL));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user