summaryrefslogtreecommitdiffstats
path: root/src/inkscape-application.h
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2018-12-09 19:04:42 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2018-12-09 19:04:42 +0000
commit7bbad129a0c9c9f3a38b178557d68623bef03464 (patch)
tree964e4f6ced0914ea706197645a7ca636ca60376c /src/inkscape-application.h
parentfix, test, and document more Inkscape::URI methods (diff)
downloadinkscape-7bbad129a0c9c9f3a38b178557d68623bef03464.tar.gz
inkscape-7bbad129a0c9c9f3a38b178557d68623bef03464.zip
Gtk/Gio templating of main inkscape application class to allow commandline usage when graphic server is not available
Diffstat (limited to 'src/inkscape-application.h')
-rw-r--r--src/inkscape-application.h51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/inkscape-application.h b/src/inkscape-application.h
index 90553cd0d..c80110ac2 100644
--- a/src/inkscape-application.h
+++ b/src/inkscape-application.h
@@ -30,17 +30,42 @@
typedef std::vector<std::pair<std::string, Glib::VariantBase> > action_vector_t;
-class InkscapeApplication : public Gtk::Application
+
+class InkscapeApplication
{
+public:
+ virtual void on_startup() = 0;
+ virtual void on_startup2() = 0;
+ virtual InkFileExportCmd* file_export() = 0;
+ virtual int on_handle_local_options(const Glib::RefPtr<Glib::VariantDict>& options) = 0;
+ virtual void on_new() = 0;
+ 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<SPDocument*> _documents;
+ InkFileExportCmd _file_export;
+ // Actions from the command line or file.
+ action_vector_t _command_line_actions;
+
+
+};
+
+
+
-public:
- static Glib::RefPtr<InkscapeApplication> create();
- SPDocument* get_active_document();
- Inkscape::Selection* get_active_selection();
+template <class T> class ConcreteInkscapeApplication : public T, public InkscapeApplication
+{
+public:
+ ConcreteInkscapeApplication();
+
+public:
InkFileExportCmd* file_export() { return &_file_export; }
protected:
@@ -48,12 +73,8 @@ protected:
void on_startup2();
void on_activate() override;
void on_open(const Gio::Application::type_vec_files& files, const Glib::ustring& hint) override;
-
-private:
SPDesktop* create_window(const Glib::RefPtr<Gio::File>& file = Glib::RefPtr<Gio::File>());
void parse_actions(const Glib::ustring& input, action_vector_t& action_vector);
- void shell();
- void shell2();
private:
// Callbacks
@@ -63,18 +84,12 @@ private:
void on_new();
void on_quit();
void on_about();
+
+ void shell();
+ void shell2();
Glib::RefPtr<Gtk::Builder> _builder;
- bool _with_gui;
- bool _use_shell;
- InkFileExportCmd _file_export;
-
- // Documents are owned by the application which is responsible for opening/saving/exporting. WIP
- std::vector<SPDocument*> _documents;
-
- // Actions from the command line or file.
- action_vector_t _command_line_actions;
};
#endif // INKSCAPE_APPLICATION_H