summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/set-title-dialog.ui128
-rw-r--r--src/terminal-window.c46
-rw-r--r--src/terminal.gresource.xml1
5 files changed, 142 insertions, 35 deletions
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a89bd24..da9e39c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -13,6 +13,7 @@ src/profile-editor.c
src/profile-manager.ui
src/profile-new-dialog.ui
src/profile-preferences.ui
+src/set-title-dialog.ui
src/skey-challenge.ui
src/skey-popup.c
src/terminal-accels.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 04bebf9..df984f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -165,6 +165,7 @@ EXTRA_DIST = \
profile-manager.ui \
profile-new-dialog.ui \
profile-preferences.ui \
+ set-title-dialog.ui \
skey-challenge.ui \
terminal.about \
terminal.xml \
diff --git a/src/set-title-dialog.ui b/src/set-title-dialog.ui
new file mode 100644
index 0000000..e2576ff
--- /dev/null
+++ b/src/set-title-dialog.ui
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.2 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">process-stop</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">gtk-ok</property>
+ </object>
+ <object class="GtkDialog" id="dialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Set Title</property>
+ <property name="role">mate-terminal-change-title</property>
+ <property name="modal">True</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="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <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="button1">
+ <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">image1</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">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">_OK</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">image2</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>
+ <style>
+ <class name="linked"/>
+ </style>
+ </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="margin_left">12</property>
+ <property name="margin_right">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">_Title:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">title_entry</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="title_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="width_chars">30</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</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>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button1</action-widget>
+ <action-widget response="-5">button2</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 5e98629..b50378f 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -4224,53 +4224,29 @@ static void
terminal_set_title_callback (GtkAction *action,
TerminalWindow *window)
{
+ GtkBuilder *builder;
TerminalWindowPrivate *priv = window->priv;
- GtkWidget *dialog, *message_area, *hbox, *label, *entry;
+ GtkWidget *dialog, *entry;
if (priv->active_screen == NULL)
return;
- /* FIXME: hook the screen up so this dialogue closes if the terminal screen closes */
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (window),
- GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_OTHER,
- GTK_BUTTONS_OK_CANCEL,
- "%s", "");
+ builder = gtk_builder_new_from_resource (TERMINAL_RESOURCES_PATH_PREFIX G_DIR_SEPARATOR_S "ui/set-title-dialog.ui");
+ dialog = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
+ entry = GTK_WIDGET (gtk_builder_get_object (builder, "title_entry"));
+ g_object_unref (builder);
- gtk_window_set_title (GTK_WINDOW (dialog), _("Set Title"));
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_window_set_role (GTK_WINDOW (dialog), "mate-terminal-change-title");
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- /* Alternative button order was set automatically by GtkMessageDialog */
+ gtk_widget_grab_focus (entry);
+ gtk_entry_set_text (GTK_ENTRY (entry), terminal_screen_get_raw_title (priv->active_screen));
+ gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
+ g_object_set_data (G_OBJECT (dialog), "title-entry", entry);
g_signal_connect (dialog, "response",
G_CALLBACK (terminal_set_title_dialog_response_cb), priv->active_screen);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (terminal_util_dialog_response_on_delete), NULL);
- message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
- gtk_container_foreach (GTK_CONTAINER (message_area), (GtkCallback) gtk_widget_hide, NULL);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_box_pack_start (GTK_BOX (message_area), hbox, FALSE, FALSE, 0);
-
- label = gtk_label_new_with_mnemonic (_("_Title:"));
- gtk_label_set_xalign (GTK_LABEL (label), 0.0);
- gtk_label_set_yalign (GTK_LABEL (label), 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-
- entry = gtk_entry_new ();
- gtk_entry_set_width_chars (GTK_ENTRY (entry), 32);
- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
- gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
- gtk_widget_show_all (hbox);
-
- gtk_widget_grab_focus (entry);
- gtk_entry_set_text (GTK_ENTRY (entry), terminal_screen_get_raw_title (priv->active_screen));
- gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
- g_object_set_data (G_OBJECT (dialog), "title-entry", entry);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_window_present (GTK_WINDOW (dialog));
}
diff --git a/src/terminal.gresource.xml b/src/terminal.gresource.xml
index 4332ba8..02fc71d 100644
--- a/src/terminal.gresource.xml
+++ b/src/terminal.gresource.xml
@@ -24,6 +24,7 @@
<file compressed="true" preprocess="xml-stripblanks">profile-manager.ui</file>
<file compressed="true" preprocess="xml-stripblanks">profile-new-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">profile-preferences.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">set-title-dialog.ui</file>
<file compressed="true" preprocess="xml-stripblanks">skey-challenge.ui</file>
<file compressed="true" preprocess="xml-stripblanks">terminal.xml</file>
<file compressed="true">terminal.about</file>