SF.net SVN: geany:[3291] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Nov 29 12:52:09 UTC 2008


Revision: 3291
          http://geany.svn.sourceforge.net/geany/?rev=3291&view=rev
Author:   eht16
Date:     2008-11-29 12:52:09 +0000 (Sat, 29 Nov 2008)

Log Message:
-----------
Another attempt to handle tab close button size properly (based on code from Colomban Wendling, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/notebook.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-11-29 12:51:50 UTC (rev 3290)
+++ trunk/ChangeLog	2008-11-29 12:52:09 UTC (rev 3291)
@@ -14,6 +14,9 @@
    src/filetypes.h, src/highlighting.c, src/plugindata.h, src/editor.c,
    src/about.c:
    Add new filetype 'YAML' (patch by Walery Studennikov, thanks).
+ * src/notebook.c:
+   Another attempt to handle tab close button size properly (based on
+   code from Colomban Wendling, thanks).
 
 
 2008-11-28  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/notebook.c
===================================================================
--- trunk/src/notebook.c	2008-11-29 12:51:50 UTC (rev 3290)
+++ trunk/src/notebook.c	2008-11-29 12:52:09 UTC (rev 3291)
@@ -207,6 +207,17 @@
 
 void notebook_init()
 {
+	/* Individual style for the tab close buttons */
+	gtk_rc_parse_string(
+		"style \"geany-close-tab-button-style\" {\n"
+		"	GtkWidget::focus-padding = 0\n"
+		"	GtkWidget::focus-line-width = 0\n"
+		"	xthickness = 0\n"
+		"	ythickness = 0\n"
+		"}\n"
+		"widget \"*.geany-close-tab-button\" style \"geany-close-tab-button-style\""
+	);
+
 	g_signal_connect_after(main_widgets.notebook, "button-press-event",
 		G_CALLBACK(notebook_tab_bar_click_cb), NULL);
 
@@ -463,31 +474,21 @@
 	if (file_prefs.show_tab_cross)
 	{
 		GtkWidget *image, *btn, *align;
-		GtkRcStyle *rcstyle;
-		GtkRequisition size;
+		gint w, h;
 
 		btn = gtk_button_new();
 		gtk_button_set_relief(GTK_BUTTON(btn), GTK_RELIEF_NONE);
-
-		/* don't allow focus on the close button */
 		gtk_button_set_focus_on_click(GTK_BUTTON(btn), FALSE);
+		gtk_widget_set_name(btn, "geany-close-tab-button");
 
-		/* make it as small as possible */
-		rcstyle = gtk_rc_style_new();
-		rcstyle->xthickness = rcstyle->ythickness = 0;
-		gtk_widget_modify_style(btn, rcstyle);
-		gtk_rc_style_unref(rcstyle);
-
 		image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
-#ifndef G_OS_WIN32
-		gtk_widget_size_request(image, &size);
-		gtk_widget_set_size_request(btn, size.width, size.height);
-#endif
-		gtk_button_set_image(GTK_BUTTON(btn), image);
+		gtk_container_add(GTK_CONTAINER(btn), image);
 
+		gtk_icon_size_lookup_for_settings(gtk_widget_get_settings(btn), GTK_ICON_SIZE_MENU, &w, &h);
+		gtk_widget_set_size_request(btn, w + 2, h + 2);
+
 		align = gtk_alignment_new(1.0, 0.0, 0.0, 0.0);
 		gtk_container_add(GTK_CONTAINER(align), btn);
-
 		gtk_box_pack_start(GTK_BOX(hbox), align, TRUE, TRUE, 0);
 
 		g_signal_connect(btn, "clicked", G_CALLBACK(notebook_tab_close_clicked_cb), page);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list