Revision: 3739 http://geany.svn.sourceforge.net/geany/?rev=3739&view=rev Author: eht16 Date: 2009-04-27 19:30:29 +0000 (Mon, 27 Apr 2009)
Log Message: ----------- Remember the active sidebar page between sessions.
Modified Paths: -------------- trunk/ChangeLog trunk/src/callbacks.c trunk/src/keyfile.c trunk/src/main.c trunk/src/ui_utils.c trunk/src/ui_utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-04-27 19:29:33 UTC (rev 3738) +++ trunk/ChangeLog 2009-04-27 19:30:29 UTC (rev 3739) @@ -1,3 +1,10 @@ +2009-04-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/callbacks.c, src/keyfile.c, src/main.c, src/ui_utils.c, + src/ui_utils.h: + Remember the active sidebar page between sessions. + + 2009-04-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/symbols.c:
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2009-04-27 19:29:33 UTC (rev 3738) +++ trunk/src/callbacks.c 2009-04-27 19:30:29 UTC (rev 3739) @@ -1623,16 +1623,12 @@ on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem, gpointer user_data) { - static gint active_page = -1; + if (ignore_callback) + return;
- if (ignore_callback) return; - if (ui_prefs.sidebar_visible) - { - /* 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(main_widgets.sidebar_notebook)); - } + ui_prefs.sidebar_page = gtk_notebook_get_current_page( + GTK_NOTEBOOK(main_widgets.sidebar_notebook));
ui_prefs.sidebar_visible = ! ui_prefs.sidebar_visible;
@@ -1643,7 +1639,8 @@ }
ui_sidebar_show_hide(); - gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), active_page); + gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), + ui_prefs.sidebar_page); }
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2009-04-27 19:29:33 UTC (rev 3738) +++ trunk/src/keyfile.c 2009-04-27 19:30:29 UTC (rev 3739) @@ -447,7 +447,14 @@
static void save_ui_prefs(GKeyFile *config) { + /* If the sidebar is visible, retrieve the active page number. Otherwise it was already + * set on hiding the sidebar. */ + if (ui_prefs.sidebar_visible) + ui_prefs.sidebar_page = gtk_notebook_get_current_page( + GTK_NOTEBOOK(main_widgets.sidebar_notebook)); + g_key_file_set_boolean(config, PACKAGE, "sidebar_visible", ui_prefs.sidebar_visible); + g_key_file_set_integer(config, PACKAGE, "sidebar_page", ui_prefs.sidebar_page); g_key_file_set_boolean(config, PACKAGE, "statusbar_visible", interface_prefs.statusbar_visible); g_key_file_set_boolean(config, PACKAGE, "msgwindow_visible", ui_prefs.msgwindow_visible); g_key_file_set_boolean(config, PACKAGE, "fullscreen", ui_prefs.fullscreen); @@ -792,6 +799,7 @@ GError *error = NULL;
ui_prefs.sidebar_visible = utils_get_setting_boolean(config, PACKAGE, "sidebar_visible", TRUE); + ui_prefs.sidebar_page = utils_get_setting_integer(config, PACKAGE, "sidebar_page", 0); ui_prefs.msgwindow_visible = utils_get_setting_boolean(config, PACKAGE, "msgwindow_visible", TRUE); ui_prefs.fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE); ui_prefs.custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2009-04-27 19:29:33 UTC (rev 3738) +++ trunk/src/main.c 2009-04-27 19:30:29 UTC (rev 3739) @@ -191,6 +191,7 @@ ignore_callback = FALSE; } ui_sidebar_show_hide(); + /* sets the icon style of the toolbar */ switch (toolbar_prefs.icon_style) { @@ -1048,6 +1049,9 @@ plugins_load_active(); #endif
+ /* set the active sidebar page after plugins have been loaded */ + gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook), ui_prefs.sidebar_page); + /* load keybinding settings after plugins have added their groups */ keybindings_load_keyfile();
Modified: trunk/src/ui_utils.c =================================================================== --- trunk/src/ui_utils.c 2009-04-27 19:29:33 UTC (rev 3738) +++ trunk/src/ui_utils.c 2009-04-27 19:30:29 UTC (rev 3739) @@ -759,9 +759,9 @@ ui_widget_show_hide(main_widgets.sidebar_notebook, ui_prefs.sidebar_visible);
ui_widget_show_hide(gtk_notebook_get_nth_page( - GTK_NOTEBOOK(main_widgets.sidebar_notebook), 0), interface_prefs.sidebar_symbol_visible); + GTK_NOTEBOOK(main_widgets.sidebar_notebook), 0), interface_prefs.sidebar_symbol_visible); ui_widget_show_hide(gtk_notebook_get_nth_page( - GTK_NOTEBOOK(main_widgets.sidebar_notebook), 1), interface_prefs.sidebar_openfiles_visible); + GTK_NOTEBOOK(main_widgets.sidebar_notebook), 1), interface_prefs.sidebar_openfiles_visible); }
Modified: trunk/src/ui_utils.h =================================================================== --- trunk/src/ui_utils.h 2009-04-27 19:29:33 UTC (rev 3738) +++ trunk/src/ui_utils.h 2009-04-27 19:30:29 UTC (rev 3739) @@ -83,6 +83,7 @@ gint geometry[5]; /* 0:x, 1:y, 2:width, 3:height, flag for maximized state */ gboolean fullscreen; gboolean sidebar_visible; + gint sidebar_page; gboolean msgwindow_visible; gboolean allow_always_save; /* if set, files can always be saved, even if unchanged */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.