On 09/11/2012 18:39, Nick Treleaven wrote: > On 05/11/2012 22:45, Lex Trotman wrote: >> I can't find the mail with the patch quickly so I havn't looked at it. > > I've attached a trailing-space stripped version of it (I had to convert > the line-endings CRLF -> LF for git, and my project prefs stripped the > spaces).
Rebased, no CRLF (why did it get these?), and with ASCII only chars for Colomban :-) -- Quentin “Sardem FF7” Glidic
>From 91a2e23ecfdbce2bf1a621b7f6e3e2d99cd57de9 Mon Sep 17 00:00:00 2001 From: Quentin Glidic <sardemff7+...@sardemff7.net> Date: Thu, 3 May 2012 13:22:49 +0200 Subject: [PATCH] More consistent behavior for open new tab / rename "Rename" is a button, so a conscious user action while "Open file in a new tab" is a checkbox, more like a setting. When a user wants to rename a file, she/he has to uncheck the box, which is annoying when the new tab behavior is wanted in all other cases There was also a little bug: the "Rename" button was not deactivated if the saved state of the box was checked, leading to a duplicated file when the user expected a rename Here, we consider the button as an action i.e. prevalent on the checkbox, which is considered as a setting Also, when a file is unsaved, we don't create a new tab for it --- src/dialogs.c | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/dialogs.c b/src/dialogs.c index d8071db..3aa2220 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -487,12 +487,6 @@ 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) { GeanyDocument *doc = document_get_current(); @@ -500,27 +494,24 @@ static gboolean handle_save_as(const gchar *utf8_filename, gboolean open_new_tab 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); + else 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); + } + /* 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; } @@ -616,9 +607,6 @@ static GtkWidget *create_save_file_dialog(void) 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; -- 1.8.0
_______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel