diff --git a/src/Makefile.am b/src/Makefile.am
index 4d91119..239fded 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -23,6 +23,8 @@ mate_terminal_SOURCES= \
terminal-accels.h \
terminal-app.c \
terminal-app.h \
+ terminal-close-button.h \
+ terminal-close-button.c \
terminal-debug.c \
terminal-debug.h \
terminal-encoding.c \
diff --git a/src/terminal-close-button.c b/src/terminal-close-button.c
new file mode 100644
index 0000000..8a1f777
--- /dev/null
+++ b/src/terminal-close-button.c
@@ -0,0 +1,74 @@
+/*
+ * terminal-close-button.c
+ *
+ * Copyright © 2010 - Paolo Borelli
+ * Copyright © 2011 - Ignacio Casal Quinteiro
+ * Copyright © 2016 - Wolfgang Ulbrich
+ *
+ * Mate-terminal is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+
+#include "terminal-close-button.h"
+
+struct _TerminalCloseButtonClassPrivate {
+ GtkCssProvider *css;
+};
+
+G_DEFINE_TYPE_WITH_CODE (TerminalCloseButton, terminal_close_button, GTK_TYPE_BUTTON,
+ g_type_add_class_private (g_define_type_id, sizeof (TerminalCloseButtonClassPrivate)))
+
+static void
+terminal_close_button_class_init (TerminalCloseButtonClass *klass)
+{
+ static const gchar button_style[] =
+ "* {\n"
+ "padding: 0;\n"
+ "}";
+
+ klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButtonClassPrivate);
+
+ klass->priv->css = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (klass->priv->css, button_style, -1, NULL);
+}
+
+static void
+terminal_close_button_init (TerminalCloseButton *button)
+{
+ GtkWidget *image;
+ GtkStyleContext *context;
+
+ gtk_widget_set_name (GTK_WIDGET (button), "mate-terminal-tab-close-button");
+
+ image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image);
+
+ gtk_container_add (GTK_CONTAINER (button), image);
+
+ context = gtk_widget_get_style_context (GTK_WIDGET (button));
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (TERMINAL_CLOSE_BUTTON_GET_CLASS (button)->priv->css),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
+GtkWidget *
+terminal_close_button_new ()
+{
+ return GTK_WIDGET (g_object_new (TERMINAL_TYPE_CLOSE_BUTTON,
+ "relief", GTK_RELIEF_NONE,
+ "focus-on-click", FALSE,
+ NULL));
+}
+
diff --git a/src/terminal-close-button.h b/src/terminal-close-button.h
new file mode 100644
index 0000000..9578010
--- /dev/null
+++ b/src/terminal-close-button.h
@@ -0,0 +1,59 @@
+/*
+ * terminal-close-button.h
+ *
+ * Copyright © 2010 - Paolo Borelli
+ * Copyright © 2016 - Wolfgang Ulbrich
+ *
+ * Mate-terminal is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mate-terminal is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef __TERMINAL_CLOSE_BUTTON_H__
+#define __TERMINAL_CLOSE_BUTTON_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_CLOSE_BUTTON (terminal_close_button_get_type ())
+#define TERMINAL_CLOSE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButton))
+#define TERMINAL_CLOSE_BUTTON_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButton const))
+#define TERMINAL_CLOSE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButtonClass))
+#define TERMINAL_IS_CLOSE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_CLOSE_BUTTON))
+#define TERMINAL_IS_CLOSE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TERMINAL_TYPE_CLOSE_BUTTON))
+#define TERMINAL_CLOSE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_CLOSE_BUTTON, TerminalCloseButtonClass))
+
+typedef struct _TerminalCloseButton TerminalCloseButton;
+typedef struct _TerminalCloseButtonPrivate TerminalCloseButtonPrivate;
+typedef struct _TerminalCloseButtonClass TerminalCloseButtonClass;
+typedef struct _TerminalCloseButtonClassPrivate TerminalCloseButtonClassPrivate;
+
+struct _TerminalCloseButton
+{
+ GtkButton parent;
+};
+
+struct _TerminalCloseButtonClass
+{
+ GtkButtonClass parent_class;
+
+ TerminalCloseButtonClassPrivate *priv;
+};
+
+GType terminal_close_button_get_type (void) G_GNUC_CONST;
+
+GtkWidget *terminal_close_button_new (void);
+
+G_END_DECLS
+
+#endif /* __TERMINAL_CLOSE_BUTTON_H__ */
diff --git a/src/terminal-tab-label.c b/src/terminal-tab-label.c
index ef71437..e5c252a 100644
--- a/src/terminal-tab-label.c
+++ b/src/terminal-tab-label.c
@@ -23,6 +23,7 @@
#include "terminal-intl.h"
#include "terminal-tab-label.h"
+#include "terminal-close-button.h"
#define TERMINAL_TAB_LABEL_GET_PRIVATE(tab_label)(G_TYPE_INSTANCE_GET_PRIVATE ((tab_label), TERMINAL_TYPE_TAB_LABEL, TerminalTabLabelPrivate))
@@ -91,22 +92,6 @@ terminal_tab_label_parent_set (GtkWidget *widget,
parent_set (widget, old_parent);
}
-static void
-terminal_tab_label_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
-{
- TerminalTabLabel *tab_label = TERMINAL_TAB_LABEL (widget);
- TerminalTabLabelPrivate *priv = tab_label->priv;
- void (* style_set) (GtkWidget *, GtkStyle *) = GTK_WIDGET_CLASS (terminal_tab_label_parent_class)->style_set;
- int h, w;
-
- if (style_set)
- style_set (widget, previous_style);
-
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
- gtk_widget_set_size_request (priv->close_button, w + 2, h + 2);
-}
-
static void
terminal_tab_label_init (TerminalTabLabel *tab_label)
{
@@ -121,7 +106,7 @@ terminal_tab_label_constructor (GType type,
GObject *object;
TerminalTabLabel *tab_label;
TerminalTabLabelPrivate *priv;
- GtkWidget *hbox, *label, *close_button, *image;
+ GtkWidget *hbox, *label, *close_button;
object = G_OBJECT_CLASS (terminal_tab_label_parent_class)->constructor
(type, n_construct_properties, construct_params);
@@ -148,15 +133,9 @@ terminal_tab_label_constructor (GType type,
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
- priv->close_button = close_button = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
- gtk_button_set_focus_on_click (GTK_BUTTON (close_button), FALSE);
- gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
- gtk_widget_set_name (close_button, "mate-terminal-tab-close-button");
+ priv->close_button = close_button = terminal_close_button_new ();
gtk_widget_set_tooltip_text (close_button, _("Close tab"));
- image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (close_button), image);
gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0);
sync_tab_label (priv->screen, NULL, label);
@@ -210,7 +189,6 @@ terminal_tab_label_class_init (TerminalTabLabelClass *klass)
gobject_class->set_property = terminal_tab_label_set_property;
widget_class->parent_set = terminal_tab_label_parent_set;
- widget_class->style_set = terminal_tab_label_style_set;
signals[CLOSE_BUTTON_CLICKED] =
g_signal_new (I_("close-button-clicked"),
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 9b320fa..ce0fc96 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -2131,16 +2131,6 @@ terminal_window_class_init (TerminalWindowClass *klass)
widget_class->screen_changed = terminal_window_screen_changed;
g_type_class_add_private (object_class, sizeof (TerminalWindowPrivate));
-
- gtk_rc_parse_string ("style \"mate-terminal-tab-close-button-style\"\n"
- "{\n"
- "GtkWidget::focus-padding = 0\n"
- "GtkWidget::focus-line-width = 0\n"
- "xthickness = 0\n"
- "ythickness = 0\n"
- "}\n"
- "widget \"*.mate-terminal-tab-close-button\" style \"mate-terminal-tab-close-button-style\"");
-
}
static void