Branch: refs/heads/master Author: Nick Treleaven nick.treleaven@btinternet.com Committer: Nick Treleaven nick.treleaven@btinternet.com Date: Fri, 23 Nov 2012 15:36:58 UTC Commit: 3949cf730435c023215f8b8757144b6fb369a367 https://github.com/geany/geany/commit/3949cf730435c023215f8b8757144b6fb369a3...
Log Message: ----------- Remove 'Open file in a new tab' save as option
Modified Paths: -------------- src/dialogs.c
Modified: src/dialogs.c 68 files changed, 13 insertions(+), 55 deletions(-) =================================================================== @@ -74,10 +74,6 @@ enum gboolean show_hidden; gboolean more_options_visible; } open; - struct - { - gboolean open_in_new_tab; - } save; } filesel_state = { { @@ -86,9 +82,6 @@ enum 0, FALSE, FALSE - }, - { - FALSE } };
@@ -487,40 +480,26 @@ void dialogs_show_open_file(void) }
-static void on_save_as_new_tab_toggled(GtkToggleButton *togglebutton, gpointer user_data) -{ - gtk_widget_set_sensitive(GTK_WIDGET(user_data), ! gtk_toggle_button_get_active(togglebutton)); -} - - -static gboolean handle_save_as(const gchar *utf8_filename, gboolean open_new_tab, gboolean rename_file) +static gboolean handle_save_as(const gchar *utf8_filename, gboolean rename_file) { GeanyDocument *doc = document_get_current(); gboolean success = FALSE;
g_return_val_if_fail(NZV(utf8_filename), FALSE);
- if (open_new_tab) - { /* "open" the saved file in a new tab and switch to it */ - doc = document_clone(doc, utf8_filename); - success = document_save_file_as(doc, NULL); - } - else + if (doc->file_name != NULL) { - if (doc->file_name != NULL) + if (rename_file) { - if (rename_file) - { - document_rename_file(doc, utf8_filename); - } - /* create a new tm_source_file object otherwise tagmanager won't work correctly */ - tm_workspace_remove_object(doc->tm_file, TRUE, TRUE); - doc->tm_file = NULL; + document_rename_file(doc, utf8_filename); } - success = document_save_file_as(doc, utf8_filename); - - build_menu_update(doc); + /* create a new tm_source_file object otherwise tagmanager won't work correctly */ + tm_workspace_remove_object(doc->tm_file, TRUE, TRUE); + doc->tm_file = NULL; } + success = document_save_file_as(doc, utf8_filename); + + build_menu_update(doc); return success; }
@@ -549,16 +528,10 @@ static gboolean save_as_dialog_handle_response(GtkWidget *dialog, gint response) /* fall through */ case GTK_RESPONSE_ACCEPT: { - gboolean open_new_tab = gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON(ui_lookup_widget(dialog, "check_open_new_tab"))); gchar *utf8_filename;
utf8_filename = utils_get_utf8_from_locale(new_filename); - success = handle_save_as(utf8_filename, open_new_tab, rename_file); - - if (success) - filesel_state.save.open_in_new_tab = open_new_tab; - + success = handle_save_as(utf8_filename, rename_file); g_free(utf8_filename); break; } @@ -575,7 +548,7 @@ static gboolean save_as_dialog_handle_response(GtkWidget *dialog, gint response)
static GtkWidget *create_save_file_dialog(void) { - GtkWidget *dialog, *vbox, *check_open_new_tab, *rename_btn; + GtkWidget *dialog, *rename_btn; const gchar *initdir;
dialog = gtk_file_chooser_dialog_new(_("Save File"), GTK_WINDOW(main_widgets.window), @@ -595,15 +568,6 @@ static GtkWidget *create_save_file_dialog(void) GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
- vbox = gtk_vbox_new(FALSE, 0); - check_open_new_tab = gtk_check_button_new_with_mnemonic(_("_Open file in a new tab")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_open_new_tab), filesel_state.save.open_in_new_tab); - gtk_widget_set_tooltip_text(check_open_new_tab, - _("Keep the current unsaved document open" - " and open the newly saved file in a new tab")); - gtk_box_pack_start(GTK_BOX(vbox), check_open_new_tab, FALSE, FALSE, 0); - gtk_widget_show_all(vbox); - gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), vbox); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE);
@@ -615,12 +579,6 @@ static GtkWidget *create_save_file_dialog(void) gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), linitdir); g_free(linitdir); } - - g_signal_connect(check_open_new_tab, "toggled", - G_CALLBACK(on_save_as_new_tab_toggled), rename_btn); - - ui_hookup_widget(dialog, check_open_new_tab, "check_open_new_tab"); - return dialog; }
@@ -706,7 +664,7 @@ gboolean dialogs_show_save_as() gchar *utf8_name = win32_show_document_save_as_dialog(GTK_WINDOW(main_widgets.window), _("Save File"), DOC_FILENAME(doc)); if (utf8_name != NULL) - result = handle_save_as(utf8_name, FALSE, FALSE); + result = handle_save_as(utf8_name, FALSE); } else #endif
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).