Add confirm-close-dialog.ui

rbuj 2020-03-30 15:04:33 +02:00 committed by ZenWalker
parent 9d128954c0
commit c8dd5b0e71
5 changed files with 198 additions and 25 deletions

View File

@ -2,12 +2,14 @@
# Please keep this file sorted alphabetically. # Please keep this file sorted alphabetically.
mate-terminal.appdata.xml.in mate-terminal.appdata.xml.in
mate-terminal.desktop.in.in mate-terminal.desktop.in.in
src/confirm-close-dialog.ui
src/eggsmclient.c src/eggsmclient.c
src/org.mate.terminal.gschema.xml.in
src/profile-editor.c
src/encodings-dialog.ui src/encodings-dialog.ui
src/extra-strings.c
src/find-dialog.ui src/find-dialog.ui
src/keybinding-editor.ui src/keybinding-editor.ui
src/org.mate.terminal.gschema.xml.in
src/profile-editor.c
src/profile-manager.ui src/profile-manager.ui
src/profile-new-dialog.ui src/profile-new-dialog.ui
src/profile-preferences.ui src/profile-preferences.ui
@ -25,4 +27,3 @@ src/terminal-tab-label.c
src/terminal-tabs-menu.c src/terminal-tabs-menu.c
src/terminal-util.c src/terminal-util.c
src/terminal-window.c src/terminal-window.c
src/extra-strings.c

View File

@ -158,6 +158,7 @@ CLEANFILES = \
$(BUILT_SOURCES) $(BUILT_SOURCES)
EXTRA_DIST = \ EXTRA_DIST = \
confirm-close-dialog.ui \
encodings-dialog.ui \ encodings-dialog.ui \
find-dialog.ui \ find-dialog.ui \
keybinding-editor.ui \ keybinding-editor.ui \

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkImage" id="image_cancel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">process-stop</property>
</object>
<object class="GtkImage" id="image_close">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">window-close</property>
</object>
<object class="GtkDialog" id="confirm_close_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property>
<child type="titlebar">
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">14</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="homogeneous">True</property>
<property name="layout_style">expand</property>
<child>
<object class="GtkButton" id="button_cancel">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image_cancel</property>
<property name="use_underline">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_close">
<property name="label" translatable="yes">C_lose Window</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">True</property>
<property name="image">image_close</property>
<property name="use_underline">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="vbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<child>
<object class="GtkBox" id="hbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="icon_name">dialog-warning</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="question_text">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Close this window?</property>
<property name="selectable">True</property>
<property name="single_line_mode">True</property>
<property name="max_width_chars">40</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="description_text">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">There is still a process running in this terminal.
Closing the terminal will kill it.</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-6">button_cancel</action-widget>
<action-widget response="-3">button_close</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -3566,6 +3566,7 @@ static gboolean
confirm_close_window_or_tab (TerminalWindow *window, confirm_close_window_or_tab (TerminalWindow *window,
TerminalScreen *screen) TerminalScreen *screen)
{ {
GtkBuilder *builder;
TerminalWindowPrivate *priv = window->priv; TerminalWindowPrivate *priv = window->priv;
GtkWidget *dialog; GtkWidget *dialog;
gboolean do_confirm; gboolean do_confirm;
@ -3573,13 +3574,6 @@ confirm_close_window_or_tab (TerminalWindow *window,
int n_tabs; int n_tabs;
char *confirm_msg; char *confirm_msg;
if (priv->confirm_close_dialog)
{
/* WTF, already have one? It's modal, so how did that happen? */
gtk_dialog_response (GTK_DIALOG (priv->confirm_close_dialog),
GTK_RESPONSE_DELETE_EVENT);
}
do_confirm = g_settings_get_boolean (settings_global, "confirm-window-close"); do_confirm = g_settings_get_boolean (settings_global, "confirm-window-close");
if (!do_confirm) if (!do_confirm)
@ -3615,30 +3609,28 @@ confirm_close_window_or_tab (TerminalWindow *window,
if (has_processes) if (has_processes)
{ {
if (n_tabs > 1) if (n_tabs > 1)
confirm_msg = _("There are still processes running in some terminals in this window. " confirm_msg = _("There are still processes running in some terminals in this window.\n"
"Closing the window will kill all of them."); "Closing the window will kill all of them.");
else else
confirm_msg = _("There is still a process running in this terminal. " confirm_msg = _("There is still a process running in this terminal.\n"
"Closing the terminal will kill it."); "Closing the terminal will kill it.");
} else if (n_tabs > 1) } else if (n_tabs > 1)
confirm_msg = _("There are multiple tabs open in this window."); confirm_msg = _("There are multiple tabs open in this window.");
else else
return FALSE; return FALSE;
dialog = priv->confirm_close_dialog =
gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CANCEL,
"%s", n_tabs > 1 ? _("Close this window?") : _("Close this terminal?"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), builder = gtk_builder_new_from_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/confirm-close-dialog.ui");
"%s", confirm_msg); priv->confirm_close_dialog = dialog = GTK_WIDGET (gtk_builder_get_object (builder, "confirm_close_dialog"));
if (n_tabs > 1) {
gtk_window_set_title (GTK_WINDOW (dialog), ""); gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "question_text")), _("Close this window?"));
gtk_button_set_label (GTK_BUTTON (gtk_builder_get_object (builder, "button_close")), _("C_lose Window"));
gtk_dialog_add_button (GTK_DIALOG (dialog), n_tabs > 1 ? _("C_lose Window") : _("C_lose Terminal"), GTK_RESPONSE_ACCEPT); } else {
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "question_text")), _("Close this terminal?"));
gtk_button_set_label (GTK_BUTTON (gtk_builder_get_object (builder, "button_close")), _("C_lose Terminal"));
}
gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "description_text")), confirm_msg);
g_object_unref (builder);
g_object_set_data (G_OBJECT (dialog), "close-screen", screen); g_object_set_data (G_OBJECT (dialog), "close-screen", screen);
@ -3647,6 +3639,8 @@ confirm_close_window_or_tab (TerminalWindow *window,
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (confirm_close_response_cb), window); G_CALLBACK (confirm_close_response_cb), window);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_window_set_title (GTK_WINDOW (dialog), "");
gtk_window_present (GTK_WINDOW (dialog)); gtk_window_present (GTK_WINDOW (dialog));
return TRUE; return TRUE;

View File

@ -17,6 +17,7 @@
--> -->
<gresources> <gresources>
<gresource prefix="/org/mate/terminal/ui"> <gresource prefix="/org/mate/terminal/ui">
<file compressed="true" preprocess="xml-stripblanks">confirm-close-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">encodings-dialog.ui</file> <file compressed="true" preprocess="xml-stripblanks">encodings-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">find-dialog.ui</file> <file compressed="true" preprocess="xml-stripblanks">find-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">keybinding-editor.ui</file> <file compressed="true" preprocess="xml-stripblanks">keybinding-editor.ui</file>