diff --git a/ChangeLog b/ChangeLog index 4329a543c..318f67e07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-22 Enrico Troeger + + * src/keybindings.c, src/utils.c: improved toggle visibility of + sidebar when toggled by keyboard + + 2006-05-21 Enrico Troeger * src/keybindings.c: added menu_messagewindow and toggle_sidebar diff --git a/src/keybindings.c b/src/keybindings.c index dab1376a5..221467467 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -484,10 +484,28 @@ static void cb_func_switch_tabright(void) static void cb_func_toggle_sidebar(void) { - app->treeview_symbol_visible = ! app->treeview_symbol_visible; - app->treeview_openfiles_visible = ! app->treeview_openfiles_visible; + static gboolean symbol = FALSE; + static gboolean openfiles = FALSE; + static gboolean is_visible = FALSE; - utils_treeviews_showhide();; + /* this code is a bit confusing, but I want to keep the settings in the preferences dialog + * synchronous with the real status of the sidebar, so we have to store the previous state when + * hiding the sidebar to restore it correctly */ + is_visible = (app->treeview_symbol_visible || app->treeview_openfiles_visible) ? TRUE : FALSE; + if (is_visible) + { + symbol = app->treeview_symbol_visible; + openfiles = app->treeview_openfiles_visible; + app->treeview_symbol_visible = FALSE; + app->treeview_openfiles_visible = FALSE; + } + else + { + app->treeview_symbol_visible = symbol; + app->treeview_openfiles_visible = openfiles; + } + + utils_treeviews_showhide(); } static void cb_func_edit_duplicateline(void) diff --git a/src/utils.c b/src/utils.c index 61f1b49f2..645e11e11 100644 --- a/src/utils.c +++ b/src/utils.c @@ -649,7 +649,7 @@ void utils_update_tag_list(gint idx, gboolean update) } // make all inactive, because there is no more tab left, or something strange occured - if (idx == -1 || ! app->treeview_symbol_visible || ! doc_list[idx].file_type->has_tags) + if (idx == -1 || ! doc_list[idx].file_type->has_tags) { gtk_widget_set_sensitive(app->tagbar, FALSE); gtk_container_add(GTK_CONTAINER(app->tagbar), app->default_tag_tree);