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
=== modified file 'annotate/gannotate.py'
--- annotate/gannotate.py 2012-03-11 18:24:06 +0000
+++ annotate/gannotate.py 2012-09-02 15:01:18 +0000
@@ -279,19 +279,23 @@
279 cell.set_property("xalign", 1.0)279 cell.set_property("xalign", 1.0)
280 cell.set_property("ypad", 0)280 cell.set_property("ypad", 0)
281 cell.set_property("family", "Monospace")281 cell.set_property("family", "Monospace")
282 cell.set_property("cell-background-gdk",282 cell.set_property(
283 tv.get_style().bg[Gtk.StateType.NORMAL])283 "cell-background-rgba",
284 tv.get_style_context().get_background_color(Gtk.StateType.NORMAL))
284 col = Gtk.TreeViewColumn()285 col = Gtk.TreeViewColumn()
285 col.set_resizable(False)286 col.set_resizable(False)
286 col.pack_start(cell, True)287 col.pack_start(cell, True)
287 col.add_attribute(cell, "text", LINE_NUM_COL)288 col.add_attribute(cell, "text", LINE_NUM_COL)
288 tv.append_column(col)289 tv.append_column(col)
289290
291 style_context = self.get_style_context()
292
290 cell = Gtk.CellRendererText()293 cell = Gtk.CellRendererText()
291 cell.set_property("ypad", 0)294 cell.set_property("ypad", 0)
292 cell.set_property("ellipsize", Pango.EllipsizeMode.END)295 cell.set_property("ellipsize", Pango.EllipsizeMode.END)
293 cell.set_property("cell-background-gdk",296 cell.set_property(
294 self.get_style().bg[Gtk.StateType.NORMAL])297 "cell-background-rgba",
298 style_context.get_background_color(Gtk.StateType.NORMAL))
295 col = Gtk.TreeViewColumn("Committer")299 col = Gtk.TreeViewColumn("Committer")
296 col.set_resizable(True)300 col.set_resizable(True)
297 col.pack_start(cell, True)301 col.pack_start(cell, True)
@@ -301,8 +305,9 @@
301 cell = Gtk.CellRendererText()305 cell = Gtk.CellRendererText()
302 cell.set_property("xalign", 1.0)306 cell.set_property("xalign", 1.0)
303 cell.set_property("ypad", 0)307 cell.set_property("ypad", 0)
304 cell.set_property("cell-background-gdk",308 cell.set_property(
305 self.get_style().bg[Gtk.StateType.NORMAL])309 "cell-background-rgba",
310 style_context.get_background_color(Gtk.StateType.NORMAL))
306 col = Gtk.TreeViewColumn("Revno")311 col = Gtk.TreeViewColumn("Revno")
307 col.set_resizable(False)312 col.set_resizable(False)
308 col.pack_start(cell, True)313 col.pack_start(cell, True)
309314
=== modified file 'branchview/graphcell.py'
--- branchview/graphcell.py 2011-09-07 16:01:14 +0000
+++ branchview/graphcell.py 2012-09-02 15:01:18 +0000
@@ -90,7 +90,8 @@
90 return self._box_size90 return self._box_size
91 except AttributeError:91 except AttributeError:
92 pango_ctx = widget.get_pango_context()92 pango_ctx = widget.get_pango_context()
93 font_desc = widget.get_style().font_desc93 font_desc = widget.get_style_context().get_font(
94 Gtk.StateType.NORMAL)
94 metrics = pango_ctx.get_metrics(font_desc, None)95 metrics = pango_ctx.get_metrics(font_desc, None)
95 ascent = PANGO_PIXELS(metrics.get_ascent())96 ascent = PANGO_PIXELS(metrics.get_ascent())
96 descent = PANGO_PIXELS(metrics.get_descent())97 descent = PANGO_PIXELS(metrics.get_descent())

Subscribers

People subscribed via source and target branches

to all changes: