From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..db908f640 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1228,8 +1228,8 @@ static int sp_process_file_list(GSList *fl) std::vector items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); - for ( SPObject *iter = root->firstChild(); iter ; iter = iter->getNext()) { - SPItem* item = (SPItem*) iter; + for (auto& iter: root->_children) { + SPItem* item = (SPItem*) &iter; if (! (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item) || SP_IS_GROUP(item))) { continue; } -- cgit v1.2.3 From 9e210a6d1333c3366681547e3e81593ef69ff73e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 12:56:49 +0200 Subject: Last part of new SPObject children list (bzr r14954.1.20) --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index db908f640..7ab27dcb2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1483,10 +1483,8 @@ do_query_all_recurse (SPObject *o) } } - SPObject *child = o->children; - while (child) { - do_query_all_recurse (child); - child = child->next; + for(auto& child: o->_children) { + do_query_all_recurse (&child); } } -- cgit v1.2.3 From 24d3f50003ca3cec6a03a7f5267cc4fe5588c69f Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Thu, 14 Jul 2016 13:17:21 +0200 Subject: Renamed children list in SPObject (bzr r14954.1.21) --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 7ab27dcb2..c01c4ee46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1228,7 +1228,7 @@ static int sp_process_file_list(GSList *fl) std::vector items; SPRoot *root = doc->getRoot(); doc->ensureUpToDate(); - for (auto& iter: root->_children) { + for (auto& iter: root->children) { SPItem* item = (SPItem*) &iter; if (! (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item) || SP_IS_GROUP(item))) { continue; @@ -1483,7 +1483,7 @@ do_query_all_recurse (SPObject *o) } } - for(auto& child: o->_children) { + for(auto& child: o->children) { do_query_all_recurse (&child); } } -- cgit v1.2.3 From 49a7927ecf31ace696e9e5770e8d6543c356db7a Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 19:15:34 +0100 Subject: Finish removing GTK+ 2 fallbacks (bzr r15023.2.8) --- src/main.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..3c0244e8b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,10 +52,8 @@ #include #include -#if GTK_CHECK_VERSION(3,0,0) #include #include -#endif #include "inkgc/gc-core.h" @@ -1056,8 +1054,6 @@ sp_main_gui(int argc, char const **argv) #endif g_free(usericondir); - -#if GTK_CHECK_VERSION(3,0,0) // Add style sheet (GTK3) Glib::RefPtr screen = Gdk::Screen::get_default(); @@ -1114,7 +1110,6 @@ sp_main_gui(int argc, char const **argv) Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); } -#endif gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); Inkscape::Debug::log_display_config(); -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/main.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8cf52127b..cd93f2ed3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,9 +38,6 @@ #include #endif #include -#include -#include -#include #include #ifndef POPT_TABLEEND @@ -48,9 +45,6 @@ #endif /* Not def: POPT_TABLEEND */ #include -#include -#include -#include #if GTK_CHECK_VERSION(3,0,0) #include @@ -63,16 +57,13 @@ #undef AND #endif -#include "macros.h" #include "file.h" #include "document.h" #include "layer-model.h" #include "selection.h" -#include "sp-object.h" #include "ui/interface.h" #include "print.h" #include "color.h" -#include "sp-item.h" #include "sp-root.h" #include "svg/svg.h" @@ -93,10 +84,8 @@ #include "helper/action-context.h" #include "helper/png-write.h" -#include "helper/geom.h" #include -#include #include #include #include @@ -114,9 +103,8 @@ #endif // WITH_DBUS #include -#include #include - +#include #include #ifndef HAVE_BIND_TEXTDOMAIN_CODESET @@ -129,8 +117,6 @@ #include #include "verbs.h" -#include - #include "path-chemistry.h" #include "sp-text.h" #include "sp-flowtext.h" -- cgit v1.2.3 From 5198e76ee434bd68985181d26900d71c1675cc63 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 9 Aug 2016 12:32:55 +0100 Subject: Move some main functions to Application class (bzr r15048) --- src/main.cpp | 104 +++++------------------------------------------------------ 1 file changed, 8 insertions(+), 96 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 28bdf8359..28ae6992f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,7 +46,6 @@ #include -#include #include #include "inkgc/gc-core.h" @@ -101,9 +100,12 @@ #endif // WITH_DBUS #include +#include +#include #include #include #include +#include #ifndef HAVE_BIND_TEXTDOMAIN_CODESET #define bind_textdomain_codeset(p,c) @@ -851,8 +853,8 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) // temporarily switch gettext encoding to locale, so that help messages can be output properly - gchar const *charset; - g_get_charset(&charset); + std::string charset; + Glib::get_charset(charset); bind_textdomain_codeset(GETTEXT_PACKAGE, charset); @@ -998,16 +1000,6 @@ snooper(GdkEvent *event, gpointer /*data*/) { gtk_main_do_event (event); } -static std::vector getDirectorySet(const gchar* userDir, const gchar* const * systemDirs) { - std::vector listing; - listing.push_back(userDir); - for ( const char* const* cur = systemDirs; *cur; cur++ ) - { - listing.push_back(*cur); - } - return listing; -} - int sp_main_gui(int argc, char const **argv) { @@ -1017,103 +1009,23 @@ sp_main_gui(int argc, char const **argv) int retVal = sp_common_main( argc, argv, &fl ); g_return_val_if_fail(retVal == 0, 1); - // Add possible icon entry directories - std::vector dataDirs = getDirectorySet( g_get_user_data_dir(), - g_get_system_data_dirs() ); - for (std::vector::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) - { - std::vector listing; - listing.push_back(*it); - listing.push_back("inkscape"); - listing.push_back("icons"); - Glib::ustring dir = Glib::build_filename(listing); - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), dir.c_str()); - } - - // Add our icon directory to the search path for icon theme lookups. - gchar *usericondir = Inkscape::Application::profile_path("icons"); - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), usericondir); - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), INKSCAPE_PIXMAPDIR); -#ifdef INKSCAPE_THEMEDIR - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), INKSCAPE_THEMEDIR); - gtk_icon_theme_rescan_if_needed (gtk_icon_theme_get_default()); -#endif - g_free(usericondir); - - // Add style sheet (GTK3) - Glib::RefPtr screen = Gdk::Screen::get_default(); - - Glib::ustring inkscape_style = INKSCAPE_UIDIR; - inkscape_style += "/style.css"; - // std::cout << "CSS Stylesheet Inkscape: " << inkscape_style << std::endl; - - if (g_file_test (inkscape_style.c_str(), G_FILE_TEST_EXISTS)) { - Glib::RefPtr provider = Gtk::CssProvider::create(); - - // From 3.16, throws an error which we must catch. - try { - provider->load_from_path (inkscape_style); - } -#if GTK_CHECK_VERSION(3,16,0) - // Gtk::CssProviderError not defined until 3.16. - catch (const Gtk::CssProviderError& ex) - { - std::cerr << "CSSProviderError::load_from_path(): failed to load: " << inkscape_style - << "\n (" << ex.what() << ")" << std::endl; - } -#else - catch (...) - {} -#endif - - Gtk::StyleContext::add_provider_for_screen (screen, provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } else { - std::cerr << "sp_main_gui: Cannot find default style file:\n (" << inkscape_style - << ")" << std::endl; - } - - Glib::ustring user_style = Inkscape::Application::profile_path("ui/style.css"); - // std::cout << "CSS Stylesheet User: " << user_style << std::endl; - - if (g_file_test (user_style.c_str(), G_FILE_TEST_EXISTS)) { - Glib::RefPtr provider2 = Gtk::CssProvider::create(); - - // From 3.16, throws an error which we must catch. - try { - provider2->load_from_path (user_style); - } -#if GTK_CHECK_VERSION(3,16,0) - // Gtk::CssProviderError not defined until 3.16. - catch (const Gtk::CssProviderError& ex) - { - std::cerr << "CSSProviderError::load_from_path(): failed to load: " << user_style - << "\n (" << ex.what() << ")" << std::endl; - } -#else - catch (...) - {} -#endif - - Gtk::StyleContext::add_provider_for_screen (screen, provider2, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - } - gdk_event_handler_set((GdkEventFunc)snooper, NULL, NULL); Inkscape::Debug::log_display_config(); // Set default window icon. Obeys the theme. - gtk_window_set_default_icon_name("inkscape"); + Gtk::Window::set_default_icon_name("inkscape"); // Do things that were previously in inkscape_gtk_stock_init(). sp_icon_get_phys_size(GTK_ICON_SIZE_MENU); Inkscape::UI::Widget::Panel::prep(); - gboolean create_new = TRUE; + bool create_new = true; /// \todo FIXME BROKEN - non-UTF-8 sneaks in here. Inkscape::Application::create(argv[0], true); while (fl) { if (sp_file_open((gchar *)fl->data,NULL)) { - create_new=FALSE; + create_new=false; } fl = g_slist_remove(fl, fl->data); } -- cgit v1.2.3 From 57f595dad1c2b8eb1862ae8396613b33a4ed8854 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 18 Aug 2016 23:35:06 +0200 Subject: Fix compilation error (https://inkscape.org/en/paste/9901/) (bzr r15071) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 28ae6992f..004d96191 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -856,7 +856,7 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest ) std::string charset; Glib::get_charset(charset); - bind_textdomain_codeset(GETTEXT_PACKAGE, charset); + bind_textdomain_codeset(GETTEXT_PACKAGE, charset.c_str()); poptContext ctx = poptGetContext(NULL, argc, argv, options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); -- cgit v1.2.3