ocarina: Show paths in the library
Clicking them doesn't do anything yet, and the buttons are non-functional as well. But paths are displayed as they're configured! Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
aebcfaab45
commit
34dd1a1088
|
@ -9,6 +9,7 @@ using namespace std;
|
|||
|
||||
/* ocarina.cpp */
|
||||
string lib_file(const string &);
|
||||
GObject *get_object(const string &);
|
||||
GtkWidget *get_widget(const string &);
|
||||
void connect_signal(const string &, const string &, GCallback, void *);
|
||||
|
||||
|
|
|
@ -17,14 +17,14 @@ struct library_info {
|
|||
}
|
||||
};
|
||||
|
||||
class LibraryDriver : public libsaria::library::Driver {
|
||||
/*class LibraryDriver : public libsaria::library::Driver {
|
||||
public:
|
||||
void path_added(libsaria::library::Path *);
|
||||
void path_updated(libsaria::library::Path *);
|
||||
void path_removed(libsaria::library::Path *);
|
||||
};
|
||||
|
||||
static LibraryDriver driver;
|
||||
static LibraryDriver driver;*/
|
||||
static GtkListStore *path_list;
|
||||
|
||||
static struct library_info columns[] = {
|
||||
|
@ -35,12 +35,12 @@ static struct library_info columns[] = {
|
|||
|
||||
static unsigned int NUM_COLUMNS = sizeof(columns) / sizeof(library_info);
|
||||
|
||||
static bool find_path(libsaria::library::Path *path, GtkTreeIter *iter)
|
||||
/*static bool find_path(libsaria::library::Path *path, GtkTreeIter *iter)
|
||||
{
|
||||
libsaria::library::Path *list_path;
|
||||
libsaria::library::Path *list_path;*/
|
||||
|
||||
/* get_iter_first() return FALSE if the liststore is empty */
|
||||
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(path_list), iter))
|
||||
/* if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(path_list), iter))
|
||||
return false;
|
||||
|
||||
do {
|
||||
|
@ -50,9 +50,9 @@ static bool find_path(libsaria::library::Path *path, GtkTreeIter *iter)
|
|||
} while (gtk_tree_model_iter_next(GTK_TREE_MODEL(path_list), iter));
|
||||
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
void LibraryDriver::path_updated(libsaria::library::Path *path)
|
||||
/*void LibraryDriver::path_updated(libsaria::library::Path *path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
if (!find_path(path, &iter))
|
||||
|
@ -84,7 +84,7 @@ void LibraryDriver::path_removed(libsaria::library::Path *path)
|
|||
if (!find_path(path, &iter))
|
||||
return;
|
||||
gtk_list_store_remove(path_list, &iter);
|
||||
}
|
||||
}*/
|
||||
|
||||
static void on_click_add(GtkWidget *b, gpointer d)
|
||||
{
|
||||
|
|
|
@ -72,9 +72,14 @@ static gboolean timeout_poll(gpointer data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
GObject *get_object(const string &name)
|
||||
{
|
||||
return gtk_builder_get_object(builder, name.c_str());
|
||||
}
|
||||
|
||||
GtkWidget *get_widget(const string &name)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET(gtk_builder_get_object(builder, name.c_str()));
|
||||
GtkWidget *widget = GTK_WIDGET(get_object(name));
|
||||
if (!widget)
|
||||
println(name + " is not a widget!");
|
||||
return widget;
|
||||
|
|
121
xml/ocarina.xml
121
xml/ocarina.xml
|
@ -2,6 +2,18 @@
|
|||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<!-- interface-naming-policy toplevel-contextual -->
|
||||
<object class="GtkListStore" id="LibraryList">
|
||||
<columns>
|
||||
<!-- column-name Pointer -->
|
||||
<column type="gpointer"/>
|
||||
<!-- column-name Enabled -->
|
||||
<column type="gboolean"/>
|
||||
<!-- column-name Path1 -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Size -->
|
||||
<column type="guint"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="PauseAdjustment">
|
||||
<property name="upper">256</property>
|
||||
<property name="step_increment">1</property>
|
||||
|
@ -371,10 +383,115 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="model">LibraryList</property>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn1">
|
||||
<property name="title" translatable="yes">On</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererToggle" id="cellrenderertoggle1"/>
|
||||
<attributes>
|
||||
<attribute name="active">1</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn2">
|
||||
<property name="title" translatable="yes">Path</property>
|
||||
<property name="expand">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext1"/>
|
||||
<attributes>
|
||||
<attribute name="text">2</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
||||
<property name="title" translatable="yes">Size</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||
<attributes>
|
||||
<attribute name="text">3</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkVBox" id="vbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="AddLibrary">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="RefreshLibraries">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-refresh</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
Loading…
Reference in New Issue