~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tidying and docs
[disorder]
/
disobedience
/
choose.c
diff --git
a/disobedience/choose.c
b/disobedience/choose.c
index
cf22eaf
..
f13362a
100644
(file)
--- a/
disobedience/choose.c
+++ b/
disobedience/choose.c
@@
-48,7
+48,8
@@
struct displaydata {
};
/* instantiate the node vector type */
};
/* instantiate the node vector type */
-VECTOR_TYPE(nodevector, struct choosenode *, xrealloc)
+
+VECTOR_TYPE(nodevector, struct choosenode *, xrealloc);
struct choosenode {
struct choosenode *parent; /* parent node */
struct choosenode {
struct choosenode *parent; /* parent node */
@@
-137,17
+138,24
@@
static void clicked_choosenode(GtkWidget attribute((unused)) *widget,
gpointer user_data);
static void activate_play(GtkMenuItem *menuitem, gpointer user_data);
gpointer user_data);
static void activate_play(GtkMenuItem *menuitem, gpointer user_data);
+#if 0
static void activate_remove(GtkMenuItem *menuitem, gpointer user_data);
static void activate_remove(GtkMenuItem *menuitem, gpointer user_data);
+#endif
static void activate_properties(GtkMenuItem *menuitem, gpointer user_data);
static gboolean sensitive_play(struct choosenode *cn);
static void activate_properties(GtkMenuItem *menuitem, gpointer user_data);
static gboolean sensitive_play(struct choosenode *cn);
+#if 0
static gboolean sensitive_remove(struct choosenode *cn);
static gboolean sensitive_remove(struct choosenode *cn);
+#endif
static gboolean sensitive_properties(struct choosenode *cn);
static struct menuitem menuitems[] = {
static gboolean sensitive_properties(struct choosenode *cn);
static struct menuitem menuitems[] = {
- { "Play", activate_play, sensitive_play, 0, 0 },
+ { "Play track", activate_play, sensitive_play, 0, 0 },
+#if 0
+ /* Not implemented yet */
{ "Remove", activate_remove, sensitive_remove, 0, 0 },
{ "Remove", activate_remove, sensitive_remove, 0, 0 },
- { "Properties", activate_properties, sensitive_properties, 0, 0 },
+#endif
+ { "Track properties", activate_properties, sensitive_properties, 0, 0 },
};
#define NMENUITEMS (int)(sizeof menuitems / sizeof *menuitems)
};
#define NMENUITEMS (int)(sizeof menuitems / sizeof *menuitems)
@@
-426,7
+434,7
@@
static void fill_search_node(struct choosenode *cn) {
D(("fill_search_node %s", cn->path));
/* We depend on the search results being sorted as by compare_path(). */
D(("fill_search_node %s", cn->path));
/* We depend on the search results being sorted as by compare_path(). */
- c
n->children.nvec = 0
;
+ c
lear_children(cn)
;
for(n = 0; n < nsearchresults; ++n) {
/* We only care about descendants of CN */
if(!is_descendant(cn->path, searchresults[n]))
for(n = 0; n < nsearchresults; ++n) {
/* We only care about descendants of CN */
if(!is_descendant(cn->path, searchresults[n]))
@@
-589,7
+597,9
@@
static void redisplay_tree(void) {
files_selected = 0;
files_visible = 0;
/* Correct the layout and find out how much space it uses */
files_selected = 0;
files_visible = 0;
/* Correct the layout and find out how much space it uses */
+ MTAG_PUSH("display_tree");
d = display_tree(root, 0, 0);
d = display_tree(root, 0, 0);
+ MTAG_POP();
/* We must set the total size or scrolling will not work (it wouldn't be hard
* for GtkLayout to figure it out for itself but presumably you're supposed
* to be able to have widgets off the edge of the layuot.)
/* We must set the total size or scrolling will not work (it wouldn't be hard
* for GtkLayout to figure it out for itself but presumably you're supposed
* to be able to have widgets off the edge of the layuot.)
@@
-623,6
+633,7
@@
static struct displaydata display_tree(struct choosenode *cn, int x, int y) {
* A non-expandable item has just a text label and no arrow.
*/
if(!cn->container) {
* A non-expandable item has just a text label and no arrow.
*/
if(!cn->container) {
+ MTAG_PUSH("make_widgets_1");
/* Widgets need to be created */
NW(hbox);
cn->hbox = gtk_hbox_new(FALSE, 1);
/* Widgets need to be created */
NW(hbox);
cn->hbox = gtk_hbox_new(FALSE, 1);
@@
-639,6
+650,8
@@
static struct displaydata display_tree(struct choosenode *cn, int x, int y) {
cn->marker = gtk_image_new_from_pixbuf(pb);
}
}
cn->marker = gtk_image_new_from_pixbuf(pb);
}
}
+ MTAG_POP();
+ MTAG_PUSH("make_widgets_2");
NW(label);
cn->label = gtk_label_new(cn->display);
if(cn->arrow)
NW(label);
cn->label = gtk_label_new(cn->display);
if(cn->arrow)
@@
-646,6
+659,8
@@
static struct displaydata display_tree(struct choosenode *cn, int x, int y) {
gtk_container_add(GTK_CONTAINER(cn->hbox), cn->label);
if(cn->marker)
gtk_container_add(GTK_CONTAINER(cn->hbox), cn->marker);
gtk_container_add(GTK_CONTAINER(cn->hbox), cn->label);
if(cn->marker)
gtk_container_add(GTK_CONTAINER(cn->hbox), cn->marker);
+ MTAG_POP();
+ MTAG_PUSH("make_widgets_3");
NW(event_box);
cn->container = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(cn->container), cn->hbox);
NW(event_box);
cn->container = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(cn->container), cn->hbox);
@@
-658,6
+673,7
@@
static struct displaydata display_tree(struct choosenode *cn, int x, int y) {
gtk_widget_set_name(cn->container, "choose");
/* Show everything by default */
gtk_widget_show_all(cn->container);
gtk_widget_set_name(cn->container, "choose");
/* Show everything by default */
gtk_widget_show_all(cn->container);
+ MTAG_POP();
}
assert(cn->container);
/* Make sure the icon is right */
}
assert(cn->container);
/* Make sure the icon is right */
@@
-675,6
+691,8
@@
static struct displaydata display_tree(struct choosenode *cn, int x, int y) {
else {
gtk_layout_put(GTK_LAYOUT(chooselayout), cn->container, x, y);
cn->flags |= CN_DISPLAYED;
else {
gtk_layout_put(GTK_LAYOUT(chooselayout), cn->container, x, y);
cn->flags |= CN_DISPLAYED;
+ /* Now chooselayout has a ref to the container */
+ g_object_unref(cn->container);
}
/* Set the widget's selection status */
if(!(cn->flags & CN_EXPANDABLE))
}
/* Set the widget's selection status */
if(!(cn->flags & CN_EXPANDABLE))
@@
-903,10
+921,12
@@
static void activate_play(GtkMenuItem attribute((unused)) *menuitem,
disorder_eclient_play(client, tracks[n], 0, 0);
}
disorder_eclient_play(client, tracks[n], 0, 0);
}
+#if 0
static void activate_remove(GtkMenuItem attribute((unused)) *menuitem,
gpointer attribute((unused)) user_data) {
/* TODO remove all selected tracks */
}
static void activate_remove(GtkMenuItem attribute((unused)) *menuitem,
gpointer attribute((unused)) user_data) {
/* TODO remove all selected tracks */
}
+#endif
static void activate_properties(GtkMenuItem attribute((unused)) *menuitem,
gpointer attribute((unused)) user_data) {
static void activate_properties(GtkMenuItem attribute((unused)) *menuitem,
gpointer attribute((unused)) user_data) {
@@
-920,9
+940,11
@@
static gboolean sensitive_play(struct choosenode attribute((unused)) *cn) {
return !!files_selected;
}
return !!files_selected;
}
+#if 0
static gboolean sensitive_remove(struct choosenode attribute((unused)) *cn) {
return FALSE; /* not implemented yet */
}
static gboolean sensitive_remove(struct choosenode attribute((unused)) *cn) {
return FALSE; /* not implemented yet */
}
+#endif
static gboolean sensitive_properties(struct choosenode attribute((unused)) *cn) {
return !!files_selected;
static gboolean sensitive_properties(struct choosenode attribute((unused)) *cn) {
return !!files_selected;