glom r1995 - in trunk: . glom glom/layout_item_dialogs glom/libglom/data_structure glom/mode_data glom/mode_design/print_layouts glom/utility_widgets glom/utility_widgets/calendar



Author: murrayc
Date: Tue Mar 17 08:40:25 2009
New Revision: 1995
URL: http://svn.gnome.org/viewvc/glom?rev=1995&view=rev

Log:
2009-03-17  Murray Cumming  <murrayc murrayc com>

* configure.ac: Depend on gtkmm 2.14 rather than gtkmm 2.10.

* glom/Makefile.am: 
* glom/utility_widgets/Makefile.am:
* glom/utility_widgets/calendar/: Remove copy of Gtk::Calendar.
* glom/mode_data/box_data_calendar_related.h: Adapted.

* glom/application.cc:: init_toolbars(), add_ui_from_string():
* glom/dialog_existing_or_new.cc: constructor, get_uri(), 
existing_icon_data_func():
* glom/dialog_existing_or_new.h
* glom/layout_item_dialogs/box_formatting.cc: get_formatting():
* glom/libglom/data_structure/print_layout.cc: Constructor, operator=():

* glom/mode_design/print_layouts/canvas_print_layout.cc: set_print_layout():
* glom/mode_design/print_layouts/window_print_layout_edit.cc: 
get_icon_for_toolbar_item(), on_canvas_drag_drop(), on_canvas_drag_motion():
* glom/xsl_utils.cc: transform_and_open(): 
Remove workarounds for gtkmm 2.10 now that we can depend on gtkmm 2.14.
This is not really necessary but it's nice to clean up the code.

Removed:
   trunk/glom/utility_widgets/calendar/
Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/glom/Makefile.am
   trunk/glom/application.cc
   trunk/glom/dialog_existing_or_new.cc
   trunk/glom/dialog_existing_or_new.h
   trunk/glom/layout_item_dialogs/box_formatting.cc
   trunk/glom/libglom/data_structure/print_layout.cc
   trunk/glom/mode_data/box_data_calendar_related.h
   trunk/glom/mode_design/print_layouts/canvas_print_layout.cc
   trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc
   trunk/glom/utility_widgets/Makefile.am
   trunk/glom/xsl_utils.cc

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Tue Mar 17 08:40:25 2009
@@ -106,7 +106,7 @@
 
 
 # Do not require, goocanvas and gtksourceviewmm in client only mode
-REQUIRED_LIBS="bakery-2.6 >= 2.6.0 gtkmm-2.4 >= 2.10 gthread-2.0 libxslt >= 1.1.10 pygda-4.0 >= 2.25.3 pygtk-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.12 libgda-4.0 >= 3.99.13 libgda-postgres-4.0 goocanvasmm-1.0 >= 0.13.0"
+REQUIRED_LIBS="bakery-2.6 >= 2.6.0 gtkmm-2.4 >= 2.14 gthread-2.0 libxslt >= 1.1.10 pygda-4.0 >= 2.25.3 pygtk-2.0 >= 2.6.0 libgdamm-4.0 >= 3.99.12 libgda-4.0 >= 3.99.13 libgda-postgres-4.0 goocanvasmm-1.0 >= 0.13.0"
 if test $enable_client_only != yes; then
 	REQUIRED_LIBS="$REQUIRED_LIBS gtksourceviewmm-2.0"
 fi
@@ -115,7 +115,7 @@
 if test "$enable_maemo" = "yes"; then
 	REQUIRED_LIBS="$REQUIRED_LIBS hildonmm libepc-1.0 >= 0.3.1 avahi-ui";
 elif test "$win32" = "true"; then
-	REQUIRED_LIBS="$REQUIRED_LIBS gtkmm-2.4 >= 2.10";
+	REQUIRED_LIBS="$REQUIRED_LIBS gtkmm-2.4 >= 2.14";
 else
 	REQUIRED_LIBS="$REQUIRED_LIBS iso-codes libepc-1.0 >= 0.3.1 avahi-ui";
 fi
@@ -240,7 +240,6 @@
     glom/mode_find/Makefile \
     glom/navigation/Makefile \
     glom/utility_widgets/Makefile \
-      glom/utility_widgets/calendar/Makefile \
       glom/utility_widgets/cellrendererlist/Makefile \
       glom/utility_widgets/adddel/Makefile \
         glom/utility_widgets/adddel/eggcolumnchooser/Makefile \

Modified: trunk/glom/Makefile.am
==============================================================================
--- trunk/glom/Makefile.am	(original)
+++ trunk/glom/Makefile.am	Tue Mar 17 08:40:25 2009
@@ -82,7 +82,6 @@
               utility_widgets/adddel/libutility_widgets_adddel.a \
               utility_widgets/adddel/eggcolumnchooser/libutility_widgets_adddel_eggcolumnchooserdialog.a \
               utility_widgets/db_adddel/libutility_widgets_db_adddel.a \
-              utility_widgets/calendar/libutility_widgets_calendar.a \
               utility_widgets/canvas/libutility_widgets_canvas.a \
               utility_widgets/cellrendererlist/libutility_widgets_cellrendererlist.a \
               utility_widgets/egg/toolpalette/libeggtoolpalette.la \

Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc	(original)
+++ trunk/glom/application.cc	Tue Mar 17 08:40:25 2009
@@ -259,19 +259,17 @@
 */
 }
 
-//gtkmm <2.12.7 has a bug that stops this working with non-ASCII text,
-//so we use the C function instead.
 //We could put this in Bakery instead, but it's hard enough just getting updates 
 //into Ubuntu, so we override this Bakery::App method here.
-//TODO: Remove this when gtkmm 2.12.7 is distributed widely-enough.
 void App_Glom::add_ui_from_string(const Glib::ustring& ui_description)
 {
-  GError* error = 0;
-  gtk_ui_manager_add_ui_from_string(m_refUIManager->gobj(), ui_description.c_str(), ui_description.bytes(), &error);
-  if(error)
+  try
+  {
+    m_refUIManager->add_ui_from_string(ui_description);
+  }  
+  catch(const Glib::Error& error)
   {
-    std::cerr << "App_Glom::add_ui_from_string(): exception: " << error->message << std::endl;
-    g_clear_error(&error);
+    std::cerr << "App_Glom::add_ui_from_string(): exception: " << error.what() << std::endl;
   }
 }
 

Modified: trunk/glom/dialog_existing_or_new.cc
==============================================================================
--- trunk/glom/dialog_existing_or_new.cc	(original)
+++ trunk/glom/dialog_existing_or_new.cc	Tue Mar 17 08:40:25 2009
@@ -199,7 +199,7 @@
       Gtk::TreeModel::iterator iter = m_existing_model->append(m_iter_existing_recent->children());
       (*iter)[m_existing_columns.m_col_title] = info->get_display_name();
       (*iter)[m_existing_columns.m_col_time] = info->get_modified();
-      (*iter)[m_existing_columns.m_col_recent_info] = new Glib::RefPtr<Gtk::RecentInfo>(info);
+      (*iter)[m_existing_columns.m_col_recent_info] = info;
     }
   }
 
@@ -280,17 +280,6 @@
   }
 #endif
 
-  // Release the recent infos (see comment in the header for why these
-  // have to be dynamically allocated)
-  if(!m_iter_existing_recent_dummy.get())
-  {
-    const Gtk::TreeNodeChildren& children = m_iter_existing_recent->children();
-    for(Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); ++ iter)
-    {
-      Glib::RefPtr<Gtk::RecentInfo>* info = (*iter)[m_existing_columns.m_col_recent_info];
-      delete info;
-    }
-  }
 }
 
 bool Dialog_ExistingOrNew::on_existing_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const Gtk::TreeModel::Path& path, bool /* path_currently_selected */)
@@ -373,8 +362,8 @@
     }
     else
     {
-      Glib::RefPtr<Gtk::RecentInfo>* info = (*iter)[m_existing_columns.m_col_recent_info];
-      return (*info)->get_uri();
+      Glib::RefPtr<Gtk::RecentInfo> info = (*iter)[m_existing_columns.m_col_recent_info];
+      return info->get_uri();
     }
   }
   else
@@ -448,7 +437,7 @@
   {
     if(m_existing_model->is_ancestor(m_iter_existing_recent, iter))
     {
-      //Glib::RefPtr<Gtk::RecentInfo>* info = (*iter)[m_existing_columns.m_col_recent_info];
+      //Glib::RefPtr<Gtk::RecentInfo> info = (*iter)[m_existing_columns.m_col_recent_info];
       //pixbuf_renderer->property_pixbuf() = (*info)->get_icon(Gtk::ICON_SIZE_BUTTON);
       pixbuf_renderer->set_property("icon-name", Glib::ustring("glom"));
     }

Modified: trunk/glom/dialog_existing_or_new.h
==============================================================================
--- trunk/glom/dialog_existing_or_new.h	(original)
+++ trunk/glom/dialog_existing_or_new.h	Tue Mar 17 08:40:25 2009
@@ -134,11 +134,7 @@
 #endif
 
     // For recently used resources:
-    // TODO: We can't use Glib::RefPtr<Gtk::RecentInfo> directly here, due to
-    // bug #527587. Therefore, the refptrs are dynamically allocated and
-    // explicitely freed in the destructor. This has already been fixed in
-    // gtkmm trunk and is fixed for gtkmm 2.14.
-    Gtk::TreeModelColumn<Glib::RefPtr<Gtk::RecentInfo>*> m_col_recent_info;
+    Gtk::TreeModelColumn< Glib::RefPtr<Gtk::RecentInfo> > m_col_recent_info;
   };
   
   class NewModelColumns : public Gtk::TreeModel::ColumnRecord

Modified: trunk/glom/layout_item_dialogs/box_formatting.cc
==============================================================================
--- trunk/glom/layout_item_dialogs/box_formatting.cc	(original)
+++ trunk/glom/layout_item_dialogs/box_formatting.cc	Tue Mar 17 08:40:25 2009
@@ -198,12 +198,6 @@
   enforce_constraints();
 }
 
-//TODO: Remove this when using gtkmm 2.14, which has Gdk::Color::to_string():
-static Glib::ustring color_to_string(const Gdk::Color& color)
-{
-  return Glib::convert_return_gchar_ptr_to_ustring( gdk_color_to_string(color.gobj()) );
-}
-
 bool Box_Formatting::get_formatting(FieldFormatting& format) const
 {
   //Numeric Formatting:
@@ -226,12 +220,13 @@
 
   Glib::ustring color_foreground;
   if(m_checkbox_format_text_color_foreground->get_active())
-    color_foreground = color_to_string( m_colorbutton_foreground->get_color() );
+    color_foreground = m_colorbutton_foreground->get_color().to_string();
   m_format.set_text_format_color_foreground(color_foreground);
 
   Glib::ustring color_background;
   if(m_checkbox_format_text_color_background->get_active())
-    color_background = color_to_string( m_colorbutton_background->get_color() );
+    color_background = m_colorbutton_background->get_color().to_string();
+
   m_format.set_text_format_color_background(color_background);
 
   //Choices:

Modified: trunk/glom/libglom/data_structure/print_layout.cc
==============================================================================
--- trunk/glom/libglom/data_structure/print_layout.cc	(original)
+++ trunk/glom/libglom/data_structure/print_layout.cc	Tue Mar 17 08:40:25 2009
@@ -36,9 +36,8 @@
   m_layout_group(src.m_layout_group),
   m_show_table_title(src.m_show_table_title)
 {
-  //TODO: Use PageSetup::copy() when we can use gtkmm 2.14:
   if(src.m_page_setup)
-    m_page_setup = Glib::wrap( gtk_page_setup_copy(const_cast<GtkPageSetup*>(src.m_page_setup->gobj())) );
+    m_page_setup = src.m_page_setup->copy();
 }
 
 PrintLayout& PrintLayout::operator=(const PrintLayout& src)
@@ -48,10 +47,9 @@
   m_layout_group = src.m_layout_group;
   m_show_table_title = src.m_show_table_title;
 
-  //TODO: Use PageSetup::copy() when we can use gtkmm 2.14:
   m_page_setup.clear();
   if(src.m_page_setup)
-    m_page_setup = Glib::wrap( gtk_page_setup_copy(const_cast<GtkPageSetup*>(src.m_page_setup->gobj())) );
+    m_page_setup = src.m_page_setup->copy();
 
   return *this;
 }

Modified: trunk/glom/mode_data/box_data_calendar_related.h
==============================================================================
--- trunk/glom/mode_data/box_data_calendar_related.h	(original)
+++ trunk/glom/mode_data/box_data_calendar_related.h	Tue Mar 17 08:40:25 2009
@@ -26,7 +26,7 @@
 #include "box_data_portal.h"
 #include <libglom/data_structure/layout/layoutitem_calendarportal.h>
 #include "../utility_widgets/layoutwidgetbase.h"
-#include "../utility_widgets/calendar/glomcalendar.h"
+#include <gtkmm/calendar.h>
 
 namespace Glom
 {
@@ -91,7 +91,7 @@
   void clear_cached_database_values();
     
 private:
-  GlomGtk::Calendar m_calendar;
+  Gtk::Calendar m_calendar;
     
   //TODO: Avoid repeating these in so many widgets:
   Gtk::Menu* m_pMenuPopup;

Modified: trunk/glom/mode_design/print_layouts/canvas_print_layout.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/canvas_print_layout.cc	(original)
+++ trunk/glom/mode_design/print_layouts/canvas_print_layout.cc	Tue Mar 17 08:40:25 2009
@@ -78,10 +78,9 @@
   remove_all_items(m_items_group);
   add_layout_group(print_layout->m_layout_group, true /* is top-level */);
 
-  //TODO: Use PageSetup::copy() when we can use gtkmm 2.14:
   Glib::RefPtr<Gtk::PageSetup> page_setup;
   if(print_layout->get_page_setup())
-    page_setup = Glib::wrap( gtk_page_setup_copy(const_cast<GtkPageSetup*>(print_layout->get_page_setup()->gobj())) );
+    page_setup = print_layout->get_page_setup()->copy();
 
   set_page_setup(page_setup);
 

Modified: trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc
==============================================================================
--- trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc	(original)
+++ trunk/glom/mode_design/print_layouts/window_print_layout_edit.cc	Tue Mar 17 08:40:25 2009
@@ -229,28 +229,21 @@
     return result;
 
   const Gtk::StockID stock_id = action->property_stock_id();
-  if(!(stock_id.get_string().empty())) //The operator bool() is only in gtkmm 2.14.
+  if(!(stock_id.get_string().empty())) //The operator bool() is only in later versions of gtkmm 2.*.x
   {
     result = item.render_icon(stock_id, Gtk::ICON_SIZE_LARGE_TOOLBAR);
   }
   else
   {
-    //TODO: Use this when we can use gtkmm 2.14: Glib::ustring icon_name = action->property_icon_name();
-    gchar* c_icon_name = 0;
-    g_object_get (action->gobj(), "icon-name", &c_icon_name, NULL);
-    Glib::ustring icon_name = Glib::convert_return_gchar_ptr_to_ustring(c_icon_name);
-    c_icon_name = 0;
+    const Glib::ustring icon_name = action->property_icon_name();
 
     Glib::RefPtr<Gdk::Screen> screen = item.get_screen();
     if(!screen)
       return result;
 
-    Glib::RefPtr<Gtk::Settings> settings = Gtk::Settings::get_for_screen(screen);
-
     int width = 0;
     int height = 0;
-    //TODO: Use this when we can use gtkmm 2.14: Gtk::IconSize::lookup(with, height, settings);
-    if(!gtk_icon_size_lookup_for_settings (settings->gobj(), GTK_ICON_SIZE_LARGE_TOOLBAR, &width, &height))
+    if(!Gtk::IconSize::lookup(Gtk::ICON_SIZE_LARGE_TOOLBAR, width, height))
     {
       //An arbitrary default:
       width = height = 24;
@@ -334,9 +327,7 @@
   //Cause our drag_data_received callback to be called:
   //Note that this isn't necessary when using DEST_DEFAULT_DEFAULTS (or DEST_DEFAULT_DROP), 
   //because that would allow us to just return true to make this happen automatically.
-  // Seems the const version of the method was added in gtkmm 2.14 so we do this const_cast here
-  // to allow compiling with 2.12 (jhs)
-  m_canvas.drag_get_data(drag_context, const_cast<Glib::ustring&>(target), timestamp);
+  m_canvas.drag_get_data(drag_context, target, timestamp);
 
   return true; //Allow the drop.
 }
@@ -356,9 +347,7 @@
     //This will cause our drag_data_received callback to be called, with that information.
     //Note: This does not work (and grabs the cursor) if we call dest_set() with the flags for default actions, such as DEST_DEFAULT_DEFAULTS.
     m_drag_preview_requested = true;
-    // Seems the const version of the method was added in gtkmm 2.14 so we do this const_cast here
-    // to allow compiling with 2.12 (jhs)
-    m_canvas.drag_get_data(drag_context, const_cast<Glib::ustring&>(target), timestamp);
+    m_canvas.drag_get_data(drag_context, target, timestamp);
     return true;
   }
 

Modified: trunk/glom/utility_widgets/Makefile.am
==============================================================================
--- trunk/glom/utility_widgets/Makefile.am	(original)
+++ trunk/glom/utility_widgets/Makefile.am	Tue Mar 17 08:40:25 2009
@@ -1,4 +1,4 @@
-SUBDIRS = cellrendererlist adddel db_adddel canvas calendar egg 
+SUBDIRS = cellrendererlist adddel db_adddel canvas egg 
 
 gladedir = $(datadir)/glom/glade/
 glom_icon_dir = $(datadir)/glom/pixmaps

Modified: trunk/glom/xsl_utils.cc
==============================================================================
--- trunk/glom/xsl_utils.cc	(original)
+++ trunk/glom/xsl_utils.cc	Tue Mar 17 08:40:25 2009
@@ -141,14 +141,14 @@
 #ifdef G_OS_WIN32
   // gtk_show_uri doesn't seem to work on Win32, at least not for local files
   // We use Windows API instead.
+  // TODO: Check it again and file a bug if necessary.
   ShellExecute(NULL, "open", file->get_path().c_str(), NULL, NULL, SW_SHOW);
 #else
   //Use the GNOME browser:
-  //TODO: Use gtk_show_uri() as soon as we require GTK+ 2.14
   GError* gerror = 0;
-  if(!g_app_info_launch_default_for_uri(file->get_uri().c_str(), NULL, &gerror))
+  if(gtk_show_uri(0 /* screen */, file->get_uri().c_str(), GDK_CURRENT_TIME, &gerror))
   {
-    std::cerr << "Error while calling g_app_info_launch_default_for_uri(): " << gerror->message << std::endl;
+    std::cerr << "Error while calling gtk_show_uri(): " << gerror->message << std::endl;
     g_error_free(gerror);
   }
 #endif



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