[gtkmm] Fix the build with --disable-deprecated-api
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Fix the build with --disable-deprecated-api
- Date: Fri, 20 Dec 2013 13:08:50 +0000 (UTC)
commit fdc47d1fa5c634311ec122dd41e695ea83897bc4
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Fri Dec 20 14:06:10 2013 +0100
Fix the build with --disable-deprecated-api
* gdk/gdkmm/filelist.am:
* gdk/src/filelist.am: Split gdkmm_files_hg into gdkmm_files_any_hg and
gdkmm_files_deprecated_hg. Move color.hg to gdkmm_files_deprecated_hg.
* gtk/src/button.ccg: Include gtkmm/image.h.
* gtk/src/radioaction.ccg: Add _DEPRECATE_IFDEF_START/END.
* gtk/src/recentaction.[hg|ccg]: Hand-code deprecated constructors and
create() methods. It's the only way to get correct #ifndef directives in
the .cc file.
* gtk/src/texttag.hg: Add _CONFIGINCLUDE.
gdk/gdkmm/filelist.am | 6 +++---
gdk/src/filelist.am | 16 ++++++++++++++--
gtk/src/button.ccg | 2 +-
gtk/src/radioaction.ccg | 16 ++++++++++++++++
gtk/src/recentaction.ccg | 40 ++++++++++++++++++++++++++++++++++++++++
gtk/src/recentaction.hg | 14 ++++++++++----
gtk/src/texttag.hg | 1 +
7 files changed, 85 insertions(+), 10 deletions(-)
---
diff --git a/gdk/gdkmm/filelist.am b/gdk/gdkmm/filelist.am
index 9c591c1..504439b 100644
--- a/gdk/gdkmm/filelist.am
+++ b/gdk/gdkmm/filelist.am
@@ -1,8 +1,8 @@
## This file is part of gtkmm.
-gdkmm_files_built_cc = $(gdkmm_files_hg:.hg=.cc) wrap_init.cc
-gdkmm_files_built_h = $(gdkmm_files_hg:.hg=.h)
-gdkmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(gdkmm_files_hg))
+gdkmm_files_built_cc = $(gdkmm_files_used_hg:.hg=.cc) wrap_init.cc
+gdkmm_files_built_h = $(gdkmm_files_used_hg:.hg=.h)
+gdkmm_files_built_ph = $(patsubst %.hg,private/%_p.h,$(gdkmm_files_used_hg))
gdkmm_files_extra_cc = general.cc
gdkmm_files_extra_h = general.h wrap_init.h
diff --git a/gdk/src/filelist.am b/gdk/src/filelist.am
index 7127515..91158d4 100644
--- a/gdk/src/filelist.am
+++ b/gdk/src/filelist.am
@@ -12,9 +12,8 @@ gdkmm_files_defs = \
gdk_docs.xml \
gdk_docs_override.xml
-gdkmm_files_hg = \
+gdkmm_files_any_hg = \
applaunchcontext.hg \
- color.hg \
cursor.hg \
device.hg \
devicemanager.hg \
@@ -35,4 +34,17 @@ gdkmm_files_hg = \
visual.hg \
window.hg
+gdkmm_files_deprecated_hg = \
+ color.hg
+
+if DISABLE_DEPRECATED_API
+gdkmm_files_used_hg = $(gdkmm_files_any_hg)
+else
+gdkmm_files_used_hg = $(gdkmm_files_any_hg) $(gdkmm_files_deprecated_hg)
+endif
+
+gdkmm_files_hg = \
+ $(gdkmm_files_any_hg) \
+ $(gdkmm_files_deprecated_hg)
+
gdkmm_files_ccg = $(gdkmm_files_hg:.hg=.ccg)
diff --git a/gtk/src/button.ccg b/gtk/src/button.ccg
index e519342..583880f 100644
--- a/gtk/src/button.ccg
+++ b/gtk/src/button.ccg
@@ -18,7 +18,7 @@
#include <gtk/gtk.h>
#include <gtkmm/stock.h>
-
+#include <gtkmm/image.h>
namespace Gtk
{
diff --git a/gtk/src/radioaction.ccg b/gtk/src/radioaction.ccg
index 9c1f4f6..b26b00a 100644
--- a/gtk/src/radioaction.ccg
+++ b/gtk/src/radioaction.ccg
@@ -23,12 +23,14 @@ typedef Gtk::RadioAction::Group Group; //So that the generate get_group return t
namespace Gtk
{
+_DEPRECATE_IFDEF_START
RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const
Glib::ustring& label, const Glib::ustring& tooltip)
:
_CONSTRUCT("name", name.c_str(), "stock_id", stock_id.get_c_str(), "label", (label.empty() ? 0 :
label.c_str()), "tooltip", (tooltip.empty() ? 0 : tooltip.c_str()))
{
set_group(group);
}
+_DEPRECATE_IFDEF_END
RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Glib::ustring& icon_name, const
Glib::ustring& label, const Glib::ustring& tooltip)
:
@@ -39,13 +41,27 @@ RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Glib::us
Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Glib::ustring&
label, const Glib::ustring& tooltip)
{
+_DEPRECATE_IFDEF_START
return Glib::RefPtr<RadioAction>( new RadioAction(group, name, Gtk::StockID(), label, tooltip) );
+#else // GTKMM_DISABLE_DEPRECATED
+ // StockID is deprecated. Can't call the constructor that takes a StockID.
+ Glib::RefPtr<RadioAction> action(new RadioAction());
+ action->set_name(name);
+ action->set_group(group);
+ if (!label.empty())
+ action->set_label(label);
+ if (!tooltip.empty())
+ action->set_tooltip(tooltip);
+ return action;
+_DEPRECATE_IFDEF_END
}
+_DEPRECATE_IFDEF_START
Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Gtk::StockID&
stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
{
return Glib::RefPtr<RadioAction>( new RadioAction(group, name, stock_id, label, tooltip) );
}
+_DEPRECATE_IFDEF_END
Glib::RefPtr<RadioAction> RadioAction::create_with_icon_name(Group& group, const Glib::ustring& name, const
Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
{
diff --git a/gtk/src/recentaction.ccg b/gtk/src/recentaction.ccg
index 8045bee..1cac8c4 100644
--- a/gtk/src/recentaction.ccg
+++ b/gtk/src/recentaction.ccg
@@ -21,11 +21,51 @@
namespace Gtk
{
+_DEPRECATE_IFDEF_START
+RecentAction::RecentAction(const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label,
const Glib::ustring& tooltip)
+:
+ // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+ Glib::ObjectBase(0),
+ Gtk::Action(Glib::ConstructParams(recentaction_class_.init(), "name", name.empty() ? 0 : name.c_str(),
"stock_id", (stock_id).get_c_str(), "label", label.empty() ? 0 : label.c_str(), "tooltip", tooltip.empty() ?
0 : tooltip.c_str(), static_cast<char*>(0)))
+{
+}
+
+RecentAction::RecentAction(const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label,
const Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager)
+:
+ // Mark this class as non-derived to allow C++ vfuncs to be skipped.
+ Glib::ObjectBase(0),
+ Gtk::Action(Glib::ConstructParams(recentaction_class_.init(), "name", name.empty() ? 0 : name.c_str(),
"stock_id", (stock_id).get_c_str(), "label", label.empty() ? 0 : label.c_str(), "tooltip", tooltip.empty() ?
0 : tooltip.c_str(), "recent_manager", Glib::unwrap(recent_manager), static_cast<char*>(0)))
+{
+}
+_DEPRECATE_IFDEF_END
+
Glib::RefPtr<RecentAction> RecentAction::create(const Glib::ustring& name, const Glib::ustring& label, const
Glib::ustring& tooltip)
{
+_DEPRECATE_IFDEF_START
return Glib::RefPtr<RecentAction>( new RecentAction(name, StockID(), label, tooltip) );
+#else // GTKMM_DISABLE_DEPRECATED
+ // StockID is deprecated. Can't call the constructor that takes a StockID.
+ Glib::RefPtr<RecentAction> action(new RecentAction());
+ action->set_name(name);
+ if (!label.empty())
+ action->set_label(label);
+ if (!tooltip.empty())
+ action->set_tooltip(tooltip);
+ return action;
+_DEPRECATE_IFDEF_END
}
+_DEPRECATE_IFDEF_START
+Glib::RefPtr<RecentAction> RecentAction::create(const Glib::ustring& name, const Gtk::StockID& stock_id,
const Glib::ustring& label, const Glib::ustring& tooltip)
+{
+ return Glib::RefPtr<RecentAction>( new RecentAction(name, stock_id, label, tooltip) );
+}
+
+Glib::RefPtr<RecentAction> RecentAction::create(const Glib::ustring& name, const Gtk::StockID& stock_id,
const Glib::ustring& label, const Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager)
+{
+ return Glib::RefPtr<RecentAction>( new RecentAction(name, stock_id, label, tooltip, recent_manager) );
+}
+_DEPRECATE_IFDEF_END
} // namespace Gtk
diff --git a/gtk/src/recentaction.hg b/gtk/src/recentaction.hg
index 1c3cecb..091e329 100644
--- a/gtk/src/recentaction.hg
+++ b/gtk/src/recentaction.hg
@@ -65,6 +65,9 @@ protected:
//Make sure that we use NULL instead of empty strings for the constructors:
#m4 _CONVERSION(`const Glib::ustring&',`const char*',`$3.empty() ? 0 : $3.c_str()')
+ // _WRAP_CTOR does not take a 'deprecated' parameter.
+ // _WRAP_CTOR(RecentAction(const Glib::ustring& name, const StockID& stock_id = StockID(), const
Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring()),
gtk_recent_action_new)
+ // _WRAP_CTOR(RecentAction(const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label,
const Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager),
gtk_recent_action_new_for_manager )
_DEPRECATE_IFDEF_START
//Note that the order of the parameters is not the same as gtk_recent_action_new(), because
//a) we want to be consistent with Action, ToggleAction, etc.
@@ -72,12 +75,12 @@ _DEPRECATE_IFDEF_START
/**
* @deprecated Stock IDs are deprecated, so use another constructor.
*/
- _WRAP_CTOR(RecentAction(const Glib::ustring& name, const StockID& stock_id = StockID(), const
Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring()),
gtk_recent_action_new)
+ explicit RecentAction(const Glib::ustring& name, const StockID& stock_id = StockID(), const Glib::ustring&
label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
/**
* @deprecated Stock IDs are deprecated, so use another constructor.
*/
- _WRAP_CTOR(RecentAction(const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label,
const Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager),
gtk_recent_action_new_for_manager )
+ explicit RecentAction(const Glib::ustring& name, const StockID& stock_id, const Glib::ustring& label,
const Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager);
_DEPRECATE_IFDEF_END
public:
@@ -87,16 +90,19 @@ public:
static Glib::RefPtr<RecentAction> create(const Glib::ustring& name, const Glib::ustring& label =
Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
+ // _WRAP_CREATE does not take a 'deprecated' parameter.
+ // _WRAP_CREATE(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label =
Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring())
+ // _WRAP_CREATE(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const
Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager)
_DEPRECATE_IFDEF_START
/**
* @deprecated Stock IDs are deprecated, so use another create() method.
*/
- _WRAP_CREATE(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label =
Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring())
+ static Glib::RefPtr<RecentAction> create(const Glib::ustring& name, const Gtk::StockID& stock_id, const
Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
/**
* @deprecated Stock IDs are deprecated, so use another create() method.
*/
- _WRAP_CREATE(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const
Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager)
+ static Glib::RefPtr<RecentAction> create(const Glib::ustring& name, const Gtk::StockID& stock_id, const
Glib::ustring& label, const Glib::ustring& tooltip, const Glib::RefPtr<RecentManager>& recent_manager);
_DEPRECATE_IFDEF_END
diff --git a/gtk/src/texttag.hg b/gtk/src/texttag.hg
index d04bfd2..df7e22b 100644
--- a/gtk/src/texttag.hg
+++ b/gtk/src/texttag.hg
@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+_CONFIGINCLUDE(gtkmmconfig.h)
#include <glibmm/object.h>
#include <gtkmm/enums.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]