mirror of
https://github.com/transmission/transmission
synced 2025-01-30 10:52:00 +00:00
Move GTK compatibility definitions into a separate header (#4493)
* Move GTK compatibility macros into a separate header * Fix Cairo compatibility checks * Move Glib-namespaced definitions to GtkCompat header * Remove unused stringify definitions since we're using fmtlib
This commit is contained in:
parent
b64b696272
commit
192a76b621
32 changed files with 175 additions and 151 deletions
|
@ -9,7 +9,7 @@ IncludeCategories:
|
|||
- Regex: '^<libtransmission/'
|
||||
Priority: 3
|
||||
SortPriority: 4
|
||||
- Regex: '^<(cairo|gdk|gio|glib|gtk|pango)mm[-./]'
|
||||
- Regex: '^<(cairo|gdk|gio|glib|gtk|pango)mm([-./]|config)'
|
||||
Priority: 5
|
||||
- Regex: '^<(fmt)/'
|
||||
Priority: 6
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <giomm/listmodel.h>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "DetailsDialog.h"
|
||||
#include "Dialogs.h"
|
||||
#include "FilterBar.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "HigWorkarea.h" // GUI_PAD, GUI_PAD_BIG
|
||||
#include "MainWindow.h"
|
||||
#include "MakeDialog.h"
|
||||
|
|
|
@ -143,6 +143,7 @@ set(${PROJECT_NAME}_HEADERS
|
|||
FilterBar.h
|
||||
Flags.h
|
||||
FreeSpaceLabel.h
|
||||
GtkCompat.h
|
||||
HigWorkarea.h
|
||||
IconCache.h
|
||||
ListModelAdapter.h
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "Actions.h"
|
||||
#include "FaviconCache.h" // gtr_get_favicon()
|
||||
#include "FileList.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "HigWorkarea.h" // GUI_PAD, GUI_PAD_BIG, GUI_PAD_SMALL
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "Dialogs.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "FileList.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "HigWorkarea.h" // GUI_PAD, GUI_PAD_BIG
|
||||
#include "IconCache.h"
|
||||
#include "PrefsDialog.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Utils.h"
|
||||
#include "GtkCompat.h"
|
||||
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
||||
|
|
134
gtk/GtkCompat.h
Normal file
134
gtk/GtkCompat.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
// This file Copyright © 2022 Mnemosyne LLC.
|
||||
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
||||
// or any future license endorsed by Mnemosyne LLC.
|
||||
// License text can be found in the licenses/ folder.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cairommconfig.h>
|
||||
#include <glibmmconfig.h>
|
||||
#include <gtkmmconfig.h>
|
||||
#include <pangommconfig.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#ifndef GTKMM_CHECK_VERSION
|
||||
#define GTKMM_CHECK_VERSION(major, minor, micro) \
|
||||
(GTKMM_MAJOR_VERSION > (major) || (GTKMM_MAJOR_VERSION == (major) && GTKMM_MINOR_VERSION > (minor)) || \
|
||||
(GTKMM_MAJOR_VERSION == (major) && GTKMM_MINOR_VERSION == (minor) && GTKMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#ifndef GLIBMM_CHECK_VERSION
|
||||
#define GLIBMM_CHECK_VERSION(major, minor, micro) \
|
||||
(GLIBMM_MAJOR_VERSION > (major) || (GLIBMM_MAJOR_VERSION == (major) && GLIBMM_MINOR_VERSION > (minor)) || \
|
||||
(GLIBMM_MAJOR_VERSION == (major) && GLIBMM_MINOR_VERSION == (minor) && GLIBMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#ifndef CAIROMM_CHECK_VERSION
|
||||
#define CAIROMM_CHECK_VERSION(major, minor, micro) \
|
||||
(CAIROMM_MAJOR_VERSION > (major) || (CAIROMM_MAJOR_VERSION == (major) && CAIROMM_MINOR_VERSION > (minor)) || \
|
||||
(CAIROMM_MAJOR_VERSION == (major) && CAIROMM_MINOR_VERSION == (minor) && CAIROMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#ifndef PANGOMM_CHECK_VERSION
|
||||
#define PANGOMM_CHECK_VERSION(major, minor, micro) \
|
||||
(PANGOMM_MAJOR_VERSION > (major) || (PANGOMM_MAJOR_VERSION == (major) && PANGOMM_MINOR_VERSION > (minor)) || \
|
||||
(PANGOMM_MAJOR_VERSION == (major) && PANGOMM_MINOR_VERSION == (minor) && PANGOMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
||||
#define IF_GTKMM4(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_GTKMM4(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#if GLIBMM_CHECK_VERSION(2, 68, 0)
|
||||
#define IF_GLIBMM2_68(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_GLIBMM2_68(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#if CAIROMM_CHECK_VERSION(1, 16, 0)
|
||||
#define IF_CAIROMM1_16(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_CAIROMM1_16(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#if PANGOMM_CHECK_VERSION(2, 48, 0)
|
||||
#define IF_PANGOMM2_48(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_PANGOMM2_48(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#define TR_GTK_ALIGN(Code) IF_GTKMM4(Gtk::Align::Code, Gtk::ALIGN_##Code)
|
||||
#define TR_GTK_BUTTONS_TYPE(Code) IF_GTKMM4(Gtk::ButtonsType::Code, Gtk::BUTTONS_##Code)
|
||||
#define TR_GTK_CELL_RENDERER_STATE(Code) IF_GTKMM4(Gtk::CellRendererState::Code, Gtk::CELL_RENDERER_##Code)
|
||||
#define TR_GTK_FILE_CHOOSER_ACTION(Code) IF_GTKMM4(Gtk::FileChooser::Action::Code, Gtk::FILE_CHOOSER_ACTION_##Code)
|
||||
#define TR_GTK_MESSAGE_TYPE(Code) IF_GTKMM4(Gtk::MessageType::Code, Gtk::MESSAGE_##Code)
|
||||
#define TR_GTK_ORIENTATION(Code) IF_GTKMM4(Gtk::Orientation::Code, Gtk::ORIENTATION_##Code)
|
||||
#define TR_GTK_POLICY_TYPE(Code) IF_GTKMM4(Gtk::PolicyType::Code, Gtk::POLICY_##Code)
|
||||
#define TR_GTK_RESPONSE_TYPE(Code) IF_GTKMM4(Gtk::ResponseType::Code, Gtk::RESPONSE_##Code)
|
||||
#define TR_GTK_SELECTION_MODE(Code) IF_GTKMM4(Gtk::SelectionMode::Code, Gtk::SELECTION_##Code)
|
||||
#define TR_GTK_SORT_TYPE(Code) IF_GTKMM4(Gtk::SortType::Code, Gtk::SORT_##Code)
|
||||
#define TR_GTK_STATE_FLAGS(Code) IF_GTKMM4(Gtk::StateFlags::Code, Gtk::STATE_FLAG_##Code)
|
||||
#define TR_GTK_TREE_MODEL_FLAGS(Code) IF_GTKMM4(Gtk::TreeModel::Flags::Code, Gtk::TREE_MODEL_##Code)
|
||||
#define TR_GTK_TREE_VIEW_COLUMN_SIZING(Code) IF_GTKMM4(Gtk::TreeViewColumn::Sizing::Code, Gtk::TREE_VIEW_COLUMN_##Code)
|
||||
|
||||
#define TR_GTK_TREE_MODEL_CHILD_ITER(Obj) IF_GTKMM4((Obj).get_iter(), (Obj))
|
||||
#define TR_GTK_WIDGET_GET_ROOT(Obj) IF_GTKMM4((Obj).get_root(), (Obj).get_toplevel())
|
||||
|
||||
#define TR_GDK_COLORSPACE(Code) IF_GTKMM4(Gdk::Colorspace::Code, Gdk::COLORSPACE_##Code)
|
||||
#define TR_GDK_EVENT_TYPE(Code) IF_GTKMM4(Gdk::Event::Type::Code, GdkEventType::GDK_##Code)
|
||||
#define TR_GDK_DRAG_ACTION(Code) IF_GTKMM4(Gdk::DragAction::Code, Gdk::ACTION_##Code)
|
||||
#define TR_GDK_MODIFIED_TYPE(Code) IF_GTKMM4(Gdk::ModifierType::Code, GdkModifierType::GDK_##Code)
|
||||
|
||||
#define TR_GLIB_FILE_TEST(Code) IF_GLIBMM2_68(Glib::FileTest::Code, Glib::FILE_TEST_##Code)
|
||||
#define TR_GLIB_NODE_TREE_TRAVERSE_FLAGS(Cls, Code) IF_GLIBMM2_68(Cls::TraverseFlags::Code, Cls::TRAVERSE_##Code)
|
||||
#define TR_GLIB_PARAM_FLAGS(Code) IF_GLIBMM2_68(Glib::ParamFlags::Code, Glib::PARAM_##Code)
|
||||
#define TR_GLIB_SPAWN_FLAGS(Code) IF_GLIBMM2_68(Glib::SpawnFlags::Code, Glib::SPAWN_##Code)
|
||||
#define TR_GLIB_USER_DIRECTORY(Code) IF_GLIBMM2_68(Glib::UserDirectory::Code, Glib::USER_DIRECTORY_##Code)
|
||||
|
||||
#define TR_GLIB_EXCEPTION_WHAT(Obj) IF_GLIBMM2_68((Obj).what(), (Obj).what().c_str())
|
||||
|
||||
#define TR_GIO_APP_INFO_CREATE_FLAGS(Code) IF_GLIBMM2_68(Gio::AppInfo::CreateFlags::Code, Gio::APP_INFO_CREATE_##Code)
|
||||
#define TR_GIO_APPLICATION_FLAGS(Code) IF_GLIBMM2_68(Gio::Application::Flags::Code, Gio::APPLICATION_##Code)
|
||||
#define TR_GIO_DBUS_BUS_TYPE(Code) IF_GLIBMM2_68(Gio::DBus::BusType::Code, Gio::DBus::BUS_TYPE_##Code)
|
||||
#define TR_GIO_DBUS_PROXY_FLAGS(Code) IF_GLIBMM2_68(Gio::DBus::ProxyFlags::Code, Gio::DBus::PROXY_FLAGS_##Code)
|
||||
#define TR_GIO_FILE_MONITOR_EVENT(Code) IF_GLIBMM2_68(Gio::FileMonitor::Event::Code, Gio::FILE_MONITOR_EVENT_##Code)
|
||||
|
||||
#define TR_CAIRO_SURFACE_FORMAT(Code) IF_CAIROMM1_16(Cairo::Surface::Format::Code, Cairo::FORMAT_##Code)
|
||||
#define TR_CAIRO_CONTEXT_OPERATOR(Code) IF_CAIROMM1_16(Cairo::Context::Operator::Code, Cairo::OPERATOR_##Code)
|
||||
|
||||
#define TR_PANGO_ALIGNMENT(Code) IF_PANGOMM2_48(Pango::Alignment::Code, Pango::ALIGN_##Code)
|
||||
#define TR_PANGO_ELLIPSIZE_MODE(Code) IF_PANGOMM2_48(Pango::EllipsizeMode::Code, Pango::ELLIPSIZE_##Code)
|
||||
#define TR_PANGO_WEIGHT(Code) IF_PANGOMM2_48(Pango::Weight::Code, Pango::WEIGHT_##Code)
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
#if !GLIBMM_CHECK_VERSION(2, 68, 0)
|
||||
|
||||
template<typename T>
|
||||
class RefPtr;
|
||||
|
||||
template<typename T>
|
||||
inline bool operator==(RefPtr<T> const& lhs, std::nullptr_t /*rhs*/)
|
||||
{
|
||||
return !lhs;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator!=(RefPtr<T> const& lhs, std::nullptr_t /*rhs*/)
|
||||
{
|
||||
return !(lhs == nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline RefPtr<T> make_refptr_for_instance(T* object)
|
||||
{
|
||||
return RefPtr<T>(object);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace Glib
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "IconCache.h"
|
||||
|
||||
#include "Utils.h"
|
||||
#include "GtkCompat.h"
|
||||
|
||||
#include <giomm/contenttype.h>
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "ListModelAdapter.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Utils.h"
|
||||
#include "GtkCompat.h"
|
||||
|
||||
#include <giomm/listmodel.h>
|
||||
#include <glibmm/object.h>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "Actions.h"
|
||||
#include "FilterBar.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "ListModelAdapter.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "MakeDialog.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "PathButton.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "MessageLogWindow.h"
|
||||
|
||||
#include "Actions.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "Notify.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "FileList.h"
|
||||
#include "FreeSpaceLabel.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "PathButton.h"
|
||||
#include "Prefs.h"
|
||||
#include "PrefsDialog.h"
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "PathButton.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
#include <giomm/file.h>
|
||||
#include <glibmm/error.h>
|
||||
#include <glibmm/i18n.h>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Utils.h"
|
||||
#include "GtkCompat.h"
|
||||
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "Prefs.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "PrefsDialog.h"
|
||||
|
||||
#include "FreeSpaceLabel.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "PathButton.h"
|
||||
#include "Prefs.h"
|
||||
#include "Session.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "RelocateDialog.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "PathButton.h"
|
||||
#include "Prefs.h" /* gtr_pref_string_get */
|
||||
#include "Session.h"
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "Torrent.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "StatsDialog.h"
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "PrefsDialog.h"
|
||||
#include "Session.h"
|
||||
#include "Utils.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "HigWorkarea.h" // GUI_PAD, GUI_PAD_SMALL
|
||||
#include "Torrent.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h> /* tr_truncd() */
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Utils.h"
|
||||
#include "GtkCompat.h"
|
||||
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "TorrentFilter.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
void TorrentFilter::set_activity(Activity type)
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "Torrent.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <glibmm/refptr.h>
|
||||
#include <glibmm/ustring.h>
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "TorrentSorter.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GtkCompat.h"
|
||||
#include "Torrent.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <glibmm/refptr.h>
|
||||
|
||||
|
|
148
gtk/Utils.h
148
gtk/Utils.h
|
@ -5,6 +5,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "GtkCompat.h"
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
|
||||
|
@ -38,88 +40,6 @@
|
|||
****
|
||||
***/
|
||||
|
||||
#ifndef GTKMM_CHECK_VERSION
|
||||
#define GTKMM_CHECK_VERSION(major, minor, micro) \
|
||||
(GTKMM_MAJOR_VERSION > (major) || (GTKMM_MAJOR_VERSION == (major) && GTKMM_MINOR_VERSION > (minor)) || \
|
||||
(GTKMM_MAJOR_VERSION == (major) && GTKMM_MINOR_VERSION == (minor) && GTKMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#ifndef GLIBMM_CHECK_VERSION
|
||||
#define GLIBMM_CHECK_VERSION(major, minor, micro) \
|
||||
(GLIBMM_MAJOR_VERSION > (major) || (GLIBMM_MAJOR_VERSION == (major) && GLIBMM_MINOR_VERSION > (minor)) || \
|
||||
(GLIBMM_MAJOR_VERSION == (major) && GLIBMM_MINOR_VERSION == (minor) && GLIBMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#ifndef PANGOMM_CHECK_VERSION
|
||||
#define PANGOMM_CHECK_VERSION(major, minor, micro) \
|
||||
(PANGOMM_MAJOR_VERSION > (major) || (PANGOMM_MAJOR_VERSION == (major) && PANGOMM_MINOR_VERSION > (minor)) || \
|
||||
(PANGOMM_MAJOR_VERSION == (major) && PANGOMM_MINOR_VERSION == (minor) && PANGOMM_MICRO_VERSION >= (micro)))
|
||||
#endif
|
||||
|
||||
#if GTKMM_CHECK_VERSION(4, 0, 0)
|
||||
#define IF_GTKMM4(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_GTKMM4(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#if GLIBMM_CHECK_VERSION(2, 68, 0)
|
||||
#define IF_GLIBMM2_68(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_GLIBMM2_68(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#if PANGOMM_CHECK_VERSION(2, 48, 0)
|
||||
#define IF_PANGOMM2_48(ThenValue, ElseValue) ThenValue
|
||||
#else
|
||||
#define IF_PANGOMM2_48(ThenValue, ElseValue) ElseValue
|
||||
#endif
|
||||
|
||||
#define TR_GTK_ALIGN(Code) IF_GTKMM4(Gtk::Align::Code, Gtk::ALIGN_##Code)
|
||||
#define TR_GTK_BUTTONS_TYPE(Code) IF_GTKMM4(Gtk::ButtonsType::Code, Gtk::BUTTONS_##Code)
|
||||
#define TR_GTK_CELL_RENDERER_STATE(Code) IF_GTKMM4(Gtk::CellRendererState::Code, Gtk::CELL_RENDERER_##Code)
|
||||
#define TR_GTK_FILE_CHOOSER_ACTION(Code) IF_GTKMM4(Gtk::FileChooser::Action::Code, Gtk::FILE_CHOOSER_ACTION_##Code)
|
||||
#define TR_GTK_MESSAGE_TYPE(Code) IF_GTKMM4(Gtk::MessageType::Code, Gtk::MESSAGE_##Code)
|
||||
#define TR_GTK_ORIENTATION(Code) IF_GTKMM4(Gtk::Orientation::Code, Gtk::ORIENTATION_##Code)
|
||||
#define TR_GTK_POLICY_TYPE(Code) IF_GTKMM4(Gtk::PolicyType::Code, Gtk::POLICY_##Code)
|
||||
#define TR_GTK_RESPONSE_TYPE(Code) IF_GTKMM4(Gtk::ResponseType::Code, Gtk::RESPONSE_##Code)
|
||||
#define TR_GTK_SELECTION_MODE(Code) IF_GTKMM4(Gtk::SelectionMode::Code, Gtk::SELECTION_##Code)
|
||||
#define TR_GTK_SORT_TYPE(Code) IF_GTKMM4(Gtk::SortType::Code, Gtk::SORT_##Code)
|
||||
#define TR_GTK_STATE_FLAGS(Code) IF_GTKMM4(Gtk::StateFlags::Code, Gtk::STATE_FLAG_##Code)
|
||||
#define TR_GTK_TREE_MODEL_FLAGS(Code) IF_GTKMM4(Gtk::TreeModel::Flags::Code, Gtk::TREE_MODEL_##Code)
|
||||
#define TR_GTK_TREE_VIEW_COLUMN_SIZING(Code) IF_GTKMM4(Gtk::TreeViewColumn::Sizing::Code, Gtk::TREE_VIEW_COLUMN_##Code)
|
||||
|
||||
#define TR_GTK_TREE_MODEL_CHILD_ITER(Obj) IF_GTKMM4((Obj).get_iter(), (Obj))
|
||||
#define TR_GTK_WIDGET_GET_ROOT(Obj) IF_GTKMM4((Obj).get_root(), (Obj).get_toplevel())
|
||||
|
||||
#define TR_GDK_COLORSPACE(Code) IF_GTKMM4(Gdk::Colorspace::Code, Gdk::COLORSPACE_##Code)
|
||||
#define TR_GDK_EVENT_TYPE(Code) IF_GTKMM4(Gdk::Event::Type::Code, GdkEventType::GDK_##Code)
|
||||
#define TR_GDK_DRAG_ACTION(Code) IF_GTKMM4(Gdk::DragAction::Code, Gdk::ACTION_##Code)
|
||||
#define TR_GDK_MODIFIED_TYPE(Code) IF_GTKMM4(Gdk::ModifierType::Code, GdkModifierType::GDK_##Code)
|
||||
|
||||
#define TR_GLIB_FILE_TEST(Code) IF_GLIBMM2_68(Glib::FileTest::Code, Glib::FILE_TEST_##Code)
|
||||
#define TR_GLIB_NODE_TREE_TRAVERSE_FLAGS(Cls, Code) IF_GLIBMM2_68(Cls::TraverseFlags::Code, Cls::TRAVERSE_##Code)
|
||||
#define TR_GLIB_SPAWN_FLAGS(Code) IF_GLIBMM2_68(Glib::SpawnFlags::Code, Glib::SPAWN_##Code)
|
||||
#define TR_GLIB_USER_DIRECTORY(Code) IF_GLIBMM2_68(Glib::UserDirectory::Code, Glib::USER_DIRECTORY_##Code)
|
||||
|
||||
#define TR_GLIB_EXCEPTION_WHAT(Obj) IF_GLIBMM2_68((Obj).what(), (Obj).what().c_str())
|
||||
|
||||
#define TR_GIO_APP_INFO_CREATE_FLAGS(Code) IF_GLIBMM2_68(Gio::AppInfo::CreateFlags::Code, Gio::APP_INFO_CREATE_##Code)
|
||||
#define TR_GIO_APPLICATION_FLAGS(Code) IF_GLIBMM2_68(Gio::Application::Flags::Code, Gio::APPLICATION_##Code)
|
||||
#define TR_GIO_DBUS_BUS_TYPE(Code) IF_GLIBMM2_68(Gio::DBus::BusType::Code, Gio::DBus::BUS_TYPE_##Code)
|
||||
#define TR_GIO_DBUS_PROXY_FLAGS(Code) IF_GLIBMM2_68(Gio::DBus::ProxyFlags::Code, Gio::DBus::PROXY_FLAGS_##Code)
|
||||
#define TR_GIO_FILE_MONITOR_EVENT(Code) IF_GLIBMM2_68(Gio::FileMonitor::Event::Code, Gio::FILE_MONITOR_EVENT_##Code)
|
||||
|
||||
#define TR_CAIRO_SURFACE_FORMAT(Code) IF_GTKMM4(Cairo::Surface::Format::Code, Cairo::FORMAT_##Code)
|
||||
#define TR_CAIRO_CONTEXT_OPERATOR(Code) IF_GTKMM4(Cairo::Context::Operator::Code, Cairo::OPERATOR_##Code)
|
||||
|
||||
#define TR_PANGO_ALIGNMENT(Code) IF_PANGOMM2_48(Pango::Alignment::Code, Pango::ALIGN_##Code)
|
||||
#define TR_PANGO_ELLIPSIZE_MODE(Code) IF_PANGOMM2_48(Pango::EllipsizeMode::Code, Pango::ELLIPSIZE_##Code)
|
||||
#define TR_PANGO_WEIGHT(Code) IF_PANGOMM2_48(Pango::Weight::Code, Pango::WEIGHT_##Code)
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
extern int const mem_K;
|
||||
extern char const* const mem_K_str;
|
||||
extern char const* const mem_M_str;
|
||||
|
@ -284,48 +204,23 @@ extern size_t const max_recent_dirs;
|
|||
std::list<std::string> gtr_get_recent_dirs(std::string const& pref);
|
||||
void gtr_save_recent_dir(std::string const& pref, Glib::RefPtr<Session> const& core, std::string const& dir);
|
||||
|
||||
namespace gtr_detail
|
||||
{
|
||||
|
||||
#if G_ENCODE_VERSION(GLIBMM_MAJOR_VERSION, GLIBMM_MINOR_VERSION) < G_ENCODE_VERSION(2, 62)
|
||||
|
||||
template<typename T>
|
||||
inline T const& sprintify(T const& arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
|
||||
inline char const* sprintify(Glib::ustring const& arg)
|
||||
{
|
||||
return arg.c_str();
|
||||
}
|
||||
|
||||
inline char const* sprintify(std::string const& arg)
|
||||
{
|
||||
return arg.c_str();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace gtr_detail
|
||||
|
||||
template<typename T, typename U>
|
||||
inline Glib::RefPtr<T> gtr_ptr_static_cast(Glib::RefPtr<U> const& ptr)
|
||||
{
|
||||
#if G_ENCODE_VERSION(GLIBMM_MAJOR_VERSION, GLIBMM_MINOR_VERSION) < G_ENCODE_VERSION(2, 68)
|
||||
return Glib::RefPtr<T>::cast_static(ptr);
|
||||
#else
|
||||
#if GLIBMM_CHECK_VERSION(2, 68, 0)
|
||||
return std::static_pointer_cast<T>(ptr);
|
||||
#else
|
||||
return Glib::RefPtr<T>::cast_static(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
inline Glib::RefPtr<T> gtr_ptr_dynamic_cast(Glib::RefPtr<U> const& ptr)
|
||||
{
|
||||
#if G_ENCODE_VERSION(GLIBMM_MAJOR_VERSION, GLIBMM_MINOR_VERSION) < G_ENCODE_VERSION(2, 68)
|
||||
return Glib::RefPtr<T>::cast_dynamic(ptr);
|
||||
#else
|
||||
#if GLIBMM_CHECK_VERSION(2, 68, 0)
|
||||
return std::dynamic_pointer_cast<T>(ptr);
|
||||
#else
|
||||
return Glib::RefPtr<T>::cast_dynamic(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -394,30 +289,3 @@ void gtr_window_on_close(Gtk::Window& widget, F&& callback)
|
|||
widget.signal_delete_event().connect(sigc::hide<0>(bool_callback), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace Glib
|
||||
{
|
||||
|
||||
#if G_ENCODE_VERSION(GLIBMM_MAJOR_VERSION, GLIBMM_MINOR_VERSION) < G_ENCODE_VERSION(2, 68)
|
||||
|
||||
template<typename T>
|
||||
inline bool operator==(RefPtr<T> const& lhs, std::nullptr_t /*rhs*/)
|
||||
{
|
||||
return !lhs;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool operator!=(RefPtr<T> const& lhs, std::nullptr_t /*rhs*/)
|
||||
{
|
||||
return !(lhs == nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline RefPtr<T> make_refptr_for_instance(T* object)
|
||||
{
|
||||
return RefPtr<T>(object);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace Glib
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// License text can be found in the licenses/ folder.
|
||||
|
||||
#include "Application.h"
|
||||
#include "GtkCompat.h"
|
||||
#include "Notify.h"
|
||||
#include "Prefs.h"
|
||||
#include "Utils.h"
|
||||
|
|
Loading…
Reference in a new issue