paperbox r181 - in trunk: . src ui
- From: markoa svn gnome org
- To: svn-commits-list gnome org
- Subject: paperbox r181 - in trunk: . src ui
- Date: Sun, 24 Aug 2008 11:32:35 +0000 (UTC)
Author: markoa
Date: Sun Aug 24 11:32:34 2008
New Revision: 181
URL: http://svn.gnome.org/viewvc/paperbox?rev=181&view=rev
Log:
A toolbar with blank about
Modified:
trunk/ChangeLog
trunk/src/main-window.cc
trunk/src/main-window.hh
trunk/ui/window-main.glade
Modified: trunk/src/main-window.cc
==============================================================================
--- trunk/src/main-window.cc (original)
+++ trunk/src/main-window.cc Sun Aug 24 11:32:34 2008
@@ -172,6 +172,7 @@
MainWindow::init_gui(const shared_ptr<Config>& cfg)
{
get_widgets_from_ui_file();
+ init_toolbar();
setup_tiles();
label_tags_.set_markup(boldify(_("Tags")));
@@ -200,6 +201,9 @@
// make sure the glade object has been initialized properly in the ctor
g_assert(glade_);
+ glade_->get_widget("menu_vbox", menu_vbox_);
+ g_assert(menu_vbox_);
+
glade_->get_widget("hpane", hpane_);
g_assert(hpane_);
@@ -220,6 +224,40 @@
}
void
+ MainWindow::init_toolbar()
+ {
+ action_group_ = Gtk::ActionGroup::create();
+
+ action_group_->add(Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT),
+ sigc::mem_fun(*this, &MainWindow::on_menu_about));
+
+ ui_manager_ = Gtk::UIManager::create();
+ ui_manager_->insert_action_group(action_group_);
+
+ /*this->*/add_accel_group(ui_manager_->get_accel_group());
+
+ Glib::ustring ui_info =
+ "<ui>"
+ " <toolbar name='ToolBar'>"
+ " <toolitem action='HelpAbout'/>"
+ " </toolbar>"
+ "</ui>";
+
+ try {
+ ui_manager_->add_ui_from_string(ui_info);
+ } catch (const Glib::Error& ex) {
+ Glib::ustring msg =
+ "building menu and toolbar failed: " + ex.what();
+ LOG_ERROR(msg);
+ g_warning(msg.c_str());
+ }
+
+ Gtk::Widget* toolbar = ui_manager_->get_widget("/ToolBar");
+ if (toolbar)
+ menu_vbox_->pack_start(*toolbar, Gtk::PACK_SHRINK);
+ }
+
+ void
MainWindow::setup_tiles()
{
tile_view_ = Gtk::manage(new DocumentTileView());
@@ -239,6 +277,12 @@
sigc::mem_fun(*this, &MainWindow::on_category_selected));
}
+ void
+ MainWindow::on_menu_about()
+ {
+ g_debug("about...");
+ }
+
bool
MainWindow::on_category_selected(const Glib::RefPtr<Gtk::TreeModel>& /*m*/,
const Gtk::TreeModel::Path& path,
Modified: trunk/src/main-window.hh
==============================================================================
--- trunk/src/main-window.hh (original)
+++ trunk/src/main-window.hh Sun Aug 24 11:32:34 2008
@@ -61,6 +61,7 @@
protected:
void init_gui(const boost::shared_ptr<Config>& cfg);
void get_widgets_from_ui_file();
+ void init_toolbar();
void setup_tiles();
void setup_categories();
void reload_category_view();
@@ -73,6 +74,8 @@
const std::vector<boost::shared_ptr<Document> > docs);
/*** Signal handlers ***/
+ void on_menu_about();
+
void on_new_document(const boost::shared_ptr<Document>& doc);
void on_document_tile_selected(/*Document*/Gtk::Util::Tile& t);
@@ -90,9 +93,13 @@
Browser* browser_;
Glib::RefPtr<Gnome::Glade::Xml> glade_;
+ Glib::RefPtr<Gtk::UIManager> ui_manager_;
+ Glib::RefPtr<Gtk::ActionGroup> action_group_;
/* * Child widgets * */
+ Gtk::VBox* menu_vbox_;
+
// ~left side~
Gtk::HPaned* hpane_;
Gtk::VBox* left_top_vbox_;
Modified: trunk/ui/window-main.glade
==============================================================================
--- trunk/ui/window-main.glade (original)
+++ trunk/ui/window-main.glade Sun Aug 24 11:32:34 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.2 on Sat Apr 26 17:38:32 2008 -->
+<!--Generated with glade3 3.4.5 on Sun Aug 24 13:26:01 2008 -->
<glade-interface>
<widget class="GtkWindow" id="MainWindow">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -10,6 +10,17 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
+ <widget class="GtkVBox" id="menu_vbox">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHPaned" id="hpane">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -85,6 +96,9 @@
</packing>
</child>
</widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]