glom r1797 - in trunk: . glom glom/libglom



Author: murrayc
Date: Thu Dec 11 18:31:08 2008
New Revision: 1797
URL: http://svn.gnome.org/viewvc/glom?rev=1797&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:
   trunk/ChangeLog
   trunk/config.h.in
   trunk/glom/Makefile.am
   trunk/glom/dialog_existing_or_new.cc
   trunk/glom/dialog_existing_or_new.h
   trunk/glom/libglom/connectionpool.cc

Modified: trunk/config.h.in
==============================================================================
--- trunk/config.h.in	(original)
+++ trunk/config.h.in	Thu Dec 11 18:31:08 2008
@@ -70,10 +70,6 @@
 /* ISO codes prefix */
 #undef ISO_CODES_PREFIX
 
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
-#undef LT_OBJDIR
-
 /* Name of package */
 #undef PACKAGE
 

Modified: trunk/glom/Makefile.am
==============================================================================
--- trunk/glom/Makefile.am	(original)
+++ trunk/glom/Makefile.am	Thu Dec 11 18:31:08 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: trunk/glom/dialog_existing_or_new.cc
==============================================================================
--- trunk/glom/dialog_existing_or_new.cc	(original)
+++ trunk/glom/dialog_existing_or_new.cc	Thu Dec 11 18:31:08 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: trunk/glom/dialog_existing_or_new.h
==============================================================================
--- trunk/glom/dialog_existing_or_new.h	(original)
+++ trunk/glom/dialog_existing_or_new.h	Thu Dec 11 18:31:08 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: trunk/glom/libglom/connectionpool.cc
==============================================================================
--- trunk/glom/libglom/connectionpool.cc	(original)
+++ trunk/glom/libglom/connectionpool.cc	Thu Dec 11 18:31:08 2008
@@ -583,7 +583,7 @@
 #endif // !G_OS_WIN32
 
   //If we crash while running (unlikely, hopefully), then try to cleanup.
-  previous_sig_handler = signal(SIGSEGV, &on_linux_signal);
+  //previous_sig_handler = signal(SIGSEGV, &on_linux_signal);
 
   return true;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]