[glade3] * src/glade-close-button.c: Made the close button in notebook tabs smaller.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * src/glade-close-button.c: Made the close button in notebook tabs smaller.
- Date: Sun, 26 Dec 2010 11:47:34 +0000 (UTC)
commit 7fcb740bd8d9de099c05b2235a5e71049e951af9
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Dec 26 20:13:40 2010 +0900
* src/glade-close-button.c: Made the close button in notebook tabs smaller.
ChangeLog | 2 ++
src/glade-close-button.c | 41 +++++++++++++++++++----------------------
2 files changed, 21 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c3aaee5..d3afd50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
* gladeui/glade-design-layout.c: Make sure to hide widgets going out of the workspace
so that embedded toplevels dont "pop out" of the workspace
+ * src/glade-close-button.c: Made the close button in notebook tabs smaller.
+
2010-12-23 Tristan Van Berkom <tristanvb openismus com>
* gladeui/glade-widget.c: Check if object is actually in the parent when rebuilding
diff --git a/src/glade-close-button.c b/src/glade-close-button.c
index 7977283..b8a0f4a 100644
--- a/src/glade-close-button.c
+++ b/src/glade-close-button.c
@@ -25,41 +25,38 @@
G_DEFINE_TYPE (GladeCloseButton, glade_close_button, GTK_TYPE_BUTTON)
static void
-glade_close_button_style_set (GtkWidget *button,
- GtkStyle *previous_style)
-{
- gint h, w;
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (button),
- GTK_ICON_SIZE_MENU, &w, &h);
-
- gtk_widget_set_size_request (button, w + 2, h + 2);
-
- GTK_WIDGET_CLASS (glade_close_button_parent_class)->style_set (button, previous_style);
-}
-
-static void
glade_close_button_class_init (GladeCloseButtonClass *klass)
{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- widget_class->style_set = glade_close_button_style_set;
}
static void
glade_close_button_init (GladeCloseButton *button)
{
- GtkRcStyle *rcstyle;
GtkWidget *image;
+ GtkCssProvider *provider;
+
+ gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
/* make it as small as possible */
- rcstyle = gtk_rc_style_new ();
- rcstyle->xthickness = rcstyle->ythickness = 0;
- gtk_widget_modify_style (GTK_WIDGET (button), rcstyle);
- g_object_unref (rcstyle);
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider,
+ "* {\n"
+ " -GtkButton-default-border : 0;\n"
+ " -GtkButton-default-outside-border : 0;\n"
+ " -GtkButton-inner-border : 0;\n"
+ " -GtkWidget-focus-line-width : 0;\n"
+ " -GtkWidget-focus-padding : 0;\n"
+ " padding : 0;\n"
+ "}", -1, NULL);
+
+ gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (button)),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
GTK_ICON_SIZE_MENU);
+
gtk_widget_show (image);
gtk_container_add (GTK_CONTAINER (button), image);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]