diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-06-24 17:50:36 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-06-24 17:50:36 +0000 |
| commit | d71265c629a103d8c821fe85ccf71bd9c93baf47 (patch) | |
| tree | c01fe4543cd48f64a8ca4b60e01e1bb5040922d9 /src/widgets/desktop-widget.cpp | |
| parent | Working with powerclip and powermask (diff) | |
| parent | Merge branch 'ui-files-for-ui-xml' (diff) | |
| download | inkscape-d71265c629a103d8c821fe85ccf71bd9c93baf47.tar.gz inkscape-d71265c629a103d8c821fe85ccf71bd9c93baf47.zip | |
Updating to master
Diffstat (limited to 'src/widgets/desktop-widget.cpp')
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 94 |
1 files changed, 39 insertions, 55 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index d8c27f5b7..ce4c5936c 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -66,6 +66,7 @@ #include <gtkmm/cssprovider.h> #include <gtkmm/paned.h> #include <gtkmm/messagedialog.h> +#include "inkscape-version.h" using Inkscape::UI::Widget::UnitTracker; using Inkscape::UI::UXManager; @@ -761,69 +762,52 @@ SPDesktopWidget::updateTitle(gchar const* uri) Gtk::Window *window = static_cast<Gtk::Window*>(g_object_get_data(G_OBJECT(this), "window")); if (window) { - gchar const *fname = uri; - GString *name = g_string_new (""); - - gchar const *grayscalename = N_("grayscale"); - gchar const *grayscalenamecomma = N_(", grayscale"); - gchar const *printcolorsname = N_("print colors preview"); - gchar const *printcolorsnamecomma = N_(", print colors preview"); - gchar const *outlinename = N_("outline"); - gchar const *nofiltersname = N_("no filters"); - gchar const *colormodename = NULL; - gchar const *colormodenamecomma = NULL; - gchar const *rendermodename = NULL; - gchar const *modifiedname = ""; + SPDocument *doc = this->desktop->doc(); + + std::string Name; if (doc->isModifiedSinceSave()) { - modifiedname = "*"; + Name += "*"; } - if (this->desktop->getColorMode() == Inkscape::COLORMODE_GRAYSCALE) { - colormodename = grayscalename; - colormodenamecomma = grayscalenamecomma; - } else if (this->desktop->getColorMode() == Inkscape::COLORMODE_PRINT_COLORS_PREVIEW) { - colormodename = printcolorsname; - colormodenamecomma = printcolorsnamecomma; + Name += uri; + + if (desktop->number > 1) { + Name += ": "; + Name += std::to_string(desktop->number); } - if (this->desktop->getMode() == Inkscape::RENDERMODE_OUTLINE) { - rendermodename = outlinename; - } else if (this->desktop->getMode() == Inkscape::RENDERMODE_NO_FILTERS) { - rendermodename = nofiltersname; + Name += " ("; + + if (desktop->getMode() == Inkscape::RENDERMODE_OUTLINE) { + Name += N_("outline"); + } else if (desktop->getMode() == Inkscape::RENDERMODE_NO_FILTERS) { + Name += N_("no filters"); } - - - if (this->desktop->number > 1) { - if (rendermodename) { - if (colormodenamecomma) { - g_string_printf (name, _("%s%s: %d (%s%s) - Inkscape"), modifiedname, fname, this->desktop->number, _(rendermodename), _(colormodenamecomma)); - } else { - g_string_printf (name, _("%s%s: %d (%s) - Inkscape"), modifiedname, fname, this->desktop->number, _(rendermodename)); - } - } else { - if (colormodename) { - g_string_printf (name, _("%s%s: %d (%s) - Inkscape"), modifiedname, fname, this->desktop->number, _(colormodename)); - } else { - g_string_printf (name, _("%s%s: %d - Inkscape"), modifiedname, fname, this->desktop->number); - } - } + + if (desktop->getColorMode() != Inkscape::COLORMODE_NORMAL && + desktop->getMode() != Inkscape::RENDERMODE_NORMAL) { + Name += ", "; + } + + if (desktop->getColorMode() == Inkscape::COLORMODE_GRAYSCALE) { + Name += N_("grayscale"); + } else if (desktop->getColorMode() == Inkscape::COLORMODE_PRINT_COLORS_PREVIEW) { + Name += N_("print colors preview"); + } + + if (*Name.rbegin() == '(') { // Can not use C++11 .back() or .pop_back() with ustring! + Name.erase(Name.size() - 2); } else { - if (rendermodename) { - if (colormodenamecomma) { - g_string_printf (name, _("%s%s (%s%s) - Inkscape"), modifiedname, fname, _(rendermodename), _(colormodenamecomma)); - } else { - g_string_printf (name, _("%s%s (%s) - Inkscape"), modifiedname, fname, _(rendermodename)); - } - } else { - if (colormodename) { - g_string_printf (name, _("%s%s (%s) - Inkscape"), modifiedname, fname, _(colormodename)); - } else { - g_string_printf (name, _("%s%s - Inkscape"), modifiedname, fname); - } - } + Name += ")"; } - window->set_title (name->str); - g_string_free (name, TRUE); + + Name += " - Inkscape"; + + // Name += " ("; + // Name += Inkscape::version_string; + // Name += ")"; + + window->set_title (Name); } } |
