Commit 1cce4d0d authored by Kai Willadsen's avatar Kai Willadsen

Avoid some GTK+ warnings by ensuring a style is set on required widgets

parent bbcf9904
......@@ -42,6 +42,7 @@ class DiffMap(gtk.DrawingArea):
self._h_offset = 0
self._scroll_y = 0
self._scroll_height = 0
self._setup = False
def setup(self, scrollbar, change_chunk_fn, color_map):
for (o, h) in self._handlers:
......@@ -50,6 +51,7 @@ class DiffMap(gtk.DrawingArea):
self._scrolladj = scrollbar.get_adjustment()
self.on_scrollbar_style_set(scrollbar, None)
self.on_scrollbar_size_allocate(scrollbar, scrollbar.allocation)
scrollbar.ensure_style()
scroll_style_hid = scrollbar.connect("style-set",
self.on_scrollbar_style_set)
scroll_size_hid = scrollbar.connect("size-allocate",
......@@ -64,6 +66,7 @@ class DiffMap(gtk.DrawingArea):
(self._scrolladj, adj_val_hid)]
self._difffunc = change_chunk_fn
self.set_color_scheme(color_map)
self._setup = True
self.queue_draw()
def set_color_scheme(self, color_map):
......@@ -94,6 +97,8 @@ class DiffMap(gtk.DrawingArea):
self.queue_draw()
def do_expose_event(self, event):
if not self._setup:
return
height = self._scroll_height - self._h_offset - 1
y_start = self._scroll_y - self.allocation.y + self._y_offset + 1
xpad = self.style_get_property('x-padding')
......
......@@ -289,8 +289,9 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
"diffmap", "linkmap", "msgarea_mgr",
"vbox"])
self.widget.connect("style-set", self.on_style_set)
self.widget.ensure_style()
self.on_style_set(self.widget, None)
self.widget.connect("style-set", self.on_style_set)
self.custom_labels = []
self.set_num_panes(num_panes)
......
......@@ -248,8 +248,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self.actiongroup.add_toggle_actions(toggle_actions)
self.findbar = findbar.FindBar(self.table)
self.widget.connect("style-set", self.on_style_set)
self.widget.ensure_style()
self.on_style_set(self.widget, None)
self.widget.connect("style-set", self.on_style_set)
self.set_num_panes(num_panes)
gobject.idle_add( lambda *args: self.load_font()) # hack around Bug 316730
......
......@@ -61,6 +61,7 @@ class MsgArea(gtk.HBox):
# widgets, not on the message area itself, since gtk does
# not deliver any further style-set signals for a widget on
# which the style has been forced with gtk_widget_set_style()
self.__main_hbox.ensure_style()
self.__main_hbox.connect("style-set", self.__on_style_set)
self.add_buttons(buttons)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment