Commit 4f163da8 authored by Chyla Zbigniew's avatar Chyla Zbigniew
Browse files

Fixes #51316 (actually, it fixes the _real_ problem).


Fixes #51316 (actually, it fixes the _real_ problem).

* src/dialogs/dialog-plugin-manager.c
(cb_pm_button_activate_plugin_clicked): If the plugin is already
active, remove it from "marked for deactivation" list.
(cb_pm_button_deactivate_plugin_clicked): If the plugin cannot be
deactivated, optionally add it to "marked for deactivation" list
(if the user wants to).
(cb_pm_clist_row_selected):
Make "Activate plugin" button sensitive for some active plugins (for
those on "marked for deactivation" list).
(cb_pm_clist_row_unselected):
Bugfix: don't free pm_gui->current_plugin_id string.
(update_plugin_manager_view):
Display the plugin state after its name ("in memory", "marked for
deactivation").
(dialog_plugin_manager): Plug leak.

* src/plugin.c
(plugin_info_force_mark_inactive,
plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
(plugins_shutdown): Set all plugins on "marked for deactivation"
list as inactive before saving active plugins in configuration.

* src/plugin.h:
(plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
parent 0393f83f
2001-03-05 Zbigniew Chyla <cyba@gnome.pl>
Fixes #51316 (actually, it fixes the _real_ problem).
* src/dialogs/dialog-plugin-manager.c
(cb_pm_button_activate_plugin_clicked): If the plugin is already
active, remove it from "marked for deactivation" list.
(cb_pm_button_deactivate_plugin_clicked): If the plugin cannot be
deactivated, optionally add it to "marked for deactivation" list
(if the user wants to).
(cb_pm_clist_row_selected):
Make "Activate plugin" button sensitive for some active plugins (for
those on "marked for deactivation" list).
(cb_pm_clist_row_unselected):
Bugfix: don't free pm_gui->current_plugin_id string.
(update_plugin_manager_view):
Display the plugin state after its name ("in memory", "marked for
deactivation").
(dialog_plugin_manager): Plug leak.
* src/plugin.c
(plugin_info_force_mark_inactive,
plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
(plugins_shutdown): Set all plugins on "marked for deactivation"
list as inactive before saving active plugins in configuration.
* src/plugin.h:
(plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
2001-03-05 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c
......@@ -1695,7 +1726,7 @@
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
Update row heights after pasting a region. Fixes #38176.
Update row heights after pasting a region.
2001-01-23 Morten Welinder <terra@diku.dk>
......
2001-03-05 Zbigniew Chyla <cyba@gnome.pl>
Fixes #51316 (actually, it fixes the _real_ problem).
* src/dialogs/dialog-plugin-manager.c
(cb_pm_button_activate_plugin_clicked): If the plugin is already
active, remove it from "marked for deactivation" list.
(cb_pm_button_deactivate_plugin_clicked): If the plugin cannot be
deactivated, optionally add it to "marked for deactivation" list
(if the user wants to).
(cb_pm_clist_row_selected):
Make "Activate plugin" button sensitive for some active plugins (for
those on "marked for deactivation" list).
(cb_pm_clist_row_unselected):
Bugfix: don't free pm_gui->current_plugin_id string.
(update_plugin_manager_view):
Display the plugin state after its name ("in memory", "marked for
deactivation").
(dialog_plugin_manager): Plug leak.
* src/plugin.c
(plugin_info_force_mark_inactive,
plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
(plugins_shutdown): Set all plugins on "marked for deactivation"
list as inactive before saving active plugins in configuration.
* src/plugin.h:
(plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
2001-03-05 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c
......@@ -1695,7 +1726,7 @@
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
Update row heights after pasting a region. Fixes #38176.
Update row heights after pasting a region.
2001-01-23 Morten Welinder <terra@diku.dk>
......
2001-03-05 Zbigniew Chyla <cyba@gnome.pl>
Fixes #51316 (actually, it fixes the _real_ problem).
* src/dialogs/dialog-plugin-manager.c
(cb_pm_button_activate_plugin_clicked): If the plugin is already
active, remove it from "marked for deactivation" list.
(cb_pm_button_deactivate_plugin_clicked): If the plugin cannot be
deactivated, optionally add it to "marked for deactivation" list
(if the user wants to).
(cb_pm_clist_row_selected):
Make "Activate plugin" button sensitive for some active plugins (for
those on "marked for deactivation" list).
(cb_pm_clist_row_unselected):
Bugfix: don't free pm_gui->current_plugin_id string.
(update_plugin_manager_view):
Display the plugin state after its name ("in memory", "marked for
deactivation").
(dialog_plugin_manager): Plug leak.
* src/plugin.c
(plugin_info_force_mark_inactive,
plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
(plugins_shutdown): Set all plugins on "marked for deactivation"
list as inactive before saving active plugins in configuration.
* src/plugin.h:
(plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
2001-03-05 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c
......@@ -1695,7 +1726,7 @@
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
Update row heights after pasting a region. Fixes #38176.
Update row heights after pasting a region.
2001-01-23 Morten Welinder <terra@diku.dk>
......
2001-03-05 Zbigniew Chyla <cyba@gnome.pl>
Fixes #51316 (actually, it fixes the _real_ problem).
* src/dialogs/dialog-plugin-manager.c
(cb_pm_button_activate_plugin_clicked): If the plugin is already
active, remove it from "marked for deactivation" list.
(cb_pm_button_deactivate_plugin_clicked): If the plugin cannot be
deactivated, optionally add it to "marked for deactivation" list
(if the user wants to).
(cb_pm_clist_row_selected):
Make "Activate plugin" button sensitive for some active plugins (for
those on "marked for deactivation" list).
(cb_pm_clist_row_unselected):
Bugfix: don't free pm_gui->current_plugin_id string.
(update_plugin_manager_view):
Display the plugin state after its name ("in memory", "marked for
deactivation").
(dialog_plugin_manager): Plug leak.
* src/plugin.c
(plugin_info_force_mark_inactive,
plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
(plugins_shutdown): Set all plugins on "marked for deactivation"
list as inactive before saving active plugins in configuration.
* src/plugin.h:
(plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
2001-03-05 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c
......@@ -1695,7 +1726,7 @@
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
Update row heights after pasting a region. Fixes #38176.
Update row heights after pasting a region.
2001-01-23 Morten Welinder <terra@diku.dk>
......
2001-03-05 Zbigniew Chyla <cyba@gnome.pl>
Fixes #51316 (actually, it fixes the _real_ problem).
* src/dialogs/dialog-plugin-manager.c
(cb_pm_button_activate_plugin_clicked): If the plugin is already
active, remove it from "marked for deactivation" list.
(cb_pm_button_deactivate_plugin_clicked): If the plugin cannot be
deactivated, optionally add it to "marked for deactivation" list
(if the user wants to).
(cb_pm_clist_row_selected):
Make "Activate plugin" button sensitive for some active plugins (for
those on "marked for deactivation" list).
(cb_pm_clist_row_unselected):
Bugfix: don't free pm_gui->current_plugin_id string.
(update_plugin_manager_view):
Display the plugin state after its name ("in memory", "marked for
deactivation").
(dialog_plugin_manager): Plug leak.
* src/plugin.c
(plugin_info_force_mark_inactive,
plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
(plugins_shutdown): Set all plugins on "marked for deactivation"
list as inactive before saving active plugins in configuration.
* src/plugin.h:
(plugin_db_mark_plugin_for_deactivation,
plugin_db_is_plugin_marked_for_deactivation): New functions.
2001-03-05 Almer S. Tigelaar <almer@gnome.org>
* src/sheet-control-gui.c
......@@ -1695,7 +1726,7 @@
2001-01-24 Almer S. Tigelaar <almer1@dds.nl>
* src/clipboard.c (clipboard_paste_region):
Update row heights after pasting a region. Fixes #38176.
Update row heights after pasting a region.
2001-01-23 Morten Welinder <terra@diku.dk>
......
......@@ -201,6 +201,11 @@ cb_pm_button_activate_plugin_clicked (GtkButton *button, PluginManagerGUI *pm_gu
g_return_if_fail (pm_gui->current_plugin_id != NULL);
pinfo = plugin_db_get_plugin_info_by_plugin_id (pm_gui->current_plugin_id);
if (plugin_info_is_active (pinfo)) {
plugin_db_mark_plugin_for_deactivation (pinfo, FALSE);
update_plugin_manager_view (pm_gui);
return;
}
loader_type_str = plugin_info_peek_loader_type_str (pinfo);
if (plugin_loader_is_available_by_id (loader_type_str)) {
loader_available = TRUE;
......@@ -299,7 +304,21 @@ cb_pm_button_deactivate_plugin_clicked (GtkButton *button, PluginManagerGUI *pm_
update_plugin_manager_view (pm_gui);
}
} else {
gnumeric_error_plugin (COMMAND_CONTEXT (pm_gui->wbcg), _("Plugin is still in use."));
if (plugin_db_is_plugin_marked_for_deactivation (pinfo)) {
gnumeric_error_plugin (COMMAND_CONTEXT (pm_gui->wbcg), _("Plugin is still in use."));
} else {
gboolean mark_for_deactivation;
mark_for_deactivation = gnumeric_dialog_question_yes_no (
pm_gui->wbcg,
_("Plugin cannot be deactivated because it's still in use.\n"
"Do you want to mark it for deactivation such that it will be inactive after restarting Gnumeric?"),
FALSE);
if (mark_for_deactivation) {
plugin_db_mark_plugin_for_deactivation (pinfo, TRUE);
update_plugin_manager_view (pm_gui);
}
}
}
}
......@@ -362,15 +381,27 @@ cb_pm_checkbutton_install_new_toggled (GtkCheckButton *checkbutton, PluginManage
static void
cb_pm_clist_row_selected (GtkCList *clist, gint row_no, gint col_no, gpointer unused, PluginManagerGUI *pm_gui)
{
PluginInfo *pinfo;
g_return_if_fail (pm_gui != NULL);
g_free (pm_gui->current_plugin_id);
pm_gui->current_plugin_id = g_strdup (gtk_clist_get_row_data (clist, row_no));
pinfo = plugin_db_get_plugin_info_by_plugin_id (pm_gui->current_plugin_id);
g_return_if_fail (pinfo != NULL);
if (clist == pm_gui->clist_active) {
gtk_clist_unselect_all (pm_gui->clist_inactive);
if (plugin_db_is_plugin_marked_for_deactivation (pinfo)) {
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_activate_plugin), TRUE);
} else {
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_activate_plugin), FALSE);
}
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_deactivate_plugin), TRUE);
} else {
gtk_clist_unselect_all (pm_gui->clist_active);
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_activate_plugin), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_deactivate_plugin), FALSE);
}
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_activate_plugin), clist == pm_gui->clist_inactive);
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_deactivate_plugin), clist == pm_gui->clist_active);
g_free (pm_gui->current_plugin_id);
pm_gui->current_plugin_id = g_strdup (gtk_clist_get_row_data (clist, row_no));
update_plugin_details_view (pm_gui);
}
......@@ -379,8 +410,6 @@ cb_pm_clist_row_unselected (GtkCList *clist, gint row_no, gint col_no, gpointer
{
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_activate_plugin), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (pm_gui->button_deactivate_plugin), FALSE);
g_free (pm_gui->current_plugin_id);
pm_gui->current_plugin_id = NULL;
update_plugin_details_view (pm_gui);
}
......@@ -453,13 +482,29 @@ update_plugin_manager_view (PluginManagerGUI *pm_gui)
pinfo = (PluginInfo *) l->data;
if (plugin_info_is_active (pinfo)) {
gboolean is_in_mem, is_marked;
clist = pm_gui->clist_active;
n_active_plugins++;
is_in_mem = plugin_info_is_loaded (pinfo);
is_marked = plugin_db_is_plugin_marked_for_deactivation (pinfo);
if (is_in_mem && is_marked) {
cols[0] = g_strdup_printf (_("%s [in memory, marked for deactivation]"),
plugin_info_peek_name (pinfo));
} else if (is_in_mem) {
cols[0] = g_strdup_printf (_("%s [in memory]"),
plugin_info_peek_name (pinfo));
} else if (is_marked) {
cols[0] = g_strdup_printf (_("%s [marked for deactivation]"),
plugin_info_peek_name (pinfo));
} else {
cols[0] = plugin_info_get_name (pinfo);
}
} else {
clist = pm_gui->clist_inactive;
n_inactive_plugins++;
cols[0] = plugin_info_get_name (pinfo);
}
cols[0] = plugin_info_get_name (pinfo);
row_no = gtk_clist_append (clist, cols);
plugin_id = plugin_info_get_id (pinfo);
gtk_clist_set_row_data_full (clist, row_no, plugin_id, &free_plugin_id);
......@@ -607,6 +652,7 @@ dialog_plugin_manager (WorkbookControlGUI *wbcg)
gnome_config_sync ();
g_free (pm_gui->current_plugin_id);
g_free (pm_gui);
gtk_object_unref (GTK_OBJECT (gui));
}
......@@ -70,6 +70,8 @@ struct _PluginLoaderTypeInfo {
gpointer get_type_callback_data;
};
static GList *plugins_marked_for_deactivation = NULL;
static GList *known_plugin_id_list = NULL;
static gboolean known_plugin_id_list_is_ready = FALSE;
......@@ -681,6 +683,14 @@ plugin_can_deactivate (PluginInfo *pinfo)
return TRUE;
}
static void
plugin_info_force_mark_inactive (PluginInfo *pinfo)
{
g_return_if_fail (pinfo != NULL);
pinfo->is_active = FALSE;
}
void
plugin_load_service (PluginInfo *pinfo, PluginService *service, ErrorInfo **ret_error)
{
......@@ -1211,6 +1221,21 @@ plugin_db_is_saved_active_plugin (const gchar *plugin_id)
return FALSE;
}
void
plugin_db_mark_plugin_for_deactivation (PluginInfo *pinfo, gboolean mark)
{
plugins_marked_for_deactivation = g_list_remove (plugins_marked_for_deactivation, pinfo);
if (mark) {
plugins_marked_for_deactivation = g_list_prepend (plugins_marked_for_deactivation, pinfo);
}
}
gboolean
plugin_db_is_plugin_marked_for_deactivation (PluginInfo *pinfo)
{
return g_list_find (plugins_marked_for_deactivation, pinfo) != NULL;
}
/*
* May return errors for some plugins.
*/
......@@ -1327,8 +1352,12 @@ plugins_init (CommandContext *context)
void
plugins_shutdown (void)
{
GList *l;
ErrorInfo *ignored_error;
for (l = plugins_marked_for_deactivation; l != NULL; l = l->next) {
plugin_info_force_mark_inactive ((PluginInfo *) l->data);
}
plugin_db_update_saved_active_plugin_id_list ();
plugin_db_shutdown (&ignored_error);
error_info_free (ignored_error);
......
......@@ -56,7 +56,8 @@ void plugin_db_shutdown (ErrorInfo **ret_error);
void plugin_db_activate_saved_active_plugins (ErrorInfo **ret_error);
void plugin_db_activate_plugin_list (GList *plugins, ErrorInfo **ret_error);
void plugin_db_deactivate_plugin_list (GList *plugins, ErrorInfo **ret_error);
void plugin_db_mark_plugin_for_deactivation (PluginInfo *pinfo, gboolean mark);
gboolean plugin_db_is_plugin_marked_for_deactivation (PluginInfo *pinfo);
/*
* For all plugin_info_get_* functions below you should free returned data after use
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment