[Xfce4-commits] [xfce/thunar] 01/01: Use libxfce4ui close-multiple-tab dialog (Bug #16254)
noreply at xfce.org
noreply at xfce.org
Mon Feb 3 22:21:12 CET 2020
This is an automated email from the git hooks/post-receive script.
a l e x p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar.
commit 59244a32f25dae0aae51a595e383ab49fe255887
Author: Reuben Green <reubengreen73 at gmail.com>
Date: Sat Feb 1 23:24:53 2020 +0000
Use libxfce4ui close-multiple-tab dialog (Bug #16254)
Replaces the thunar-specific close-multiple-tab dialog code with a call
to the new function in libxfce4ui.
Co-authored-by: Alexander Schwinn <alexxcons at xfce.org>
---
configure.ac.in | 2 +-
thunar/thunar-window.c | 50 +++++++-------------------------------------------
2 files changed, 8 insertions(+), 44 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 3b01644..e031117 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -153,7 +153,7 @@ XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.42.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.22.0])
XDT_CHECK_PACKAGE([GDK_PIXBUF], [gdk-pixbuf-2.0], [2.14.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.12.0])
-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.15.0])
XDT_CHECK_PACKAGE([LIBXFCE4KBD_PRIVATE], [libxfce4kbd-private-3], [4.12.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.12.0])
XDT_CHECK_PACKAGE([PANGO], [pango], [1.38.0])
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 72a45c9..81d528a 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1092,15 +1092,12 @@ thunar_window_finalize (GObject *object)
-static gboolean thunar_window_delete( GtkWidget *widget,
- GdkEvent *event,
- gpointer data )
+static gboolean thunar_window_delete (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data )
{
- GtkWidget *dialog, *grid, *label, *icon, *checkbutton;
GtkNotebook *notebook;
- const gchar *title;
- gchar *message, *markup;
- gboolean confirm_close_multiple_tabs;
+ gboolean confirm_close_multiple_tabs, do_not_ask_again;
gint response, n_tabs;
_thunar_return_val_if_fail (THUNAR_IS_WINDOW (widget),FALSE);
@@ -1119,47 +1116,14 @@ static gboolean thunar_window_delete( GtkWidget *widget,
return FALSE;
/* ask the user for confirmation */
- dialog = gtk_dialog_new_with_buttons (_("Warning"),
- GTK_WINDOW (widget),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- _("_Cancel"), GTK_RESPONSE_CANCEL,
- _("Close T_ab"), GTK_RESPONSE_CLOSE,
- _("Close _Window"), GTK_RESPONSE_YES,
- NULL);
- grid = gtk_grid_new ();
- gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
- gtk_widget_set_margin_start (grid, 12);
- gtk_widget_set_margin_end (grid, 12);
- gtk_widget_set_margin_top (grid, 12);
- gtk_widget_set_margin_bottom (grid, 12);
- gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid);
-
- icon = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG);
- gtk_grid_attach (GTK_GRID (grid), icon, 0, 0, 1, 2);
-
- title = _("Close all tabs?");
- message = g_strdup_printf (_("This window has %d tabs open. Closing this window\n"
- "will also close all its tabs."), n_tabs);
- markup = g_markup_printf_escaped ("<span weight='bold' size='larger'>%s</span>\n%s\n", title, message);
- g_free (message);
- label = gtk_label_new (NULL);
- gtk_label_set_markup (GTK_LABEL (label), markup);
- g_free (markup);
- gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
-
- checkbutton = gtk_check_button_new_with_mnemonic (_("Do _not ask me again"));
- gtk_grid_attach (GTK_GRID (grid), checkbutton, 1, 1, 1, 1);
-
- gtk_widget_show_all (dialog);
- response = gtk_dialog_run (GTK_DIALOG (dialog));
+ do_not_ask_again = FALSE;
+ response = xfce_dialog_confirm_close_tabs (GTK_WINDOW (widget), n_tabs, TRUE, &do_not_ask_again);
/* if the user requested not to be asked again, store this preference */
- if (response != GTK_RESPONSE_CANCEL && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)))
+ if (response != GTK_RESPONSE_CANCEL && do_not_ask_again)
g_object_set (G_OBJECT (THUNAR_WINDOW (widget)->preferences),
"misc-confirm-close-multiple-tabs", FALSE, NULL);
- gtk_widget_destroy (dialog);
-
if(response == GTK_RESPONSE_YES)
return FALSE;
if(response == GTK_RESPONSE_CLOSE)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list