From 01127d7e0a92e5db071cdeca1d4c9610e7af7537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sat, 26 Aug 2006 16:44:08 +0000 Subject: [PATCH] Fixed weird behaviour of Save all tool button and menu item. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@763 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 8 +++++++- src/geany.h | 2 +- src/main.c | 2 ++ src/utils.c | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a82dcfa2..2834bab0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,14 @@ +2006-08-26 Enrico Tröger + + * src/geany.h, src/main.c, src/utils.c: + Fixed weird behaviour of Save all tool button and menu item. + + 2006-08-23 Enrico Tröger * src/prefs.c, src/vte.c: Added new VTE settings to the preferences dialog. - Improved ignore menu bar accelerator settings. + Improved ignore menu bar accelerator setting. Keep current working directory when restarting the VTE (happens when hitting Ctrl+C). * src/document.c: Added counter when using "Replace All" and display diff --git a/src/geany.h b/src/geany.h index 001762e0..77424f9b 100644 --- a/src/geany.h +++ b/src/geany.h @@ -163,7 +163,7 @@ typedef struct MyApp GtkWidget *menu_copy_items[5]; GtkWidget *redo_items[3]; GtkWidget *undo_items[3]; - GtkWidget *save_buttons[2]; + GtkWidget *save_buttons[4]; GtkWidget *sensitive_buttons[37]; GtkWidget *open_colorsel; GtkWidget *open_fontsel; diff --git a/src/main.c b/src/main.c index a409f409..ea074643 100644 --- a/src/main.c +++ b/src/main.c @@ -262,6 +262,8 @@ static void main_init(void) app->menu_insert_include_item[1] = lookup_widget(app->window, "insert_include2"); app->save_buttons[0] = lookup_widget(app->window, "menu_save1"); app->save_buttons[1] = lookup_widget(app->window, "toolbutton10"); + app->save_buttons[2] = lookup_widget(app->window, "menu_save_all1"); + app->save_buttons[3] = lookup_widget(app->window, "toolbutton22"); app->sensitive_buttons[0] = lookup_widget(app->window, "menu_close1"); app->sensitive_buttons[1] = lookup_widget(app->window, "toolbutton15"); app->sensitive_buttons[2] = lookup_widget(app->window, "menu_change_font1"); diff --git a/src/utils.c b/src/utils.c index 65e7d6e5..7abc1c7c 100644 --- a/src/utils.c +++ b/src/utils.c @@ -248,8 +248,23 @@ void utils_update_popup_goto_items(gboolean enable) void utils_save_buttons_toggle(gboolean enable) { + guint i; + guint dirty_tabs = 0; + gtk_widget_set_sensitive(app->save_buttons[0], enable); gtk_widget_set_sensitive(app->save_buttons[1], enable); + + // save all menu item and tool button + for (i = 0; i < gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)); i++) + { + // count the amount of tabs where changes were made and if they are more than one, + // we need the save all button / item + if (doc_list[i].is_valid && doc_list[i].changed) + dirty_tabs++; + } + + gtk_widget_set_sensitive(app->save_buttons[2], (dirty_tabs > 1) ? TRUE : FALSE); + gtk_widget_set_sensitive(app->save_buttons[3], (dirty_tabs > 1) ? TRUE : FALSE); }