Add icons to outline visuals in tree views

Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
TheJackiMonster 2022-11-01 02:03:16 +01:00
parent 43a9462840
commit d3a2e7f907
No known key found for this signature in database
GPG key ID: D850A5F772E880F9
4 changed files with 35 additions and 0 deletions

View file

@ -63,8 +63,14 @@ class EditorView:
outlineItem.load(False)
if type(outlineItem) is OutlineFolder:
icon = "folder-symbolic"
for item in outlineItem:
self.__appendOutlineItem(item, tree_iter)
elif type(outlineItem) is OutlineText:
icon = "emblem-documents-symbolic"
else:
icon = "folder-documents-symbolic"
wordCount = validInt(outlineItem.textCount())
goal = validInt(outlineItem.goalCount())
@ -83,6 +89,7 @@ class EditorView:
self.outlineStore.set_value(tree_iter, 5, wordCount)
self.outlineStore.set_value(tree_iter, 6, goal)
self.outlineStore.set_value(tree_iter, 7, progress)
self.outlineStore.set_value(tree_iter, 8, icon)
def refreshOutlineStore(self):
self.outlineStore.clear()

View file

@ -148,8 +148,14 @@ class OutlineView:
outlineItem.load(False)
if type(outlineItem) is OutlineFolder:
icon = "folder-symbolic"
for item in outlineItem:
self.__appendOutlineItem(item, tree_iter)
elif type(outlineItem) is OutlineText:
icon = "emblem-documents-symbolic"
else:
icon = "folder-documents-symbolic"
wordCount = validInt(outlineItem.textCount())
goal = validInt(outlineItem.goalCount())
@ -168,6 +174,7 @@ class OutlineView:
self.outlineStore.set_value(tree_iter, 5, wordCount)
self.outlineStore.set_value(tree_iter, 6, goal)
self.outlineStore.set_value(tree_iter, 7, progress)
self.outlineStore.set_value(tree_iter, 8, icon)
def refreshOutlineStore(self):
self.outlineStore.clear()

View file

@ -56,6 +56,8 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<column type="gulong"/>
<!-- column-name progress -->
<column type="gint"/>
<!-- column-name icon -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="status_store">
@ -98,6 +100,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<property name="can-focus">True</property>
<property name="model">outline_store</property>
<property name="headers-visible">False</property>
<property name="enable-tree-lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="outline_selection"/>
</child>
@ -105,6 +108,9 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<object class="GtkTreeViewColumn">
<child>
<object class="GtkCellRendererPixbuf"/>
<attributes>
<attribute name="icon-name">8</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText"/>
@ -290,6 +296,7 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="model">outline_store</property>
<property name="enable-tree-lines">True</property>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
@ -299,6 +306,12 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<property name="min-width">50</property>
<property name="title" translatable="yes">Title</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererPixbuf"/>
<attributes>
<attribute name="icon-name">8</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText">
<property name="editable">True</property>

View file

@ -65,6 +65,8 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<column type="gulong"/>
<!-- column-name progress -->
<column type="gint"/>
<!-- column-name icon -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkTreeModelFilter" id="filtered_outline_store">
@ -279,6 +281,12 @@ along with Manuskript. If not, see <http://www.gnu.org/licenses/>.
<property name="min-width">50</property>
<property name="title" translatable="yes">Title</property>
<property name="expand">True</property>
<child>
<object class="GtkCellRendererPixbuf"/>
<attributes>
<attribute name="icon-name">8</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererText">
<property name="editable">True</property>