glom r1795 - in branches/glom-1-8: . glom glom/utility_widgets
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r1795 - in branches/glom-1-8: . glom glom/utility_widgets
- Date: Thu, 11 Dec 2008 17:46:34 +0000 (UTC)
Author: murrayc
Date: Thu Dec 11 17:46:34 2008
New Revision: 1795
URL: http://svn.gnome.org/viewvc/glom?rev=1795&view=rev
Log:
2008-12-11 Murray Cumming <murrayc murrayc com>
* glom/Makefile.am:
* glom/dialog_existing_or_new.[h|cc]: Also check an alternative
directory path for the examples because an (unofficial) Ubuntu package
installs them in an unexpected location. I would rather find out
how/why that is happening though.
Modified:
branches/glom-1-8/ChangeLog
branches/glom-1-8/glom/Makefile.am
branches/glom-1-8/glom/dialog_existing_or_new.cc
branches/glom-1-8/glom/dialog_existing_or_new.h
branches/glom-1-8/glom/utility_widgets/flowtable.cc
Modified: branches/glom-1-8/glom/Makefile.am
==============================================================================
--- branches/glom-1-8/glom/Makefile.am (original)
+++ branches/glom-1-8/glom/Makefile.am Thu Dec 11 17:46:34 2008
@@ -7,6 +7,7 @@
gladedir = $(datadir)/glom/glade
glomxsltdir = $(datadir)/glom/xslt/
glom_examples_dir = $(pkgdatadir)/doc/examples/
+glom_examples_dir_alternative = $(datadir)/doc/glom/examples/
glom_icon_dir = $(datadir)/icons/hicolor/48x48/apps
bin_PROGRAMS = glom
@@ -24,6 +25,7 @@
-DDATADIR=\""$(datadir)"\" \
-DGLOM_XSLTDIR=\""$(glomxsltdir)/"\" \
-DGLOM_EXAMPLES_DIR=\""$(glom_examples_dir)"\" \
+ -DGLOM_EXAMPLES_DIR_ALTERNATIVE=\""$(glom_examples_dir_alternative)"\" \
-DGLOM_ICON_DIR=\""$(glom_icon_dir)"\"
glom_SOURCES = main.cc \
Modified: branches/glom-1-8/glom/dialog_existing_or_new.cc
==============================================================================
--- branches/glom-1-8/glom/dialog_existing_or_new.cc (original)
+++ branches/glom-1-8/glom/dialog_existing_or_new.cc Thu Dec 11 17:46:34 2008
@@ -157,7 +157,10 @@
m_iter_new_template = m_new_model->append();
(*m_iter_new_template)[m_new_columns.m_col_title] = _("New From Template");
- // Load example files
+
+ // Load example files:
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+
#ifdef G_OS_WIN32
gchar* dir = g_win32_get_package_installation_subdirectory(NULL, NULL, "share/glom/doc/examples");
std::string path(dir);
@@ -166,25 +169,21 @@
if(!Glib::file_test(path, Glib::FILE_TEST_EXISTS))
path = GLOM_EXAMPLES_DIR;
#else
-#ifndef GLOM_ENABLE_CLIENT_ONLY
const char* path = GLOM_EXAMPLES_DIR;
-#endif
-#endif
+#endif //G_OS_WIN32
-#ifndef GLOM_ENABLE_CLIENT_ONLY
- m_examples_dir = Gio::File::create_for_path(path);
-
- try
+ if(!list_examples_at_path(path))
{
- m_examples_dir->enumerate_children_async(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_enumerate_children),
- G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE","G_FILE_ATTRIBUTE_STANDARD_NAME);
- // TODO: Monitor example directory for new/removed files?
- }
- catch(const Glib::Exception& ex)
- {
- std::cerr << "Could not enumerate examples at path=:" << path << ex.what() << std::endl;
+ // If that directory did not exist, then try this one instead:
+ // (An Ubuntu package puts the example files here for some reason.
+ // TODO: Find out what Makefile.am variable to use to just use this automatically instead.
+ #ifndef G_OS_WIN32
+ list_examples_at_path(GLOM_EXAMPLES_DIR_ALTERNATIVE);
+ #endif //G_OS_WIN32
}
-#endif /* !GLOM_ENABLE_CLIENT_ONLY */
+
+#endif //!GLOM_ENABLE_CLIENT_ONLY
+
// Browse local network
#ifndef G_OS_WIN32
@@ -246,6 +245,28 @@
update_ui_sensitivity();
}
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+bool Dialog_ExistingOrNew::list_examples_at_path(const std::string& path)
+{
+ std::cout << "Dialog_ExistingOrNew::list_examples_at_path(): path=" << path << std::endl;
+
+ m_examples_dir = Gio::File::create_for_path(path);
+
+ try
+ {
+ m_examples_dir->enumerate_children_async(sigc::mem_fun(*this, &Dialog_ExistingOrNew::on_enumerate_children),
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE","G_FILE_ATTRIBUTE_STANDARD_NAME);
+ // TODO: Monitor example directory for new/removed files?
+ return true;
+ }
+ catch(const Glib::Exception& ex)
+ {
+ std::cerr << "Could not enumerate examples at path=:" << path << ex.what() << std::endl;
+ return false;
+ }
+}
+#endif // !GLOM_ENABLE_CLIENT_ONLY
+
Dialog_ExistingOrNew::~Dialog_ExistingOrNew()
{
#ifndef G_OS_WIN32
@@ -578,6 +599,9 @@
#ifndef GLOM_ENABLE_CLIENT_ONLY
void Dialog_ExistingOrNew::on_enumerate_children(const Glib::RefPtr<Gio::AsyncResult>& res)
{
+ if(!m_examples_dir)
+ return;
+
try
{
m_examples_enumerator = m_examples_dir->enumerate_children_finish(res);
@@ -585,7 +609,7 @@
}
catch(const Glib::Exception& ex)
{
- std::cerr << "Could not enumerate examples: " << ex.what() << std::endl;
+ std::cerr << "Could not enumerate files in examples directory: " << ex.what() << std::endl;
m_examples_enumerator.reset();
m_examples_dir.reset();
Modified: branches/glom-1-8/glom/dialog_existing_or_new.h
==============================================================================
--- branches/glom-1-8/glom/dialog_existing_or_new.h (original)
+++ branches/glom-1-8/glom/dialog_existing_or_new.h Thu Dec 11 17:46:34 2008
@@ -69,6 +69,7 @@
std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_existing(const Gtk::TreeModel::iterator& parent, const Glib::ustring& text);
std::auto_ptr<Gtk::TreeModel::iterator> create_dummy_item_new(const Gtk::TreeModel::iterator& parent, const Glib::ustring& text);
+
void existing_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
void existing_title_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
void new_icon_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
@@ -84,6 +85,7 @@
void update_ui_sensitivity();
#ifndef GLOM_ENABLE_CLIENT_ONLY
+ bool list_examples_at_path(const std::string& path);
void on_enumerate_children(const Glib::RefPtr<Gio::AsyncResult>& res);
void on_next_files(const Glib::RefPtr<Gio::AsyncResult>& res);
void on_read(const Glib::RefPtr<Gio::AsyncResult>& res);
Modified: branches/glom-1-8/glom/utility_widgets/flowtable.cc
==============================================================================
--- branches/glom-1-8/glom/utility_widgets/flowtable.cc (original)
+++ branches/glom-1-8/glom/utility_widgets/flowtable.cc Thu Dec 11 17:46:34 2008
@@ -467,7 +467,7 @@
value = 1;
m_columns_count = value;
- std::cout << "FlowTable::set_columns_count(): m_columns_count=:" << m_columns_count << std::endl;
+ //std::cout << "FlowTable::set_columns_count(): m_columns_count=:" << m_columns_count << std::endl;
}
void FlowTable::get_item_requested_width(const FlowTableItem& item, int& first, int& second) const
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]