Esempio n. 1
0
void SelectJackControlPgm::on_starter_changed() {
    Gtk::TreeModel::iterator i = startercombo->get_active();
    if (!i) {
	return;
    }
    Glib::ustring s;
    i->get_value(2,s);
    description->set_markup(s);
    i->get_value(1, s);
    if (s == "other") {
	customstarter->show();
    } else {
	customstarter->hide();
    }
}
Esempio n. 2
0
JSBool
JSTreeView::getPropertySwitch(NATIVE & theNative, unsigned long theID,
        JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
    switch (theID) {
        case PROP_selected_row:
            try {
                Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = theNative.get_selection();
                Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
                if (iter) {
                    asl::Ptr<Gtk::TreeIter> myRow = asl::Ptr<Gtk::TreeIter>(new Gtk::TreeIter(iter));
                    *vp = as_jsval(cx, myRow, myRow.get());

                } else {
                    *vp = JSVAL_NULL;
                }
                return JS_TRUE;
            } HANDLE_CPP_EXCEPTION;
        case PROP_selected_row_values:
            try {
                Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = theNative.get_selection();
                Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
                if (iter) {
                    int myColCount = theNative.get_model()->get_n_columns();
                    vector<Glib::ustring> myStrings;
                    for (int i=1; i < myColCount; ++i) {
                        Glib::ustring myValue;
                        iter->get_value(i, myValue);
                        myStrings.push_back(myValue);
                    }
                    *vp = as_jsval(cx, myStrings);
                } else {
                    *vp = JSVAL_NULL;
                }
                return JS_TRUE;
            } HANDLE_CPP_EXCEPTION;
        case PROP_column_count:
            *vp = as_jsval(cx, theNative.get_columns().size());
            return JS_TRUE;
        case PROP_headers_visible:
            *vp = as_jsval(cx, theNative.get_headers_visible());
            return JS_TRUE;
        case PROP_signal_cursor_changed:
            {
            JSSignalProxy0<void>::OWNERPTR mySignal( new
                JSSignalProxy0<void>::NATIVE(theNative.signal_cursor_changed()));
            *vp = jslib::as_jsval(cx, mySignal);
            }
            return JS_TRUE;
        default:
            return JSBASE::getPropertySwitch(theNative, theID, cx, obj, id, vp);
    }
}
void EntityChooser::onSelectionChanged()
{
	// Prepare to check for a selection
	Gtk::TreeModel::iterator iter = _selection->get_selected();

	if (iter)
	{
		_selectedEntityName = iter->get_value(_listColumns.name);
	}
	else
	{
		_selectedEntityName.clear();
	}
}
  void ArtistsWidget::on_itemClick(Gtk::TreeModel::Path p) {
    Gtk::TreeModel::iterator i = treeModel->get_iter(p);
    Glib::ustring s;
    int isArtist;

    MPD::Song* song;
    i->get_value(0, s);
    i->get_value(2, isArtist);
    i->get_value(3, song);



    // if is artist, load artist's songs
    if (isArtist == 1) {
      loadArtistsSongs(s.c_str());
    } else if (isArtist == 0) {
      // add to queue and play
      MPD::Client::GetInstance()->AddSong(*song, MPD::Client::GetInstance()->GetPlaylistLength());
      MPD::Client::GetInstance()->Play(MPD::Client::GetInstance()->GetPlaylistLength());
    } else {
      loadArtists();
    }

  }
Esempio n. 5
0
void NewModelClassBox::on_apply()
{
    vpz::Classes& classes = mModeling->vpz().project().classes();

    std::string class_name = mEntryClassName->get_text();
    boost::trim(class_name);

    if (class_name.empty() || classes.exist(class_name)) {
        Error(_("Enter a VALID class name."));
        return;
    }

    Gtk::TreeModel::iterator iter = mComboTypeModel->get_active();
    if (not iter) {
        Error(_("Choose a model type."));
        return;
    }
    std::string model_type = iter->get_value(mColumns.m_col_type);

    std::string model_name = mEntryModelName->get_text();
    boost::trim(model_name);
    if (model_name.empty()) {
        Error(_("Enter a model name."));
        return;
    }

    vpz::Class& new_class = classes.add(class_name);
    if (model_type == "Atomic") {
        vpz::BaseModel* model = new vpz::AtomicModel(model_name, NULL);
        new_class.setModel(model);
    } else {
        new_class.setModel(new vpz::CoupledModel(model_name, NULL));
    }

    mGVLE->redrawModelClassBox();
    mDialog->hide_all();
}