Similar to applications like Firefox and Chromium. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1362
-- Commit Summary --
* Add "Close Documents to the Right" feature
-- File Changes --
M src/notebook.c (29)
-- Patch Links --
https://github.com/geany/geany/pull/1362.patch https://github.com/geany/geany/pull/1362.diff
b4n approved this pull request.
LGBI.
I'm not sure I see a use case for this, but looks good.
@@ -473,6 +496,12 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc)
g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_other_documents1_activate), doc); gtk_widget_set_sensitive(GTK_WIDGET(menu_item), (doc != NULL));
+ menu_item = ui_image_menu_item_new(GTK_STOCK_CLOSE, _("Close Documents to the _Right"));
beware: that'll likely be on the left on RTL locales. would be worth mentioning to the translators -- or not, because we ain't sure :)
codebrainz commented on this pull request.
@@ -473,6 +496,12 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc)
g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_other_documents1_activate), doc); gtk_widget_set_sensitive(GTK_WIDGET(menu_item), (doc != NULL));
+ menu_item = ui_image_menu_item_new(GTK_STOCK_CLOSE, _("Close Documents to the _Right"));
Yeah. Is there a way with gettext to transmit a note with the string, or just a normal comment? Also, does GtkNotebook handle the backwards indexing already when in RTL mode?
I'm not sure I see a use case for this
It's explained pretty well in the [Firefox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=866880) about adding it to that browser.
b4n commented on this pull request.
@@ -473,6 +496,12 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc)
g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_other_documents1_activate), doc); gtk_widget_set_sensitive(GTK_WIDGET(menu_item), (doc != NULL));
+ menu_item = ui_image_menu_item_new(GTK_STOCK_CLOSE, _("Close Documents to the _Right"));
I think putting a comment like `/* Translators: the direction is locale-dependent */` will be extracted (with the `translators` prefix). But you can check easily updating `geany.pot` and checking whether it appears there :) Maybe @frlan can tell you straight away for sure though.
b4n commented on this pull request.
@@ -473,6 +496,12 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc)
g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_other_documents1_activate), doc); gtk_widget_set_sensitive(GTK_WIDGET(menu_item), (doc != NULL));
+ menu_item = ui_image_menu_item_new(GTK_STOCK_CLOSE, _("Close Documents to the _Right"));
Valid remark from @elextr on IRC: as tabs can be put on the right, so stack vertically, it might be useful to say "below".
Another partly valid point that was raised is that it might be possible to change RTL/LTR without affecting the effective language of the UI. I don't think it's too important, but could be checked manually with `gtk_widget_get_direction()` and then providing the different possible strings (left/right/below -- let's not get crazy and imagine UI can be bottom-up…).
b4n commented on this pull request.
@@ -473,6 +496,12 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc)
g_signal_connect(menu_item, "activate", G_CALLBACK(on_close_other_documents1_activate), doc); gtk_widget_set_sensitive(GTK_WIDGET(menu_item), (doc != NULL));
+ menu_item = ui_image_menu_item_new(GTK_STOCK_CLOSE, _("Close Documents to the _Right"));
…and @elextr pointed out you edited your original comment, didn't see that.
What about #566?
There are [reports](https://www.bleepingcomputer.com/news/google/google-to-remove-chrome-close-o...) that Google plans to remove this from chrome.
@kugel- didn't notice it. I'd been using this feature all the time since I made the patch and completely forgot it wasn't merged :)
@elextr Not surprising, they remove all other useful features.
Merged in a40823084e1615e04464f974f616794a7b3570da, please raise new issues related to this.
Closed #1362.
b4n commented on this pull request.
- gint doc_page = document_get_notebook_page(doc);
+ return total_pages > (doc_page + 1); +} + + +void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocument *doc) +{ + g_return_if_fail(has_tabs_on_right(doc)); + GtkNotebook *nb = GTK_NOTEBOOK(main_widgets.notebook); + gint doc_page = document_get_notebook_page(doc); + for (gint i = doc_page + 1; i < gtk_notebook_get_n_pages(nb); ) + { + if (! document_close(document_get_from_page(i))) + i++; // only increment if tab wasn't closed + } + gtk_notebook_set_current_page(nb, doc_page);
This should probably not go to the document's page but to the originally current one if it hasn't been closed; because like that using the feature on a non-current tab makes that tab current, even if the previously active tab was on the left of the one on which you activated the feature.
b4n commented on this pull request.
- gint doc_page = document_get_notebook_page(doc);
+ return total_pages > (doc_page + 1); +} + + +void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocument *doc) +{ + g_return_if_fail(has_tabs_on_right(doc)); + GtkNotebook *nb = GTK_NOTEBOOK(main_widgets.notebook); + gint doc_page = document_get_notebook_page(doc); + for (gint i = doc_page + 1; i < gtk_notebook_get_n_pages(nb); ) + { + if (! document_close(document_get_from_page(i))) + i++; // only increment if tab wasn't closed + } + gtk_notebook_set_current_page(nb, doc_page);
See #1579
github-comments@lists.geany.org