[devhelp] misc: remove custom code & styling for tab close buttons



commit 3d8bd27941b55bbac7eea6110c0bb5ad0cc7358e
Author: Frédéric Péters <fpeters 0d be>
Date:   Wed Jan 27 18:16:25 2016 +0100

    misc: remove custom code & styling for tab close buttons

 src/Makefile.am          |    4 +--
 src/dh-window.c          |   18 +++++++++-
 src/gedit-close-button.c |   82 ----------------------------------------------
 src/gedit-close-button.h |   60 ---------------------------------
 4 files changed, 17 insertions(+), 147 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 21651f1..dbe1eca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -83,9 +83,7 @@ libdevhelp_3_la_SOURCES =                             \
        dh-sidebar.c                                    \
        dh-util.c                                       \
        dh-util.h                                       \
-       dh-window.c                                     \
-       gedit-close-button.c                            \
-       gedit-close-button.h
+       dh-window.c
 
 # do not distribute generated files
 nodist_libdevhelp_3_la_SOURCES =                       \
diff --git a/src/dh-window.c b/src/dh-window.c
index 76a5e19..0490d13 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -33,7 +33,6 @@
 #include "dh-util.h"
 #include "dh-enum-types.h"
 #include "dh-settings.h"
-#include "gedit-close-button.h"
 
 typedef struct {
         GMenuModel     *gear_app_menu;
@@ -1313,6 +1312,9 @@ window_new_tab_label (DhWindow        *window,
         GtkWidget *label;
         GtkWidget *hbox;
         GtkWidget *close_button;
+        GtkWidget *image;
+        GIcon *icon;
+        GtkStyleContext *context;
 
         hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
 
@@ -1321,7 +1323,19 @@ window_new_tab_label (DhWindow        *window,
         gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
         gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
 
-        close_button = gedit_close_button_new ();
+        close_button = GTK_WIDGET (g_object_new (GTK_TYPE_BUTTON,
+                                "focus-on-click", FALSE,
+                                NULL));
+        context = gtk_widget_get_style_context (close_button);
+        gtk_style_context_add_class (context, "small-button");
+        gtk_style_context_add_class (context, "flat");
+
+        icon = g_themed_icon_new_with_default_fallbacks ("window-close-symbolic");
+        image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+        gtk_widget_show (image);
+        g_object_unref (icon);
+        gtk_container_add (GTK_CONTAINER (close_button), image);
+
         g_object_set_data (G_OBJECT (close_button), "parent_tab", (gpointer) parent);
 
         g_signal_connect (close_button, "clicked",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]