From 8b04d0db6c55e36935690d37defb6f9b68945796 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 05:40:36 +0000 Subject: SPDocument->Document (bzr r8404) --- src/inkscape.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 60ab895ed..c2c45d3bb 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -105,7 +105,7 @@ static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape struct Inkscape::Application { GObject object; Inkscape::XML::Document *menus; - std::map document_set; + std::map document_set; GSList *desktops; gchar *argv0; gboolean dialogs_toggle; @@ -126,7 +126,7 @@ struct Inkscape::ApplicationClass { void (* set_eventcontext) (Inkscape::Application * inkscape, SPEventContext * eventcontext); void (* activate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); void (* deactivate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); - void (* destroy_document) (Inkscape::Application *inkscape, SPDocument *doc); + void (* destroy_document) (Inkscape::Application *inkscape, Document *doc); void (* color_set) (Inkscape::Application *inkscape, SPColor *color, double opacity); void (* shut_down) (Inkscape::Application *inkscape); void (* dialogs_hide) (Inkscape::Application *inkscape); @@ -326,11 +326,11 @@ static gint inkscape_autosave(gpointer) gint docnum = 0; SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Autosaving documents...")); - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - SPDocument *doc = iter->first; + Document *doc = iter->first; ++docnum; @@ -463,7 +463,7 @@ inkscape_init (SPObject * object) g_assert_not_reached (); } - new (&inkscape->document_set) std::map(); + new (&inkscape->document_set) std::map(); inkscape->menus = sp_repr_read_mem (_(menus_skeleton), MENUS_SKELETON_SIZE, NULL); inkscape->desktops = NULL; @@ -597,10 +597,10 @@ inkscape_crash_handler (int /*signum*/) gint count = 0; GSList *savednames = NULL; GSList *failednames = NULL; - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - SPDocument *doc = iter->first; + Document *doc = iter->first; Inkscape::XML::Node *repr; repr = sp_document_repr_root (doc); if (doc->isModifiedSinceSave()) { @@ -1219,7 +1219,7 @@ inkscape_external_change () * fixme: These need probably signals too */ void -inkscape_add_document (SPDocument *document) +inkscape_add_document (Document *document) { g_return_if_fail (document != NULL); @@ -1228,7 +1228,7 @@ inkscape_add_document (SPDocument *document) // try to insert the pair into the list if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) { //insert failed, this key (document) is already in the list - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1247,13 +1247,13 @@ inkscape_add_document (SPDocument *document) // returns true if this was last reference to this document, so you can delete it bool -inkscape_remove_document (SPDocument *document) +inkscape_remove_document (Document *document) { g_return_val_if_fail (document != NULL, false); if (!Inkscape::NSApplication::Application::getNewGui()) { - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1290,7 +1290,7 @@ inkscape_active_desktop (void) return (SPDesktop *) inkscape->desktops->data; } -SPDocument * +Document * inkscape_active_document (void) { if (Inkscape::NSApplication::Application::getNewGui()) @@ -1304,13 +1304,13 @@ inkscape_active_document (void) } bool inkscape_is_sole_desktop_for_document(SPDesktop const &desktop) { - SPDocument const* document = desktop.doc(); + Document const* document = desktop.doc(); if (!document) { return false; } for ( GSList *iter = inkscape->desktops ; iter ; iter = iter->next ) { SPDesktop *other_desktop=(SPDesktop *)iter->data; - SPDocument *other_document=other_desktop->doc(); + Document *other_document=other_desktop->doc(); if ( other_document == document && other_desktop != &desktop ) { return false; } -- cgit v1.2.3 From 51c2905fd3e99955db2d823b79abb763d8097028 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 6 Aug 2009 14:17:17 +0000 Subject: Revert recent refactoring changes by johnce because they break the build, which cannot be fixed easily. (bzr r8422) --- src/inkscape.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c2c45d3bb..60ab895ed 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -105,7 +105,7 @@ static void inkscape_deactivate_desktop_private (Inkscape::Application *inkscape struct Inkscape::Application { GObject object; Inkscape::XML::Document *menus; - std::map document_set; + std::map document_set; GSList *desktops; gchar *argv0; gboolean dialogs_toggle; @@ -126,7 +126,7 @@ struct Inkscape::ApplicationClass { void (* set_eventcontext) (Inkscape::Application * inkscape, SPEventContext * eventcontext); void (* activate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); void (* deactivate_desktop) (Inkscape::Application * inkscape, SPDesktop * desktop); - void (* destroy_document) (Inkscape::Application *inkscape, Document *doc); + void (* destroy_document) (Inkscape::Application *inkscape, SPDocument *doc); void (* color_set) (Inkscape::Application *inkscape, SPColor *color, double opacity); void (* shut_down) (Inkscape::Application *inkscape); void (* dialogs_hide) (Inkscape::Application *inkscape); @@ -326,11 +326,11 @@ static gint inkscape_autosave(gpointer) gint docnum = 0; SP_ACTIVE_DESKTOP->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Autosaving documents...")); - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - Document *doc = iter->first; + SPDocument *doc = iter->first; ++docnum; @@ -463,7 +463,7 @@ inkscape_init (SPObject * object) g_assert_not_reached (); } - new (&inkscape->document_set) std::map(); + new (&inkscape->document_set) std::map(); inkscape->menus = sp_repr_read_mem (_(menus_skeleton), MENUS_SKELETON_SIZE, NULL); inkscape->desktops = NULL; @@ -597,10 +597,10 @@ inkscape_crash_handler (int /*signum*/) gint count = 0; GSList *savednames = NULL; GSList *failednames = NULL; - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { - Document *doc = iter->first; + SPDocument *doc = iter->first; Inkscape::XML::Node *repr; repr = sp_document_repr_root (doc); if (doc->isModifiedSinceSave()) { @@ -1219,7 +1219,7 @@ inkscape_external_change () * fixme: These need probably signals too */ void -inkscape_add_document (Document *document) +inkscape_add_document (SPDocument *document) { g_return_if_fail (document != NULL); @@ -1228,7 +1228,7 @@ inkscape_add_document (Document *document) // try to insert the pair into the list if (!(inkscape->document_set.insert(std::make_pair(document, 1)).second)) { //insert failed, this key (document) is already in the list - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1247,13 +1247,13 @@ inkscape_add_document (Document *document) // returns true if this was last reference to this document, so you can delete it bool -inkscape_remove_document (Document *document) +inkscape_remove_document (SPDocument *document) { g_return_val_if_fail (document != NULL, false); if (!Inkscape::NSApplication::Application::getNewGui()) { - for (std::map::iterator iter = inkscape->document_set.begin(); + for (std::map::iterator iter = inkscape->document_set.begin(); iter != inkscape->document_set.end(); ++iter) { if (iter->first == document) { @@ -1290,7 +1290,7 @@ inkscape_active_desktop (void) return (SPDesktop *) inkscape->desktops->data; } -Document * +SPDocument * inkscape_active_document (void) { if (Inkscape::NSApplication::Application::getNewGui()) @@ -1304,13 +1304,13 @@ inkscape_active_document (void) } bool inkscape_is_sole_desktop_for_document(SPDesktop const &desktop) { - Document const* document = desktop.doc(); + SPDocument const* document = desktop.doc(); if (!document) { return false; } for ( GSList *iter = inkscape->desktops ; iter ; iter = iter->next ) { SPDesktop *other_desktop=(SPDesktop *)iter->data; - Document *other_document=other_desktop->doc(); + SPDocument *other_document=other_desktop->doc(); if ( other_document == document && other_desktop != &desktop ) { return false; } -- cgit v1.2.3 From 0ff8eef7cfad92189e1d624a2b3ae449be64e891 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Fri, 7 Aug 2009 12:32:06 +0000 Subject: Report complete paths when doing an emergency save (closes LP #171392) (bzr r8436) --- src/inkscape.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 60ab895ed..01e11a916 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -634,6 +634,7 @@ inkscape_crash_handler (int /*signum*/) gchar * location = homedir_path(c); Inkscape::IO::dump_fopen_call(location, "E"); file = Inkscape::IO::fopen_utf8name(location, "w"); + g_snprintf (c, 1024, "%s", location); // we want the complete path to be stored in c (for reporting purposes) g_free(location); if (!file) { // try saving to /tmp @@ -643,9 +644,14 @@ inkscape_crash_handler (int /*signum*/) } if (!file) { // try saving to the current directory + gchar *curdir = g_get_current_dir(); g_snprintf (c, 1024, "inkscape-%.256s.%s.%d.svg", docname, sptstr, count); Inkscape::IO::dump_fopen_call(c, "F"); file = Inkscape::IO::fopen_utf8name(c, "w"); + // store the complete path in c so that it can be reported later + gchar * location = g_build_filename(curdir, c, NULL); + g_snprintf (c, 1024, "%s", location); + g_free(location); } if (file) { sp_repr_save_stream (repr->document(), file, SP_SVG_NS_URI); -- cgit v1.2.3 From cdbf85902231b4d70c122dcd1c6e0a4d682ddbf9 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Wed, 19 Aug 2009 00:10:57 +0000 Subject: fix 167857 (bzr r8509) --- src/inkscape.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 01e11a916..fc9aff78e 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -805,8 +805,10 @@ inkscape_application_init (const gchar *argv0, gboolean use_gui) } } - inkscape_load_menus(inkscape); - sp_input_load_from_preferences(); + if (use_gui) { + inkscape_load_menus(inkscape); + sp_input_load_from_preferences(); + } /* set language for user interface according setting in preferences */ Glib::ustring ui_language = prefs->getString("/ui/language"); -- cgit v1.2.3 From 01d8a34a845e1639e833c45dabfe1e14c9f74c0b Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 30 Sep 2009 07:40:21 +0000 Subject: Create additional user subdir's. Fixes bug #437938. (bzr r8682) --- src/inkscape.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index fc9aff78e..586abd22b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -1482,6 +1482,13 @@ profile_path(const char *filename) if ( g_mkdir_with_parents(prefdir, mode) == -1 ) { int problem = errno; g_warning("Unable to create profile directory (%s) (%d)", g_strerror(problem), problem); + } else { + gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "palettes", NULL}; + for (gchar const** name = userDirs; *name; ++name) { + gchar *dir = g_build_filename(prefdir, *name, NULL); + g_mkdir_with_parents(dir, mode); + g_free(dir); + } } } } -- cgit v1.2.3 From ef0a6a40cbad39f2a94c95c94d977b199dddfebf Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Mon, 9 Nov 2009 17:58:28 +0000 Subject: Migrate file MRU prefs (bzr r8827) --- src/inkscape.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index 586abd22b..8506f05de 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -1457,6 +1457,7 @@ profile_path(const char *filename) if (needsMigration) { // TODO here is a point to hook in preference migration g_warning("Preferences need to be migrated from 0.46 or older %s to %s", legacyDir, prefdir); + Inkscape::Preferences::migrate( legacyDir, prefdir ); } bool needsRenameWarning = ( !Inkscape::IO::file_test( prefdir, G_FILE_TEST_EXISTS ) && Inkscape::IO::file_test( dev47Dir, G_FILE_TEST_EXISTS ) ); -- cgit v1.2.3