Glib::RefPtr<Gtk::Action> ActionManager::find_action_by_name(const std::string & n) const { Glib::ListHandle<Glib::RefPtr<Gtk::Action> > actions = m_main_window_actions->get_actions(); for(Glib::ListHandle<Glib::RefPtr<Gtk::Action> >::const_iterator iter2(actions.begin()); iter2 != actions.end(); ++iter2) { if((*iter2)->get_name() == n) { return *iter2; } } DBG_OUT("%s not found", n.c_str()); return Glib::RefPtr<Gtk::Action>(); }
/** Constructor. * @param cobject C base object * @param builder instance to retrieve widgets from */ HybrisMonitorGtkWindow::HybrisMonitorGtkWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder> &builder) : Gtk::Window(cobject), ros_nh_() { set_wmclass("Hybris Robot Monitor", "Hybris Robot Monitor"); #ifdef HAVE_GCONFMM gconf_ = Gnome::Conf::Client::get_default_client(); gconf_->add_dir(GCONF_PREFIX); #endif builder->get_widget("lab_agent_now", lab_agent_now_); builder->get_widget("lab_agent_before", lab_agent_before_); builder->get_widget("lab_skill", lab_skill_); builder->get_widget("trv_plan", trv_plan_); builder->get_widget("window_plan", window_plan_); builder->get_widget("lab_plan_status", lab_plan_status_); plan_list_ = Gtk::ListStore::create(plan_record_); trv_plan_->set_model(plan_list_); trv_plan_->append_column("Step", plan_record_.step); trv_plan_->get_selection()->set_mode(Gtk::SELECTION_NONE); Glib::ListHandle<Gtk::TreeViewColumn *> columns = trv_plan_->get_columns(); for (Glib::ListHandle<Gtk::TreeViewColumn *>::iterator c = columns.begin(); c != columns.end(); ++c) { #if GTK_VERSION_GE(3,0) Gtk::CellRenderer *cell_renderer = (*c)->get_first_cell(); #else Gtk::CellRenderer *cell_renderer = (*c)->get_first_cell_renderer(); #endif Gtk::CellRendererText *text_renderer = dynamic_cast<Gtk::CellRendererText *>(cell_renderer); if ( text_renderer ) { Pango::AttrList attr_list; Pango::Attribute scale_attr = Pango::Attribute::create_attr_scale(1.25); attr_list.insert(scale_attr); text_renderer->property_attributes().set_value(attr_list); #ifdef GLIBMM_PROPERTIES_ENABLED (*c)->add_attribute(text_renderer->property_background_gdk(), plan_record_.background); (*c)->add_attribute(text_renderer->property_foreground_gdk(), plan_record_.foreground); #else (*c)->add_attribute(*text_renderer, "background-gdk", plan_record_.background); (*c)->add_attribute(*text_renderer, "foreground-gdk", plan_record_.background); #endif } } //graph_changed.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_graph_changed)); dsp_planner_status_.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_planner_status_cb)); sub_planner_status_ = ros_nh_.subscribe("continual_planning_status", 10, &HybrisMonitorGtkWindow::planner_status_cb, this); dsp_skiller_status_.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_skiller_status_cb)); sub_skiller_status_ = ros_nh_.subscribe("skiller_status", 10, &HybrisMonitorGtkWindow::skiller_status_cb, this); dsp_agent_info_.connect(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_agent_info_cb)); sub_agent_info_ = ros_nh_.subscribe("agent_info", 10, &HybrisMonitorGtkWindow::agent_info_cb, this); #ifdef HAVE_GCONFMM gconf_->signal_value_changed().connect( sigc::hide(sigc::hide(sigc::mem_fun(*this, &HybrisMonitorGtkWindow::on_config_changed)))); on_config_changed(); #endif }
GrubSettingsDlgGtk::GrubSettingsDlgGtk() : event_lock(false), bttRemoveCustomEntry(Gtk::Stock::REMOVE), rbDefPredefined(gettext("pre_defined: "), true), rbDefSaved(gettext("previously _booted entry"), true), lblDefaultEntry(gettext("default entry")), lblView(gettext("visibility")), chkShowMenu(gettext("show menu")), lblTimeout(gettext("Timeout")), lblTimeout2(gettext("Seconds")), lblKernelParams(gettext("kernel parameters")), chkGenerateRecovery(gettext("generate recovery entries")), chkOsProber(gettext("look for other operating systems")), chkResolution(gettext("custom resolution: ")), gccNormalBackground(true), gccHighlightBackground(true) { this->set_title("GPC - "+Glib::ustring(gettext("settings"))); this->set_icon_name("gpc"); Gtk::VBox* winBox = this->get_vbox(); winBox->add(tabbox); tabbox.append_page(alignCommonSettings, gettext("_General"), true); tabbox.append_page(vbAppearanceSettings, gettext("A_ppearance"), true); tabbox.append_page(vbAllEntries, gettext("_Advanced"), true); vbAllEntries.pack_start(hbAllEntriesControl, Gtk::PACK_SHRINK); vbAllEntries.pack_start(scrAllEntries); hbAllEntriesControl.add(bttAddCustomEntry); hbAllEntriesControl.add(bttRemoveCustomEntry); hbAllEntriesControl.set_border_width(5); hbAllEntriesControl.set_spacing(5); scrAllEntries.add(tvAllEntries); scrAllEntries.set_border_width(5); scrAllEntries.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); refAsListStore = Gtk::ListStore::create(asTreeModel); tvAllEntries.set_model(refAsListStore); tvAllEntries.append_column_editable(gettext("is active"), asTreeModel.active); tvAllEntries.append_column_editable(gettext("name"), asTreeModel.name); tvAllEntries.append_column_editable(gettext("value"), asTreeModel.value); refAsListStore->signal_row_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_setting_row_changed)); vbCommonSettings.set_spacing(15); vbAppearanceSettings.set_spacing(15); vbCommonSettings.pack_start(groupDefaultEntry, Gtk::PACK_SHRINK); groupDefaultEntry.add(alignDefaultEntry); groupDefaultEntry.set_sensitive(false); groupDefaultEntry.set_label_widget(lblDefaultEntry); lblDefaultEntry.set_attributes(attrDefaultEntry); aDefaultEntry = Pango::Attribute::create_attr_weight(Pango::WEIGHT_BOLD); attrDefaultEntry.insert(aDefaultEntry); alignDefaultEntry.add(vbDefaultEntry); vbDefaultEntry.add(hbDefPredefined); vbDefaultEntry.add(rbDefSaved); hbDefPredefined.pack_start(rbDefPredefined, Gtk::PACK_SHRINK); hbDefPredefined.pack_start(cbDefEntry); vbDefaultEntry.set_spacing(5); groupDefaultEntry.set_shadow_type(Gtk::SHADOW_NONE); alignDefaultEntry.set_padding(2, 2, 25, 2); rbDefPredefined.set_group(rbgDefEntry); rbDefSaved.set_group(rbgDefEntry); Glib::ListHandle<Gtk::CellRenderer*> cellRenderers = cbDefEntry.get_cells(); Gtk::CellRenderer* cellRenderer = *cellRenderers.begin(); cellRenderer->set_fixed_size(200, -1); cbDefEntry.set_wrap_width(2); alignCommonSettings.add(vbCommonSettings); alignCommonSettings.set_padding(20, 0, 0, 0); vbCommonSettings.pack_start(groupView, Gtk::PACK_SHRINK); groupView.add(alignView); groupView.set_shadow_type(Gtk::SHADOW_NONE); groupView.set_label_widget(lblView); lblView.set_attributes(attrDefaultEntry); alignView.add(vbView); vbView.set_spacing(5); alignView.set_padding(2, 2, 25, 2); vbView.add(chkShowMenu); vbView.add(chkOsProber); vbView.add(hbTimeout); hbTimeout.set_spacing(5); hbTimeout.pack_start(lblTimeout, Gtk::PACK_SHRINK); hbTimeout.pack_start(spTimeout, Gtk::PACK_SHRINK); hbTimeout.pack_start(lblTimeout2, Gtk::PACK_SHRINK); spTimeout.set_digits(0); spTimeout.set_increments(1, 5); spTimeout.set_range(0, 1000000); vbCommonSettings.pack_start(groupKernelParams, Gtk::PACK_SHRINK); groupKernelParams.add(alignKernelParams); groupKernelParams.set_shadow_type(Gtk::SHADOW_NONE); groupKernelParams.set_label_widget(lblKernelParams); lblKernelParams.set_attributes(attrDefaultEntry); alignKernelParams.add(vbKernelParams); alignKernelParams.set_padding(10, 2, 25, 2); vbKernelParams.add(txtKernelParams); vbKernelParams.add(chkGenerateRecovery); vbKernelParams.set_spacing(5); vbAppearanceSettings.pack_start(alignResolution, Gtk::PACK_SHRINK); alignResolution.add(hbResolution); alignResolution.set_padding(10, 0, 6, 0); hbResolution.pack_start(chkResolution, Gtk::PACK_SHRINK); hbResolution.pack_start(cbResolution); cbResolution.append_text("saved"); //color chooser vbAppearanceSettings.pack_start(groupColorChooser, Gtk::PACK_SHRINK); groupColorChooser.set_label_widget(lblColorChooser); groupColorChooser.set_shadow_type(Gtk::SHADOW_NONE); lblColorChooser.set_attributes(attrDefaultEntry); alignColorChooser.add(tblColorChooser); tblColorChooser.attach(lblforegroundColor, 1,2,0,1); tblColorChooser.attach(lblBackgroundColor, 2,3,0,1); tblColorChooser.attach(lblNormalColor, 0,1,1,2); tblColorChooser.attach(lblHighlightColor, 0,1,2,3); tblColorChooser.attach(gccNormalForeground, 1,2,1,2); tblColorChooser.attach(gccNormalBackground, 2,3,1,2); tblColorChooser.attach(gccHighlightForeground, 1,2,2,3); tblColorChooser.attach(gccHighlightBackground, 2,3,2,3); tblColorChooser.set_spacings(10); //background image vbAppearanceSettings.pack_start(groupBackgroundImage); groupBackgroundImage.set_shadow_type(Gtk::SHADOW_NONE); groupBackgroundImage.add(alignBackgroundImage); groupBackgroundImage.set_label_widget(lblBackgroundImage); lblBackgroundImage.set_attributes(attrDefaultEntry); alignBackgroundImage.add(vbBackgroundImage); vbBackgroundImage.pack_start(hbImgBtts); vbBackgroundImage.pack_start(lblBackgroundRequiredInfo); vbButtons.add(bttRemoveBackground); vbBackgroundImage.set_spacing(5); hbImgBtts.set_spacing(5); vbButtons.set_spacing(5); bttRemoveBackground.set_no_show_all(true); imgBackgroundImage.set_no_show_all(true); lblBackgroundRequiredInfo.set_no_show_all(true); //<signals> rbDefPredefined.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_default_entry_predefined_toggeled)); rbDefSaved.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_default_entry_saved_toggeled)); cbDefEntry.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_default_entry_changed)); chkShowMenu.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_showMenu_toggled)); chkOsProber.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_osProber_toggled)); spTimeout.signal_value_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_timeout_changed)); txtKernelParams.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_kernelparams_changed)); chkGenerateRecovery.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_recovery_toggled)); chkResolution.signal_toggled().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_chkResolution_toggled)); cbResolution.get_entry()->signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_resolution_selected)); gccNormalForeground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed)); gccNormalBackground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed)); gccHighlightForeground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed)); gccHighlightBackground.signal_changed().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_color_changed)); fcBackgroundImage.signal_file_set().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_other_image_chosen)); bttRemoveBackground.signal_clicked().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_bttRemoveBackground_clicked)); bttAddCustomEntry.signal_clicked().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_add_row_button_clicked)); bttRemoveCustomEntry.signal_clicked().connect(sigc::mem_fun(this, &GrubSettingsDlgGtk::signal_remove_row_button_clicked)); this->add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE); this->set_default_size(300, 400); }