Kaydet (Commit) 0f061ee3 authored tarafından Enrico Tröger's avatar Enrico Tröger

Improved behaviour of toggle sidebar after a restart. Introduced new flag…

Improved behaviour of toggle sidebar after a restart. Introduced new flag sidebar_visible, renamed configuration keys.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@538 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 87dda1b7
2006-07-07 Enrico Tröger <enrico.troeger@uvena.de>
* src/prefs.c: Fixed bug when saving VTE settings.
* src/keybindings.c, src/utils.c, src/callbacks.c, src/geany.h,
src/prefs.c, src/keyfile.c:
Improved behaviour of toggle sidebar after a restart.
Introduced new flag sidebar_visible, renamed configuration keys.
2006-07-06 Nick Treleaven <nick.treleaven@btinternet.com>
......
......@@ -1513,14 +1513,13 @@ on_openfiles_tree_popup_clicked (GtkMenuItem *menuitem,
}
case 3:
{
app->treeview_openfiles_visible = FALSE;
app->sidebar_openfiles_visible = FALSE;
utils_treeviews_showhide();
break;
}
case 4:
{
app->treeview_openfiles_visible = FALSE;
app->treeview_symbol_visible = FALSE;
app->sidebar_visible = FALSE;
utils_treeviews_showhide();
break;
}
......@@ -1538,14 +1537,13 @@ on_taglist_tree_popup_clicked (GtkMenuItem *menuitem,
{
case 0:
{
app->treeview_symbol_visible = FALSE;
app->sidebar_symbol_visible = FALSE;
utils_treeviews_showhide();
break;
}
case 1:
{
app->treeview_openfiles_visible = FALSE;
app->treeview_symbol_visible = FALSE;
app->sidebar_visible = FALSE;
utils_treeviews_showhide();
break;
}
......
......@@ -132,8 +132,9 @@ typedef struct MyApp
gboolean quitting;
gboolean ignore_global_tags;
gboolean toolbar_visible;
gboolean treeview_symbol_visible;
gboolean treeview_openfiles_visible;
gboolean sidebar_symbol_visible;
gboolean sidebar_openfiles_visible;
gboolean sidebar_visible;
gboolean msgwindow_visible;
gboolean fullscreen;
gboolean beep_on_errors;
......
......@@ -650,29 +650,21 @@ static void cb_func_switch_tabright(void)
static void cb_func_toggle_sidebar(void)
{
static gboolean symbol = FALSE;
static gboolean openfiles = FALSE;
static gboolean is_visible = FALSE;
static gint active_page = -1;
/* 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)
if (app->sidebar_visible)
{
symbol = app->treeview_symbol_visible;
openfiles = app->treeview_openfiles_visible;
app->treeview_symbol_visible = FALSE;
app->treeview_openfiles_visible = FALSE;
// to remember the active page because GTK (e.g. 2.8.18) doesn't do it and shows always
// the last page (for unknown reason, with GTK 2.6.4 it works)
active_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->treeview_notebook));
}
else
app->sidebar_visible = ! app->sidebar_visible;
if ((! app->sidebar_openfiles_visible && ! app->sidebar_symbol_visible))
{
app->treeview_symbol_visible = symbol;
app->treeview_openfiles_visible = openfiles;
app->sidebar_openfiles_visible = TRUE;
app->sidebar_symbol_visible = TRUE;
}
utils_treeviews_showhide();
......
......@@ -85,8 +85,9 @@ void configuration_save(void)
g_key_file_set_integer(config, PACKAGE, "long_line_column", app->long_line_column);
g_key_file_set_string(config, PACKAGE, "long_line_color", app->long_line_color);
g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", app->beep_on_errors);
g_key_file_set_boolean(config, PACKAGE, "treeview_symbol_visible", app->treeview_symbol_visible);
g_key_file_set_boolean(config, PACKAGE, "treeview_openfiles_visible", app->treeview_openfiles_visible);
g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", app->sidebar_symbol_visible);
g_key_file_set_boolean(config, PACKAGE, "sidebar_openfiles_visible", app->sidebar_openfiles_visible);
g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", app->sidebar_visible);
g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", app->msgwindow_visible);
g_key_file_set_boolean(config, PACKAGE, "use_folding", app->pref_editor_folding);
g_key_file_set_boolean(config, PACKAGE, "use_auto_indention", app->pref_editor_use_auto_indention);
......@@ -235,8 +236,9 @@ gboolean configuration_load(void)
app->tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
app->tab_pos_msgwin = utils_get_setting_integer(config, PACKAGE, "tab_pos_msgwin",GTK_POS_LEFT);
app->tab_pos_sidebar = utils_get_setting_integer(config, PACKAGE, "tab_pos_sidebar", GTK_POS_TOP);
app->treeview_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "treeview_symbol_visible", TRUE);
app->treeview_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "treeview_openfiles_visible", TRUE);
app->sidebar_symbol_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_symbol_visible", TRUE);
app->sidebar_openfiles_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_openfiles_visible", TRUE);
app->sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE);
app->msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE);
app->pref_editor_folding = utils_get_setting_boolean(config, PACKAGE, "use_folding", TRUE);
app->pref_editor_use_indicators = utils_get_setting_boolean(config, PACKAGE, "use_indicators", TRUE);
......
......@@ -100,10 +100,10 @@ void prefs_init_dialog(void)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_main_show_goto);
widget = lookup_widget(app->prefs_dialog, "check_list_symbol");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->treeview_symbol_visible);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->sidebar_symbol_visible);
widget = lookup_widget(app->prefs_dialog, "check_list_openfiles");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->treeview_openfiles_visible);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->sidebar_openfiles_visible);
widget = lookup_widget(app->prefs_dialog, "tagbar_font");
gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), app->tagbar_font);
......@@ -348,10 +348,10 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
app->pref_main_show_goto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "check_list_symbol");
app->treeview_symbol_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
app->sidebar_symbol_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "check_list_openfiles");
app->treeview_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
app->sidebar_openfiles_visible = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
widget = lookup_widget(app->prefs_dialog, "radio_long_line_line");
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) app->long_line_type = 0;
......
......@@ -2176,16 +2176,21 @@ gint utils_get_int_from_hexcolor(const gchar *hex)
void utils_treeviews_showhide(void)
{
utils_widget_show_hide(gtk_notebook_get_nth_page(
GTK_NOTEBOOK(app->treeview_notebook), 0), app->treeview_symbol_visible);
utils_widget_show_hide(gtk_notebook_get_nth_page(
GTK_NOTEBOOK(app->treeview_notebook), 1), app->treeview_openfiles_visible);
// hide complete notebook if both pages are hidden
if ((! app->treeview_symbol_visible) && (! app->treeview_openfiles_visible))
// hide complete notebook
if (! app->sidebar_visible || (! app->sidebar_openfiles_visible && ! app->sidebar_symbol_visible))
{
if (app->sidebar_visible) app->sidebar_visible = FALSE;
gtk_widget_hide(app->treeview_notebook);
}
else
{
gtk_widget_show(app->treeview_notebook);
utils_widget_show_hide(gtk_notebook_get_nth_page(
GTK_NOTEBOOK(app->treeview_notebook), 0), app->sidebar_symbol_visible);
utils_widget_show_hide(gtk_notebook_get_nth_page(
GTK_NOTEBOOK(app->treeview_notebook), 1), app->sidebar_openfiles_visible);
}
}
......
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