After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 636501 - Port to the new gtk+ 3.0 GtkStyleContext
Port to the new gtk+ 3.0 GtkStyleContext
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Build
git master
Other Linux
: Normal critical
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks: 636497
 
 
Reported: 2010-12-05 06:31 UTC by Craig Keogh
Modified: 2011-01-11 01:28 UTC
See Also:
GNOME target: 3.0
GNOME version: ---


Attachments
egg: update from master (3.99 KB, patch)
2010-12-14 23:35 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review
Port to gtk+ master's GtkStyleContext (15.42 KB, patch)
2010-12-14 23:35 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review
Port to gtk+ master's GtkStyleContext (15.51 KB, patch)
2010-12-15 14:30 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review
ephy-location-entry: fix secure bg/fg colors (2.04 KB, patch)
2011-01-03 21:44 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review
ephy-location-entry: fix secure bg/fg colors (2.14 KB, patch)
2011-01-08 14:32 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review
Use the new GTK_STATE_FLAG_NORMAL flag (2.42 KB, patch)
2011-01-08 14:32 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review

Description Craig Keogh 2010-12-05 06:31:08 UTC
gtk+ 2.91.6+ has changed API. GTK+ branch gtk-style-context has been merged to
master and porting is required to GtkStyleContext. See:
http://git.gnome.org/browse/gtk+/commit/?id=f8a874abb1d1d8925b0f841e95bbef6cdcb21ac4

build failure (from git master):
ephy-location-entry.c: In function 'ephy_location_entry_style_set':
ephy-location-entry.c:139:2: warning: implicit declaration of function 'gtk_widget_get_style'
ephy-location-entry.c:139:2: warning: nested extern declaration of 'gtk_widget_get_style'
ephy-location-entry.c:139:49: error: invalid type argument of '->' (have 'int')
make[4]: Leaving directory `/home/Oxyde/gnome/epiphany/lib/widgets'
make[3]: Leaving directory `/home/Oxyde/gnome/epiphany/lib'
make[2]: Leaving directory `/home/Oxyde/gnome/epiphany/lib'
make[1]: Leaving directory `/home/Oxyde/gnome/epiphany'
ephy-location-entry.c: In function 'favicon_create_drag_surface':
ephy-location-entry.c:790:8: warning: assignment makes pointer from integer without a cast
ephy-location-entry.c: In function 'textcell_data_func':
ephy-location-entry.c:1081:9: warning: assignment makes pointer from integer without a cast
ephy-location-entry.c: In function 'ephy_location_entry_set_secure':
ephy-location-entry.c:1570:3: warning: implicit declaration of function 'gtk_widget_modify_text'
ephy-location-entry.c:1570:3: warning: nested extern declaration of 'gtk_widget_modify_text'
ephy-location-entry.c:1571:3: warning: implicit declaration of function 'gtk_widget_modify_base'
ephy-location-entry.c:1571:3: warning: nested extern declaration of 'gtk_widget_modify_base'
Comment 1 Wouter Bolsterlee (uws) 2010-12-06 21:16:58 UTC
Confirming.
Comment 2 Diego Escalante Urrelo (not reading bugmail) 2010-12-14 19:50:31 UTC
I'm working on this.
Comment 3 Diego Escalante Urrelo (not reading bugmail) 2010-12-14 23:35:32 UTC
Created attachment 176435 [details] [review]
egg: update from master

Bug #636501
Comment 4 Diego Escalante Urrelo (not reading bugmail) 2010-12-14 23:35:36 UTC
Created attachment 176436 [details] [review]
Port to gtk+ master's GtkStyleContext

Updates all our uses of GtkStyle stuff to the newer GtkStyleContext API.
ephy-web-view porting done by Matthias Clasen <mclasen@redhat.com>

Bug #636501
Comment 5 Diego Escalante Urrelo (not reading bugmail) 2010-12-14 23:37:52 UTC
This two patches should be enough.

Notice that the code to make the location bar change color when the website is secure is not having any effect, apparently due to the fallout of GtkStyleContext. It is supposed to just work when GTK+ stabilizes.
Comment 6 Carlos Garcia Campos 2010-12-15 07:44:47 UTC
Review of attachment 176436 [details] [review]:

::: embed/ephy-web-view.c
@@ +1198,3 @@
+                    priv->text_rectangle.width,
+                    priv->text_rectangle.height);
+  gtk_style_context_restore (context);

Why do you restore the context before gtk_render_layout? I would just set the normal state, render layot and then restore the context.

::: lib/widgets/ephy-location-entry.c
@@ +156,2 @@
+	if (fg_color != NULL)
+		priv->secure_fg_color = *fg_color;

fg_color should be freed here with gdk_rgba_free()

@@ +161,2 @@
+	if (bg_color != NULL)
+		priv->secure_bg_color = *bg_color;

The same here, free bg_color

::: src/ephy-notebook.c
@@ +628,3 @@
+					GTK_STYLE_PROVIDER (provider),
+					GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+

gtk_style_context_add_provider() takes a reference, so you should unref() the provider after add_provider().
Comment 7 Diego Escalante Urrelo (not reading bugmail) 2010-12-15 14:30:27 UTC
Created attachment 176463 [details] [review]
Port to gtk+ master's GtkStyleContext

Updates all our uses of GtkStyle stuff to the newer GtkStyleContext API.
ephy-web-view porting done by Matthias Clasen <mclasen@redhat.com>

Bug #636501
Comment 8 Xan Lopez 2010-12-15 14:38:17 UTC
Review of attachment 176463 [details] [review]:

Looks good to me too, thanks for the review Carlos.
Comment 9 Diego Escalante Urrelo (not reading bugmail) 2010-12-15 14:51:11 UTC
Done! Thanks for your help Carlos :)

Attachment 176435 [details] pushed as f6ffd60 - egg: update from master
Attachment 176463 [details] pushed as 43a776e - Port to gtk+ master's GtkStyleContext
Comment 10 Cosimo Cecchi 2010-12-16 10:22:05 UTC
Review of attachment 176463 [details] [review]:

::: lib/widgets/ephy-location-entry.c
@@ +91,3 @@
 
+static const GdkRGBA fallback_bg_color = { 0, 0xf7f7, 0xf7f7, 0xbebe }; /* yellow-ish */
+static const GdkRGBA fallback_fg_color = { 0, 0, 0, 0 }; /* black */

This seems wrong to me; the bg color should be { 0xf7f7 / 65535, 0xf7f7 / 65535, 0xbebe / 65535, 1 } and black { 0, 0, 0, 1 }, as GdkRGBA uses double values in the [0, 1] interval to hold color values, and the last member is the alpha channel.
Comment 11 Cosimo Cecchi 2010-12-16 10:24:40 UTC
(In reply to comment #5)

> Notice that the code to make the location bar change color when the website is
> secure is not having any effect, apparently due to the fallout of
> GtkStyleContext. It is supposed to just work when GTK+ stabilizes.

Reopening, as this might be happening because of what I mentioned in my last comment.
Comment 12 Xan Lopez 2010-12-16 11:08:24 UTC
(In reply to comment #10)
> Review of attachment 176463 [details] [review]:
> 
> ::: lib/widgets/ephy-location-entry.c
> @@ +91,3 @@
> 
> +static const GdkRGBA fallback_bg_color = { 0, 0xf7f7, 0xf7f7, 0xbebe }; /*
> yellow-ish */
> +static const GdkRGBA fallback_fg_color = { 0, 0, 0, 0 }; /* black */
> 
> This seems wrong to me; the bg color should be { 0xf7f7 / 65535, 0xf7f7 /
> 65535, 0xbebe / 65535, 1 } and black { 0, 0, 0, 1 }, as GdkRGBA uses double
> values in the [0, 1] interval to hold color values, and the last member is the
> alpha channel.

You are right about the range values, but I've tested this and it does not seem to fix the issue. You can commit anyway.
Comment 13 Wouter Bolsterlee (uws) 2010-12-19 23:01:12 UTC
Building git master against GTK+ master still fails with this error for me:

make[4]: Entering directory `/home/uws/Projects/Gnome/Development/src/epiphany/src'
  CCLD   epiphany
./.libs/libephymain.a(libephymain_la-ephy-notebook.o): In function `tab_label_style_set_cb':
/home/uws/Projects/Gnome/Development/src/epiphany/src/ephy-notebook.c:565: undefined reference to `gtk_style_context_get_font'
../lib/widgets/.libs/libephywidgets.a(libephywidgets_la-ephy-location-entry.o): In function `favicon_create_drag_surface':
/home/uws/Projects/Gnome/Development/src/epiphany/lib/widgets/ephy-location-entry.c:794: undefined reference to `gtk_style_context_get_font'
collect2: ld returned 1 exit status
make[4]: *** [epiphany] Error 1
make[4]: Leaving directory `/home/uws/Projects/Gnome/Development/src/epiphany/src'


Any clue?
Comment 14 Diego Escalante Urrelo (not reading bugmail) 2011-01-03 21:44:23 UTC
Created attachment 177435 [details] [review]
ephy-location-entry: fix secure bg/fg colors

GdkRGBA elements are double type, also we need to pass "0" as GtkStateFlag for
the override functions, otherwise our colors are never applied.

Bug #636501
Comment 15 Diego Escalante Urrelo (not reading bugmail) 2011-01-08 14:32:43 UTC
Created attachment 177826 [details] [review]
ephy-location-entry: fix secure bg/fg colors

GdkRGBA elements are doubles. Also, we need to pass GTK_STATE_FLAG_NORMAL as
GtkStateFlag for the override functions, otherwise our colors are never
applied.

Bug #636501
Comment 16 Diego Escalante Urrelo (not reading bugmail) 2011-01-08 14:32:50 UTC
Created attachment 177827 [details] [review]
Use the new GTK_STATE_FLAG_NORMAL flag

Until 2.99.0 GtkStyleContext didn't have a "normal" flag, the closest thing was
GTK_STATE_FLAG_ACTIVE, but it is not necessarily correct.

Bug #636501
Comment 17 Diego Escalante Urrelo (not reading bugmail) 2011-01-11 01:28:04 UTC
Attachment 177827 [details] pushed as b2bbeb1 - Use the new GTK_STATE_FLAG_NORMAL flag