Merge lp:~sinzui/bzr-gtk/get_style_context into lp:bzr-gtk

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 795
Proposed branch: lp:~sinzui/bzr-gtk/get_style_context
Merge into: lp:bzr-gtk
Diff against target: 57 lines (+13/-7)
2 files modified
annotate/gannotate.py (+11/-6)
branchview/graphcell.py (+2/-1)
To merge this branch: bzr merge lp:~sinzui/bzr-gtk/get_style_context
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+122411@code.launchpad.net

Description of the change

bzr gannotate fails to start using Gtk 3.4 as provided by quantal. The get_style() method and the GtkStyle object are deprecated. Most of the calls were fixed earlier this year, but a few remain and now must be removed. Per the previous fixes, get_style() becomes get_style_context(). The new object uses methods instead of properties. Also note that 'cell-background-gdk' was replaced with 'cell-background-rgba' It is a simple mechanical change that fixes the only issues I have encountered with bzr-gtk on quantal.

While this branch did fix most of the test suite and all of the issue I see running bzr-gtk tip, there are two test failures that relate to fonts. Fonts in quantal are broken at the moment, there are warnings shown on the command line for all gtk apps that this moment. There are two errors and I am confident that one will be fixed with quantal is fixed. There is an error about setting the monospace font in the DiffView is confusing. The test says the font was not set, but I can see it was. I tried re writing both the test and how the font was set, but there is no change. We may want to consider deleting the assert if the issue is not resolved for quantal.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks Curtis.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'annotate/gannotate.py'
2--- annotate/gannotate.py 2012-03-11 18:24:06 +0000
3+++ annotate/gannotate.py 2012-09-02 15:01:18 +0000
4@@ -279,19 +279,23 @@
5 cell.set_property("xalign", 1.0)
6 cell.set_property("ypad", 0)
7 cell.set_property("family", "Monospace")
8- cell.set_property("cell-background-gdk",
9- tv.get_style().bg[Gtk.StateType.NORMAL])
10+ cell.set_property(
11+ "cell-background-rgba",
12+ tv.get_style_context().get_background_color(Gtk.StateType.NORMAL))
13 col = Gtk.TreeViewColumn()
14 col.set_resizable(False)
15 col.pack_start(cell, True)
16 col.add_attribute(cell, "text", LINE_NUM_COL)
17 tv.append_column(col)
18
19+ style_context = self.get_style_context()
20+
21 cell = Gtk.CellRendererText()
22 cell.set_property("ypad", 0)
23 cell.set_property("ellipsize", Pango.EllipsizeMode.END)
24- cell.set_property("cell-background-gdk",
25- self.get_style().bg[Gtk.StateType.NORMAL])
26+ cell.set_property(
27+ "cell-background-rgba",
28+ style_context.get_background_color(Gtk.StateType.NORMAL))
29 col = Gtk.TreeViewColumn("Committer")
30 col.set_resizable(True)
31 col.pack_start(cell, True)
32@@ -301,8 +305,9 @@
33 cell = Gtk.CellRendererText()
34 cell.set_property("xalign", 1.0)
35 cell.set_property("ypad", 0)
36- cell.set_property("cell-background-gdk",
37- self.get_style().bg[Gtk.StateType.NORMAL])
38+ cell.set_property(
39+ "cell-background-rgba",
40+ style_context.get_background_color(Gtk.StateType.NORMAL))
41 col = Gtk.TreeViewColumn("Revno")
42 col.set_resizable(False)
43 col.pack_start(cell, True)
44
45=== modified file 'branchview/graphcell.py'
46--- branchview/graphcell.py 2011-09-07 16:01:14 +0000
47+++ branchview/graphcell.py 2012-09-02 15:01:18 +0000
48@@ -90,7 +90,8 @@
49 return self._box_size
50 except AttributeError:
51 pango_ctx = widget.get_pango_context()
52- font_desc = widget.get_style().font_desc
53+ font_desc = widget.get_style_context().get_font(
54+ Gtk.StateType.NORMAL)
55 metrics = pango_ctx.get_metrics(font_desc, None)
56 ascent = PANGO_PIXELS(metrics.get_ascent())
57 descent = PANGO_PIXELS(metrics.get_descent())

Subscribers

People subscribed via source and target branches

to all changes: