typedef struct _ChimaraBrowserPrivate {
GtkActionGroup *action_group;
+ GtkListStore *library_model;
} ChimaraBrowserPrivate;
#define CHIMARA_BROWSER_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), CHIMARA_TYPE_BROWSER, ChimaraBrowserPrivate))
{
CHIMARA_BROWSER_USE_PRIVATE;
g_object_unref(priv->action_group);
+ g_object_unref(priv->library_model);
/* Chain up */
G_OBJECT_CLASS(chimara_browser_parent_class)->finalize(self);
/* Build user interface */
char *object_ids[] = {
"browser_group",
+ "browser-box",
+ "library-model",
NULL
};
GtkBuilder *builder = new_builder_with_objects(object_ids);
gtk_ui_manager_insert_action_group(uimanager, chimara_app_get_action_group(theapp), 1);
GtkWidget *menubar = gtk_ui_manager_get_widget(uimanager, "/browser_menu");
GtkWidget *toolbar = gtk_ui_manager_get_widget(uimanager, "/browser_toolbar");
- GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
+ GtkWidget *vbox = GTK_WIDGET(load_object(builder, "browser-box"));
gtk_container_add(GTK_CONTAINER(self), vbox);
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
+ priv->library_model = GTK_LIST_STORE(load_object(builder, "library-model"));
+ g_object_ref(priv->library_model);
+
+ /* Make up some fake library data */
+ GdkPixbuf *fake_cover_art = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, 120, 120);
+ gdk_pixbuf_fill(fake_cover_art, 0xA4000000);
+ GtkTreeIter iter;
+ gtk_list_store_append(priv->library_model, &iter);
+ gtk_list_store_set(priv->library_model, &iter,
+ 0, "IFID-02343-234213D-23423",
+ 1, "The Great Nose Picker",
+ 2, "Hank Berriman",
+ 3, 2004,
+ 4, fake_cover_art,
+ -1);
+ gdk_pixbuf_unref(fake_cover_art);
+
g_signal_connect(self, "delete-event", G_CALLBACK(on_browser_delete_event), NULL);
g_object_unref(uimanager);
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkVBox" id="browser-box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkTreeView" id="library-view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">library-model</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="library-text-column">
+ <property name="title" translatable="yes">Text</property>
+ <property name="expand">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="library-cover-art-column">
+ <property name="fixed_width">120</property>
+ <property name="title" translatable="yes">Cover art</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="library-cover-art-renderer"/>
+ <attributes>
+ <attribute name="pixbuf">4</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
<object class="GtkListStore" id="interpreters">
<columns>
<!-- column-name Format -->
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="library-model">
+ <columns>
+ <!-- column-name ifid -->
+ <column type="gchararray"/>
+ <!-- column-name title -->
+ <column type="gchararray"/>
+ <!-- column-name author -->
+ <column type="gchararray"/>
+ <!-- column-name firstpublished -->
+ <column type="guint"/>
+ <!-- column-name coverart -->
+ <column type="GdkPixbuf"/>
+ </columns>
+ </object>
<object class="GtkVBox" id="player-vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>