diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es> | 2018-07-25 12:08:00 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es> | 2018-07-25 12:08:00 +0000 |
| commit | 71da50844cd9aba61152c202a011665fd0bc0f30 (patch) | |
| tree | 38559c3821573acea6dc96bbf2adeae99d8fc2df | |
| parent | Working on open folders on WIN (diff) | |
| download | inkscape-71da50844cd9aba61152c202a011665fd0bc0f30.tar.gz inkscape-71da50844cd9aba61152c202a011665fd0bc0f30.zip | |
Fix a win compiling bug and coding style
| -rw-r--r-- | src/io/resource.cpp | 7 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 55 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 30 | ||||
| -rw-r--r-- | src/ui/widget/anchor-selector.cpp | 32 | ||||
| -rw-r--r-- | src/ui/widget/preferences-widget.cpp | 21 |
5 files changed, 76 insertions, 69 deletions
diff --git a/src/io/resource.cpp b/src/io/resource.cpp index 9f584f58c..83772dd5d 100644 --- a/src/io/resource.cpp +++ b/src/io/resource.cpp @@ -105,8 +105,8 @@ gchar *_get_path(Domain domain, Type type, char const *filename) path = profile_path(name); } break; } - - + + if (filename && path) { gchar *temp=g_build_filename(path, filename, NULL); g_free(path); @@ -425,7 +425,8 @@ char *profile_path(const char *filename) int problem = errno; g_warning("Unable to create profile directory (%s) (%d)", g_strerror(problem), problem); } else { - gchar const *userDirs[] = {"keys", "templates", "icons", "extensions", "ui", "symbols", "themes", "palettes", nullptr}; + gchar const *userDirs[] = { "keys", "templates", "icons", "extensions", "ui", + "symbols", "themes", "palettes", nullptr }; for (gchar const** name = userDirs; *name; ++name) { gchar *dir = g_build_filename(prefdir, *name, NULL); g_mkdir_with_parents(dir, mode); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 049d6ca5c..414369f5b 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -20,10 +20,10 @@ #include "inkscape-preferences.h" #include <gio/gio.h> +#include <glibmm/fileutils.h> #include <glibmm/i18n.h> #include <glibmm/markup.h> #include <glibmm/miscutils.h> -#include <glibmm/fileutils.h> #include <gtk/gtksettings.h> #include <gtkmm/main.h> #include <gtkmm/recentinfo.h> @@ -625,11 +625,11 @@ void InkscapePreferences::symbolicThemeCheck() } if (folder == prefs->getString("/theme/iconTheme")) { #ifdef WIN32 - path += g_win32_locale_filename_from_utf8("/scalable/actions"); + path += g_win32_locale_filename_from_utf8("/scalable/actions"); #else - path += "/scalable/actions"; + path += "/scalable/actions"; #endif - std::vector<Glib::ustring> symbolic_icons = get_filenames(path, {"-symbolic.svg"}, {}); + std::vector<Glib::ustring> symbolic_icons = get_filenames(path, { "-symbolic.svg" }, {}); if (symbolic_icons.size() > 0) { symbolic = true; symbolic_icons.clear(); @@ -640,7 +640,8 @@ void InkscapePreferences::symbolicThemeCheck() _symbolic_icons.set_active(false); _symbolic_icons.hide(); _symbolic_color.hide(); - } else { + } + else { _symbolic_icons.show(); _symbolic_color.show(); } @@ -859,7 +860,7 @@ void InkscapePreferences::initPageUI() values.erase(unique(values.begin(), values.end()), values.end()); _icon_theme.init("/theme/iconTheme", labels, values, "hicolor"); _page_theme.add_line(false, _("Change icon theme:"), _icon_theme, "", "", false); - _icon_theme.signal_changed().connect( sigc::mem_fun(*this, &InkscapePreferences::symbolicThemeCheck)); + _icon_theme.signal_changed().connect(sigc::mem_fun(*this, &InkscapePreferences::symbolicThemeCheck)); } _dark_theme.init(_("Use dark theme"), "/theme/darkTheme", true); @@ -887,7 +888,7 @@ void InkscapePreferences::initPageUI() _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); } _apply_theme.set_label(_("Now")); - _apply_theme.set_tooltip_text (_("It apply slow")); + _apply_theme.set_tooltip_text(_("It apply slow")); _page_theme.add_line(false, _("Apply theme"), _apply_theme, "", _("Apply theme"), false); _apply_theme.signal_clicked().connect(sigc::ptr_fun(sp_ui_reload)); this->AddPage(_page_theme, _("Theme"), iter_ui, PREFS_PAGE_UI_THEME); @@ -2192,28 +2193,38 @@ void InkscapePreferences::initPageSystem() _sys_user_config.init((char const *)Inkscape::IO::Resource::profile_path(""), _("Open inkscape folder")); _page_system.add_line(true, _("User config: "), _sys_user_config, "", _("Location of users configuration"), true); - _sys_user_extension_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""),_("Open extensions folder")); + _sys_user_extension_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::EXTENSIONS, ""), + _("Open extensions folder")); _page_system.add_line(true, _("User extensions: "), _sys_user_extension_dir, "", _("Location of the users extensions"), true); - _sys_user_themes_dir.init((char const *)Inkscape::IO::Resource::profile_path("/themes"),_("Open themes folder")); + _sys_user_themes_dir.init((char const *)Inkscape::IO::Resource::profile_path("/themes"), _("Open themes folder")); _page_system.add_line(true, _("User themes: "), _sys_user_themes_dir, "", _("Location of the users themes"), true); - - _sys_user_icons_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::ICONS, ""),_("Open icons folder")); + + _sys_user_icons_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::ICONS, ""), + _("Open icons folder")); _page_system.add_line(true, _("User icons: "), _sys_user_icons_dir, "", _("Location of the users icons"), true); - - _sys_user_templates_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::TEMPLATES, ""),_("Open templates folder")); - _page_system.add_line(true, _("User templates: "), _sys_user_templates_dir, "", _("Location of the users templates"), true); - _sys_user_symbols_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::SYMBOLS, ""),_("Open symbols folder")); - _page_system.add_line(true, _("User symbols: "), _sys_user_symbols_dir, "", _("Location of the users symbols"), true); - - _sys_user_palettes_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::PALETTES, ""),_("Open palletes folder")); - _page_system.add_line(true, _("User palettes: "), _sys_user_palettes_dir, "", _("Location of the users palettes"), true); + _sys_user_templates_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::TEMPLATES, ""), + _("Open templates folder")); + _page_system.add_line(true, _("User templates: "), _sys_user_templates_dir, "", + _("Location of the users templates"), true); + + _sys_user_symbols_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::SYMBOLS, ""), + _("Open symbols folder")); + _page_system.add_line(true, _("User symbols: "), _sys_user_symbols_dir, "", _("Location of the users symbols"), + true); - _sys_user_keys_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, ""),_("Open keys shorcuts folder")); + _sys_user_palettes_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::PALETTES, ""), + _("Open palletes folder")); + _page_system.add_line(true, _("User palettes: "), _sys_user_palettes_dir, "", _("Location of the users palettes"), + true); + + _sys_user_keys_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, ""), + _("Open keys shorcuts folder")); _page_system.add_line(true, _("User keys: "), _sys_user_keys_dir, "", _("Location of the users keys"), true); - - _sys_user_ui_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::UIS, ""),_("Open UI folder")); + + _sys_user_ui_dir.init((char const *)IO::Resource::get_path(IO::Resource::USER, IO::Resource::UIS, ""), + _("Open UI folder")); _page_system.add_line(true, _("User UI: "), _sys_user_ui_dir, "", _("Location of the users UI"), true); _sys_user_cache.set_text(g_get_user_cache_dir()); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index f734543f3..f36b3d944 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -353,21 +353,21 @@ protected: UI::Widget::PrefCheckButton _misc_namedicon_delay; // System page - // UI::Widget::Button *_apply_theme; + // UI::Widget::Button *_apply_theme; UI::Widget::PrefSpinButton _misc_latency_skew; UI::Widget::PrefSpinButton _misc_simpl; Gtk::Entry _sys_user_prefs; Gtk::Entry _sys_tmp_files; Gtk::Entry _sys_extension_dir; - UI::Widget::PrefOpenFolder _sys_user_config; - UI::Widget::PrefOpenFolder _sys_user_extension_dir; - UI::Widget::PrefOpenFolder _sys_user_themes_dir; - UI::Widget::PrefOpenFolder _sys_user_ui_dir; - UI::Widget::PrefOpenFolder _sys_user_icons_dir; - UI::Widget::PrefOpenFolder _sys_user_keys_dir; - UI::Widget::PrefOpenFolder _sys_user_palettes_dir; - UI::Widget::PrefOpenFolder _sys_user_templates_dir; - UI::Widget::PrefOpenFolder _sys_user_symbols_dir; + UI::Widget::PrefOpenFolder _sys_user_config; + UI::Widget::PrefOpenFolder _sys_user_extension_dir; + UI::Widget::PrefOpenFolder _sys_user_themes_dir; + UI::Widget::PrefOpenFolder _sys_user_ui_dir; + UI::Widget::PrefOpenFolder _sys_user_icons_dir; + UI::Widget::PrefOpenFolder _sys_user_keys_dir; + UI::Widget::PrefOpenFolder _sys_user_palettes_dir; + UI::Widget::PrefOpenFolder _sys_user_templates_dir; + UI::Widget::PrefOpenFolder _sys_user_symbols_dir; Gtk::Entry _sys_user_cache; Gtk::Entry _sys_data; Gtk::TextView _sys_icon; @@ -573,11 +573,11 @@ protected: private: - void symbolicThemeCheck(); - InkscapePreferences(); - InkscapePreferences(InkscapePreferences const &d); - InkscapePreferences operator=(InkscapePreferences const &d); - bool _init; + void symbolicThemeCheck(); + InkscapePreferences(); + InkscapePreferences(InkscapePreferences const &d); + InkscapePreferences operator=(InkscapePreferences const &d); + bool _init; }; } // namespace Dialog diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index ededc84e3..a92dbd68e 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -30,22 +30,21 @@ AnchorSelector::AnchorSelector() : _container() { set_halign(Gtk::ALIGN_CENTER); - setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); - setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); - setupButton(INKSCAPE_ICON("boundingbox_top_right"), _buttons[2]); - setupButton(INKSCAPE_ICON("boundingbox_left"), _buttons[3]); - setupButton(INKSCAPE_ICON("boundingbox_center"), _buttons[4]); - setupButton(INKSCAPE_ICON("boundingbox_right"), _buttons[5]); - setupButton(INKSCAPE_ICON("boundingbox_bottom_left"), _buttons[6]); - setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); + setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); + setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); + setupButton(INKSCAPE_ICON("boundingbox_top_right"), _buttons[2]); + setupButton(INKSCAPE_ICON("boundingbox_left"), _buttons[3]); + setupButton(INKSCAPE_ICON("boundingbox_center"), _buttons[4]); + setupButton(INKSCAPE_ICON("boundingbox_right"), _buttons[5]); + setupButton(INKSCAPE_ICON("boundingbox_bottom_left"), _buttons[6]); + setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); setupButton(INKSCAPE_ICON("boundingbox_bottom_right"), _buttons[8]); _container.set_row_homogeneous(); _container.set_column_homogeneous(true); - for(int i = 0; i < 9; ++i) { - _buttons[i].signal_clicked().connect( - sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); + for (int i = 0; i < 9; ++i) { + _buttons[i].signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); _container.attach(_buttons[i], i % 3, i / 3, 1, 1); } @@ -62,12 +61,10 @@ AnchorSelector::~AnchorSelector() void AnchorSelector::btn_activated(int index) { - if(_selection == index && _buttons[index].get_active() == false) - { + if (_selection == index && _buttons[index].get_active() == false) { _buttons[index].set_active(true); } - else if(_selection != index && _buttons[index].get_active()) - { + else if (_selection != index && _buttons[index].get_active()) { int old_selection = _selection; _selection = index; _buttons[old_selection].set_active(false); @@ -78,9 +75,8 @@ void AnchorSelector::btn_activated(int index) void AnchorSelector::setAlignment(int horizontal, int vertical) { int index = 3 * vertical + horizontal; - if(index >= 0 && index < 9) - { - _buttons[index].set_active(!_buttons[index].get_active()); + if (index >= 0 && index < 9) { + _buttons[index].set_active(!_buttons[index].get_active()); } } diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index 431b0d0ea..5a48a2b0d 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -884,35 +884,34 @@ void PrefOpenFolder::init(Glib::ustring const &entry_string, Glib::ustring const { relatedEntry = new Gtk::Entry(); relatedButton = new Gtk::Button(); - Gtk::HBox* pixlabel = new Gtk::HBox(false, 3); + Gtk::HBox *pixlabel = new Gtk::HBox(false, 3); Gtk::Image *im = sp_get_icon_image("document-open", Gtk::ICON_SIZE_BUTTON); pixlabel->pack_start(*im); Gtk::Label *l = new Gtk::Label(); l->set_markup_with_mnemonic(_("Open")); pixlabel->pack_start(*l); - relatedButton->add(*pixlabel); + relatedButton->add(*pixlabel); relatedButton->set_tooltip_text(tooltip); relatedEntry->set_text(entry_string); relatedEntry->set_sensitive(false); this->pack_end(*relatedButton, false, false, 4); this->pack_start(*relatedEntry, true, true, 0); - relatedButton->signal_clicked().connect( - sigc::mem_fun(*this, &PrefOpenFolder::onRelatedButtonClickedCallback)); - + relatedButton->signal_clicked().connect(sigc::mem_fun(*this, &PrefOpenFolder::onRelatedButtonClickedCallback)); } void PrefOpenFolder::onRelatedButtonClickedCallback() { - g_mkdir_with_parents (relatedEntry->get_text().c_str(), 0700); + g_mkdir_with_parents(relatedEntry->get_text().c_str(), 0700); #ifdef WIN32 - Uri uri = new System::Uri(relatedEntry->get_text()); - Glib::ustring uri_open = (uri.AbsoluteUri).c_str() + System::Uri uri = new System::Uri(relatedEntry->get_text()); + Glib::ustring uri_open = (uri.AbsoluteUri) + .c_str() #else Glib::ustring uri_open = ("file://" + relatedEntry->get_text()).c_str(); #endif - GError *error = NULL; - if (!g_app_info_launch_default_for_uri (uri_open.c_str(), NULL, &error)) { - g_warning ("Failed to open uri: %s", error->message); + GError *error = NULL; + if (!g_app_info_launch_default_for_uri(uri_open.c_str(), NULL, &error)) { + g_warning("Failed to open uri: %s", error->message); } } |
