static void selection_made_common(GtkWidget *clist, gint row, dialog_generic_t *dptr) {
    gint n, listnum;
    gchar *name;
    int rv, chan_num;

    scope_vert_t *vert;
    /* If we get here, it should be a valid selection */
    vert = &(ctrl_usr->vert);
    chan_num = *((int *)(dptr->app_data));
    /* figure out which notebook tab it was */
    listnum = -1;
    for (n = 0; n < 3; n++) {
	if (clist == vert->lists[n]) {
	    listnum = n;
	}
    }
    /* Get the text from the list */
    gtk_clist_get_text(GTK_CLIST(clist), row, 0, &name);
    /* try to set up the new source */
    rv = set_channel_source(chan_num, listnum, name);
    if ( rv == 0 ) {
	/* set return value of dialog to indicate success */
	dptr->retval = 1;
    } else {
	/* new source invalid, return as if user hit cancel */
	dptr->retval = 2;
    }
    /* destroy window to cause dialog_generic_destroyed() to be called */
    gtk_widget_destroy(dptr->window);
    return;
}
Exemple #2
0
static char *chan_src_cmd(int src_type, char *src_name)
{
    int chan_num, rv;

    if ( deferred_channel == 0 ) {
	// changing currently active channel
	chan_num = ctrl_usr->vert.selected;
	rv = set_channel_source(chan_num, src_type, src_name);
    } else {
	// setting source for previously empty channel
	chan_num = deferred_channel;
	rv = set_channel_source(chan_num, src_type, src_name);
	if ( rv == 0 ) {
	    // got a source now, select the channel
	    return chan_cmd(&chan_num);
	}
    }
    if ( rv < 0 ) {
	return "object not found";
    }
    return NULL;
}