void PreferencesDialogImpl::defaultButtonCB()
{
    Config::defaultConfig();

    m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]);
    m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]);
}
void dialog::operate4(Image imag,std::string filename)
{
    set_default_size(300, 50);
    set_border_width(10);
    set_position(Gtk::WIN_POS_CENTER);
    set_resizable(false);

    Gtk::Box *vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
    add(*vbox);

    Gtk::Grid *grid = Gtk::manage(new Gtk::Grid);
    vbox->add(*grid);

    Gtk::Label *label = Gtk::manage(new Gtk::Label("File Name :"));
    grid->attach(*label,0,0,1,1);
    Gtk::Entry *bvalue = Gtk::manage(new Gtk::Entry());
    grid->attach(*bvalue, 1, 0, 1, 1);
    Gtk::Label *label2 = Gtk::manage(new Gtk::Label(".bmp"));
    grid->attach(*label2,2,0,1,1);

    set_title("Save As");
    bvalue->set_text("Untitled");
    bvalue->set_max_length(50);

    Gtk::Button *bok = Gtk::manage(new Gtk::Button("OK"));
    bok->signal_clicked().connect(sigc::bind<Gtk::Entry*>(sigc::mem_fun(*this, &dialog::on_bok4_click), bvalue,imag,filename));
    grid->attach(*bok, 2, 2, 1, 1);
    show_all_children();
}
void PreferencesDialogImpl::savePreferences()
{
    g_configMap[Config::EDITOR[0]] = m_editorEntry->get_text();
    g_configMap[Config::CTAGS[0]] = m_ctagsEntry->get_text();

    Config::write();
}
//--------------------------------------------------------------------------------
void DbMySQLTableEditorFKPage::cell_editing_started(GtkCellRenderer* cr, GtkCellEditable* ce, gchar* path, gpointer udata)
{
  DbMySQLTableEditorFKPage* self = reinterpret_cast<DbMySQLTableEditorFKPage*>(udata);

  bec::NodeId node(path);
  if ( node.is_valid() )
    self->_fk_node = node;

  if ( GTK_IS_ENTRY(ce) ) // Fill in name of the foreign key column
  {
    ::bec::FKConstraintListBE        *fk_be         = self->_be->get_fks();
    Gtk::Entry* entry = Glib::wrap(GTK_ENTRY(ce));

    std::string name;
    if (node.back() == fk_be->count()-1)
      fk_be->set_field(node, bec::FKConstraintListBE::Name, 1);

    fk_be->get_field(node, bec::FKConstraintListBE::Name, name);
    entry->set_text(name);
  }

  // clean up edit_done signal/slotl
  if ( self->_ce && self->_edit_conn )
  {
    g_signal_handler_disconnect (self->_ce, self->_edit_conn);
    self->_ce = 0;
    self->_edit_conn = 0;
  }

  if (GTK_IS_CELL_EDITABLE(ce))
  {
    self->_ce = ce;
    self->_edit_conn = g_signal_connect(ce, "editing-done", GCallback(&DbMySQLTableEditorFKPage::cell_editing_done), udata);
  }
}
//--------------------------------------------------------------------------------
void DbMySQLTableEditorIndexPage::cell_editing_done(GtkCellEditable *ce) {
  if (_editing_done_id != 0 && _editable_cell != 0) {
    g_signal_handler_disconnect(_editable_cell, _editing_done_id);
    _editing_done_id = 0;
    _editable_cell = 0;
  }

  // If it's Gtk::Entry, we try to find out if maybe user leave edit field empty,
  // if so we revert it to the last known value or to the default one.
  if (GTK_IS_ENTRY(ce)) {
    GtkEntry *entry_widget = GTK_ENTRY(ce);
    if (entry_widget) {
      Gtk::Entry *entry = Glib::wrap(entry_widget);

      if (entry && entry->get_text_length() == 0) {
        Gtk::TreeModel::Path path;
        Gtk::TreeView::Column *column(0);
        _indexes_tv->get_cursor(path, column);
        bec::NodeId node(path.to_string());
        if (node.is_valid()) {
          std::string name = _user_index_name;
          if (name.empty())
            name = strfmt("index%i", path[0] + 1);

          _be->get_indexes()->set_field(node, MySQLTableIndexListBE::Name, name);
          entry->set_text(name);
        }
      }
    }
  }
}
//------------------------------------------------------------------------------
std::string mforms::gtk::ToolBarImpl::get_item_text(mforms::ToolBarItem *item) {
  std::string text;

  switch (item->get_type()) {
    case mforms::FlatSelectorItem:
    case mforms::SelectorItem: {
      Gtk::ComboBoxText *ct = cast<Gtk::ComboBoxText *>(item->get_data_ptr());
      if (ct)
        text = ct->get_active_text();
      break;
    }
    case mforms::ColorSelectorItem: {
      const Gtk::ComboBox *combo = cast<Gtk::ComboBox *>(item->get_data_ptr());
      if (combo) {
        const Gtk::TreeIter iter = combo->get_active();
        const Gtk::TreeRow row = *iter;
        text = row.get_value(color_combo_columns->color);
      }
      break;
    }
    case mforms::SearchFieldItem: {
      Gtk::Entry *e = cast<Gtk::Entry *>(item->get_data_ptr());
      if (e)
        text = e->get_text();
      break;
    }
    default: {
      Gtk::Widget *btn = cast<Gtk::Widget *>(item->get_data_ptr());
      if (btn)
        text = btn->get_name();
    }
  }

  return text;
}
Exemple #7
0
    /*! \brief This function is designed to be used in a Gtk::Entry's
     signal_changed() callback.  It enforces that the text is
     formatted in the style of a numeric value.

     It allows the first character to be a minus or plus sign, there
     to be a sequence of digits, possibly split by one decimal point.

     An example use is \code
     entry.signal_changed().connect(sigc::bind<Gtk::Entry&>(&magnet::Gtk::forceNumericEntry,
     entry)); \endcode
    */
    inline void forceNumericEntry(::Gtk::Entry& textfield)
    {
      std::string value = textfield.get_text();
      
      bool hasPoint = false;
      bool hasExponent = false;
      std::string::iterator iPtr = value.begin();
      if ((*iPtr == '-') || (*iPtr == '+')) ++iPtr;

      while (iPtr != value.end())
	if (std::isdigit(*iPtr))
	  ++iPtr;
	else if ((*iPtr == '.') && (!hasPoint))
	  { ++iPtr; hasPoint = true; }
	else if ((*iPtr == 'e') 
		 && (!hasExponent)
		 && (iPtr != value.begin())
		 && std::isdigit(*(iPtr - 1)))
	  {
	    //If the last value was a digit we can have a single e
	    //argument, but don't allow decimal exponents
	    hasExponent=true; 
	    hasPoint = true;
	    ++iPtr;
	    //Eat the sign of the exponent
	    if ((*iPtr == '-') || (*iPtr == '+')) ++iPtr;
	  }
	else
	  iPtr = value.erase(iPtr);
      
      if (value[0] == '.') value.erase(value.begin());

      textfield.set_text(value);
    }
std::string DialogBoxFactory::showDomainIDataEditDialog(int Id,
    std::string DataName, std::string Val)
{
  Gtk::Dialog Dialog(_("Edit Inputdata"), true, false);

  Gtk::Entry Entry;
  Entry.set_text(Val);

  Gtk::Label Label(Glib::ustring::compose(_("%1 for ID %2"), DataName,Id));

  Dialog.get_vbox()->pack_start(Label);
  Dialog.get_vbox()->pack_start(Entry);

  Dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  Dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

  Dialog.set_default_response(Gtk::RESPONSE_OK);

  Dialog.show_all_children();

  int Res = Dialog.run();

  if (Res == Gtk::RESPONSE_CANCEL || Res == Gtk::RESPONSE_DELETE_EVENT)
    return Val;

  std::string NewVal = Entry.get_text();
  if (NewVal == "" || NewVal == " ")
    NewVal = "0";

  return NewVal;
}
Exemple #9
0
void ConnectView::signal_entry_changed()
{
  // Use the value of the entry widget, rather than the
  // active text, so the user can enter other values.
  Gtk::Entry *entry = m_combo.get_entry();
  m_settings->Hardware.PortName = entry->get_text();
}
    virtual void do_refresh_form_data()
    {
        Gtk::Entry *entry;
        xml()->get_widget("name_entry", entry);

        Gtk::TextView *tview;
        xml()->get_widget("text_view", tview);

        Gtk::ComboBox *combo;
        xml()->get_widget("collation_combo", combo);

        Gtk::Button *btn;
        xml()->get_widget("refactor_btn", btn);

        if (_be)
        {
            set_selected_combo_item(combo, _be->get_schema_option_by_name("CHARACTER SET - COLLATE"));

            _old_name = _be->get_name();
            entry->set_text(_old_name);

            tview->get_buffer()->set_text(_be->get_comment());

            bool is_editing_live_obj= is_editing_live_object();
            tview->set_sensitive(!is_editing_live_obj);
            Gtk::Label *tlabel;
            xml()->get_widget("label5", tlabel);
            tlabel->set_sensitive(!is_editing_live_obj);
            btn->set_sensitive(_be->refactor_possible());
        }
    }
static void sp_attribute_table_entry_changed ( Gtk::Entry *editable,
                                   SPAttributeTable *spat )
{
    if (!spat->blocked)
    {
        std::vector<Glib::ustring> attributes = spat->get_attributes();
        std::vector<Gtk::Entry *> entries = spat->get_entries();
        for (guint i = 0; i < (attributes.size()); i++) {
            Gtk::Entry *e = entries[i];
            if ((GtkWidget*)editable == (GtkWidget*)e->gobj()) {
                spat->blocked = true;
                Glib::ustring text = e->get_text ();
                if (spat->_object) {
                    spat->_object->getRepr()->setAttribute(attributes[i].c_str(), text.c_str(), false);
                    DocumentUndo::done(spat->_object->document, SP_VERB_NONE,
                                       _("Set attribute"));
                }
                spat->blocked = false;
                return;
            }
        }
        g_warning ("file %s: line %d: Entry signalled change, but there is no such entry", __FILE__, __LINE__);
    }

} // end of sp_attribute_table_entry_changed()
Exemple #12
0
void Settings::set_to_gui (Builder &builder, int i)
{
  const char *glade_name = settings[i].glade_name;

  if (!glade_name)
        return;

  switch (settings[i].type) {
  case T_BOOL: {
    Gtk::CheckButton *check = NULL;
    builder->get_widget (glade_name, check);
    if (!check)
      std::cerr << "Missing boolean config item " << glade_name << "\n";
    else
      check->set_active (*PTR_BOOL(this, i));
    break;
  }
  case T_INT:
  case T_FLOAT: {
    Gtk::Widget *w = NULL;
    builder->get_widget (glade_name, w);
    if (!w) {
      std::cerr << "Missing user interface item " << glade_name << "\n";
      break;
    }

    Gtk::SpinButton *spin = dynamic_cast<Gtk::SpinButton *>(w);
    if (spin) {
      if (settings[i].type == T_INT)
          spin->set_value (*PTR_INT(this, i));
      else
          spin->set_value (*PTR_FLOAT(this, i));
      break;
    }
    Gtk::Range *range = dynamic_cast<Gtk::Range *>(w);
    if (range) {
      if (settings[i].type == T_INT)
        range->set_value (*PTR_INT(this, i));
      else
        range->set_value (*PTR_FLOAT(this, i));
    }
    break;
  }
  case T_STRING: {
    Gtk::Entry *e = NULL;
    builder->get_widget (glade_name, e);
    if (!e) {
      std::cerr << "Missing user interface item " << glade_name << "\n";
      break;
    }
    e->set_text(*PTR_STRING(this, i));
    break;
  }
  case T_COLOUR_MEMBER:
    break; // Ignore, Colour members are special 
  default:
    std::cerr << "corrupt setting type\n";
    break;
  }
}
static void sp_attribute_table_object_modified ( SPObject */*object*/,
                                     guint flags,
                                     SPAttributeTable *spat )
{
    if (flags && SP_OBJECT_MODIFIED_FLAG)
    {
        std::vector<Glib::ustring> attributes = spat->get_attributes();
        std::vector<Gtk::Entry *> entries = spat->get_entries();
        Glib::ustring text="";
        for (guint i = 0; i < (attributes.size()); i++) {
            Gtk::Entry* e = entries[i];
            const gchar *val = spat->_object->getRepr()->attribute(attributes[i].c_str());
            text = e->get_text ();
            if (val || !text.empty()) {
                if (text != val) {
                    /* We are different */
                    spat->blocked = true;
                    e->set_text (val ? val : (const gchar *) "");
                    spat->blocked = false;
                }
            }
        }
    }

} // end of sp_attribute_table_object_modified()
Exemple #14
0
void Widget_Preview::on_zoom_entry_activated()
{
	Gtk::Entry* entry = zoom_preview.get_entry();
	String str(entry->get_text());
	string digi = "0123456789";
	size_t first = str.find_first_of(digi);

	if (first == string::npos)
	{
		entry->set_text(_("Fit"));

		//release the focus to enable accelerator keys
		preview_window.grab_focus();

		return ;
	}

	size_t last = str.find_first_not_of(digi);

	if (last == string::npos)
	{
		last = str.find_last_of(digi) + 1;
	}

	if (first > last)
	{
		entry->set_text (_("Fit"));
	}

	else entry->set_text(str.substr(first, last - first) + "%");

	//release the focus to enable accelerator keys
	preview_window.grab_focus();
}
std::string DialogBoxFactory::showTextEntryDialog(Glib::ustring MessageText,
    Glib::ustring LabelText)
{
  Gtk::Dialog Dialog;

  Gtk::Label Message(MessageText);

  Gtk::Label Label(LabelText);
  Gtk::Entry Entry;
  Gtk::HBox Box;
  Box.pack_start(Label);
  Box.pack_start(Entry);

  Dialog.get_vbox()->pack_start(Message, true, true, 10);
  Dialog.get_vbox()->pack_start(Box, true, true, 10);

  Dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  Dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

  Dialog.show_all_children();

  if (Dialog.run() == Gtk::RESPONSE_OK)
    return Entry.get_text();

  return "";
}
      void on_limits_changed()
      {
	magnet::gtk::forceNumericEntry(_minValue);
	try { _min = boost::lexical_cast<GLfloat>(_minValue.get_text()); } catch(...) {}
	magnet::gtk::forceNumericEntry(_maxValue);
	try { _max = boost::lexical_cast<GLfloat>(_maxValue.get_text()); } catch(...) {}
	_signal_changed.emit();
      }
Exemple #17
0
void *procesar_boton(void *nada){			// Hilo que se ejecutará cuando se pulse el botón OK Go!. Simula un inicio de sesión que una vez fallará y otra vez no
	Gtk::Label *etiq;			// Estos son los objetos que queremos manejar. En la ventana hay más, pero no les hacemos nada, asique no necesitamos declarar punteros a ellos. Esta es la etiqueta que muestra el Cargando...
	Gtk::Spinner *spin;			// Esto es un dibujito que gira mientras carga
	Gtk::Image *image;			// Esta es la imagen que aparece cuando se inicia sesión (tanto si falla(muestra una X de error) como si no(muestra un tick verde)
	Gtk::RadioButton *radio;		// Este es un botón de los de la izquierda, donde seleccionas si inicias sesion, creas usuario o borras usuario
	Gtk::Entry *entrada;			// Esta es la cajeta de entrada de texto como por ejemplo, donde pones el nombre de usuario y la contraseña

	builder->get_widget("label3", etiq);	// Como el builder crea la ventana, él nos dará las referencias a los objetos definidos arriba
	builder->get_widget("spinner1", spin);
	builder->get_widget("image1", image);
	image->set_visible(false);		// Hacemos que las imagenes no se vean. Mientras está cargando no se muestran. Esta es la imagen de cuando se inicia sesión correctamente
	builder->get_widget("image2", image);	// Reusamos el puntero para referenciar a la otra imagen. Esta se muestra cuando el inicio sesion falla
	image->set_visible(false);
	builder->get_widget("radiobutton1",radio);// Como esto se ejecuta cuando se pulsa el botón OK Go!, se supone que estamos procesando el inicio de sesión. Es habitual bloquearlo todo para que no se pueda cambiar de opción mientras se inicia sesion (En realidad es por estética, porque al programa se la trae floja lo que hagas) :)
	radio->set_sensitive(false);
	builder->get_widget("radiobutton2",radio);
	radio->set_sensitive(false);
	builder->get_widget("radiobutton3",radio);
	radio->set_sensitive(false);
	builder->get_widget("entry1", entrada);
	entrada->set_sensitive(false);
	builder->get_widget("entry2", entrada);
	entrada->set_sensitive(false);

	spin->set_visible(true);		// Como estamos cargando, mostramos el iconito este girando. (Este es el mismo que se muestra cuando buscas archivos en ubuntu)
	etiq->set_label("Conectando...");	// Hacemos que la etiqueta muestre Conectando...

	sleep(1);				// Simulamos que la conexion se establece

	etiq->set_label("Obteniendo datos del servidor");	// Se supone que estamos conectados y ahora intercambiamos datos con el servidor

	sleep(2);				// Simulamos el intercambio de datos
	
	spin->set_visible(false);		// Ya se ha procesado el inicio de sesion y ya no debemos ver el iconico girando, porque eso es sólo cuando carga

	if(i%2){					// Si es impar, el inicio de sesion es correcto
		builder->get_widget("image1", image);	// Obtenemos la imagen1, la del tick verde
		etiq->set_label("Login correcto");	// Cambiamos el texto de la etiqueta (una etiqueta sólo hace eso: mostrar texto)
	} else {
		etiq->set_label("Login incorrecto");	// Si es par, el inicio de sesion es incorrecto. No tenemos que obtener la imagen porque el puntero ya apunta a la imagen correcta
	}

	image->set_visible(true);	// Sea cual sea la imagen escogida, se muestra

	builder->get_widget("radiobutton1",radio);	// Y se desbloquea todo esperando a que el usuario cambie algo y vuelva a pulsar otro botón
	radio->set_sensitive(true);
	builder->get_widget("radiobutton2",radio);
	radio->set_sensitive(true);
	builder->get_widget("radiobutton3",radio);
	radio->set_sensitive(true);
	builder->get_widget("entry1", entrada);
	entrada->set_sensitive(true);
	builder->get_widget("entry2", entrada);
	entrada->set_sensitive(true);

	i++;	// Esto alterna entre simular un inicio de sesion correcto (i impar) y uno incorrecto (i par)
}
void GscAddDeviceWindow::on_device_name_entry_changed()
{
	// Allow OK only if name is not empty
	Gtk::Entry* entry = lookup_widget<Gtk::Entry*>("device_name_entry");
	Gtk::Button* ok_button = lookup_widget<Gtk::Button*>("window_ok_button");
	if (entry && ok_button) {
		ok_button->set_sensitive(!entry->get_text().empty());
	}
}
 void height_changed()
 {
   Gtk::Entry *entry;
   _xml->get_widget("height_entry", entry);
   int i= base::atoi<int>(entry->get_text().c_str(), 0);
   if (i > 0)
     _be.set_height(i);
   do_refresh_form_data();
 }
Exemple #20
0
    void settingsCallback()
    {
      try {
	_focalLength = boost::lexical_cast<double>(_focalLengthSlider.get_text());
      } catch (...) {}
      try {
	_focalWidth = boost::lexical_cast<double>(_focalWidthSlider.get_text());
      } catch (...) {}
    }
void GscPreferencesWindow::update_device_widgets(const std::string& device, const std::string& params)
{
	Gtk::Entry* entry = 0;

	if ((entry = this->lookup_widget<Gtk::Entry*>("device_options_device_entry")))
		entry->set_text(device);

	if ((entry = this->lookup_widget<Gtk::Entry*>("device_options_parameter_entry")))
		entry->set_text(params);
}
Exemple #22
0
void stock::on_eArticleID_changed(){
    Gtk::Entry* arID ;
    window->get_widget("eArticleID",arID);
    int newID = String2Int(arID->get_text()) ;
    if(newID > 0){
        singleArticle->load(newID);
        Gtk::Entry* arDes ;
        window->get_widget("eArticleNumber",arDes);
        arDes->set_text(singleArticle->firstRecord.row_string["number"] + " " + singleArticle->firstRecord.row_string["designation"]);
    }
}
  virtual void do_refresh_form_data() {
    Gtk::Entry *entry;
    _xml->get_widget("name_entry", entry);

    Gtk::TextView *tview;
    _xml->get_widget("text_view", tview);

    entry->set_text(_be.get_name());

    tview->get_buffer()->set_text(_be.get_text());
  }
void SPAttributeTable::set_object(SPObject *object,
                            std::vector<Glib::ustring> &labels,
                            std::vector<Glib::ustring> &attributes,
                            GtkWidget* parent)
{
    g_return_if_fail (!object || SP_IS_OBJECT (object));
    g_return_if_fail (!object || !labels.empty() || !attributes.empty());
    g_return_if_fail (labels.size() == attributes.size());

    clear();
    _object = object;

    if (object) {
        blocked = true;

        // Set up object
        modified_connection = object->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_attribute_table_object_modified), this));
        release_connection  = object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this));

        // Create table
        table = new Gtk::Table (attributes.size(), 2, false);
        if (!(parent == NULL))
        {
            gtk_container_add (GTK_CONTAINER (parent),(GtkWidget*)table->gobj());
        }
        
        // Fill rows
        _attributes = attributes;
        for (guint i = 0; i < (attributes.size()); i++) {
            Gtk::Label *ll = new Gtk::Label (_(labels[i].c_str()));
            ll->show();
            ll->set_alignment (1.0, 0.5);
            table->attach (*ll, 0, 1, i, i + 1,
                               Gtk::FILL,
                               (Gtk::EXPAND | Gtk::FILL),
                               XPAD, YPAD );
            Gtk::Entry *ee = new Gtk::Entry();
            ee->show();
            const gchar *val = object->getRepr()->attribute(attributes[i].c_str());
            ee->set_text (val ? val : (const gchar *) "");
            table->attach (*ee, 1, 2, i, i + 1,
                               (Gtk::EXPAND | Gtk::FILL),
                               (Gtk::EXPAND | Gtk::FILL),
                               XPAD, YPAD );
            _entries.push_back(ee);
            g_signal_connect ( ee->gobj(), "changed",
                               G_CALLBACK (sp_attribute_table_entry_changed),
                               this );
        }
        /* Show table */
        table->show ();
        blocked = false;
    }
}
void DocumentProperties::onNewExtraField ()
{
	Gtk::Dialog dialog ("New Field", *dialog_, true, false);

	Gtk::VBox *vbox = dialog.get_vbox ();

	Gtk::HBox hbox;
	hbox.set_spacing (12);
	vbox->pack_start (hbox, true, true, 0);

	Gtk::Label label ("Field name:", false);
	hbox.pack_start (label, false, false, 0);

	Gtk::Entry entry;
	entry.set_activates_default (true);
	hbox.pack_start (entry, true, true, 0);

	dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	dialog.add_button (Gtk::Stock::OK, Gtk::RESPONSE_ACCEPT);
	dialog.set_default_response (Gtk::RESPONSE_ACCEPT);

	dialog.show_all ();
	vbox->set_border_width (12);

	if (dialog.run () == Gtk::RESPONSE_ACCEPT) {

		Gtk::ListStore::iterator it = extrafieldsstore_->children().begin ();
		Gtk::ListStore::iterator const end = extrafieldsstore_->children().end ();
		bool key_isnew = true;
		for (; it != end; ++it)
			if (Utility::firstCap ((*it)[extrakeycol_]) == Utility::firstCap (entry.get_text ())) {
				key_isnew = false;
			}
		if ( key_isnew ) {
			Gtk::ListStore::iterator row = extrafieldsstore_->append ();
			(*row)[extrakeycol_] = Utility::firstCap (entry.get_text ());
			(*row)[extravalcol_] = "";
		} else {
			Glib::ustring message;
			message = String::ucompose (
			"<b><big>%1</big></b>",
			_("This key already exists.\n"));
			Gtk::MessageDialog dialog (

			message, true,
			Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true);

			dialog.run ();

		}
	}
}
SelectionSetToolmenu::SelectionSetToolmenu() :
	Gtk::ToolItem(),
	_listStore(Gtk::ListStore::create(_columns)),
	_clearSetsButton(NULL),
	_entry(Gtk::manage(new Gtk::ComboBoxEntry(_listStore, _columns.name)))
{
	// Hbox containing all our items
	Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 3));
	add(*hbox);

	// Pack Label
	hbox->pack_start(
		*Gtk::manage(new gtkutil::LeftAlignedLabel(_("Selection Set: "))),
		false, false, 0);

	// Pack Combo Box
	hbox->pack_start(*_entry, true, true, 0);

	// Add tooltip
	_entry->set_tooltip_markup(_(ENTRY_TOOLTIP));

	// Add clear button
	{
		Gtk::Image* image = Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbufWithMask("delete.png")));
		image->show();

		_clearSetsButton = Gtk::manage(new Gtk::ToolButton(*image, _("Clear Selection Sets")));

		// Set tooltip
		_clearSetsButton->set_tooltip_text(_("Clear Selection Sets"));

		// Connect event
		_clearSetsButton->signal_clicked().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onDeleteAllSetsClicked));

		hbox->pack_start(*_clearSetsButton, false, false, 0);
	}

	// Connect the signals
	Gtk::Entry* childEntry = _entry->get_entry();
	childEntry->signal_activate().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onEntryActivated));

	_entry->signal_changed().connect(sigc::mem_fun(*this, &SelectionSetToolmenu::onSelectionChanged));

	// Populate the list
	update();

	// Add self as observer
	GlobalSelectionSetManager().addObserver(*this);

	show_all();
}
void GscPreferencesWindow::import_config()
{
	// Clear and fill the entries.

	Gtk::CheckButton* check = 0;
	Gtk::Entry* entry = 0;


	// ------- General tab

	bool scan_on_startup;
	if ( prefs_config_get("gui/scan_on_startup", scan_on_startup)
			&& (check = this->lookup_widget<Gtk::CheckButton*>("scan_on_startup_check")) )
		check->set_active(scan_on_startup);

	bool show_smart_capable_only;
	if ( prefs_config_get("gui/show_smart_capable_only", show_smart_capable_only)
			&& (check = this->lookup_widget<Gtk::CheckButton*>("show_smart_capable_only_check")) )
		check->set_active(show_smart_capable_only);

	bool win32_search_smartctl_in_smartmontools;
	if ( prefs_config_get("system/win32_search_smartctl_in_smartmontools", win32_search_smartctl_in_smartmontools)
			&& (check = this->lookup_widget<Gtk::CheckButton*>("search_in_smartmontools_first_check")) )
		check->set_active(win32_search_smartctl_in_smartmontools);

	std::string smartctl_binary;
	if ( prefs_config_get("system/smartctl_binary", smartctl_binary)
			&& (entry = this->lookup_widget<Gtk::Entry*>("smartctl_binary_entry")) )
		entry->set_text(smartctl_binary);

	std::string smartctl_options;
	if ( prefs_config_get("system/smartctl_options", smartctl_options)
			&& (entry = this->lookup_widget<Gtk::Entry*>("smartctl_options_entry")) )
		entry->set_text(smartctl_options);


	// ------- Drives tab

	std::string device_blacklist_patterns;
	if ( prefs_config_get("system/device_blacklist_patterns", device_blacklist_patterns)
			&& (entry = this->lookup_widget<Gtk::Entry*>("device_blacklist_patterns_entry")) )
		entry->set_text(device_blacklist_patterns);


	std::string devmap_str;
	if ( prefs_config_get("system/smartctl_device_options", devmap_str) ) {
		device_option_map_t devmap = app_unserialize_device_option_map(devmap_str);
		device_options_treeview->set_device_map(devmap);
	}

}
Exemple #28
0
 pinDialogPriv(pinDialog &,const void *opsysParam) :
     Gtk::Dialog("inputDialog",true), m_label("pin entry")
     {
     m_textInput.set_activates_default(true);
     get_vbox()->pack_start(m_label);
     m_label.set_alignment(0.1,0.5);
     get_vbox()->pack_start(m_textInput);
     m_textInput.set_visibility(false);
     set_has_separator(true);
     add_button(Gtk::Stock::OK,Gtk::RESPONSE_OK);
     add_button(Gtk::Stock::CANCEL ,Gtk::RESPONSE_CANCEL);
     set_default_response(Gtk::RESPONSE_CANCEL);
     show_all_children();
     }
Gtk::Widget* PrefPage::appendEntry(const std::string& name, const std::string& registryKey)
{
	Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 0.0, 0.0));
	alignment->show();

	Gtk::Entry* entry = Gtk::manage(new Gtk::Entry);
	entry->set_width_chars(static_cast<gint>(std::max(GlobalRegistry().get(registryKey).size(), std::size_t(30))));

	alignment->add(*entry);

	// Connect the registry key to the newly created input field
    registry::bindPropertyToBufferedKey(entry->property_text(), registryKey, _registryBuffer, _resetValuesSignal);

	appendNamedWidget(name, *alignment);

	return entry;
}
void GscPreferencesWindow::on_device_options_add_device_button_clicked()
{
	Gtk::Entry* entry = 0;
	std::string dev, par;

	if ((entry = this->lookup_widget<Gtk::Entry*>("device_options_device_entry")))
		dev = entry->get_text();

	if ((entry = this->lookup_widget<Gtk::Entry*>("device_options_parameter_entry")))
		par = entry->get_text();

	if (device_options_treeview->has_selected_row()) {
		device_options_treeview->add_new_row("", "");  // without this it would clone the existing.
	} else {
		device_options_treeview->add_new_row(dev, par);
	}
}