[Xfce4-commits] [apps/xfce4-terminal] 01/01: Add Reset button to the title color chooser

noreply at xfce.org noreply at xfce.org
Tue May 29 17:24:54 CEST 2018


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       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 apps/xfce4-terminal.

commit adc2fc92547b88c7bac9887acb21c99bf1147168
Author: Igor <f2404 at yandex.ru>
Date:   Tue May 29 11:22:39 2018 -0400

    Add Reset button to the title color chooser
---
 terminal/terminal-screen.c |  8 ++++++--
 terminal/terminal-window.c | 12 +++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index a7b1b80..29d5708 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -2856,9 +2856,13 @@ terminal_screen_set_custom_title_color (TerminalScreen *screen,
 
   terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
 
-  if (gdk_rgba_parse (&label_color, color))
+  g_free (screen->custom_title_color);
+  screen->custom_title_color = NULL;
+
+  if (color == NULL)
+    gtk_label_set_attributes (GTK_LABEL (screen->tab_label), NULL);
+  else if (gdk_rgba_parse (&label_color, color))
     {
-      g_free (screen->custom_title_color);
       screen->custom_title_color = g_strdup (color);
       terminal_screen_set_tab_label_color (screen, &label_color);
     }
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index e82204a..584e8f3 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -2207,10 +2207,14 @@ static void
 terminal_window_action_set_title_color (GtkAction      *action,
                                         TerminalWindow *window)
 {
-  GdkRGBA    color;
+  GtkWidget *dialog;
   gchar     *color_string;
-  GtkWidget *dialog = gtk_color_chooser_dialog_new (_("Choose title color"), GTK_WINDOW (window));
-  int        response = gtk_dialog_run (GTK_DIALOG (dialog));
+  GdkRGBA    color;
+  int        response;
+
+  dialog = gtk_color_chooser_dialog_new (_("Choose title color"), GTK_WINDOW (window));
+  gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Reset"), GTK_RESPONSE_NO);
+  response = gtk_dialog_run (GTK_DIALOG (dialog));
 
   if (response == GTK_RESPONSE_OK)
     {
@@ -2219,6 +2223,8 @@ terminal_window_action_set_title_color (GtkAction      *action,
       terminal_screen_set_custom_title_color (window->priv->active, color_string);
       g_free (color_string);
     }
+  else if (response == GTK_RESPONSE_NO)
+    terminal_screen_set_custom_title_color (window->priv->active, NULL);
 
   gtk_widget_destroy (dialog);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list