Revision: 4673 http://geany.svn.sourceforge.net/geany/?rev=4673&view=rev Author: statc Date: 2010-02-15 09:42:21 +0000 (Mon, 15 Feb 2010)
Log Message: ----------- Add a GUI preference to control whether the default session is loaded if any files are opened via command-line (fix #2838686). Location of the preference: General > Startup tab > Startup frame.
Modified Paths: -------------- branches/sm/ChangeLog branches/sm/geany.glade branches/sm/src/interface.c branches/sm/src/keyfile.c branches/sm/src/main.c branches/sm/src/prefs.c branches/sm/src/prefs.h
Modified: branches/sm/ChangeLog =================================================================== --- branches/sm/ChangeLog 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/ChangeLog 2010-02-15 09:42:21 UTC (rev 4673) @@ -5,6 +5,11 @@ projects' files are now stored as absolute. * src/main.c: Load files from command line even if a project is being opened. + * geany.glade, src/interface.c, src/keyfile.c, src/main.c, + src/prefs.c, src/prefs.h: + Add a GUI preference to control whether the default session is + loaded if any files are opened via command-line (fix #2838686). + Location of the preference: General > Startup tab > Startup frame.
2010-02-07 Eugene Arshinov <earshinov(at)gmail(dot)com>
Modified: branches/sm/geany.glade =================================================================== --- branches/sm/geany.glade 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/geany.glade 2010-02-15 09:42:21 UTC (rev 4673) @@ -2927,6 +2927,39 @@ </child>
<child> + <widget class="GtkAlignment" id="alignment46"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">1</property> + <property name="yscale">1</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">12</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkCheckButton" id="check_load_session_even_if_any_files_opened"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Even if any files are opened via command-line</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</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: branches/sm/src/interface.c =================================================================== --- branches/sm/src/interface.c 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/src/interface.c 2010-02-15 09:42:21 UTC (rev 4673) @@ -2338,6 +2338,8 @@ GtkWidget *alignment13; GtkWidget *vbox4; GtkWidget *check_load_session; + GtkWidget *alignment46; + GtkWidget *check_load_session_even_if_any_files_opened; GtkWidget *check_vte; GtkWidget *check_plugins; GtkWidget *label162; @@ -2751,6 +2753,15 @@ gtk_box_pack_start (GTK_BOX (vbox4), check_load_session, FALSE, FALSE, 0); gtk_tooltips_set_tip (tooltips, check_load_session, _("Opens at startup the files from the last session"), NULL);
+ alignment46 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_show (alignment46); + gtk_box_pack_start (GTK_BOX (vbox4), alignment46, TRUE, TRUE, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment46), 0, 0, 12, 0); + + check_load_session_even_if_any_files_opened = gtk_check_button_new_with_mnemonic (_("Even if any files are opened via command-line")); + gtk_widget_show (check_load_session_even_if_any_files_opened); + gtk_container_add (GTK_CONTAINER (alignment46), check_load_session_even_if_any_files_opened); + 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); @@ -4695,6 +4706,8 @@ 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, alignment46, "alignment46"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_load_session_even_if_any_files_opened, "check_load_session_even_if_any_files_opened"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_vte, "check_vte"); GLADE_HOOKUP_OBJECT (prefs_dialog, check_plugins, "check_plugins"); GLADE_HOOKUP_OBJECT (prefs_dialog, label162, "label162");
Modified: branches/sm/src/keyfile.c =================================================================== --- branches/sm/src/keyfile.c 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/src/keyfile.c 2010-02-15 09:42:21 UTC (rev 4673) @@ -339,6 +339,8 @@ g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", prefs.switch_to_status); g_key_file_set_boolean(config, PACKAGE, "beep_on_errors", prefs.beep_on_errors); g_key_file_set_boolean(config, PACKAGE, "auto_focus", prefs.auto_focus); + g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session_even_if_any_files_opened", + prefs.load_session_even_if_any_files_opened);
/* interface */ g_key_file_set_boolean(config, PACKAGE, "sidebar_symbol_visible", interface_prefs.sidebar_symbol_visible); @@ -631,6 +633,8 @@ prefs.beep_on_errors = utils_get_setting_boolean(config, PACKAGE, "beep_on_errors", TRUE); prefs.switch_to_status = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE); prefs.auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE); + prefs.load_session_even_if_any_files_opened = utils_get_setting_boolean(config, PACKAGE, + "pref_main_load_session_even_if_any_files_opened", FALSE);
/* interface */ interface_prefs.tab_pos_editor = utils_get_setting_integer(config, PACKAGE, "tab_pos_editor", GTK_POS_TOP);
Modified: branches/sm/src/main.c =================================================================== --- branches/sm/src/main.c 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/src/main.c 2010-02-15 09:42:21 UTC (rev 4673) @@ -894,6 +894,7 @@ gboolean load_default_session = TRUE; gboolean load_session = FALSE; gint files_argv_index = 0; + gboolean any_files_opened;
if (!prefs.load_session) { @@ -911,8 +912,8 @@ load_session = TRUE; }
- gboolean any_files_opened = open_cl_files(argc - files_argv_index, argv + files_argv_index); - if (any_files_opened) + any_files_opened = open_cl_files(argc - files_argv_index, argv + files_argv_index); + if (any_files_opened && !prefs.load_session_even_if_any_files_opened) load_default_session = FALSE;
if (!cl_options.load_session)
Modified: branches/sm/src/prefs.c =================================================================== --- branches/sm/src/prefs.c 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/src/prefs.c 2010-02-15 09:42:21 UTC (rev 4673) @@ -88,6 +88,7 @@ static void on_enable_plugins_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data); +static void on_load_session_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data);
@@ -346,6 +347,9 @@ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_session);
+ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session_even_if_any_files_opened"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), prefs.load_session_even_if_any_files_opened); + widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_project_session"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), project_prefs.project_session);
@@ -759,6 +763,9 @@ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session"); prefs.load_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+ widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session_even_if_any_files_opened"); + prefs.load_session_even_if_any_files_opened = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_project_session"); project_prefs.project_session = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1438,6 +1445,15 @@ }
+static void on_load_session_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean sens = gtk_toggle_button_get_active(togglebutton); + + gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, + "check_load_session_even_if_any_files_opened"), sens); +} + + static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data) { gboolean sens = gtk_toggle_button_get_active(togglebutton); @@ -1685,6 +1701,8 @@ "toggled", G_CALLBACK(on_use_folding_toggled), NULL); g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_open_encoding"), "toggled", G_CALLBACK(on_open_encoding_toggled), NULL); + g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "check_load_session"), + "toggled", G_CALLBACK(on_load_session_toggled), NULL);
g_signal_connect(ui_lookup_widget(ui_widgets.prefs_dialog, "button_help"), "button-press-event", G_CALLBACK(prefs_dialog_button_press_event_cb), NULL);
Modified: branches/sm/src/prefs.h =================================================================== --- branches/sm/src/prefs.h 2010-02-15 09:41:53 UTC (rev 4672) +++ branches/sm/src/prefs.h 2010-02-15 09:42:21 UTC (rev 4673) @@ -42,6 +42,8 @@ gboolean auto_focus; gchar *default_open_path; /**< Default path to look for files when no other path is appropriate. */ gchar *custom_plugin_path; + /** load default session even when files are being opened via command-line */ + gboolean load_session_even_if_any_files_opened; } GeanyPrefs;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.