X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/e1d4a32b103161e3b3ec51c0895f2ca88413078f..8f763f1bcd527d7f2bb27a3bf3677571c8ffd2d9:/disobedience/choose.c diff --git a/disobedience/choose.c b/disobedience/choose.c index 1cd4500..cc9f3ac 100644 --- a/disobedience/choose.c +++ b/disobedience/choose.c @@ -48,7 +48,8 @@ struct displaydata { }; /* instantiate the node vector type */ -VECTOR_TYPE(nodevector, struct choosenode *, xrealloc) + +VECTOR_TYPE(nodevector, struct choosenode *, xrealloc); struct choosenode { struct choosenode *parent; /* parent node */ @@ -632,7 +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) { - MTAG_PUSH("make_widgets"); + MTAG_PUSH("make_widgets_1"); /* Widgets need to be created */ NW(hbox); cn->hbox = gtk_hbox_new(FALSE, 1); @@ -649,6 +650,8 @@ static struct displaydata display_tree(struct choosenode *cn, int x, int y) { 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) @@ -656,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); + 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); @@ -686,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; + /* Now chooselayout has a ref to the container */ + g_object_unref(cn->container); } /* Set the widget's selection status */ if(!(cn->flags & CN_EXPANDABLE)) @@ -930,7 +937,8 @@ static void activate_properties(GtkMenuItem attribute((unused)) *menuitem, } static gboolean sensitive_play(struct choosenode attribute((unused)) *cn) { - return !!files_selected; + return (!!files_selected + && (disorder_eclient_state(client) & DISORDER_CONNECTED)); } #if 0 @@ -940,13 +948,13 @@ static gboolean sensitive_remove(struct choosenode attribute((unused)) *cn) { #endif static gboolean sensitive_properties(struct choosenode attribute((unused)) *cn) { - return !!files_selected; + return !!files_selected && (disorder_eclient_state(client) & DISORDER_CONNECTED); } /* Main menu plumbing ------------------------------------------------------ */ static int choose_properties_sensitive(GtkWidget attribute((unused)) *w) { - return !!files_selected; + return !!files_selected && (disorder_eclient_state(client) & DISORDER_CONNECTED); } static int choose_selectall_sensitive(GtkWidget attribute((unused)) *w) {