Пример #1
0
// Create buttons panel
Gtk::Widget& SoundChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 6));

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &SoundChooser::_onOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &SoundChooser::_onCancel));

	hbx->pack_end(*okButton, false, false, 0);
	hbx->pack_end(*cancelButton, false, false, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*hbx));
}
// Construct the buttons
Gtk::Widget& LightTextureChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(true, 6));
	hbx->set_border_width(3);

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &LightTextureChooser::callbackOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &LightTextureChooser::callbackCancel));

	hbx->pack_end(*okButton, true, true, 0);
	hbx->pack_end(*cancelButton, true, true, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*hbx));
}
Пример #3
0
// Construct the buttons
Gtk::Widget& ShaderChooser::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(false, 3));
	hbx->set_border_width(3);

	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));

	okButton->signal_clicked().connect(sigc::mem_fun(*this, &ShaderChooser::callbackOK));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ShaderChooser::callbackCancel));

	hbx->pack_end(*okButton, false, false, 0);
	hbx->pack_end(*cancelButton, false, false, 0);

	return *hbx;
}
// Lower dialog buttons
Gtk::Widget& DifficultyDialog::createButtons()
{
	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(true, 12));

	// Save button
	Gtk::Button* okButton = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
	okButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyDialog::onSave));
	buttonHBox->pack_end(*okButton, true, true, 0);

	// Close Button
	_closeButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	_closeButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyDialog::onClose));
	buttonHBox->pack_end(*_closeButton, true, true, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*buttonHBox));
}
void JointVelocityControlWidget::init(ref<BasicEnvironment> env, ref<Robot> robot, Int index, ref<ControlInterface> interface)
{
  velInterface = interface; 

  // Joint velocity controls
  Gtk::VBox* jointControlBox = new Gtk::VBox(false,5);

  Int dof =  velInterface->inputSize();
  velAdjustments.clear();
  for(Int j=0; j<dof; j++) {
    Gtk::HBox* hbox = new Gtk::HBox();
    Gtk::Label* label = new Gtk::Label(base::intToString(j)+":");
    hbox->pack_start(*manage(label), Gtk::PACK_SHRINK,5);
    Gtk::Adjustment* adj = new Gtk::Adjustment(0,-3,3,0.01,0.1);
    velAdjustments.push_back(adj);
    Gtk::HScale* scale = new Gtk::HScale(*manage(adj));
    scale->set_draw_value(true);
    scale->set_digits(2);
    scale->set_value_pos(Gtk::POS_LEFT);
    scale->set_update_policy(Gtk::UPDATE_CONTINUOUS);
    scale->set_size_request(100,-1);
    hbox->pack_end(*manage(scale));
    jointControlBox->pack_start(*manage(hbox),false,false);
    adj->signal_value_changed().connect( SigC::bind<Int>( SigC::slot(*this, &JointVelocityControlWidget::jointVelScaleChanged ), j) );
  }
  
  pack_start(*manage(jointControlBox));
}
Пример #6
0
void EffectEditor::populateWindow()
{
	// Create the overall vbox
	_dialogVBox = Gtk::manage(new Gtk::VBox(false, 3));
	add(*_dialogVBox);

	Gtk::HBox* effectHBox = Gtk::manage(new Gtk::HBox(false, 0));

	_effectTypeCombo = Gtk::manage(new Gtk::ComboBox(static_cast<const Glib::RefPtr<Gtk::TreeModel>&>(_effectStore)));

	// Add the cellrenderer for the caption
	Gtk::CellRendererText* captionRenderer = Gtk::manage(new Gtk::CellRendererText);
	_effectTypeCombo->pack_start(*captionRenderer, false);
	_effectTypeCombo->add_attribute(captionRenderer->property_text(), _effectColumns.caption);

	Gtk::Label* effectLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Effect:")));

	effectHBox->pack_start(*effectLabel, false, false, 0);
	effectHBox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_effectTypeCombo, 12, 1.0f)),
		true, true, 0
	);

	_dialogVBox->pack_start(*effectHBox, false, false, 3);

	_stateToggle = Gtk::manage(new Gtk::CheckButton(_("Active")));
	_stateToggle->signal_toggled().connect(sigc::mem_fun(*this, &EffectEditor::onStateToggle));

	_dialogVBox->pack_start(*_stateToggle, false, false, 3);

	Gtk::Label* argLabel =
		Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Arguments") + "</b>"));
	_dialogVBox->pack_start(*argLabel, false, false, 0);

	Gtk::Button* saveButton = Gtk::manage(new Gtk::Button(Gtk::Stock::APPLY));
	saveButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onSave));

	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onCancel));

	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 0));
	buttonHBox->pack_end(*saveButton, false, false, 0);
	buttonHBox->pack_end(*cancelButton, false, false, 6);

	_dialogVBox->pack_end(*buttonHBox, false, false, 3);
}
Пример #7
0
Gtk::Widget& FindAndReplaceShader::createButtons()
{
	Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6));

	Gtk::Button* replaceButton = Gtk::manage(new Gtk::Button(Gtk::Stock::FIND_AND_REPLACE));
	Gtk::Button* closeButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CLOSE));

	replaceButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onReplace));
	closeButton->signal_clicked().connect(sigc::mem_fun(*this, &FindAndReplaceShader::onClose));

	hbox->pack_end(*closeButton, false, false, 0);
	hbox->pack_end(*replaceButton, false, false, 0);

	_counterLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(""));
	_counterLabel->set_padding(18, 0);
	hbox->pack_start(*_counterLabel, false, false, 0);

	return *hbox;
}
Пример #8
0
// Create button panel
Gtk::Widget& OverlayDialog::createButtons()
{
	Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6));

	Gtk::Button* closeButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CLOSE));
	closeButton->signal_clicked().connect(sigc::mem_fun(*this, &OverlayDialog::_onClose));

	hbox->pack_end(*closeButton, false, false, 0);

	return *hbox;
}
Gtk::Widget& MD5AnimationViewer::createButtons()
{
	Gtk::HBox* hbx = Gtk::manage(new Gtk::HBox(true, 6));

	Gtk::Button* closeButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CLOSE));

	closeButton->signal_clicked().connect(sigc::mem_fun(*this, &MD5AnimationViewer::_onOK));

	hbx->pack_end(*closeButton, true, true, 0);

	return *Gtk::manage(new gtkutil::RightAlignment(*hbx));
}
VOMS_menu_item::VOMS_menu_item(Glib::ustring item_label, 
                               VOMS_server_list* parent) :
    Gtk::MenuItem::MenuItem(),
    contact_data_vector() {
    
    label = item_label;
    
    Gtk::HBox *hb = new Gtk::HBox();
    Gtk::Label *lab1 = new Gtk::Label(label);
    lab1->show();
    voms_ac_icon = new Gtk::Image(VOMS_icon_factory::disabled_icon());
    voms_ac_icon->show();
    hb->pack_start(*voms_ac_icon, false, true, 0);
    hb->pack_end(*lab1, true, true, 5);
    hb->show();
    
    add(*hb);
    show();
    
    sig_conn = this->signal_activate().connect(
                     sigc::mem_fun(*parent, &VOMS_server_list::activate_handler));
}
Пример #11
0
Settings_window::Settings_window(Gtk::Window& parent_window, Client_settings* client_settings, Daemon_settings* daemon_settings)
:
	m::gtk::Dialog(parent_window, _("Preferences")),

	priv(new Private),

	client_settings(*client_settings),
	daemon_settings(*daemon_settings),

	download_to_dialog(
		*this, format_window_title(_("Please select torrents download directory")),
		Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER
	),
	download_to_button(download_to_dialog),

	copy_finished_to_dialog(
		*this, format_window_title(_("Please select directory for finished downloads copying")),
		Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER
	),
	copy_finished_to_button(copy_finished_to_dialog)
{
	const int tabs_border_width = m::gtk::BOX_BORDER_WIDTH * 3;

	this->set_resizable(false);
	this->remove();

	Gtk::VBox* main_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
	this->add(*main_vbox);

	Gtk::HBox* main_hbox = Gtk::manage(new Gtk::HBox(false, m::gtk::HBOX_SPACING));
	main_vbox->pack_start(*main_hbox, true, true);

	std::map<Section, Gtk::TreePath> sections_paths;

	// Sections view -->
	{
		Gtk::Frame* sections_frame = Gtk::manage(new Gtk::Frame());
		main_hbox->pack_start(*sections_frame, true, true);

		sections_frame->add(this->sections_view);

		this->sections_view.set_headers_visible(false);
		this->sections_view.columns.name.property_sizing() = Gtk::TREE_VIEW_COLUMN_AUTOSIZE;
		this->sections_view.get_selection()->set_mode(Gtk::SELECTION_SINGLE);

		Gtk::TreeRow row;
		Gtk::TreeRow client_row;
		Gtk::TreeRow daemon_row;
		Gtk::TreeModel::iterator iter;

		// Добавляем разделы -->
			// Client -->
				iter = this->sections_view.model->append();
				sections_paths[CLIENT] = this->sections_view.model->get_path(iter);
				client_row = *iter;
				client_row[this->sections_view.model_columns.id] = CLIENT;
				client_row[this->sections_view.model_columns.name] = _("Client");

				iter = this->sections_view.model->append(client_row.children());
				sections_paths[CLIENT_MAIN] = this->sections_view.model->get_path(iter);
				row = *iter;
				row[this->sections_view.model_columns.id] = CLIENT_MAIN;
				row[this->sections_view.model_columns.name] = _("Main");

				// GUI -->
				{
					Gtk::TreeRow gui_row;

					iter = this->sections_view.model->append(client_row.children());
					sections_paths[CLIENT_GUI] = this->sections_view.model->get_path(iter);
					gui_row = *iter;
					gui_row[this->sections_view.model_columns.id] = CLIENT_GUI;
					gui_row[this->sections_view.model_columns.name] = _("GUI");

					iter = this->sections_view.model->append(gui_row.children());
					sections_paths[CLIENT_GUI_MISC] = this->sections_view.model->get_path(iter);
					row = *iter;
					row[this->sections_view.model_columns.id] = CLIENT_GUI_MISC;
					row[this->sections_view.model_columns.name] = _("Misc");

					iter = this->sections_view.model->append(gui_row.children());
					sections_paths[CLIENT_GUI_STATUS_BAR] = this->sections_view.model->get_path(iter);
					row = *iter;
					row[this->sections_view.model_columns.id] = CLIENT_GUI_STATUS_BAR;
					row[this->sections_view.model_columns.name] = _("Status bar");
				}
				// GUI <--
			// Client <--


			// Daemon -->
				iter = this->sections_view.model->append();
				sections_paths[DAEMON] = this->sections_view.model->get_path(iter);
				daemon_row = *iter;
				daemon_row[this->sections_view.model_columns.id] = DAEMON;
				daemon_row[this->sections_view.model_columns.name] = _("Daemon");

				// Network -->
				{
					Gtk::TreeRow network_row;

					iter = this->sections_view.model->append(daemon_row.children());
					sections_paths[DAEMON_NETWORK] = this->sections_view.model->get_path(iter);
					network_row = *iter;
					network_row[this->sections_view.model_columns.id] = DAEMON_NETWORK;
					network_row[this->sections_view.model_columns.name] = _("Network");

					iter = this->sections_view.model->append(network_row.children());
					sections_paths[DAEMON_NETWORK_MISC] = this->sections_view.model->get_path(iter);
					row = *iter;
					row[this->sections_view.model_columns.id] = DAEMON_NETWORK_MISC;
					row[this->sections_view.model_columns.name] = _("Misc");

					iter = this->sections_view.model->append(network_row.children());
					sections_paths[DAEMON_NETWORK_IP_FILTER] = this->sections_view.model->get_path(iter);
					row = *iter;
					row[this->sections_view.model_columns.id] = DAEMON_NETWORK_IP_FILTER;
					row[this->sections_view.model_columns.name] = _("IP filter");
				}
				// Network <--

				iter = this->sections_view.model->append(daemon_row.children());
				sections_paths[DAEMON_AUTOMATION] = this->sections_view.model->get_path(iter);
				row = *iter;
				row[this->sections_view.model_columns.id] = DAEMON_AUTOMATION;
				row[this->sections_view.model_columns.name] = _("Automation");
			// Daemon <--
		// Добавляем раздел <--

		this->sections_view.expand_all();

		// Устанавливаем обработчик сигнала на изменение выделенной секции
		this->sections_view.get_selection()->signal_changed().connect(
			sigc::mem_fun(*this, &Settings_window::on_section_changed_callback)
		);
	}
	// Sections view <--

	this->sections_notebook.set_show_tabs(false);
	main_hbox->pack_start(this->sections_notebook, true, true);


	// Client -->
	{
		Gtk::VBox* settings_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
		settings_vbox->set_border_width(tabs_border_width);
		this->sections_notebook.append_page(*settings_vbox);

		Gtk::HBox* hbox;
		Gtk::VBox* vbox;
		Gtk::LinkButton* button;

		m::gtk::vbox::add_big_header(*settings_vbox, _("Client"));

		vbox = Gtk::manage(new Gtk::VBox(false, 0));
		settings_vbox->pack_start(*vbox, false, false);

		// Main -->
			hbox = Gtk::manage(new Gtk::HBox(false, 0));
			vbox->pack_start(*hbox, false, false);

			button = Gtk::manage(new Gtk::LinkButton("Client::Main", _("Main")));
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button,
						sections_paths[CLIENT_MAIN]
					)
				)
			);
			hbox->pack_start(*button, false, false);
		// Main <--

		// GUI -->
			hbox = Gtk::manage(new Gtk::HBox(false, 0));
			vbox->pack_start(*hbox, false, false);

			button = Gtk::manage(new Gtk::LinkButton("Client::GUI", _("GUI")));
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button,
						sections_paths[CLIENT_GUI]
					)
				)
			);
			hbox->pack_start(*button, false, false);
		// GUI <--
	}
	// Client <--


	// Client::Main -->
	{
		Gtk::VBox* settings_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
		settings_vbox->set_border_width(tabs_border_width);
		this->sections_notebook.append_page(*settings_vbox);

		m::gtk::vbox::add_big_header(*settings_vbox, _("Client::Main"));

		// show_add_torrent_dialog -->
			this->show_add_torrent_dialog.set_label(_("Show add torrent dialog when opening torrent file"));
			settings_vbox->pack_start(this->show_add_torrent_dialog, false, false);
		// show_add_torrent_dialog <--

		// start torrent on adding -->
			this->start_torrent_on_adding_check_button.set_label(_("Start torrent on adding"));
			settings_vbox->pack_start(this->start_torrent_on_adding_check_button, false, false);
		// start torrent on adding <--

		m::gtk::vbox::add_space(*settings_vbox);

		// download_to -->
			this->download_to_dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
			this->download_to_dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
			this->download_to_dialog.set_default_response(Gtk::RESPONSE_OK);
			m::gtk::vbox::add_widget_with_label(*settings_vbox, _("Download to:"), this->download_to_button);
		// download_to <--

		// copy_finished_to -->
		{
			Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, m::gtk::HBOX_SPACING));
			settings_vbox->pack_start(*hbox, false, false);

			this->copy_finished_to_check_button.set_label( _("Copy finished to:") ),
			this->copy_finished_to_check_button.set_active();
			this->copy_finished_to_check_button.signal_toggled().connect(sigc::mem_fun(*this, &Settings_window::on_copy_finished_to_path_toggled_callback));
			hbox->pack_start(this->copy_finished_to_check_button, false, false);

			this->copy_finished_to_dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
			this->copy_finished_to_dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
			this->copy_finished_to_dialog.set_default_response(Gtk::RESPONSE_OK);
			hbox->pack_end(this->copy_finished_to_button, false, false);
		}
		// copy_finished_to <--

		m::gtk::vbox::add_space(*settings_vbox);

		// run command
		m::gtk::vbox::add_widget_with_label(*settings_vbox, _("Open command:"), this->open_command, true, true);
	}
	// Client::Main <--


	// Client::GUI -->
	{
		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.client.gui.glade",
			"client_gui_settings"
		);

		Gtk::VBox* settings_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
		settings_vbox->set_border_width(tabs_border_width);
		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "client_gui_settings")
		);

		{
			Gtk::LinkButton* button;

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "client_gui_misc_link", button);
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button, sections_paths[CLIENT_GUI_MISC]
					)
				)
			);

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "client_gui_status_bar_link", button);
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button, sections_paths[CLIENT_GUI_STATUS_BAR]
					)
				)
			);
		}
	}
	// Client::GUI <--


	// Client::GUI::Misc -->
	{
		Private::Gui_misc& misc = priv->client.gui.misc;

		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.client.gui.misc.glade",
			"gui_misc_settings"
		);

		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "gui_misc_settings")
		);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "show_speed_in_window_title",				misc.show_speed_in_window_title);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "show_zero_values",						misc.show_zero_values);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "compact_details_tab",						misc.compact_details_tab);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "show_tray_icon",							misc.show_tray_icon);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "tray_container",							misc.tray_container);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "hide_app_to_tray_at_startup",				misc.hide_app_to_tray_at_startup);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "minimize_to_tray",						misc.minimize_to_tray);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "close_to_tray",							misc.close_to_tray);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "gui_update_interval",						misc.gui_update_interval);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "max_log_lines",							misc.max_log_lines);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "download_completed_notification",			misc.download_completed_notification);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "all_downloads_completed_notification",	misc.all_downloads_completed_notification);


		misc.show_tray_icon->signal_toggled().connect(sigc::mem_fun(
			*this, &Settings_window::on_show_tray_icon_toggled_callback
		));
	}
	// Client::GUI::Misc <--


	// Client::GUI::Status bar -->
	{
		Private::Status_bar& bar = priv->client.gui.status_bar;

		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.client.gui.status_bar.glade",
			"status_bar_settings"
		);

		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "status_bar_settings")
		);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "download_speed",			bar.download_speed);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "download_payload_speed",	bar.download_payload_speed);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "upload_speed",			bar.upload_speed);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "upload_payload_speed",	bar.upload_payload_speed);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "download",				bar.download);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "payload_download",		bar.payload_download);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "upload",					bar.upload);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "payload_upload",			bar.payload_upload);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "share_ratio",				bar.share_ratio);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "failed",					bar.failed);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "redundant",				bar.redundant);
	}
	// Client::GUI::Status bar <--



	// Daemon -->
	{
		Gtk::VBox* settings_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
		settings_vbox->set_border_width(tabs_border_width);
		this->sections_notebook.append_page(*settings_vbox);

		Gtk::HBox* hbox;
		Gtk::VBox* vbox;
		Gtk::LinkButton* button;

		m::gtk::vbox::add_big_header(*settings_vbox, _("Daemon"));

		vbox = Gtk::manage(new Gtk::VBox(false, 0));
		settings_vbox->pack_start(*vbox, false, false);

		// Network -->
			hbox = Gtk::manage(new Gtk::HBox(false, 0));
			vbox->pack_start(*hbox, false, false);

			button = Gtk::manage(new Gtk::LinkButton("Daemon::Network", _("Network")));
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button,
						sections_paths[DAEMON_NETWORK]
					)
				)
			);
			hbox->pack_start(*button, false, false);
		// Network <--

		// Automation -->
			hbox = Gtk::manage(new Gtk::HBox(false, 0));
			vbox->pack_start(*hbox, false, false);

			button = Gtk::manage(new Gtk::LinkButton("Daemon::Automation", _("Automation")));
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button,
						sections_paths[DAEMON_AUTOMATION]
					)
				)
			);
			hbox->pack_start(*button, false, false);
		// Automation <--
	}
	// Daemon <--


	// Daemon::Network -->
	{
		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.daemon.network.glade",
			"daemon_network_settings"
		);

		Gtk::VBox* settings_vbox = Gtk::manage(new Gtk::VBox(false, m::gtk::VBOX_SPACING));
		settings_vbox->set_border_width(tabs_border_width);
		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "daemon_network_settings")
		);

		{
			Gtk::LinkButton* button;

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "daemon_network_misc_link", button);
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button, sections_paths[DAEMON_NETWORK_MISC]
					)
				)
			);

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "daemon_network_ip_filter_link", button);
			button->signal_clicked().connect(
				sigc::bind< std::pair<Gtk::LinkButton*, Gtk::TreePath> >(
					sigc::mem_fun(*this, &Settings_window::on_change_section_callback),
					std::pair<Gtk::LinkButton*, Gtk::TreePath>(
						button, sections_paths[DAEMON_NETWORK_IP_FILTER]
					)
				)
			);
		}
	}
	// Daemon::Network <--


	// Daemon::Network::Misc -->
	{
		Private::Network_misc& misc = priv->daemon.network.misc;

		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.daemon.network.misc.glade",
			"network_misc_settings"
		);

		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "network_misc_settings")
		);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "random_port", misc.random_port);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "custom_port", misc.custom_port);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "custom_port_box", misc.custom_port_box);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "from_port", misc.from_port);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "to_port", misc.to_port);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "current_port", misc.current_port);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "dht", misc.dht);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "upnp", misc.upnp);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "lsd", misc.lsd);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "natpmp", misc.natpmp);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "pex", misc.pex);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "smart_ban", misc.smart_ban);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "download_rate_limit", misc.download_rate_limit);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "upload_rate_limit", misc.upload_rate_limit);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "max_uploads", misc.max_uploads);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "max_connections", misc.max_connections);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "ignore_limits_on_local_network", misc.ignore_limits_on_local_network);

		MLIB_GTK_BUILDER_GET_WIDGET(builder, "use_max_announce_interval", misc.use_max_announce_interval);
		MLIB_GTK_BUILDER_GET_WIDGET(builder, "max_announce_interval", misc.max_announce_interval);

		misc.random_port->signal_toggled().connect(
			sigc::mem_fun(*priv, &Private::on_random_port_toggled_cb));
		misc.from_port->signal_value_changed().connect(
			sigc::mem_fun(*priv, &Private::on_listen_port_range_changed_cb));
		misc.to_port->signal_value_changed().connect(
			sigc::mem_fun(*priv, &Private::on_listen_port_range_changed_cb));
	}
	// Daemon::Network::Misc <--


	// Daemon::IP filter -->
	{
		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.daemon.network.ip_filter.glade",
			"ip_filter_settings"
		);

		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "ip_filter_settings")
		);
		MLIB_GTK_BUILDER_GET_WIDGET_DERIVED(builder, "ip_filter", priv->daemon.network.ip_filter);
	}
	// Daemon::IP filter <--


	// Daemon::Automation -->
	{
		Private::Automation& automation = priv->daemon.automation;

		m::gtk::Builder builder = MLIB_GTK_BUILDER_CREATE(
			std::string(APP_UI_PATH) + "/preferences.daemon.automation.glade",
			"automation_settings"
		);

		this->sections_notebook.append_page(
			*MLIB_GTK_BUILDER_GET_WIDGET(builder, "automation_settings")
		);


		// Auto load -->
		{
			Private::Auto_load& load = automation.load;

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load", load.is);
			load.is->signal_toggled().connect(sigc::mem_fun(
				*this, &Settings_window::on_auto_load_torrents_toggled_callback
			));

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load_container", load.container);

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load_from", load.from);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load_to", load.to);

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load_copy", load.copy);
			load.copy->signal_toggled().connect(sigc::mem_fun(
				*this, &Settings_window::on_auto_load_torrents_copy_to_toggled_callback
			));
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load_copy_to", load.copy_to);

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_load_delete_loaded", load.delete_loaded);
		}
		// Auto load <--


		// Auto clean -->
		{
			Private::Auto_clean& clean = automation.clean;

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_seeding_time_type", clean.max_seeding_time_type_button);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_seeding_time_label", clean.max_seeding_time_type_label);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_seeding_time", clean.max_seeding_time);
			clean.max_seeding_time_type_button->signal_clicked().connect(sigc::mem_fun(
				*this, &Settings_window::on_auto_clean_max_seeding_time_clicked_cb
			));

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_ratio_type", clean.max_ratio_type_button);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_ratio_label", clean.max_ratio_type_label);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_ratio", clean.max_ratio);
			clean.max_ratio_type_button->signal_clicked().connect(sigc::mem_fun(
				*this, &Settings_window::on_auto_clean_max_ratio_clicked_cb
			));

			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_seeding_torrents_type", clean.max_seeding_torrents_type_button);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_seeding_torrents_label", clean.max_seeding_torrents_type_label);
			MLIB_GTK_BUILDER_GET_WIDGET(builder, "auto_clean_max_seeding_torrents", clean.max_seeding_torrents);
			clean.max_seeding_torrents_type_button->signal_clicked().connect(sigc::mem_fun(
				*this, &Settings_window::on_auto_clean_max_seeding_torrents_clicked_cb
			));
		}
		// Auto clean <--
	}
	// Daemon::Automation <--

	// OK, Cancel -->
	{
		Gtk::ButtonBox* button_box = Gtk::manage(new Gtk::HButtonBox());
		button_box->set_layout(Gtk::BUTTONBOX_END);
		button_box->set_spacing(m::gtk::HBOX_SPACING);
		main_vbox->pack_start(*button_box, false, false);


		Gtk::Button* button;

		button = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
		button->signal_clicked().connect(sigc::mem_fun(*this, &Settings_window::on_cancel_button_callback));
		button_box->add(*button);

		button = Gtk::manage(new Gtk::Button(Gtk::Stock::OK));
		button->signal_clicked().connect(sigc::mem_fun(*this, &Settings_window::on_ok_button_callback));
		button_box->add(*button);
	}
	// OK, Cancel <--

	// Закрытие окна
	this->signal_delete_event().connect(sigc::mem_fun(*this, &Settings_window::on_close_callback));

	this->load_settings();

	// Выделяем вкладку по умолчанию -->
		this->show_all_children(); // Иначе сигнал не будет сгенерирован
		this->sections_view.get_selection()->select(sections_paths[CLIENT_MAIN]);
	// Выделяем вкладку по умолчанию <--

	this->show_all();
}
Пример #12
0
HistorySubMenu::HistorySubMenu( const std::string& url_history )
    : Gtk::Menu(),
      m_url_history( url_history )
{
    Gtk::MenuItem* item;

    // メニュー項目作成

    // 履歴クリア
    Gtk::Menu* menu = Gtk::manage( new Gtk::Menu() );
    item = Gtk::manage( new Gtk::MenuItem( "クリアする(_C)", true ) );
    menu->append( *item );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_clear ) ); 

    item = Gtk::manage( new Gtk::MenuItem( "履歴クリア(_C)", true ) );
    item->set_submenu( *menu );
    append( *item );

    item = Gtk::manage( new Gtk::MenuItem( "サイドバーに全て表示(_S)", true ) );
    append( *item );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_switch_sideber ) );

    // セパレータ
    item = Gtk::manage( new Gtk::SeparatorMenuItem() );
    append( *item );

    // 履歴項目
    for( int i = 0; i < CONFIG::get_history_size(); ++i ){

        Gtk::Image* image = Gtk::manage( new Gtk::Image() );
        m_vec_images.push_back( image );

        Gtk::Label* label = Gtk::manage( new Gtk::Label( HIST_NONAME ) );
        m_vec_label.push_back( label );

        Gtk::Label *label_motion = Gtk::manage( new Gtk::Label() );
        if( i == 0 ) label_motion->set_text( CONTROL::get_str_motions( CONTROL::RestoreLastTab ) );

        Gtk::HBox* hbox = Gtk::manage( new Gtk::HBox() );
        hbox->set_spacing( SPACING_MENU );
        hbox->pack_start( *image, Gtk::PACK_SHRINK );
        hbox->pack_start( *label, Gtk::PACK_SHRINK );
        hbox->pack_end( *label_motion, Gtk::PACK_SHRINK );

        Gtk::MenuItem* item = Gtk::manage( new Gtk::MenuItem( *hbox ) );
        append( *item );
        item->signal_activate().connect( sigc::bind< int >( sigc::mem_fun( *this, &HistorySubMenu::slot_active ), i ) );
        item->signal_button_press_event().connect( sigc::bind< int >( sigc::mem_fun( *this, &HistorySubMenu::slot_button_press ), i ) );
    }

    // ポップアップメニュー作成
    m_popupmenu.signal_deactivate().connect( sigc::mem_fun( *this, &HistorySubMenu::deactivate ) );

    item = Gtk::manage( new Gtk::MenuItem( "タブで開く" ) );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_open_history ) );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::SeparatorMenuItem() );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::MenuItem( "履歴から削除" ) );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_remove_history ) );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::SeparatorMenuItem() );
    m_popupmenu.append( *item );

    item = Gtk::manage( new Gtk::MenuItem( "プロパティ" ) );
    item->signal_activate().connect( sigc::mem_fun( *this, &HistorySubMenu::slot_show_property ) );
    m_popupmenu.append( *item );

    m_popupmenu.show_all_children();
}
Пример #13
0
/**
    \brief  Creates a combobox widget for an enumeration parameter
*/
Gtk::Widget *
ParamRadioButton::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal)
{
    if (_gui_hidden) return NULL;

    Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
    Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0));

    Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_LEFT, Gtk::ALIGN_TOP));
    label->show();
    hbox->pack_start(*label, false, false);

    Gtk::ComboBoxText* cbt = 0;
    bool comboSet = false;
    if (_mode == MINIMAL) {
        cbt = Gtk::manage(new ComboWdg(this, doc, node));
        cbt->show();
        vbox->pack_start(*cbt, false, false);
    }

    // add choice strings as radiobuttons
    // and select last selected option (_value)
    Gtk::RadioButtonGroup group;
    for (GSList * list = choices; list != NULL; list = g_slist_next(list)) {
        optionentry * entr = reinterpret_cast<optionentry *>(list->data);
        Glib::ustring * text = entr->guitext;
        switch ( _mode ) {
        case MINIMAL:
        {
            cbt->append_text(*text);
            if (!entr->value->compare(_value)) {
                cbt->set_active_text(*text);
                comboSet = true;
            }
        }
        break;
        case COMPACT:
        case FULL:
        {
            ParamRadioButtonWdg * radio = Gtk::manage(new ParamRadioButtonWdg(group, *text, this, doc, node, changeSignal));
            radio->show();
            vbox->pack_start(*radio, true, true);
            if (!entr->value->compare(_value)) {
                radio->set_active();
            }
        }
        break;
        }
    }

    if ( (_mode == MINIMAL) && !comboSet) {
        cbt->set_active(0);
    }

    vbox->show();
    hbox->pack_end(*vbox, false, false);
    hbox->show();


    return dynamic_cast<Gtk::Widget *>(hbox);
}
Пример #14
0
  void
  RVolume::initGTK()
  {
    _optList.reset(new Gtk::VBox);//The Vbox of options   

    {//Transfer function widget
      _transferFunction.reset(new magnet::gtk::TransferFunction
			      (magnet::function::MakeDelegate
			       (this, &RVolume::transferFunctionUpdated)));
      _transferFunction->set_size_request(-1, 100);
      
      _optList->add(*_transferFunction); _transferFunction->show();
      transferFunctionUpdated(); //Force an update of the transfer function now we have the widget
    }

    {//Volume renderer step size
      _stepSize.reset(new Gtk::Entry);
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Raytrace Step Size"));
      box->pack_start(*label, false, false); label->show();
      box->pack_end(*_stepSize, false, false);
      _stepSize->show(); _stepSize->set_text("0.01");      
      _optList->add(*box); box->show();
    }

    {//Diffusive lighting
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Diffuse Lighting"));
      box->pack_start(*label, false, false); label->show();
      _diffusiveLighting.reset(new Gtk::HScale);
      box->pack_end(*_diffusiveLighting, true, true);
      _diffusiveLighting->set_range(0,2);
      _diffusiveLighting->set_digits(3);
      _diffusiveLighting->show();      
      _diffusiveLighting->set_value(1.0);
      _optList->add(*box); box->show();
    }

    {//Specular lighting
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Specular Lighting"));
      box->pack_start(*label, false, false); label->show();
      _specularLighting.reset(new Gtk::HScale);
      box->pack_end(*_specularLighting, true, true);
      _specularLighting->set_range(0,2);
      _specularLighting->set_digits(3);
      _specularLighting->show();      
      _specularLighting->set_value(1.0);
      _optList->add(*box); box->show();
    }

    {//Ray Dithering
      Gtk::HBox* box = manage(new Gtk::HBox);	
      Gtk::Label* label = manage(new Gtk::Label("Ray Dithering"));
      box->pack_start(*label, false, false); label->show();
      _ditherRay.reset(new Gtk::HScale);
      box->pack_end(*_ditherRay, true, true);
      _ditherRay->set_range(0, 1);
      _ditherRay->set_digits(3);
      _ditherRay->show();
      _ditherRay->set_value(1.0);
      _optList->add(*box); box->show();
    }
    
    _optList->show();
    //Callbacks
    _stepSize->signal_changed()
      .connect(sigc::bind<Gtk::Entry&>(&magnet::Gtk::forceNumericEntry, *_stepSize));
    _stepSize->signal_activate().connect(sigc::mem_fun(*this, &RVolume::guiUpdate));

    guiUpdate();
  }
Пример #15
0
PreferencesDialogImpl::PreferencesDialogImpl() : Gtk::Dialog()
{
    m_editorEntry = NULL;
    m_ctagsEntry = NULL;

    // dialog properties
    set_title("Preferences");
    set_position(GTK_WIN_POS_CENTER);
    set_modal(true);
    set_border_width(10);
    set_policy(false, false, true);

    // create the Default button
    Gtk::Button* defaultButton = manage(new Gtk::Button("Default"));
    defaultButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::defaultButtonCB));
    defaultButton->set_usize(80, -1);
    defaultButton->set_flags(GTK_CAN_DEFAULT);
    defaultButton->show();

    // create the Apply button
    Gtk::Button* applyButton = manage(new Gtk::Button("Apply"));
    applyButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::applyButtonCB));
    applyButton->set_usize(80, -1);
    applyButton->set_flags(GTK_CAN_DEFAULT);
    applyButton->show();

    // create the OK button and make it default
    Gtk::Button* okButton = manage(new Gtk::Button("OK"));
    okButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::okButtonCB));
    okButton->set_usize(80, -1);
    okButton->set_flags(GTK_CAN_DEFAULT);
    okButton->grab_default();
    okButton->show();

    // create the Cancel button
    Gtk::Button* cancelButton = manage(new Gtk::Button("Cancel"));
    cancelButton->clicked.connect(SigC::slot(this, &PreferencesDialogImpl::cancelButtonCB));
    cancelButton->set_usize(80, -1);
    cancelButton->set_flags(GTK_CAN_DEFAULT);
    cancelButton->show();

    // add the buttons to the hbox
    Gtk::HBox* hbox = get_action_area();
    hbox->set_spacing(10);
    hbox->pack_start(*defaultButton, false, false);
    hbox->pack_start(*applyButton, false, false);
    hbox->pack_start(*okButton, false, false);
    hbox->pack_start(*cancelButton, false, false);

    // editor stuff
    Gtk::HBox* editorBox = manage(new Gtk::HBox());
    Gtk::Label* editorLabel = manage(new Gtk::Label("Editor Command: "));
    editorLabel->show();
    editorBox->pack_start(*editorLabel, false, false);
    m_editorEntry = manage(new Gtk::Entry());
    m_editorEntry->set_text(g_configMap[Config::EDITOR[0]]);
    m_editorEntry->show();
    editorBox->pack_end(*m_editorEntry);
    editorBox->show();

    // ctags stuff
    Gtk::HBox* ctagsBox = manage(new Gtk::HBox());
    Gtk::Label* ctagsLabel = manage(new Gtk::Label("Ctags Command: "));
    ctagsLabel->show();
    ctagsBox->pack_start(*ctagsLabel, false, false);
    m_ctagsEntry = manage(new Gtk::Entry());
    m_ctagsEntry->set_text(g_configMap[Config::CTAGS[0]]);
    m_ctagsEntry->show();
    ctagsBox->pack_end(*m_ctagsEntry);
    ctagsBox->show();

    // add everything to the vbox
    Gtk::VBox* vbox = get_vbox();
    vbox->set_spacing(5);
    vbox->pack_start(*editorBox, false, false);
    vbox->pack_start(*ctagsBox, false, false);

    show();
    Gtk::Main::run();
}