Merge lp:~kalikiana/midori/colorlabel into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Paweł Forysiuk
Approved revision: 6175
Merged at revision: 6179
Proposed branch: lp:~kalikiana/midori/colorlabel
Merge into: lp:midori
Diff against target: 47 lines (+29/-2)
1 file modified
midori/midori-view.c (+29/-2)
To merge this branch: bzr merge lp:~kalikiana/midori/colorlabel
Reviewer Review Type Date Requested Status
Paweł Forysiuk Approve
Review via email: mp+166142@code.launchpad.net

Commit message

Apply label color to label rather than event box

Description of the change

Apply label color to label rather than event box

To post a comment you must log in.
lp:~kalikiana/midori/colorlabel updated
6174. By Cris Dywan

Document the way the label for coloring is composed

6175. By Cris Dywan

With GTK+2 background colors need to be set on the event box

Revision history for this message
Paweł Forysiuk (tuxator) wrote :

Works properly now. Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-view.c'
2--- midori/midori-view.c 2013-05-23 21:25:46 +0000
3+++ midori/midori-view.c 2013-05-28 23:16:25 +0000
4@@ -5903,15 +5903,42 @@
5 GdkColor* fg_color,
6 GdkColor* bg_color)
7 {
8+ /*
9+ The proxy tab label is what's put in the notebook,
10+ in all known cases a GtkEventBox
11+ Contained can be a GtkLabel or a GtkBox including a GtkLabel
12+ Granite as of this writing uses a GtkLabel (which may change)
13+ */
14+ GtkWidget* event_box = midori_view_get_proxy_tab_label (view);
15+ GtkWidget* label = gtk_bin_get_child (GTK_BIN (event_box));
16+
17+ if (GTK_IS_BOX (label))
18+ {
19+ GList* children = gtk_container_get_children (GTK_CONTAINER (label));
20+ for (; children != NULL; children = g_list_next (children))
21+ if (GTK_IS_LABEL (children->data))
22+ {
23+ label = children->data;
24+ break;
25+ }
26+ g_list_free (children);
27+ }
28+
29 midori_tab_set_fg_color (MIDORI_TAB (view), fg_color);
30 midori_tab_set_bg_color (MIDORI_TAB (view), bg_color);
31
32- GtkWidget* label = midori_view_get_proxy_tab_label (view);
33- gtk_event_box_set_visible_window (GTK_EVENT_BOX (label),
34+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (event_box),
35 fg_color != NULL || bg_color != NULL);
36+
37 gtk_widget_modify_fg (label, GTK_STATE_NORMAL, fg_color);
38 gtk_widget_modify_fg (label, GTK_STATE_ACTIVE, fg_color);
39+
40+ #if GTK_CHECK_VERSION (3, 0, 0)
41 gtk_widget_modify_bg (label, GTK_STATE_NORMAL, bg_color);
42 gtk_widget_modify_bg (label, GTK_STATE_ACTIVE, bg_color);
43+ #else
44+ gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, bg_color);
45+ gtk_widget_modify_bg (event_box, GTK_STATE_ACTIVE, bg_color);
46+ #endif
47 }
48

Subscribers

People subscribed via source and target branches

to all changes: