diff options
author | raveit65 <[email protected]> | 2016-06-11 18:03:09 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-06-11 21:09:24 +0200 |
commit | f15b90f66bdc562b62837d1389e92608439f6b30 (patch) | |
tree | 22f72e152ee8d62f076d81815552f962f028a4c9 /src/terminal-tab-label.c | |
parent | c6fba6db82e8f427bb573f36578b99f12d6968f9 (diff) | |
download | mate-terminal-f15b90f66bdc562b62837d1389e92608439f6b30.tar.bz2 mate-terminal-f15b90f66bdc562b62837d1389e92608439f6b30.tar.xz |
Borrow pluma-close-button class and use it.
This is a subclass of GtkButton special theming for the close button.
taken from:
https://git.gnome.org/browse/gnome-terminal/commit/src?h=gnome-3-8&id=c3a3e06
https://git.gnome.org/browse/gnome-terminal/diff/src/terminal-close-button.c?h=gnome-3-8&id=2bff4b6
Diffstat (limited to 'src/terminal-tab-label.c')
-rw-r--r-- | src/terminal-tab-label.c | 28 |
1 files changed, 3 insertions, 25 deletions
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)) @@ -92,22 +93,6 @@ terminal_tab_label_parent_set (GtkWidget *widget, } 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) { tab_label->priv = TERMINAL_TAB_LABEL_GET_PRIVATE (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"), |