From: Stefano Facchini <stefano.facchini@gmail.com>
To: 9451@debbugs.gnu.org
Subject: bug#9451: GTK3 toolbar style
Date: Tue, 06 Sep 2011 18:11:06 +0200 [thread overview]
Message-ID: <1315325477.1105.17.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
When compiling with GTK3 the toolbar style should be set to
"primary-toolbar" to match the new theme. However, simply setting the
style in this way makes the toolbar looks bad because of the GtkEventBox
wrapped around every GtkButton.
It seems that the GtkEventBox is only used in connecting signals which
can be connected directly to the GtkButton itself. In the attached patch
the event box is removed and the toolbar style set to "primary-toolbar".
Feedback/comments welcome
--
Stefano Facchini <stefano.facchini@gmail.com>
[-- Attachment #2: gtk3toolbar.patch --]
[-- Type: text/x-patch, Size: 2923 bytes --]
=== modified file 'src/gtkutil.c'
--- src/gtkutil.c 2011-08-29 20:57:42 +0000
+++ src/gtkutil.c 2011-09-06 15:47:54 +0000
@@ -3855,7 +3855,7 @@
static gboolean
xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data)
{
- GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (XG_BIN_CHILD (toolitem)));
+ GtkButton *wbutton = GTK_BUTTON (XG_BIN_CHILD (toolitem));
GtkWidget *vb = XG_BIN_CHILD (wbutton);
GtkWidget *c1;
GtkLabel *wlbl = GTK_LABEL (xg_get_tool_bar_widgets (vb, &c1));
@@ -4165,6 +4165,9 @@
xg_create_tool_bar (FRAME_PTR f)
{
struct x_output *x = f->output_data.x;
+#ifdef HAVE_GTK3
+ GtkStyleContext *gsty;
+#endif
x->toolbar_widget = gtk_toolbar_new ();
x->toolbar_detached = 0;
@@ -4173,6 +4176,10 @@
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+#ifdef HAVE_GTK3
+ gsty = gtk_widget_get_style_context (x->toolbar_widget);
+ gtk_style_context_add_class (gsty, "primary-toolbar");
+#endif
}
@@ -4219,7 +4226,6 @@
GtkToolItem *ti = gtk_tool_item_new ();
GtkWidget *vb = horiz ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
GtkWidget *wb = gtk_button_new ();
- GtkWidget *weventbox = gtk_event_box_new ();
if (wimage && !text_image)
gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
@@ -4231,8 +4237,7 @@
gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (wb), vb);
- gtk_container_add (GTK_CONTAINER (weventbox), wb);
- gtk_container_add (GTK_CONTAINER (ti), weventbox);
+ gtk_container_add (GTK_CONTAINER (ti), wb);
if (wimage)
{
@@ -4247,7 +4252,6 @@
G_CALLBACK (xg_tool_bar_callback),
gi);
- g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
#ifndef HAVE_GTK3
/* Catch expose events to overcome an annoying redraw bug, see
@@ -4273,11 +4277,11 @@
"leave", so we can have only one callback. The event
will tell us what kind of event it is. */
/* The EMACS_INT cast avoids a warning. */
- g_signal_connect (G_OBJECT (weventbox),
+ g_signal_connect (G_OBJECT (wb),
"enter-notify-event",
G_CALLBACK (xg_tool_bar_help_callback),
gi);
- g_signal_connect (G_OBJECT (weventbox),
+ g_signal_connect (G_OBJECT (wb),
"leave-notify-event",
G_CALLBACK (xg_tool_bar_help_callback),
gi);
@@ -4480,7 +4484,7 @@
ti = NULL;
}
- if (ti) wbutton = XG_BIN_CHILD (XG_BIN_CHILD (ti));
+ if (ti) wbutton = XG_BIN_CHILD (ti);
/* Ignore invalid image specifications. */
image = PROP (TOOL_BAR_ITEM_IMAGES);
next reply other threads:[~2011-09-06 16:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 16:11 Stefano Facchini [this message]
2011-09-06 20:12 ` bug#9451: GTK3 toolbar style Jan Djärv
2011-12-20 11:01 ` Stefano Facchini
2012-07-15 14:22 ` Chong Yidong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315325477.1105.17.camel@localhost.localdomain \
--to=stefano.facchini@gmail.com \
--cc=9451@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.