Logo Search packages:      
Sourcecode: ardour version File versions

Glib::ustring Glib::get_application_name (  ) 

Gets a human-readable name for the application, as set by Glib::set_application_name(). This name should be localized if possible, and is intended for display to the user. Contrast with Glib::get_prgname(), which gets a non-localized name. If Glib::set_application_name() has not been called, returns the result of Glib::get_prgname() (which may be empty if Glib::set_prgname() has also not been called).

Returns:
Human-readable application name. May return "".

Definition at line 32 of file miscutils.cc.

{
  if(const char *const application_name = g_get_application_name())
  {
    // Lets be a bit more strict than the original GLib function and ensure
    // we always return valid UTF-8.  gtkmm coders surely won't expect invalid
    // UTF-8 in a Glib::ustring returned by a glibmm function.

    if(g_utf8_validate(application_name, -1, 0))
      return Glib::ustring(application_name);

    char *const appname_utf8 = g_filename_to_utf8(application_name, -1, 0, 0, 0);
    g_return_val_if_fail(appname_utf8 != 0, "");

    return Glib::ustring(ScopedPtr<char>(appname_utf8).get());
  }

  return Glib::ustring();
}


Generated by  Doxygen 1.6.0   Back to index