gtkplacesidebar: use GtkListBox

We were using GTkTreeView in a simple list. Also, as we know,
GtkCellRenderers are not the best way to theme and manipulate
widgets.

So instead use a GtkListBox to modernize the GtkPlacesSidebar,
and in the way clean up some parts of the code (like headings)
which were not used anymore.
Also we don't use a model anymore, since the data is simple
enough to manage it in a subclass of the row itself.
This commit is contained in:
Carlos Soriano
2015-05-06 23:07:17 +02:00
parent d881b15349
commit fbbad5deec
10 changed files with 2349 additions and 2147 deletions

86
gtk/ui/gtksidebarrow.ui Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkSidebarRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="margin-top">1</property>
<property name="margin-bottom">1</property>
<child>
<object class="GtkRevealer" id="revealer">
<property name="visible">True</property>
<property name="reveal-child">True</property>
<signal name="notify::child-revealed" handler="on_child_revealed"/>
<style>
<class name="sidebar-revealer"/>
</style>
<child>
<object class="GtkEventBox" id="event_box">
<property name="visible">True</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<child>
<object class="GtkImage" id="icon_widget">
<property name="visible">True</property>
<style>
<class name="sidebar-icon"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_widget">
<property name="visible">True</property>
<style>
<class name="sidebar-label"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="eject_button">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">4px</property>
<property name="no-show-all">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon_name">media-eject-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
<style>
<class name="image-button"/>
<class name="sidebar-button"/>
</style>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
<!-- We need it to not make the row smaller when the eject button is hidden -->
<object class="GtkSizeGroup">
<property name="mode">GTK_SIZE_GROUP_VERTICAL</property>
<widgets>
<widget name="eject_button"/>
<widget name="label_widget"/>
<widget name="icon_widget"/>
</widgets>
</object>
</interface>