From 3c200d427b4de843d3c979e2c7269ee8f3a31e0b Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 10 Dec 2018 14:29:19 +0100 Subject: Minor tweaks. --- src/inkscape-application.cpp | 6 ++++-- src/inkscape-application.h | 21 +++++++++++---------- src/inkscape-main.cpp | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/inkscape-application.cpp b/src/inkscape-application.cpp index a5bde2d25..4c39ee51c 100644 --- a/src/inkscape-application.cpp +++ b/src/inkscape-application.cpp @@ -180,7 +180,9 @@ ConcreteInkscapeApplication::on_startup() // Here are things that should be in on_startup() but cannot be as we don't set _with_gui until // on_handle_local_options() is called. -template<> void ConcreteInkscapeApplication::on_startup2() +template<> +void +ConcreteInkscapeApplication::on_startup2() { Inkscape::Application::create(nullptr, false); } @@ -589,7 +591,7 @@ ConcreteInkscapeApplication::on_handle_local_options(const Glib::RefPtrcontains("query-id")) { Glib::ustring query_id; options->lookup_value("query-id", query_id); diff --git a/src/inkscape-application.h b/src/inkscape-application.h index c80110ac2..e8cf12ee9 100644 --- a/src/inkscape-application.h +++ b/src/inkscape-application.h @@ -42,24 +42,25 @@ public: virtual void on_quit() = 0; SPDocument* get_active_document(); Inkscape::Selection* get_active_selection(); + protected: bool _with_gui; bool _use_shell; InkscapeApplication(); + // Documents are owned by the application which is responsible for opening/saving/exporting. WIP std::vector _documents; + InkFileExportCmd _file_export; + // Actions from the command line or file. action_vector_t _command_line_actions; - - }; - - - - - +// T can be either: +// Gio::Application (window server is not present) or +// Gtk::Application (window server is present). +// With Gtk::Application, one can still run "headless" by not creating any windows. template class ConcreteInkscapeApplication : public T, public InkscapeApplication { public: @@ -78,11 +79,11 @@ protected: private: // Callbacks - int on_handle_local_options(const Glib::RefPtr& options); + int on_handle_local_options(const Glib::RefPtr& options) override; // Actions - void on_new(); - void on_quit(); + void on_new() override; + void on_quit() override; void on_about(); void shell(); diff --git a/src/inkscape-main.cpp b/src/inkscape-main.cpp index e1c0411e0..d4fe68bb8 100644 --- a/src/inkscape-main.cpp +++ b/src/inkscape-main.cpp @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) { - if(gtk_init_check(NULL, NULL)) + if (gtk_init_check(NULL, NULL)) return (new ConcreteInkscapeApplication())->run(argc, argv); else return (new ConcreteInkscapeApplication())->run(argc, argv); -- cgit v1.2.3