Commit 85011d5c authored by Kai Willadsen's avatar Kai Willadsen

Pack FileDiff file selectors into a box to allow for future replacement

Different file selectors (i.e., history based or similar) will need a
different selector, but repacking things in the table is messy, and
plays havoc with keeping consistent column sizing. This commit adds
currently-unused HBoxes around the file selectors, and sticks them in
a size group to ensure that we get consistent column sizes.
parent e7051c49
......@@ -117,10 +117,20 @@
<placeholder/>
</child>
<child>
<object class="HistoryFileEntry" id="fileentry2">
<object class="GtkHBox" id="selector_hbox2">
<property name="visible">True</property>
<property name="history-id">fileentry</property>
<signal handler="on_fileentry_activate" name="activate"/>
<property name="can_focus">False</property>
<child>
<object class="HistoryFileEntry" id="fileentry2">
<property name="visible">True</property>
<property name="history-id">fileentry</property>
<signal handler="on_fileentry_activate" name="activate"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">5</property>
......@@ -130,10 +140,20 @@
</packing>
</child>
<child>
<object class="HistoryFileEntry" id="fileentry1">
<object class="GtkHBox" id="selector_hbox1">
<property name="visible">True</property>
<property name="history-id">fileentry</property>
<signal handler="on_fileentry_activate" name="activate"/>
<property name="can_focus">False</property>
<child>
<object class="HistoryFileEntry" id="fileentry1">
<property name="visible">True</property>
<property name="history-id">fileentry</property>
<signal handler="on_fileentry_activate" name="activate"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">3</property>
......@@ -143,10 +163,20 @@
</packing>
</child>
<child>
<object class="HistoryFileEntry" id="fileentry0">
<object class="GtkHBox" id="selector_hbox0">
<property name="visible">True</property>
<property name="history-id">fileentry</property>
<signal handler="on_fileentry_activate" name="activate"/>
<property name="can_focus">False</property>
<child>
<object class="HistoryFileEntry" id="fileentry0">
<property name="visible">True</property>
<property name="history-id">fileentry</property>
<signal handler="on_fileentry_activate" name="activate"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
......
......@@ -158,7 +158,18 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
"""
melddoc.MeldDoc.__init__(self, prefs)
gnomeglade.Component.__init__(self, paths.ui_dir("filediff.ui"), "filediff")
self.map_widgets_into_lists(["textview", "fileentry", "diffmap", "scrolledwindow", "linkmap", "statusimage", "msgarea_mgr", "vbox"])
self.map_widgets_into_lists(["textview", "fileentry", "diffmap",
"scrolledwindow", "linkmap",
"statusimage", "msgarea_mgr", "vbox",
"selector_hbox"])
# This SizeGroup isn't actually necessary for FileDiff; it's for
# handling non-homogenous selectors in FileComp. It's also fragile.
column_sizes = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
column_sizes.set_ignore_hidden(True)
for widget in self.selector_hbox:
column_sizes.add_widget(widget)
self.warned_bad_comparison = False
# Some sourceviews bind their own undo mechanism, which we replace
gtk.binding_entry_remove(srcviewer.GtkTextView, gtk.keysyms.z,
......@@ -1576,12 +1587,14 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
toshow = self.scrolledwindow[:n] + self.fileentry[:n]
toshow += self.vbox[:n] + self.msgarea_mgr[:n]
toshow += self.linkmap[:n-1] + self.diffmap[:n]
toshow += self.selector_hbox[:n]
for widget in toshow:
widget.show()
tohide = self.statusimage + self.scrolledwindow[n:] + self.fileentry[n:]
tohide += self.vbox[n:] + self.msgarea_mgr[n:]
tohide += self.linkmap[n-1:] + self.diffmap[n:]
tohide += self.selector_hbox[n:]
for widget in tohide:
widget.hide()
......
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