std::shared_ptr<quad_model_image_web_view> process(const std::string & verb, const std::string & id, const std::string & action, const std::string & view) { if( "GET" == verb ) { if( "view" == action ) { auto ptr = std::make_shared<quad_model_image_web_view>(); ptr->set_model(static_cast<quad_model*>(_controler.get_model())); return ptr; } else if( "incr" == action ) { _controler.increase_radius(); auto ptr = std::make_shared<quad_model_image_web_view>(); ptr->set_model(static_cast<quad_model*>(_controler.get_model())); return ptr; } else if( "decr" == action ) { _controler.decrease_radius(); auto ptr = std::make_shared<quad_model_image_web_view>(); ptr->set_model(static_cast<quad_model*>(_controler.get_model())); return ptr; } } }
void set_object_models(std::vector<object_model_features_t> &obj_models) { object_model_features_t obj_class; /* 0) sedan */ set_model(obj_class, 0, (char *)"car", 1.8, 4.4, 1.4, 1.0, 0.0, 0.8); obj_models.push_back(obj_class); /* 11) bike/motorbike 1 */ set_model(obj_class, 11, (char *)"bike", 0.7, 2.2, 1.4, 0.0, 1.0, 1.0); obj_models.push_back(obj_class); /* 21) small truck */ set_model(obj_class, 21, (char *)"truck", 2.2, 6.8, 2.6, 0.5, 0.5, 1.0); obj_models.push_back(obj_class); /* 31) bus (average estimative) */ set_model(obj_class, 31, (char *)"bus", 2.9, 12.6, 3.5, 1.0, 1.0, 0.0); obj_models.push_back(obj_class); /* 41) pedestrian 1 */ set_model(obj_class, 41, (char *)"pedestrian", 0.6, 0.6, 1.7, 0.0, 1.0, 0.0); obj_models.push_back(obj_class); num_of_models = int(obj_models.size()); }
FontSizeComboBox::FontSizeComboBox(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder) : Gtk::ComboBox( cobject ) { font_size_tree_model_ = Gtk::ListStore::create(columns_); font_size_tree_model_->set_sort_column(columns_.font_size, Gtk::SORT_ASCENDING); set_model(font_size_tree_model_); Gtk::TreeModel::Row row = *(font_size_tree_model_->append()); row[columns_.font_size] = 6; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 8; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 10; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 11; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 12; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 14; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 16; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 18; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 24; row = *(font_size_tree_model_->append()); row[columns_.font_size] = 32; Gtk::CellRendererText* renderer = Gtk::manage (new Gtk::CellRendererText()); pack_start (*renderer, true); add_attribute(renderer->property_text(), columns_.font_size); }
void ValueComboBox::setValues(const std::vector<std::string>& iValues) { // Set up tree model. _refTreeModel = Gtk::ListStore::create(_columns); set_model(_refTreeModel); std::cout << "ABAB1" << std::endl; _refTreeModel->clear(); std::cout << "ABAB1" << std::endl; // Fill rows with values. for (auto aValue : iValues) { std::cout << "ABAB1" << std::endl; Gtk::TreeModel::Row row = *(_refTreeModel->append()); row[_columns._name] = aValue; //set_active(row); } clear(); pack_start(_columns._name); }
void fprint_eval_row(FILE *f, model_space_t *model_space, pltb_model_stat_t *stat) { set_model(model_space, stat->matrix_index); PRINT_BODY_ROW(f, model_space->matrix_repr_short, model_space->K, stat->time_cpu, stat->time_real, stat->likelihood, stat->ic[AIC], stat->ic[AICc_C], stat->ic[AICc_RC], stat->ic[BIC_C], stat->ic[BIC_RC]); }
void NaviModules::SetDesEnv(MEnv* aDesEnv) { if (aDesEnv != iDesEnv) { unset_model(); remove_all_columns(); Glib::RefPtr<TreeModel> curmdl = get_model(); curmdl.reset(); iDesEnv = aDesEnv; if (iDesEnv != NULL) { Glib::RefPtr<Gtk::ListStore> mdl = Gtk::ListStore::create(iColRec); GtkTreeModel* model = mdl->Gtk::TreeModel::gobj(); set_model(mdl); append_column( "one", iColRec.name); enable_model_drag_source(); drag_source_set (Gtk::ArrayHandle_TargetEntry(KModListTargets, 1, Glib::OWNERSHIP_NONE), Gdk::MODIFIER_MASK, Gdk::ACTION_COPY); // Fill out the model // List modules directory struct dirent **entlist; string modpath = iDesEnv->Provider()->ModulesPath(); int n = scandir (modpath.c_str(), &entlist, FilterModulesDirEntries, alphasort); // Fill out the model for (int cnt = 0; cnt < n; ++cnt) { Gtk::TreeIter it = mdl->append(); Glib::ustring data = entlist[cnt]->d_name; (*it).set_value(iColRec.name, data); } } } }
static void set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec) { EmpathyPersonaView *self = EMPATHY_PERSONA_VIEW (object); switch (param_id) { case PROP_MODEL: set_model (self, g_value_get_object (value)); break; case PROP_SHOW_OFFLINE: empathy_persona_view_set_show_offline (self, g_value_get_boolean (value)); break; case PROP_FEATURES: set_features (self, g_value_get_flags (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } }
void NaviHier::SetDesEnv(MEnv* aDesEnv) { assert(aDesEnv == NULL || aDesEnv != NULL && iDesEnv == NULL); if (aDesEnv != iDesEnv) { unset_model(); remove_all_columns(); /* No need to delete model explicitly, it is deleted at unset_model Glib::RefPtr<TreeModel> curmdl = get_model(); TreeModel* curmdlp = curmdl.operator ->(); curmdl.reset(); delete curmdlp; */ iDesEnv = aDesEnv; if (iDesEnv != NULL) { Glib::RefPtr<HierTreeMdl> mdl = HierTreeMdl::create(iDesEnv); HierTreeMdl* hmdl = mdl.operator ->(); GtkTreeModel* model = mdl->Gtk::TreeModel::gobj(); bool isds = GTK_IS_TREE_DRAG_SOURCE(model); set_model(mdl); append_column( "one", mdl->ColRec().name); enable_model_drag_source(); drag_source_set (Gtk::ArrayHandle_TargetEntry(sNaviHierDnDTarg, 1, Glib::OWNERSHIP_NONE), Gdk::MODIFIER_MASK, Gdk::ACTION_COPY | Gdk::ACTION_MOVE); iDesObs->SignalCompDeleted().connect(sigc::mem_fun(*hmdl, &HierTreeMdl::on_comp_deleting)); iDesObs->SignalCompAdded().connect(sigc::mem_fun(*hmdl, &HierTreeMdl::on_comp_adding)); iDesObs->SignalCompChanged().connect(sigc::mem_fun(*hmdl, &HierTreeMdl::on_comp_changed)); } } }
Optimizer::Optimizer(Model *m, std::string name): Object(name) { if (m) set_model(m); set_was_used(true); min_score_= -std::numeric_limits<double>::max(); stop_on_good_score_=false; }
void US_EquilTime::change_model( void ) { US_ModelGui* dialog = new US_ModelGui( model ); connect( dialog, SIGNAL( valueChanged( US_Model ) ), SLOT ( set_model ( US_Model ) ) ); dialog->exec(); }
E3PetscSolverConfig::E3PetscSolverConfig(){ set_atol(1e-6); set_rtol(1e-6); set_init_step(0.01); set_solver(E3PetscSolverConfig::rhs); set_model("tm"); set_n_cores(1); }
PlaylistViewer::PlaylistViewer() { //Create the Tree model: m_refTreeModel = Gtk::ListStore::create(m_Columns); set_model(m_refTreeModel); // Fill the TreeView's model // Gtk::TreeModel::Row row = *(m_refTreeModel->append()); /* row[m_Columns.m_col_trackNum] = 1; row[m_Columns.m_col_trackName] = "right-click on this"; row[m_Columns.m_col_trackPath] = "right-click on this"; row = *(m_refTreeModel->append()); row[m_Columns.m_col_trackNum]= 2; row[m_Columns.m_col_trackName] = "or this"; row[m_Columns.m_col_trackPath] = "right-click on this"; row = *(m_refTreeModel->append()); row[m_Columns.m_col_trackNum] = 3; row[m_Columns.m_col_trackName] = "or this, for a popup context menu"; row[m_Columns.m_col_trackPath] = "right-click on this"; */ // master plan is to run through a vector to populate values //Add the TreeView's view columns: append_column("Track", m_Columns.m_col_trackNum); append_column("Name", m_Columns.m_col_trackName); append_column("Path", m_Columns.m_col_trackPath); //Fill popup menu: Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem("_Play", true)); item->signal_activate().connect( sigc::mem_fun(*this, &PlaylistViewer::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Queue", true)); item->signal_activate().connect( sigc::mem_fun(*this, &PlaylistViewer::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Info", true)); item->signal_activate().connect( sigc::mem_fun(*this, &PlaylistViewer::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); m_Menu_Popup.accelerate(*this); m_Menu_Popup.show_all(); //Show all menu items when the menu pops up #ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED signal_button_press_event() .connect(sigc::mem_fun(*this, &PlaylistViewer::on_button_press_event), false); #endif }
IMPCORE_BEGIN_NAMESPACE //! Constructor SteepestDescent::SteepestDescent(Model *m) : step_size_(0.01), max_step_size_(std::numeric_limits<double>::max()), threshold_(0.) { if (m) set_model(m); }
table_view::table_view(i_layout& aLayout) : item_view(aLayout), iLayout(*this), iColumnHeader(iLayout, *this), iSpacer(iLayout) { layout().set_margins(neogfx::margins(0.0)); set_selection_model(std::shared_ptr<i_item_selection_model>(new item_selection_model())); set_presentation_model(std::shared_ptr<i_item_presentation_model>(new item_presentation_model())); set_model(std::shared_ptr<i_item_model>(new default_item_model())); }
/** * ClassesTreeView */ ImportClassesBox::ClassesTreeView::ClassesTreeView( BaseObjectType* cobject, const Glib::RefPtr < Gtk::Builder >& /*refGlade*/) : Gtk::TreeView(cobject), mClasses(0) { mRefTreeModel = Gtk::ListStore::create(mColumns); set_model(mRefTreeModel); append_column(_("Class name"), mColumns.m_col_name); mRefTreeSelection = get_selection(); }
void fprint_eval_summary(FILE *f, model_space_t *model_space, pltb_model_stat_t (*stats)[], pltb_result_t *result) { double overall_time_cpu = 0.0; double overall_time_real = 0.0; for (unsigned i = 0; i < model_space->matrix_count; i++) { overall_time_cpu += (*stats)[i].time_cpu; overall_time_real += (*stats)[i].time_real; } char chosen_models[IC_MAX][MODEL_MATRIX_REPRESENTATION_LENGTH_SHORT]; for (unsigned i = 0; i < IC_MAX; i++) { set_model(model_space, result->matrix_index[i]); memcpy(&chosen_models[i], &model_space->matrix_repr_short, MODEL_MATRIX_REPRESENTATION_LENGTH * sizeof(char)); } PRINT_HLINE(f); PRINT_SUMMARY(f, overall_time_cpu, overall_time_real, chosen_models); PRINT_HLINE(f); }
ObjectsTreeView::ObjectsTreeView(std::shared_ptr<CG::World> world) : _world(world) { _refObjectsTreeModel = Gtk::ListStore::create(_objectsModelColumns); set_model(_refObjectsTreeModel); append_column("Name", _objectsModelColumns.colName); append_column("Type", _objectsModelColumns.colType); // _refObjectsTreeModel->set_sort_column(0, Gtk::SORT_ASCENDING); //Make all the columns reorderable for(guint i = 0; i < 2; i++) { Gtk::TreeView::Column* pColumn = get_column(i); pColumn->set_reorderable(); } init_popup_menu(); }
void NaviNatN::SetDesEnv(MEnv* aDesEnv) { if (aDesEnv != iDesEnv) { unset_model(); remove_all_columns(); Glib::RefPtr<TreeModel> curmdl = get_model(); curmdl.reset(); iDesEnv = aDesEnv; if (iDesEnv != NULL) { Glib::RefPtr<NatnTreeMdl> mdl = NatnTreeMdl::create(iDesEnv->Provider()); GtkTreeModel* model = mdl->Gtk::TreeModel::gobj(); bool isds = GTK_IS_TREE_DRAG_SOURCE(model); set_model(mdl); append_column( "one", mdl->ColRec().name); enable_model_drag_source(); drag_source_set (Gtk::ArrayHandle_TargetEntry(targetentries)); } } }
Tree::Tree() { // Initializing everything char DIR[256] = "/home/brian/Programs/classcatcher"; sprintf( course_file, "%s/etc/.courses", DIR ); sprintf( course_temp, "%s/etc/.courses.tmp", DIR ); m_refTreeModel = Gtk::ListStore::create( m_Columns ); set_model( m_refTreeModel ); append_column( "CRN", m_Columns.m_col_crn ); append_column( "Term", m_Columns.m_col_term ); append_column( "Year", m_Columns.m_col_year ); append_column( "Subject", m_Columns.m_col_subj ); append_column( "CRSE", m_Columns.m_col_crse ); loadfromfile(); }
control::control(imodel* const Model, k3d::istate_recorder* const StateRecorder) : m_implementation(new implementation(Model, StateRecorder)) { if(Model) { Model->connect_changed(sigc::mem_fun(*this, &control::on_data_changed)); Model->connect_enumeration_values_changed(sigc::mem_fun(*this, &control::on_enumeration_values_changed)); } set_model(m_implementation->m_list_model); Gtk::CellRendererText* const cell_renderer = new Gtk::CellRendererText(); pack_start(*manage(cell_renderer), true); add_attribute(cell_renderer->property_text(), m_implementation->m_columns.label); on_enumeration_values_changed(); on_data_changed(0); signal_changed().connect(sigc::mem_fun(*this, &control::on_list_changed)); }
GtkTorrentSideBar::GtkTorrentSideBar(GtkTreeView *tree, const Glib::RefPtr<Gtk::Builder> rbuilder) : Gtk::TreeView(tree), m_builder(rbuilder) { rbuilder->get_widget_derived("GtkMainWindow", m_parent); rbuilder->get_widget_derived("rssDialog", m_rss); m_rss->set_transient_for(*m_parent); m_liststore = Gtk::TreeStore::create(m_cols); set_model(m_liststore); set_headers_visible(false); set_show_expanders(true); set_activate_on_single_click(); expand_all(); // Shouldn't this go after setupColumns()? signal_row_activated().connect([this](const Gtk::TreeModel::Path& Path, Gtk::TreeViewColumn *col){ this->onRowClicked(*m_liststore->get_iter(Path)); }); setupColumns(); }
Chooser::Chooser() { f_store = Gtk::ListStore::create ( f_columns ); f_sortStore = Gtk::TreeModelSort::create( f_store ); set_model( f_sortStore ); set_rules_hint(); set_headers_visible( false ); set_headers_clickable( false ); set_enable_search( false ); // Create the first visible column (icon + name) // f_nameColumn = addTextColumn( gettext("Name"), f_columns.name ); f_sortStore->set_sort_column( f_columns.name, Gtk::SORT_ASCENDING ); f_selection = get_selection(); f_selection->set_mode( Gtk::SELECTION_SINGLE ); f_selection->signal_changed().connect( sigc::mem_fun( *this, &Chooser::onSelectionChanged ) ); }
TreeViewGoods::TreeViewGoods() { /* Create tree */ treeRecords = Gtk::ListStore::create( treeColumns ); set_model( treeRecords ); /* Create columns */ append_column( "Код", treeColumns.id ); append_column( "Наименование", treeColumns.name ); append_column( "Цена", treeColumns.price ); append_column( "Ед.Изм.", treeColumns.item ); /* Create popup menu */ Gtk::MenuItem* item = Gtk::manage( new Gtk::MenuItem( "Подробнее" ) ); item->signal_activate().connect( sigc::mem_fun( *this, &TreeViewGoods::on_menu_file_popup_generic ) ); menuPopup.append( *item ); menuPopup.accelerate( *this ); menuPopup.show_all(); /* Connect press event signal (mouse clicks) */ signal_button_press_event().connect( sigc::mem_fun( *this, &TreeViewGoods::on_button_press_event ), false ); }
ldc_info_t * info (int log) { hd_data_t * hd_data = new_hd_data_t(); hd_t *hd; hd = hd_list(hd_data, hw_cdrom, 1, NULL); ldc_info_t * head = NULL; ldc_info_t * tail = NULL; char buffer[500]; for(; hd; hd = hd->next) { if (! head) { head = new_ldc_info_t("dvdcd"); tail = head; } else { tail->next = new_ldc_info_t("dvdcd"); tail = tail->next; } set_vendor(tail, "vendor", hd->vendor.name, hd->vendor.id, "Vendor"); set_model(tail, "model", hd->device.name, hd->device.id, "Model"); add_info_tuple(tail, "device", hd->unix_dev_names->str, -1, "Device file"); add_info_tuple(tail, "drivers", format_drivers(hd, buffer), -1, "Drivers"); add_info_tuple(tail, "medias", format_medias(hd, buffer), -1, "Supported media types"); tail->return_status = 1; } if (log){ insert_info_log(head); } free_hd_structs (hd_data, hd); return head; }
MainTreeView::MainTreeView(std::vector<Player>& players_list) : players_list(players_list) { //Create the Tree model: m_refTreeModel = Gtk::ListStore::create(m_Columns); set_model(m_refTreeModel); //Fill the TreeView's model updateTreeView(); //Add the TreeView's view columns: append_column("Rank", m_Columns.m_col_rank); append_column("ID", m_Columns.m_col_id); append_column("Name", m_Columns.m_col_name); append_column("Elo", m_Columns.m_col_elo); append_column("K Coefficient", m_Columns.m_col_kcoeff); //Fill popup menu: auto item = Gtk::manage(new Gtk::MenuItem("_Edit", true)); item->signal_activate().connect( sigc::mem_fun(*this, &MainTreeView::on_menu_file_popup_edit_player) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Add a Result", true)); item->signal_activate().connect( sigc::mem_fun(*this, &MainTreeView::on_menu_file_popup_add_result) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Remove", true)); item->signal_activate().connect( sigc::mem_fun(*this, &MainTreeView::on_menu_file_popup_remove_player) ); m_Menu_Popup.append(*item); m_Menu_Popup.accelerate(*this); m_Menu_Popup.show_all(); //Show all menu items when the menu pops up }
int sgen_next(sgen **xsg) { sgen *sg = *xsg; int good, done; int i; done = 0; i = sg->dev; do { if (sg->instance) { if (sg->ptable) { do { sg->param += 1; } while (sg->param < sg->max_param && !set_param(sg)); } else { sg->max_param = -1; } if (sg->param < sg->max_param) { done = 1; } else if (!sg->is_instparam) { /* Try instance parameters now */ sg->is_instparam = 1; sg->param = -1; sg->max_param = *DEVices[i]->DEVpublic.numInstanceParms; sg->ptable = DEVices[i]->DEVpublic.instanceParms; } else { sg->is_principle = 0; sg->instance->GENnextInstance = sg->next_instance; sg->instance->GENstate = sg->istate; sg->instance = NULL; } } else if (sg->model) { /* Find the first/next good instance for this model */ for (good = 0; !good && sg->next_instance; good = set_inst(sg)) { sg->instance = sg->next_instance; sg->next_instance = sg->instance->GENnextInstance; } if (good) { sg->is_principle = 0; sg->istate = sg->instance->GENstate; sg->instance->GENnextInstance = NULL; sg->model->GENinstances = sg->instance; if (DEVices[i]->DEVpublic.modelParms) { sg->max_param = *DEVices[i]->DEVpublic. numModelParms; sg->ptable = DEVices[i]->DEVpublic. modelParms; } else { sg->ptable = NULL; } sg->param = -1; sg->is_instparam = 0; } else { /* No good instances of this model */ sg->model->GENinstances = sg->first_instance; sg->model->GENnextModel = sg->next_model; sg->model = NULL; } } else if (i >= 0) { /* Find the first/next good model for this device */ for (good = 0; !good && sg->next_model; good = set_model(sg)) { sg->model = sg->next_model; sg->next_model = sg->model->GENnextModel; } if (good) { sg->model->GENnextModel = NULL; sg->devlist[i] = sg->model; if (DEVices[i]->DEVpublic.modelParms) { sg->max_param = *DEVices[i]->DEVpublic. numModelParms; sg->ptable = DEVices[i]->DEVpublic. modelParms; } else { sg->ptable = NULL; } sg->next_instance = sg->first_instance = sg->model->GENinstances; } else { /* No more good models for this device */ sg->devlist[i] = sg->first_model; i = -1; /* Try the next good device */ } } else if (i < DEVmaxnum && sg->dev < DEVmaxnum) { /* Find the next good device in this circuit */ do sg->dev++; while (sg->dev < DEVmaxnum && sg->devlist[sg->dev] && !set_dev(sg)); i = sg->dev; if (i >= DEVmaxnum) /* PN: Segafult if not = */ done = 1; sg->first_model = sg->next_model = (i<DEVmaxnum) ? sg->devlist[i] : NULL; } else { done = 1; } } while (!done); if (sg->dev >= DEVmaxnum) { FREE(sg); *xsg = NULL; } return 1; }
/** * Create new ComboBoxString with an empty list. * */ ComboBoxString() { mListStore = Gtk::ListStore::create(mColumn); set_model(mListStore); pack_start(mColumn.mString); }
ListView::ListView() : Gtk::TreeView() { // поиграемся с TreeView // создаём модель m_refTreeModel = Gtk::ListStore::create( m_Columns ); set_model( m_refTreeModel ); // Теперь добавляем столбцы для отображения append_column( "Name", m_Columns.m_col_name ); append_column( "Size", m_Columns.m_col_size ); append_column( "User/Group", m_Columns.m_col_users ); append_column( "Permission", m_Columns.m_col_permission ); append_column( "Type", m_Columns.m_col_type ); append_column( "Modified", m_Columns.m_col_modified ); //Set the sort column of the Tree model: m_refTreeModel->set_sort_column(0, Gtk::SORT_ASCENDING); Gtk::TreeView::Column* pColumn; pColumn = get_column(0); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_name ); pColumn = get_column(1); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_size ); pColumn = get_column(2); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_users ); pColumn = get_column(3); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_permission ); pColumn = get_column(4); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_type ); pColumn = get_column(5); if( pColumn ) pColumn->set_sort_column( m_Columns.m_col_modified ); //Fill popup menu: Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem("_Open", true)); item->signal_activate().connect( sigc::mem_fun(*this, &ListView::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Open with…", true)); item->signal_activate().connect( sigc::mem_fun(*this, &ListView::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); item = Gtk::manage(new Gtk::MenuItem("_Properties", true)); item->signal_activate().connect( sigc::mem_fun(*this, &ListView::on_menu_file_popup_generic) ); m_Menu_Popup.append(*item); m_Menu_Popup.accelerate(*this); m_Menu_Popup.show_all(); //Show all menu items when the menu pops up signal_button_press_event() .connect(sigc::mem_fun(*this, &ListView::on_button_press_event), false); Navigator nvg; show_file_list( nvg.get_file_list() ); }
ldc_info_t * info (int log) { ldc_info_t * head = NULL; ldc_info_t * tail = NULL; hd_data_t * hd_data = new_hd_data_t(); hd_t *hd; hd_res_t *res; hd = hd_list(hd_data, hw_usb, 1, NULL); for(; hd; hd = hd->next) { if (hd->hw_class){ if (hd->hw_class == hw_disk){ //apenas os discos usb if (hd->device.name && (strstr(hd->device.name, "Card") == NULL && strstr(hd->device.name, "card") == NULL )){ if (! head) { head = new_ldc_info_t("pendrive"); tail = head; } else { tail->next = new_ldc_info_t("pendrive"); tail = tail->next; } if(hd->vendor.name){ set_vendor (tail, "vendor", hd->vendor.name, -1, "Vendor"); } else { set_vendor (tail, "vendor", "Unknown", -1, "Vendor"); } if (hd->device.name){ set_model (tail, "device", hd->device.name, -1, "Model"); } else { set_model (tail, "device", "Unknown", -1, "Model"); } if(hd->drivers) { char *s = hd_join("; ", hd->drivers); add_info_tuple(tail, "driver", s, -1, "Driver"); free(s); } else { add_info_tuple(tail, "driver", "Unknown", -1, "Driver"); } if (hd->unix_dev_name){ add_info_tuple(tail, "device_file", hd->unix_dev_name, -1, "Device File"); partitions_info(hd->unix_dev_name, tail); } else { add_info_tuple(tail, "device_file", "Unknown", -1, "Device File"); } int speed = -1; int size = -1; for(res = hd->res; res; res = res->next) { switch(res->any.type) { case res_baud: //convertendo para Mbps (divisão por 10^6) speed = res->baud.speed/1000000; break; case res_size: if(res->size.unit == size_unit_sectors){ //FIXME: adicionado 1 e feito floor => usar ceil size = ((res->size.val1*res->size.val2)/1073741824.0) + 1; //byte => GB } break; default: break; } } add_info_tuple(tail, "speed", NULL, speed, "Speed (in Mbps)"); add_info_tuple(tail, "Size", NULL, size, "Size (in GB)"); } } } } if (tail) { tail->return_status = 1; } else { //printf("Não foi detectado nenhum pen drive!!\n"); //FIXME: deve ser padronizado o retorno //head = new_ldc_info_t("pendrive"); } free_hd_structs (hd_data, hd); if (log){ insert_info_log(head); } return head; }
item_refcount::item_refcount(model_multipart *m) { set_model(m); }