glom r1851 - in trunk: . glom glom/libglom/document



Author: jhs
Date: Mon Jan 19 11:18:06 2009
New Revision: 1851
URL: http://svn.gnome.org/viewvc/glom?rev=1851&view=rev

Log:
2009-01-19  Johannes Schmid  <jschmid openismus com>

	* glom/application.cc:
	Avoid a critical warning by adding the recent data instead of
	letting Gtk::RecentManager query for non-existing uris which causes a
	Gtk-Critical. Requires new bakery trunk
	
	* glom/libglom/document/document_glom.cc:
	Don't duplicate code from Bakery.

Modified:
   trunk/ChangeLog
   trunk/glom/application.cc
   trunk/glom/libglom/document/document_glom.cc

Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc	(original)
+++ trunk/glom/application.cc	Mon Jan 19 11:18:06 2009
@@ -2370,11 +2370,27 @@
   if(!file_uri.empty())
   {
     prevent = (file_uri == m_example_uri);
+    if (prevent)
+      return;
   }
+  // Check if the file exists because Gtk::RecentManager spits out a warning otherwise
+  Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri (file_uri);
+  if (file->query_exists())
+  {
+    // Call the base class:
+    Bakery::App_WithDoc_Gtk::document_history_add(file_uri);    
+  }
+  else
+  {
+    Gtk::RecentManager::Data data;
+    data.display_name = get_document()->get_name();
+    data.app_name = "Glom";
+    data.mime_type = "application/x-glom";
+    data.is_private = false;
+    Bakery::App_WithDoc_Gtk::document_history_add(file_uri, data);
+  }
+  
 
-  // Call the base class:
-  if(!prevent)
-    Bakery::App_WithDoc_Gtk::document_history_add(file_uri);
 }
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY

Modified: trunk/glom/libglom/document/document_glom.cc
==============================================================================
--- trunk/glom/libglom/document/document_glom.cc	(original)
+++ trunk/glom/libglom/document/document_glom.cc	Mon Jan 19 11:18:06 2009
@@ -1742,7 +1742,7 @@
   //(when in developer mode - no changes should even be possible when not in developer mode)
   if(get_userlevel() == AppState::USERLEVEL_DEVELOPER)
   {
-    //This rebuilds the whole XML DOM and saves the whole document,
+    /*//This rebuilds the whole XML DOM and saves the whole document,
     //so we need to be careful not to call set_modified() too often.
 
       bool test = save_before();
@@ -1754,7 +1754,9 @@
         {
           set_modified(false);
         }
-      }
+      }*/
+		// The above is equivalent as calling Bakery::Document::save()
+		save();
   }
   else
   {
@@ -3138,11 +3140,10 @@
 
 bool Document_Glom::save_before()
 {
-  //std::cout << "debug: save_before(): uri=" << get_file_uri() << std::endl;
- 
   Bakery::BusyCursor busy_cursor(m_parent_window);
 
   xmlpp::Element* nodeRoot = get_node_document();
+
   if(nodeRoot)
   {
     //Always save as the latest format,
@@ -3396,7 +3397,7 @@
     xmlpp::Element* nodeGroups = nodeRoot->add_child(GLOM_NODE_GROUPS);
 
     nodeGroups->add_child_comment("These are only used when recreating a database from an example file. The actual access-control is on the server, of course.");
-
+    
     for(type_map_groups::const_iterator iter = m_groups.begin(); iter != m_groups.end(); ++iter)
     {
       const GroupInfo& group_info = iter->second;
@@ -3438,10 +3439,8 @@
       set_node_attribute_value(nodeModule, GLOM_ATTRIBUTE_LIBRARY_MODULE_NAME, name);
       set_node_attribute_value(nodeModule, GLOM_ATTRIBUTE_LIBRARY_MODULE_SCRIPT, script);
     }
-
   }
 
-
   //We don't use set_write_formatted() because it doesn't handle text nodes well.
   add_indenting_white_space_to_node();
 



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