Beispiel #1
0
 private static string _(string msg)
 {
     return(LibraryCatalog.GetString(msg, _LibraryTextDomain));
 }
Beispiel #2
0
        private static void InitGtk(string[] args)
        {
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                InitGtkPathWin();
            }

#if GTK_SHARP_2_8 || GTK_SHARP_2_10
            if (!GLib.Thread.Supported)
            {
                GLib.Thread.Init();
            }
#else
            // with GTK# 2.8 we can do this better, see above
            // GTK# 2.7.1 for MS .NET doesn't support that though.
            if (Type.GetType("Mono.Runtime") == null)
            {
                // when we don't run on Mono, we need to initialize glib ourself
                GLib.Thread.Init();
            }
#endif
            _UIThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;

            string appDir    = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string localeDir = Path.Combine(appDir, "locale");
            if (!Directory.Exists(localeDir))
            {
                localeDir = Path.Combine(Defines.InstallPrefix, "share");
                localeDir = Path.Combine(localeDir, "locale");
            }

            LibraryCatalog.Init("smuxi-frontend-gnome", localeDir);
#if LOG4NET
            _Logger.Debug("InitGtk(): Using locale data from: " + localeDir);
#endif
            Gtk.Application.Init(Name, ref args);
            IsGtkInitialized = true;
#if GTK_SHARP_2_10
            GLib.ExceptionManager.UnhandledException += _OnUnhandledException;
#endif

            IconName = "smuxi-frontend-gnome";
            var iconPath = Path.Combine(Defines.InstallPrefix, "share");
            iconPath = Path.Combine(iconPath, "icons");
            var theme    = Gtk.IconTheme.Default;
            var settings = Gtk.Settings.Default;
            var iconInfo = theme.LookupIcon(IconName, -1, 0);
            HasSystemIconTheme = iconInfo != null &&
                                 iconInfo.Filename != null &&
                                 iconInfo.Filename.StartsWith(iconPath);
#if LOG4NET
            _Logger.DebugFormat("InitGtk(): Using {0} icon theme",
                                HasSystemIconTheme ? "system" : "built-in");
#endif

            var unityWithLightIcons = false;
            if (Frontend.IsUnity)
            {
                var sysGtkTheme  = settings.ThemeName ?? String.Empty;
                var sysIconTheme = GetGtkIconThemeName() ?? String.Empty;
#if LOG4NET
                _Logger.DebugFormat("InitGtk(): Detected GTK+ theme: {0} " +
                                    "icon theme: {1}", sysGtkTheme,
                                    sysIconTheme);
#endif
                if (sysGtkTheme.StartsWith("Ambiance") &&
                    sysIconTheme != "ubuntu-mono-dark")
                {
#if LOG4NET
                    _Logger.Debug("InitGtk(): Detected Ambiance theme with " +
                                  "light icons");
#endif
                    unityWithLightIcons = true;
                }
            }
            var appIconDir = Path.Combine(appDir, "icons");
            if (Directory.Exists(appIconDir))
            {
                var iconTheme = "Smuxi-Symbolic";
#if LOG4NET
                _Logger.InfoFormat("InitGtk(): Setting icon theme to: {0}",
                                   iconTheme);
#endif
                var origin = Assembly.GetExecutingAssembly().FullName;
                settings.SetStringProperty(
                    "gtk-icon-theme-name", iconTheme, origin
                    );
                settings.SetLongProperty(
                    "gtk-menu-images", 0, origin
                    );
                settings.SetLongProperty(
                    "gtk-button-images", 0, origin
                    );
#if LOG4NET
                _Logger.InfoFormat("InitGtk(): Prepending {0} to icon search path",
                                   appIconDir);
#endif
                theme.PrependSearchPath(appIconDir);
            }

            if (HasSystemIconTheme)
            {
                Gtk.Window.DefaultIconName = "smuxi-frontend-gnome";
            }
            else
            {
                Gtk.Window.DefaultIcon = Frontend.LoadIcon(
                    "smuxi-frontend-gnome", 256, "icon_256x256.png"
                    );
            }
        }
Beispiel #3
0
 static string _(string msg)
 {
     return LibraryCatalog.GetString(msg, LibraryTextDomain);
 }
Beispiel #4
0
        private static void InitGtk(string[] args)
        {
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                InitGtkPathWin();
            }

#if GTK_SHARP_2_8 || GTK_SHARP_2_10
            if (!GLib.Thread.Supported)
            {
                GLib.Thread.Init();
            }
#else
            // with GTK# 2.8 we can do this better, see above
            // GTK# 2.7.1 for MS .NET doesn't support that though.
            if (Type.GetType("Mono.Runtime") == null)
            {
                // when we don't run on Mono, we need to initialize glib ourself
                GLib.Thread.Init();
            }
#endif
            _UIThreadID = System.Threading.Thread.CurrentThread.ManagedThreadId;

            string appDir    = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            string localeDir = Path.Combine(appDir, "locale");
            if (!Directory.Exists(localeDir))
            {
                localeDir = Path.Combine(Defines.InstallPrefix, "share");
                localeDir = Path.Combine(localeDir, "locale");
            }

            LibraryCatalog.Init("smuxi-frontend-gnome", localeDir);
#if LOG4NET
            _Logger.Debug("InitGtk(): Using locale data from: " + localeDir);
#endif
            Gtk.Application.Init(Name, ref args);
#if GTK_SHARP_2_10
            GLib.ExceptionManager.UnhandledException += _OnUnhandledException;
#endif

            IconName = "smuxi-frontend-gnome";
            var iconPath = Path.Combine(Defines.InstallPrefix, "share");
            iconPath = Path.Combine(iconPath, "icons");
            var theme    = Gtk.IconTheme.Default;
            var iconInfo = theme.LookupIcon(IconName, -1, 0);
            HasSystemIconTheme = iconInfo != null &&
                                 iconInfo.Filename != null &&
                                 iconInfo.Filename.StartsWith(iconPath);
#if LOG4NET
            _Logger.DebugFormat("InitGtk(): Using {0} icon theme",
                                HasSystemIconTheme ? "system" : "built-in");
#endif

            if (HasSystemIconTheme)
            {
                Gtk.Window.DefaultIconName = "smuxi-frontend-gnome";
            }
            else
            {
                Gtk.Window.DefaultIcon = Frontend.LoadIcon(
                    "smuxi-frontend-gnome", 256, "icon_256x256.png"
                    );
            }
        }
 public void MakeRelative_Invalid_Exception(string filePath, string directoryPath)
 {
     Assert.Throws <ArgumentException>(
         () => LibraryCatalog.MakeRelative(filePath, directoryPath));
 }
 public void Insert(LibraryCatalog catalog)
 {
     _context.LibraryCatalogs.Add(catalog);
 }