Example #1
0
GtkMainWindow::GtkMainWindow() :
	m_core(Application::getSingleton()->getCore())
{
	this->set_position(Gtk::WIN_POS_CENTER);
	this->set_default_size(800, 500);

	header = Gtk::manage(new Gtk::HeaderBar());
	header->set_title("gTorrent");
	header->set_show_close_button(true);

	// This needs to be refactored

	Gtk::Button *btn = Gtk::manage(new Gtk::Button());
	btn->set_label("Add");
	btn->signal_clicked().connect(sigc::mem_fun(*this, &GtkMainWindow::onAddBtnClicked));
	header->add(*btn);

	Gtk::Button *btn_m = Gtk::manage(new Gtk::Button());
	btn_m->set_label("Add Link");
	btn_m->signal_clicked().connect(sigc::mem_fun(*this, &GtkMainWindow::onAddMagnetBtnClicked));
	header->add(*btn_m);

	this->set_titlebar(*header);

	m_treeview = Gtk::manage(new GtkTorrentTreeView());
	this->add(*m_treeview);

	Glib::signal_timeout().connect(sigc::mem_fun(*this, &GtkMainWindow::onSecTick), 10);
	this->signal_delete_event().connect(sigc::mem_fun(*this, &GtkMainWindow::onDestroy));

	this->show_all();
}
Example #2
0
void RSFilechooser::set_loading(FileType type)
{
  chooser->set_select_multiple (true);
  chooser->set_action(Gtk::FILE_CHOOSER_ACTION_OPEN);
  view->show_widget("load_buttons", true);
  view->show_widget("save_buttons", false);
  Gtk::Button *button = NULL;
  builder->get_widget ("load_save_button", button);
  if (button) button->set_label(_("Load"));  
  set_filetype(type);
}
Example #3
0
void RSFilechooser::set_saving(FileType type)
{
  chooser->set_select_multiple (false);
  chooser->set_action(Gtk::FILE_CHOOSER_ACTION_SAVE);
  chooser->set_do_overwrite_confirmation(true);

  view->show_widget("save_buttons", true);
  view->show_widget("load_buttons", false);
  Gtk::Button *button = NULL;
  builder->get_widget ("load_save_button", button);
  if (button) button->set_label(_("Save"));  
  set_filetype(type);
}
Example #4
0
 void HIGMessageDialog::add_button (const Glib::RefPtr<Gdk::Pixbuf> & pixbuf, 
                                    const Glib::ustring & label_text, 
                                    Gtk::ResponseType resp, bool is_default)
 {
   Gtk::Button *button = manage(new Gtk::Button());
   Gtk::Image *image = manage(new Gtk::Image(pixbuf));
   // NOTE: This property is new to GTK+ 2.10, but we don't
   //       really need the line because we're just setting
   //       it to the default value anyway.
   //button.ImagePosition = Gtk::PositionType.Left;
   button->set_image(*image);
   button->set_label(label_text);
   button->set_use_underline(true);
   button->property_can_default().set_value(true);
   
   add_button (button, resp, is_default);
 }
Example #5
0
void RSFilechooser::set_filetype(FileType type)
{
  if (!chooser) return;
  Gtk::Button *button = NULL;
  // if no argument re-apply the filetype we have already
  // to prevent "recent files"
  if ( type == UNDEF ) {
    type = filetype;
  }
  else {
    builder->get_widget ("load_save_button", button);
  }
  view->show_widget("save_multiple", false);
  string labeltext = "";
  switch(type) {
  case GCODE:    
    chooser->set_select_multiple (false);
    chooser->set_current_folder (GCodePath); 
    chooser->set_filter(gcodefiles);
    labeltext += _("GCode");
    break;
  case SETTINGS: 
    chooser->set_select_multiple (false);
    chooser->set_current_folder (SettingsPath); 
    chooser->set_filter(settingsfiles);
    labeltext += _("Settings");
    break;
  case SVG:
    chooser->set_current_folder (ModelPath);
    chooser->set_filter(modelfiles);
    view->show_widget("save_multiple", true);
    labeltext += _("SVG");
    break;
  case MODEL:
  default:     
    chooser->set_current_folder (ModelPath);   
    chooser->set_filter(modelfiles);
    labeltext += _("Model");
    break;
  }
  if (button != NULL) button->set_label(button->get_label() + " " + labeltext);
  filetype = type;
}
void PreferencesWindow::setup_button(const Glib::ustring &widget,
				     const Glib::ustring &key)
{
  Glib::RefPtr<Gnome::Conf::Client> &client
    = MainWindow::instance().gconf_client;
  Glib::ustring dir = MainWindow::instance().gconf_dir;

  Gtk::Button *button;
  
  ui->get_widget(widget, button);
  button->set_use_underline(false);
  button->set_label(client->get_string(dir + key));
  button->signal_clicked()
    .connect(sigc::bind(sigc::mem_fun(*this,
				   &PreferencesWindow::on_button_pressed),
			button, key));
  client->notify_add(dir + key,
		     sigc::bind(sigc::mem_fun(*this, &PreferencesWindow
					   ::button_listener),
				button));
}
Example #7
0
//dialog_previewoptions stuff
Dialog_PreviewOptions::Dialog_PreviewOptions()
:Dialog(_("Preview Options")),
adj_zoom(Gtk::Adjustment::create(0.5,0.1,5.0,0.1,0.2)),
adj_fps(Gtk::Adjustment::create(12,1,120,1,5)),
check_overbegin(_("_Begin time"),false),
check_overend(_("_End time"),false),
settings(this,"prevoptions")
{
	//framerate = 15.0f;
	//zoom = 0.2f;

	//set the fps of the time widgets
	Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	dialogPadding->set_padding(12, 12, 12, 12);
	get_vbox()->add(*dialogPadding);

	Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12));
	dialogPadding->add(*dialogBox);

	Gtk::Frame *generalFrame = manage(new Gtk::Frame(_("General settings")));
	generalFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) generalFrame->get_label_widget())->set_markup(_("<b>General settings</b>"));
	dialogBox->pack_start(*generalFrame, false, false, 0);

	Gtk::Alignment *generalPadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	generalPadding->set_padding(6, 0, 24, 0);
	generalFrame->add(*generalPadding);

	Gtk::Table *generalTable = manage(new Gtk::Table(2, 2, false));
	generalTable->set_row_spacings(6);
	generalTable->set_col_spacings(12);
	generalPadding->add(*generalTable);

	Gtk::Label *zoomLabel = manage(new Gtk::Label(_("_Quality")));
	zoomLabel->set_alignment(0, 0.5);
	zoomLabel->set_use_underline(TRUE);
	Gtk::SpinButton *zoomSpinner = manage(new Gtk::SpinButton(adj_zoom, 0.1, 2));
	zoomLabel->set_mnemonic_widget(*zoomSpinner);
	zoomSpinner->set_alignment(1);
	generalTable->attach(*zoomLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	generalTable->attach(*zoomSpinner, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Label *fpsLabel = manage(new Gtk::Label(_("_FPS")));
	fpsLabel->set_alignment(0, 0.5);
	fpsLabel->set_use_underline(TRUE);
	Gtk::SpinButton *fpsSpinner = manage(new Gtk::SpinButton(adj_fps, 1, 1));
	fpsLabel->set_mnemonic_widget(*fpsSpinner);
	fpsSpinner->set_alignment(1);
	generalTable->attach(*fpsLabel, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	generalTable->attach(*fpsSpinner, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	Gtk::Frame *timeFrame = manage(new Gtk::Frame(_("Time settings")));
	timeFrame->set_shadow_type(Gtk::SHADOW_NONE);
	((Gtk::Label *) timeFrame->get_label_widget())->set_markup(_("<b>Time settings</b>"));
	dialogBox->pack_start(*timeFrame, false, false, 0);

	Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1));
	timePadding->set_padding(6, 0, 24, 0);
	timeFrame->add(*timePadding);

	Gtk::Table *timeTable = manage(new Gtk::Table(2, 2, false));
	timeTable->set_row_spacings(6);
	timeTable->set_col_spacings(12);
	timePadding->add(*timeTable);

	check_overbegin.set_alignment(0, 0.5);
	check_overbegin.set_use_underline(TRUE);
	check_overend.set_alignment(0, 0.5);
	check_overend.set_use_underline(TRUE);
	time_begin.set_alignment(1);
	time_end.set_alignment(1);
	timeTable->attach(check_overbegin, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(time_begin, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(check_overend, 0, 1, 1, 2, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);
	timeTable->attach(time_end, 1, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0);

	check_overbegin.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overbegin_toggle));
	check_overend.signal_toggled().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_overend_toggle));

	Gtk::Button *cancelButton = manage(new Gtk::Button(Gtk::StockID("gtk-cancel")));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_PreviewOptions::on_cancel_pressed));
	add_action_widget(*cancelButton, 1);
	cancelButton->show();

	Gtk::Button *okbutton = manage(new Gtk::Button(Gtk::StockID("gtk-go-forward")));
	okbutton->set_label(_("Preview"));
	okbutton->signal_clicked().connect(sigc::mem_fun(*this,&Dialog_PreviewOptions::on_ok_pressed));
	add_action_widget(*okbutton, 0);
	okbutton->show();

	time_begin.set_sensitive(false);
	time_end.set_sensitive(false);
	show_all();
}
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_text(mforms::ToolBarItem *item, const std::string &label) {
  const mforms::ToolBarItemType type = item->get_type();

  switch (type) {
    case mforms::TextActionItem:
    case mforms::ActionItem:
    case mforms::SegmentedToggleItem:
    case mforms::ToggleItem:
    case mforms::SwitcherItem: {
      Gtk::Button *btn = cast<Gtk::Button *>(item->get_data_ptr());
      if (type == mforms::SwitcherItem) {
        btn->set_label(label);
        btn->get_style_context()->add_class("SwitcherItem");
      } else
        btn->add_label(label);
      btn->set_name(label);
      break;
    }
    case mforms::TitleItem:
    case mforms::LabelItem: {
      Gtk::Label *lbl = cast<Gtk::Label *>(item->get_data_ptr());
      if (lbl) {
        lbl->set_markup("<small>" + label + "</small>");
        lbl->set_name(label);
      }
      break;
    }
    case mforms::FlatSelectorItem:
    case mforms::SelectorItem: {
      Gtk::ComboBoxText *ct = cast<Gtk::ComboBoxText *>(item->get_data_ptr());
      if (ct)
        ct->set_active_text(label);
      break;
    }
    case mforms::ColorSelectorItem: {
      Gtk::ComboBox *combo = cast<Gtk::ComboBox *>(item->get_data_ptr());
      if (combo) {
        Glib::RefPtr<Gtk::TreeModel> model = combo->get_model();
        if (model) {
          const Gtk::TreeModel::Children children = model->children();
          const Gtk::TreeIter last = children.end();
          Gtk::TreeRow row;

          for (Gtk::TreeIter it = children.begin(); it != last; ++it) {
            row = *it;
            if (row.get_value(color_combo_columns->color) == label) {
              combo->set_active(it);
              break;
            }
          }
        }
      }
      break;
    }
    case mforms::SearchFieldItem:
    case mforms::TextEntryItem: {
      Gtk::Entry *e = cast<Gtk::Entry *>(item->get_data_ptr());
      if (e)
        e->set_text(label);
      break;
    }
    case mforms::SeparatorItem:
    case mforms::ExpanderItem:
    case mforms::ImageBoxItem:
      break;
  }
}
Example #9
0
void setButtonText(string b, string txt ) {
    Gtk::Button* bu;
    VRGuiBuilder()->get_widget(b, bu);
    bu->set_label(txt);
}