paperbox r97 - in trunk: . src ui
- From: markoa svn gnome org
- To: svn-commits-list gnome org
- Subject: paperbox r97 - in trunk: . src ui
- Date: Wed, 6 Feb 2008 23:23:05 +0000 (GMT)
Author: markoa
Date: Wed Feb 6 23:23:04 2008
New Revision: 97
URL: http://svn.gnome.org/viewvc/paperbox?rev=97&view=rev
Log:
Generic input dialog, category dialog preps
Added:
trunk/src/dialog-entry.cc
trunk/src/dialog-entry.hh
trunk/ui/dialog-entry.glade
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/dialog-categories.cc
trunk/src/dialog-categories.hh
trunk/src/paths.hh
trunk/ui/Makefile.am
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Wed Feb 6 23:23:04 2008
@@ -1,4 +1,4 @@
-### Copyright (C) 2007 Marko Anastasov
+### Copyright (C) 2007, 2008 Marko Anastasov
AM_CXXFLAGS = -Wall -Wextra \
-Wctor-dtor-privacy -Woverloaded-virtual -Wchar-subscripts \
@@ -17,6 +17,8 @@
category-view.hh \
dialog-categories.cc \
dialog-categories.hh \
+ dialog-entry.cc \
+ dialog-entry.hh \
dialog-tag-entry.cc \
dialog-tag-entry.hh \
document-tag-cloud-model.cc \
Modified: trunk/src/dialog-categories.cc
==============================================================================
--- trunk/src/dialog-categories.cc (original)
+++ trunk/src/dialog-categories.cc Wed Feb 6 23:23:04 2008
@@ -22,6 +22,7 @@
#include <gtkmm/stock.h>
#include "dialog-categories.hh"
+#include "dialog-entry.hh"
#include "paths.hh"
namespace paperbox {
@@ -32,9 +33,12 @@
:
Gtk::Dialog(cobject),
glade_(glade),
+ button_new_(Gtk::Stock::NEW),
+ button_delete_(Gtk::Stock::DELETE),
button_save_(Gtk::Stock::SAVE)
{
init_gui();
+ connect_signals();
}
DialogCategories::~DialogCategories()
@@ -70,16 +74,29 @@
{
get_widgets();
+ category_view_.reset(new CategoryView(vbox_left_));
+
+ vbox_left_->pack_start(button_new_, false, false);
+ vbox_left_->pack_start(button_delete_, false, false);
+
label_category_tags_.set_text("Here are the contents:");
hbox_contents_->pack_start(label_category_tags_);
hbox_contents_->pack_start(button_save_);
vbox_right_->pack_start(scroll_window_);
+ scroll_window_.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
scroll_window_.add(text_view_);
show_all_children();
}
+ void
+ DialogCategories::connect_signals()
+ {
+ button_new_.signal_clicked().connect(
+ sigc::mem_fun(*this, &DialogCategories::on_button_new_clicked));
+ }
+
int
DialogCategories::run()
{
@@ -88,4 +105,18 @@
return response;
}
+ void
+ DialogCategories::on_button_new_clicked()
+ {
+ boost::shared_ptr<DialogEntry> dialog(DialogEntry::create());
+ dialog->set_default_response(Gtk::RESPONSE_OK);
+
+ Glib::ustring name;
+ int response = dialog->run(name);
+
+ if (response == Gtk::RESPONSE_OK) {
+ g_debug("gonna create category %s", name.c_str());
+ }
+ }
+
} // namespace paperbox
Modified: trunk/src/dialog-categories.hh
==============================================================================
--- trunk/src/dialog-categories.hh (original)
+++ trunk/src/dialog-categories.hh Wed Feb 6 23:23:04 2008
@@ -23,12 +23,14 @@
#ifndef __PAPER_BOX_DIALOG_CATEGORIES_HH__
#define __PAPER_BOX_DIALOG_CATEGORIES_HH__
+#include <boost/shared_ptr.hpp>
#include <gtkmm/button.h>
#include <gtkmm/dialog.h>
#include <gtkmm/label.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/textview.h>
#include <libglademm/xml.h>
+#include "category-view.hh"
namespace paperbox {
@@ -46,6 +48,8 @@
protected:
void get_widgets();
void init_gui();
+ void connect_signals();
+ void on_button_new_clicked();
Glib::RefPtr<Gnome::Glade::Xml> glade_;
@@ -54,6 +58,10 @@
Gtk::VBox* vbox_right_;
Gtk::HBox* hbox_contents_;
+ boost::shared_ptr<CategoryView> category_view_;
+ Gtk::Button button_new_;
+ Gtk::Button button_delete_;
+
Gtk::Label label_category_tags_;
Gtk::Button button_save_;
Gtk::ScrolledWindow scroll_window_;
Added: trunk/src/dialog-entry.cc
==============================================================================
--- (empty file)
+++ trunk/src/dialog-entry.cc Wed Feb 6 23:23:04 2008
@@ -0,0 +1,73 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
+/*
+ * PaperBox - dialog-entry.cc
+ *
+ * Copyright (C) 2007 Marko Anastasov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "dialog-entry.hh"
+#include "paths.hh"
+
+namespace paperbox {
+
+ DialogEntry::DialogEntry(GtkDialog* cobject,
+ const Glib::RefPtr<Gnome::Glade::Xml>& glade)
+ :
+ Gtk::Dialog(cobject),
+ glade_(glade),
+ label_instructions_(0)
+ {
+ glade_->get_widget("entry_tags", entry_tags_);
+ g_assert(entry_tags_);
+ }
+
+ DialogEntry::~DialogEntry()
+ {
+ }
+
+ DialogEntry*
+ DialogEntry::create()
+ {
+ Glib::RefPtr<Gnome::Glade::Xml> glade_xml =
+ Gnome::Glade::Xml::create(glade_dialog_entry);
+
+ DialogEntry* p = 0;
+ glade_xml->get_widget_derived("dialog_entry", p);
+ return p;
+ }
+
+ void
+ DialogEntry::set_instructions(const Glib::ustring& msg)
+ {
+ if (! label_instructions_) {
+ glade_->get_widget("label_instructions", label_instructions_);
+ g_assert(label_instructions_);
+ }
+
+ label_instructions_->set_text(msg);
+ }
+
+ int
+ DialogEntry::run(Glib::ustring& text)
+ {
+ int response = Gtk::Dialog::run();
+ text = entry_tags_->get_text();
+ return response;
+ }
+
+} // namespace paperbox
Added: trunk/src/dialog-entry.hh
==============================================================================
--- (empty file)
+++ trunk/src/dialog-entry.hh Wed Feb 6 23:23:04 2008
@@ -0,0 +1,54 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+
+/*
+ * PaperBox - dialog-entry.hh
+ *
+ * Copyright (C) 2007 Marko Anastasov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PAPER_BOX_DIALOG_ENTRY_HH__
+#define __PAPER_BOX_DIALOG_ENTRY_HH__
+
+#include <gtkmm/dialog.h>
+#include <gtkmm/entry.h>
+#include <gtkmm/label.h>
+#include <libglademm/xml.h>
+
+namespace paperbox {
+
+ class DialogEntry : public Gtk::Dialog
+ {
+ public:
+ DialogEntry(GtkDialog* cobject,
+ const Glib::RefPtr<Gnome::Glade::Xml>& glade);
+ virtual ~DialogEntry();
+
+ static DialogEntry* create();
+
+ virtual void set_instructions(const Glib::ustring& msg);
+
+ int run(Glib::ustring& text);
+
+ protected:
+ Glib::RefPtr<Gnome::Glade::Xml> glade_;
+ Gtk::Label* label_instructions_;
+ Gtk::Entry* entry_tags_;
+ };
+
+} // namespace paperbox
+
+#endif // __PAPER_BOX_DIALOG_ENTRY_HH__
Modified: trunk/src/paths.hh
==============================================================================
--- trunk/src/paths.hh (original)
+++ trunk/src/paths.hh Wed Feb 6 23:23:04 2008
@@ -33,6 +33,9 @@
const char* const glade_dialog_categories =
PAPERBOX_PKGDATADIR G_DIR_SEPARATOR_S "dialog-categories.glade";
+ const char* const glade_dialog_entry =
+ PAPERBOX_PKGDATADIR G_DIR_SEPARATOR_S "dialog-entry.glade";
+
const char* const glade_dialog_tag_entry =
PAPERBOX_PKGDATADIR G_DIR_SEPARATOR_S "dialog-tag-entry.glade";
Modified: trunk/ui/Makefile.am
==============================================================================
--- trunk/ui/Makefile.am (original)
+++ trunk/ui/Makefile.am Wed Feb 6 23:23:04 2008
@@ -4,7 +4,7 @@
#menusfiles = actions.xml
-gladefiles = dialog-categories.glade dialog-tag-entry.glade window-main.glade
+gladefiles = dialog-categories.glade dialog-entry.glade dialog-tag-entry.glade window-main.glade
ui_DATA = $(gladefiles)
Added: trunk/ui/dialog-entry.glade
==============================================================================
--- (empty file)
+++ trunk/ui/dialog-entry.glade Wed Feb 6 23:23:04 2008
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.0 on Wed Feb 6 23:51:41 2008 -->
+<glade-interface>
+ <widget class="GtkDialog" id="dialog_entry">
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="border_width">5</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox">
+ <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>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkVBox" id="vbox_main">
+ <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>
+ <property name="spacing">4</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkLabel" id="label_instructions">
+ <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>
+ </widget>
+ <packing>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkEntry" id="entry_tags">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="activates_default">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog_action_area">
+ <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>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="button_cancel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-6</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_ok">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">-5</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]