[Xfce4-commits] [apps/xfce4-terminal] 01/01: Restore custom title when un-closing tabs
noreply at xfce.org
noreply at xfce.org
Mon Aug 22 14:22:14 CEST 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit 7f037af29a46301e55d0f02ae262bafe5f0a182e
Author: Igor <f2404 at yandex.ru>
Date: Mon Aug 22 15:22:09 2016 +0300
Restore custom title when un-closing tabs
---
terminal/terminal-screen.c | 14 ++++++++++++++
terminal/terminal-screen.h | 1 +
terminal/terminal-window.c | 6 ++++++
3 files changed, 21 insertions(+)
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 81eaaf5..3bde8b5 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1655,6 +1655,20 @@ terminal_screen_set_custom_command (TerminalScreen *screen,
/**
+ * terminal_screen_get_custom_title:
+ * @screen : A #TerminalScreen.
+ **/
+const gchar *
+terminal_screen_get_custom_title (TerminalScreen *screen)
+{
+ terminal_return_val_if_fail (TERMINAL_IS_SCREEN (screen), NULL);
+
+ return screen->custom_title;
+}
+
+
+
+/**
* terminal_screen_set_custom_title:
* @screen : A #TerminalScreen.
* @title : Title string.
diff --git a/terminal/terminal-screen.h b/terminal/terminal-screen.h
index d6265ec..a5bf9d1 100644
--- a/terminal/terminal-screen.h
+++ b/terminal/terminal-screen.h
@@ -41,6 +41,7 @@ void terminal_screen_launch_child (TerminalScreen *scree
void terminal_screen_set_custom_command (TerminalScreen *screen,
gchar **command);
+const gchar *terminal_screen_get_custom_title (TerminalScreen *screen);
void terminal_screen_set_custom_title (TerminalScreen *screen,
const gchar *title);
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 213f5ba..93301e0 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -56,6 +56,7 @@
/* Closed tabs stored info */
typedef struct
{
+ gchar *custom_title;
gchar *working_directory;
gint position;
} TerminalWindowTabInfo;
@@ -969,6 +970,8 @@ terminal_window_notebook_page_removed (GtkNotebook *notebook,
tab_info = g_new (TerminalWindowTabInfo, 1);
tab_info->position = page_num;
tab_info->working_directory = g_strdup (terminal_screen_get_working_directory (TERMINAL_SCREEN (child)));
+ tab_info->custom_title = IS_STRING (terminal_screen_get_custom_title (TERMINAL_SCREEN (child))) ?
+ g_strdup (terminal_screen_get_custom_title (TERMINAL_SCREEN (child))) : NULL;
g_queue_push_tail (window->closed_tabs_list, tab_info);
/* show the tabs when needed */
@@ -1409,6 +1412,8 @@ terminal_window_action_undo_close_tab (GtkAction *action,
terminal_window_add (window, TERMINAL_SCREEN (terminal));
terminal_screen_set_working_directory (TERMINAL_SCREEN (terminal),
tab_info->working_directory);
+ if (tab_info->custom_title != NULL)
+ terminal_screen_set_custom_title (TERMINAL_SCREEN (terminal), tab_info->custom_title);
gtk_notebook_reorder_child (GTK_NOTEBOOK (window->notebook), terminal, tab_info->position);
/* free info */
@@ -2054,6 +2059,7 @@ terminal_window_move_tab (GtkNotebook *notebook,
static void
terminal_window_tab_info_free (TerminalWindowTabInfo *tab_info)
{
+ g_free (tab_info->custom_title);
g_free (tab_info->working_directory);
g_free (tab_info);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list