⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preferences.cc

📁 About: Paco (pacKAGE oRGANIZER) is a simple, yet powerful tool to aid package management when insta
💻 CC
字号:
//=======================================================================// Preferences.cc//-----------------------------------------------------------------------// This file is part of the package paco// Copyright (C) 2004-2007 David Rosal <david.3r@gmail.com>// For more information visit http://paco.sourceforge.net//=======================================================================#include "config.h"#include "globals.h"#include "Config.h"#include "Preferences.h"#include "MainWindow.h"#include "paco/paco.h"#include <gtkmm/stock.h>#include <gtkmm/frame.h>#include <gtkmm/tooltips.h>using namespace Gpaco;Preferences* Preferences::spPreferences = NULL;Preferences::Preferences():	Gtk::Dialog("gpaco :: Preferences", *gpMainWindow),	mButtonHour("Show _hour in date", true),	mButtonTips("Enable _tooltips", true),	mButtonHuman("Human _readable", true),	mButtonBytes("_Bytes", true),	mButtonKilobytes("_Kilobytes", true),	mButtonMegabytes("_Megabytes", true){	set_position(Gtk::WIN_POS_CENTER_ON_PARENT);	set_border_width(8);	set_has_separator();	set_resizable(false);	signal_response().connect(sigc::mem_fun(*this, &Preferences::response));		get_action_area()->set_layout(Gtk::BUTTONBOX_END);	add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);	Gtk::VButtonBox* pSizeUnitVButtonBox = Gtk::manage		(new Gtk::VButtonBox(Gtk::BUTTONBOX_START));	pSizeUnitVButtonBox->set_border_width(4);	pSizeUnitVButtonBox->pack_start(mButtonHuman);	pSizeUnitVButtonBox->pack_start(mButtonBytes);	pSizeUnitVButtonBox->pack_start(mButtonKilobytes);	pSizeUnitVButtonBox->pack_start(mButtonMegabytes);	gpTips->set_tip(mButtonHuman,		"Show sizes in human readable format (e.g. 13k 3M)");	Gtk::Frame* pSizeUnitFrame = Gtk::manage(new Gtk::Frame(" Size unit "));	pSizeUnitFrame->add(*pSizeUnitVButtonBox);	get_vbox()->set_spacing(8);	get_vbox()->pack_start(*pSizeUnitFrame);	get_vbox()->pack_start(mButtonTips);	get_vbox()->pack_start(mButtonHour);		mButtonHour.set_active(Config::hour());	mButtonTips.set_active(Config::tips());		Gtk::RadioButtonGroup sizeUnitGroup = mButtonHuman.get_group();	mButtonBytes.set_group(sizeUnitGroup);	mButtonKilobytes.set_group(sizeUnitGroup);	mButtonMegabytes.set_group(sizeUnitGroup);	switch (Config::sizeUnit()) {		case Paco::HUMAN_READABLE:	mButtonHuman.set_active(); break;		case Paco::BYTE:			mButtonBytes.set_active(); break;		case Paco::KILOBYTE:		mButtonKilobytes.set_active(); break;		case Paco::MEGABYTE:		mButtonMegabytes.set_active(); break;		default:					g_assert_not_reached();	}	show_all();}Preferences::~Preferences(){	g_assert(spPreferences != NULL);}// [static]void Preferences::instance(){	if (!spPreferences)		spPreferences = new Preferences();	spPreferences->present();}void Preferences::response(int id){	g_assert(spPreferences != NULL);	if (id == Gtk::RESPONSE_OK)		ok();		delete spPreferences;	spPreferences = NULL;;}void Preferences::ok(){	Config::hour(mButtonHour.get_active());	Config::tips(mButtonTips.get_active());		if (mButtonHuman.get_active())		Config::sizeUnit(Paco::HUMAN_READABLE);	else if (mButtonBytes.get_active())		Config::sizeUnit(Paco::BYTE);	else if (mButtonKilobytes.get_active())		Config::sizeUnit(Paco::KILOBYTE);	else if (mButtonMegabytes.get_active())		Config::sizeUnit(Paco::MEGABYTE);	else		g_assert_not_reached();		gpMainWindow->treeView().refresh();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -