16#include <glibmm/i18n.h>
30 Glib::Variant<Glib::ustring> s = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring> >(value);
32 Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(s.get());
33 if (!file->query_exists()) {
34 show_output(Glib::ustring(
"file_open: file '") + s.get().raw() +
"' does not exist.");
43 document->ensureUpToDate();
51 show_output(
"You cannot run this action without an active window");
55 Glib::Variant<Glib::ustring> s = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring>>(value);
56 Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(s.get());
57 if (!file->query_exists()) {
58 show_output(Glib::ustring(
"file_open: file '") + s.get().raw() +
"' does not exist.");
68 Glib::Variant<Glib::ustring> s = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::ustring> >(value);
76 document->ensureUpToDate();
82 Glib::Variant<bool> s = Glib::VariantBase::cast_dynamic<Glib::Variant<bool> >(value);
86 document->ensureUpToDate();
109const Glib::ustring
SECTION = NC_(
"Action Section",
"File");
114 {
"app.file-open", N_(
"File Open"),
SECTION, N_(
"Open file") },
115 {
"app.file-new", N_(
"File New"),
SECTION, N_(
"Open new document using template") },
116 {
"app.file-close", N_(
"File Close"),
SECTION, N_(
"Close active document") },
117 {
"app.file-open-window", N_(
"File Open Window"),
SECTION, N_(
"Open file window") },
118 {
"app.file-rebase", N_(
"File Contents Replace"),
SECTION, N_(
"Replace current document's contents by contents of another file") }
125 {
"app.file-open", N_(
"Enter file name")},
126 {
"app.file-new", N_(
"Enter file name")},
127 {
"app.file-open-window", N_(
"Enter file name")},
128 {
"app.file-rebase-from-saved", N_(
"Namedview; Update=1, Replace=0")}
135 Glib::VariantType Bool( Glib::VARIANT_TYPE_BOOL);
136 Glib::VariantType Int( Glib::VARIANT_TYPE_INT32);
137 Glib::VariantType Double(Glib::VARIANT_TYPE_DOUBLE);
138 Glib::VariantType String(Glib::VARIANT_TYPE_STRING);
139 Glib::VariantType BString(Glib::VARIANT_TYPE_BYTESTRING);
142#if GLIB_CHECK_VERSION(2, 52, 0)
146 gapp->add_action_with_parameter(
"file-open", String, sigc::bind(sigc::ptr_fun(&
file_open), app));
147 gapp->add_action_with_parameter(
"file-new", String, sigc::bind(sigc::ptr_fun(&
file_new), app));
148 gapp->add_action_with_parameter(
"file-open-window", String, sigc::bind(sigc::ptr_fun(&
file_open_with_window), app));
149 gapp->add_action(
"file-close", sigc::bind(sigc::ptr_fun(&
file_close), app));
150 gapp->add_action_with_parameter(
"file-rebase", Bool, sigc::bind(sigc::ptr_fun(&
file_rebase), app));
153 show_output(
"add_actions: Some actions require Glibmm 2.52, compiled with: " << glib_major_version <<
"." << glib_minor_version);
void file_open_with_window(const Glib::VariantBase &value, InkscapeApplication *app)
void file_rebase(const Glib::VariantBase &value, InkscapeApplication *app)
std::vector< std::vector< Glib::ustring > > hint_data_file
const Glib::ustring SECTION
std::vector< std::vector< Glib::ustring > > raw_data_file
void file_open(const Glib::VariantBase &value, InkscapeApplication *app)
void add_actions_file(InkscapeApplication *app)
void file_new(const Glib::VariantBase &value, InkscapeApplication *app)
void file_close(InkscapeApplication *app)
void show_output(Glib::ustring const &data, bool const is_cerr)
void add_data(std::vector< std::vector< Glib::ustring > > &raw_data)
void set_active_desktop(SPDesktop *desktop)
InkActionExtraData & get_action_extra_data()
InkscapeWindow * get_active_window()
std::pair< SPDocument *, bool > document_open(Glib::RefPtr< Gio::File > const &file)
void set_active_selection(Inkscape::Selection *selection)
Gio::Application * gio_app()
The Gio application instance, never NULL.
void set_active_document(SPDocument *document)
SPDocument * get_active_document()
SPDocument * document_new(std::string const &template_filename={})
InkActionHintData & get_action_hint_data()
void create_window(Glib::RefPtr< Gio::File > const &file={})
Create a window given a Gio::File.
void document_close(SPDocument *document)
Close a document, remove from app.
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
Typed SVG document implementation.
void rebase(Inkscape::XML::Document *new_xmldoc, bool keep_namedview=true)
TODO: insert short description here.