Revision: 2176 http://geany.svn.sourceforge.net/geany/?rev=2176&view=rev Author: eht16 Date: 2008-01-16 08:30:34 -0800 (Wed, 16 Jan 2008)
Log Message: ----------- Add option for project session files support.
Modified Paths: -------------- trunk/ChangeLog trunk/geany.glade trunk/src/interface.c trunk/src/keyfile.c trunk/src/prefs.c trunk/src/project.c trunk/src/project.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/ChangeLog 2008-01-16 16:30:34 UTC (rev 2176) @@ -1,3 +1,10 @@ +2008-01-16 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * geany.glade, src/interface.c, src/keyfile.c, src/prefs.c, + src/project.c, src/project.h: + Add option for project session files support. + + 2008-01-16 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/editor.c:
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/geany.glade 2008-01-16 16:30:34 UTC (rev 2176) @@ -3184,6 +3184,25 @@ </child>
<child> + <widget class="GtkCheckButton" id="check_project_session"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Whether to store project session files and open them when re-opening the project.</property> + <property name="label" translatable="yes">Load and save session files when open and close a project</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">False</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkCheckButton" id="check_vte"> <property name="tooltip" translatable="yes">Whether the virtual terminal emulation (VTE) should be loaded at startup. Disable it if you do not need it.</property> <property name="can_focus">True</property>
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/src/interface.c 2008-01-16 16:30:34 UTC (rev 2176) @@ -2477,6 +2477,7 @@ GtkWidget *alignment13; GtkWidget *vbox4; GtkWidget *check_load_session; + GtkWidget *check_project_session; GtkWidget *check_vte; GtkWidget *check_plugins; GtkWidget *check_save_win_pos; @@ -2811,6 +2812,13 @@ gtk_tooltips_set_tip (tooltips, check_load_session, _("Opens at startup the files from the last session"), NULL); gtk_button_set_focus_on_click (GTK_BUTTON (check_load_session), FALSE);
+ check_project_session = gtk_check_button_new_with_mnemonic (_("Load and save session files when open and close a project")); + gtk_widget_show (check_project_session); + gtk_box_pack_start (GTK_BOX (vbox4), check_project_session, FALSE, FALSE, 0); + GTK_WIDGET_UNSET_FLAGS (check_project_session, GTK_CAN_FOCUS); + gtk_tooltips_set_tip (tooltips, check_project_session, _("Whether to store project session files and open them when re-opening the project."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_project_session), FALSE); + check_vte = gtk_check_button_new_with_mnemonic (_("Load virtual terminal support")); gtk_box_pack_start (GTK_BOX (vbox4), check_vte, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, check_vte, _("Whether the virtual terminal emulation (VTE) should be loaded at startup. Disable it if you do not need it."), NULL); @@ -4417,6 +4425,7 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, alignment13, "alignment13"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox4, "vbox4"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_load_session, "check_load_session"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_project_session, "check_project_session"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_vte, "check_vte"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_plugins, "check_plugins"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_save_win_pos, "check_save_win_pos");
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/src/keyfile.c 2008-01-16 16:30:34 UTC (rev 2176) @@ -175,6 +175,7 @@
// general g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", prefs.load_session); + g_key_file_set_boolean(config, PACKAGE, "pref_main_project_session", project_prefs.project_session); g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", prefs.save_winpos); g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", prefs.confirm_exit); g_key_file_set_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", prefs.suppress_search_dialogs); @@ -471,6 +472,7 @@ prefs.suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE); prefs.suppress_status_messages = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_status_messages", FALSE); prefs.load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE); + project_prefs.project_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_project_session", TRUE); prefs.save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE); prefs.beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE); prefs.switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/src/prefs.c 2008-01-16 16:30:34 UTC (rev 2176) @@ -164,6 +164,9 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_load_session"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_session);
+ widget = lookup_widget(ui_widgets.prefs_dialog, "check_project_session"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), project_prefs.project_session); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_save_win_pos"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.save_winpos);
@@ -563,6 +566,9 @@ widget = lookup_widget(ui_widgets.prefs_dialog, "check_load_session"); prefs.load_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = lookup_widget(ui_widgets.prefs_dialog, "check_project_session"); + project_prefs.project_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(ui_widgets.prefs_dialog, "check_save_win_pos"); prefs.save_winpos = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
Modified: trunk/src/project.c =================================================================== --- trunk/src/project.c 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/src/project.c 2008-01-16 16:30:34 UTC (rev 2176) @@ -46,7 +46,7 @@ #include "geanyobject.h"
-ProjectPrefs project_prefs = {NULL}; +ProjectPrefs project_prefs = { NULL, 0 };
static struct { @@ -212,7 +212,8 @@ goto retry; } g_free(filename); - configuration_open_files(); + if (project_prefs.project_session) + configuration_open_files(); } } #endif @@ -239,7 +240,8 @@ { SHOW_ERR1(_("Project file "%s" could not be loaded."), file); } - configuration_open_files(); + if (project_prefs.project_session) + configuration_open_files(); g_free(file); } #else @@ -312,18 +314,21 @@ g_free(app->project); app->project = NULL;
- // close all existing tabs first - for (i = 0; i < max; i++) + if (project_prefs.project_session) { - if (! document_remove(0)) - break; - } + // close all existing tabs first + for (i = 0; i < max; i++) + { + if (! document_remove(0)) + break; + }
- // after closing all tabs let's open the tabs found in the default config - if (open_default == TRUE && cl_options.load_session) - { - configuration_reload_default_session(); - configuration_open_files(); + // after closing all tabs let's open the tabs found in the default config + if (open_default == TRUE && cl_options.load_session) + { + configuration_reload_default_session(); + configuration_open_files(); + } }
if (geany_object) @@ -884,12 +889,14 @@ p->run_cmd = utils_get_setting_string(config, "project", "run_cmd", ""); p->file_patterns = g_key_file_get_string_list(config, "project", "file_patterns", NULL, NULL);
- // save current (non-project) session (it could has been changed since program startup) - configuration_save_default_session(); + if (project_prefs.project_session) + { + // save current (non-project) session (it could has been changed since program startup) + configuration_save_default_session(); + // read session files so they can be opened with configuration_open_files() + configuration_load_session_files(config); + }
- // read session files so they can be opened with configuration_open_files() - configuration_load_session_files(config); - if (geany_object) { g_signal_emit_by_name(geany_object, "project-open", config); @@ -936,8 +943,8 @@ (const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
// store the session files into the project too - /// TODO maybe it is useful to store relative file names if base_path is relative - configuration_save_session_files(config); + if (project_prefs.project_session) + configuration_save_session_files(config);
if (geany_object && emit_signal) {
Modified: trunk/src/project.h =================================================================== --- trunk/src/project.h 2008-01-16 13:07:04 UTC (rev 2175) +++ trunk/src/project.h 2008-01-16 16:30:34 UTC (rev 2176) @@ -48,6 +48,7 @@ typedef struct { gchar *session_file; + gboolean project_session; } ProjectPrefs;
extern ProjectPrefs project_prefs;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.