[geany/geany-plugins] 9e480a: workbench: save settings immediately
LarsGit223
git-noreply at xxxxx
Mon May 20 17:20:12 UTC 2019
Branch: refs/heads/master
Author: LarsGit223 <lars_paulsen at web.de>
Committer: LarsGit223 <lars_paulsen at web.de>
Date: Mon, 20 May 2019 17:20:12 UTC
Commit: 9e480a3b88f95a61fbef1e951efc426ccd4a9bb2
https://github.com/geany/geany-plugins/commit/9e480a3b88f95a61fbef1e951efc426ccd4a9bb2
Log Message:
-----------
workbench: save settings immediately
After confirming changed settings with "OK" they will now immediately
be written back to the workbench file. Therefore the menu item
"Workbench / Save" became useless and has been removed. Closes #841.
Modified Paths:
--------------
workbench/README
workbench/src/menu.c
workbench/src/plugin_main.c
Modified: workbench/README
8 lines changed, 3 insertions(+), 5 deletions(-)
===================================================================
@@ -35,12 +35,10 @@ menu:
As explained above, creates a new Workbench.
**Item "Open"**
Open a Workbench.
-**Item "Save"**
- Save the opened Workbench. This "only" saves any changes
- in the Workbench file. It does not save any changes of the projects
- belonging to the Workbench.
**Item "Settings"**
- Open the Workbench settings dialog.
+ Open the Workbench settings dialog. After the settings have been
+ confirmed with "OK" they will be written back to the workbench file
+ (if any value was changed).
**Item "Close"**
Closes the opened Workbench.
Modified: workbench/src/menu.c
35 lines changed, 9 insertions(+), 26 deletions(-)
===================================================================
@@ -36,7 +36,6 @@ typedef struct
GtkWidget *root_item;
GtkWidget *item_new;
GtkWidget *item_open;
- GtkWidget *item_save;
GtkWidget *item_settings;
GtkWidget *item_close;
}WB_MENU_DATA;
@@ -58,14 +57,12 @@ void menu_set_context(MENU_CONTEXT context)
case MENU_CONTEXT_WB_OPENED:
gtk_widget_set_sensitive(menu_data.item_new, FALSE);
gtk_widget_set_sensitive(menu_data.item_open, FALSE);
- gtk_widget_set_sensitive(menu_data.item_save, TRUE);
gtk_widget_set_sensitive(menu_data.item_settings, TRUE);
gtk_widget_set_sensitive(menu_data.item_close, TRUE);
break;
case MENU_CONTEXT_WB_CLOSED:
gtk_widget_set_sensitive(menu_data.item_new, TRUE);
gtk_widget_set_sensitive(menu_data.item_open, TRUE);
- gtk_widget_set_sensitive(menu_data.item_save, FALSE);
gtk_widget_set_sensitive(menu_data.item_settings, FALSE);
gtk_widget_set_sensitive(menu_data.item_close, FALSE);
break;
@@ -127,22 +124,6 @@ static void item_open_workbench_activate_cb(G_GNUC_UNUSED GtkMenuItem *menuitem,
}
-/* The function handles the menu item "Save workbench" */
-static void item_save_workbench_activate_cb(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
-{
- GError *error = NULL;
-
- if (wb_globals.opened_wb != NULL)
- {
- if (!workbench_save(wb_globals.opened_wb, &error))
- {
- dialogs_show_msgbox(GTK_MESSAGE_INFO, _("Could not save workbench file: %s"), error->message);
- }
- sidebar_update(SIDEBAR_CONTEXT_WB_SAVED, NULL);
- }
-}
-
-
/* The function handles the menu item "Settings" */
static void item_workbench_settings_activate_cb(G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
{
@@ -153,8 +134,17 @@ static void item_workbench_settings_activate_cb(G_GNUC_UNUSED GtkMenuItem *menui
enable_live_update_old = workbench_get_enable_live_update(wb_globals.opened_wb);
if (dialogs_workbench_settings(wb_globals.opened_wb))
{
+ GError *error = NULL;
+
sidebar_update(SIDEBAR_CONTEXT_WB_SETTINGS_CHANGED, NULL);
+ /* Save the new settings to the workbench file (.geanywb). */
+ if (!workbench_save(wb_globals.opened_wb, &error))
+ {
+ dialogs_show_msgbox(GTK_MESSAGE_INFO, _("Could not save workbench file: %s"), error->message);
+ }
+ sidebar_update(SIDEBAR_CONTEXT_WB_SAVED, NULL);
+
enable_live_update = workbench_get_enable_live_update(wb_globals.opened_wb);
if (enable_live_update != enable_live_update_old)
{
@@ -209,13 +199,6 @@ gboolean menu_init(void)
g_signal_connect(menu_data.item_open, "activate",
G_CALLBACK(item_open_workbench_activate_cb), NULL);
- /* Create new menu item "Save Workbench" */
- menu_data.item_save = gtk_menu_item_new_with_mnemonic(_("_Save"));
- gtk_widget_show(menu_data.item_save);
- gtk_menu_shell_append(GTK_MENU_SHELL (menu_data.menu), menu_data.item_save);
- g_signal_connect(menu_data.item_save, "activate",
- G_CALLBACK(item_save_workbench_activate_cb), NULL);
-
/* Create new menu item "Workbench Settings" */
menu_data.item_settings = gtk_menu_item_new_with_mnemonic(_("S_ettings"));
gtk_widget_show(menu_data.item_settings);
Modified: workbench/src/plugin_main.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -130,7 +130,7 @@ void geany_load_module(GeanyPlugin *plugin)
/* Set metadata */
plugin->info->name = _("Workbench");
plugin->info->description = _("Manage and customize multiple projects.");
- plugin->info->version = "1.05";
+ plugin->info->version = "1.06";
plugin->info->author = "LarsGit223";
/* Set functions */
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list