LoadIcon() public static method

public static LoadIcon ( string iconName, int size, string resourceName ) : Gdk.Pixbuf
iconName string
size int
resourceName string
return Gdk.Pixbuf
示例#1
0
        static NotifyManager()
        {
            // image size >= 128 pixels as per notify-osd guidelines:
            // https://wiki.ubuntu.com/NotificationDevelopmentGuidelines
            PersonChatIconPixbuf = Frontend.LoadIcon(
                "smuxi-person-chat", 256, "person-chat_256x256.png"
                );
            GroupChatIconPixbuf = Frontend.LoadIcon(
                "smuxi-group-chat", 256, "group-chat_256x256.png"
                );

            var partialPath = "share";

            partialPath = Path.Combine(partialPath, "sounds");
            partialPath = Path.Combine(partialPath, "freedesktop");
            partialPath = Path.Combine(partialPath, "stereo");
            partialPath = Path.Combine(partialPath, "message-new-instant.oga");
            var soundFile    = Path.Combine(Defines.InstallPrefix, partialPath);
            var sysSoundFile = Path.Combine("/usr", partialPath);

            if (File.Exists(soundFile))
            {
                SoundFile = soundFile;
            }
            else if (File.Exists(sysSoundFile))
            {
                // fallback to system-wide install
                SoundFile = sysSoundFile;
            }
        }
示例#2
0
        public AboutDialog(Gtk.Window parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            TransientFor = parent;
            Name         = Frontend.Name;
            Version      = "\n Frontend: " + Frontend.UIName + " " + Frontend.Version +
                           "\n Engine: " + Frontend.EngineVersion;
            Copyright = "Copyright © 2005-2010 Mirco Bauer <*****@*****.**>";
            Authors   = new string[] {
                "Mirco Bauer <*****@*****.**>",
                "David Paleino <*****@*****.**>",
                "Clément Bourgeois <*****@*****.**>",
                "Chris Le Sueur <*****@*****.**>",
                "Tuukka Hastrup <*****@*****.**>"
            };
            Artists = new string[] {
                "Jakub Steiner <*****@*****.**>",
                "Rodney Dawes <*****@*****.**>",
                "Lapo Calamandrei <*****@*****.**>",
                "Ahmed Abdellah <*****@*****.**>"
            };
            TranslatorCredits = _("translator-credits");
            Logo = Frontend.LoadIcon(
                Frontend.IconName, 256, "icon_256x256.png"
                );
            Website      = "http://www.smuxi.org/";
            WebsiteLabel = _("Smuxi Website");
        }
示例#3
0
        public AboutDialog(Gtk.Window parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            TransientFor = parent;
            ProgramName  = Frontend.Name;
            var version     = Frontend.Version.ToString();
            var distVersion = Defines.DistVersion;

            if (!String.IsNullOrEmpty(distVersion))
            {
                Version = String.Format("\n Vendor: {0}", distVersion);
            }
            Version += "\n Frontend: " + Frontend.UIName + " " + version +
                       "\n Engine: " + Frontend.EngineAssemblyVersion;
            Copyright = "Copyright © 2005-2015 Mirco Bauer <*****@*****.**> and other contributors";
            Authors   = new string[] {
                "Mirco Bauer <*****@*****.**>",
                "David Paleino <*****@*****.**>",
                "Clément Bourgeois <*****@*****.**>",
                "Chris Le Sueur <*****@*****.**>",
                "Tuukka Hastrup <*****@*****.**>",
                "Bianca Mix <*****@*****.**>",
                "Oliver Schneider <*****@*****.**>",
                "Carlos Martín Nieto <*****@*****.**>"
            };
            Artists = new string[] {
                "Jakub Steiner <*****@*****.**>",
                "Rodney Dawes <*****@*****.**>",
                "Lapo Calamandrei <*****@*****.**>",
                "Ahmed Abdellah <*****@*****.**>",
                "George Karavasilev <*****@*****.**>",
                "Joern Konopka <*****@*****.**>",
                "Nuno F. Pinheiro <*****@*****.**>"
            };
            TranslatorCredits = _("translator-credits");
            Logo = Frontend.LoadIcon(
                Frontend.IconName, 256, "icon_256x256.png"
                );
            // HACK: shows "not implemented" error on OS X and
            // "No application is registered as handling this file" on Windows.
            // This probably relies on gvfs or similar which isn't available in
            // the GTK{+,#} ports/installers for OS X and Windows. Thus we only
            // show the website URL as label instead.
            if (Frontend.IsMacOSX || Frontend.IsWindows)
            {
                WebsiteLabel = "https://smuxi.im/";
            }
            else
            {
                Website      = "https://smuxi.im/";
                WebsiteLabel = _("Smuxi Website");
            }
        }
示例#4
0
文件: AboutDialog.cs 项目: RAOF/smuxi
        public AboutDialog(Gtk.Window parent)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            TransientFor = parent;
            ProgramName  = Frontend.Name;
            var version     = Frontend.Version.ToString();
            var distVersion = Defines.DistVersion;

            if (!String.IsNullOrEmpty(distVersion))
            {
                Version = String.Format("\n Vendor: {0}", distVersion);
            }
            Version += "\n Frontend: " + Frontend.UIName + " " + version +
                       "\n Engine: " + Frontend.EngineVersion;
            Copyright = "Copyright © 2005-2013 Mirco Bauer <*****@*****.**>";
            Authors   = new string[] {
                "Mirco Bauer <*****@*****.**>",
                "David Paleino <*****@*****.**>",
                "Clément Bourgeois <*****@*****.**>",
                "Chris Le Sueur <*****@*****.**>",
                "Tuukka Hastrup <*****@*****.**>",
                "Bianca Mix <*****@*****.**>",
                "Oliver Schneider <*****@*****.**>",
                "Carlos Martín Nieto <*****@*****.**>"
            };
            Artists = new string[] {
                "Jakub Steiner <*****@*****.**>",
                "Rodney Dawes <*****@*****.**>",
                "Lapo Calamandrei <*****@*****.**>",
                "Ahmed Abdellah <*****@*****.**>",
                "George Karavasilev <*****@*****.**>",
                "Joern Konopka <*****@*****.**>",
                "Nuno F. Pinheiro <*****@*****.**>"
            };
            TranslatorCredits = _("translator-credits");
            Logo = Frontend.LoadIcon(
                Frontend.IconName, 256, "icon_256x256.png"
                );
            // HACK: shows "not implemented" error on OS X
            if (!Frontend.IsMacOSX)
            {
                Website      = "http://www.smuxi.org/";
                WebsiteLabel = _("Smuxi Website");
            }
        }
示例#5
0
        public void ApplyConfig(UserConfig userConfig)
        {
            Trace.Call(userConfig);

            if (userConfig == null)
            {
                throw new ArgumentNullException("userConfig");
            }

            string modeStr = (string)userConfig["Interface/Notification/NotificationAreaIconMode"];

            f_NotificationAreaIconMode = (NotificationAreaIconMode)Enum.Parse(
                typeof(NotificationAreaIconMode),
                modeStr
                );

            // initialize status icon for the first time
            if (f_NotificationAreaIconMode != NotificationAreaIconMode.Never &&
                f_StatusIcon == null)
            {
                f_StatusIcon = new Gtk.StatusIcon();
                if (Frontend.HasSystemIconTheme)
                {
                    f_StatusIcon.IconName = Frontend.IconName;
                }
                else
                {
                    f_StatusIcon.Pixbuf = Frontend.LoadIcon(
                        Frontend.IconName, 256, "icon_256x256.png"
                        );
                }
                f_StatusIcon.Activate  += OnStatusIconActivated;
                f_StatusIcon.PopupMenu += OnStatusIconPopupMenu;
                f_StatusIcon.Tooltip    = "Smuxi";
            }
            if (f_NotificationAreaIconMode == NotificationAreaIconMode.Never &&
                !f_MainWindow.Visible)
            {
                // force window unhide as the user would not be able to bring
                // it back without a notification icon!
                f_MainWindow.Visible = true;
            }

            CheckMainWindowState();
        }
示例#6
0
        static ProtocolChatView()
        {
            IconPixbuf = Frontend.LoadIcon(
                "smuxi-protocol-chat", 16, "protocol-chat_256x256.png"
                );
            NetworkWebsiteUrls = new Dictionary <string, string>(
                StringComparer.InvariantCultureIgnoreCase
                );

            // IRC
            NetworkWebsiteUrls.Add("OFTC", "http://www.oftc.net/");
            NetworkWebsiteUrls.Add("freenode", "http://freenode.net/");
            NetworkWebsiteUrls.Add("QuakeNet", "http://www.quakenet.org/");
            NetworkWebsiteUrls.Add("IRCnet", "http://www.ircnet.org/");
            NetworkWebsiteUrls.Add("DALnet", "http://www.dal.net/");
            NetworkWebsiteUrls.Add("GameSurge", "https://gamesurge.net/");
            NetworkWebsiteUrls.Add("EFnet", "http://www.efnet.org/");
            NetworkWebsiteUrls.Add("GIMPnet", "http://www.gimp.org/");
            NetworkWebsiteUrls.Add("GSDnet", "http://www.gsd-software.net/");
            NetworkWebsiteUrls.Add("ustream", "http://www.ustream.tv/");
            NetworkWebsiteUrls.Add("Infinity-IRC", "http://www.infinityirc.com/");
            NetworkWebsiteUrls.Add("GeekShed", "http://www.geekshed.net/");

            // Twitter
            NetworkWebsiteUrls.Add("Twitter", "http://www.twitter.com/");

            // XMPP - with federation
            NetworkWebsiteUrls.Add("XMPP", "http://xmpp.org/");
            NetworkWebsiteUrls.Add("jabber.org", "http://planet.jabber.org/");
            NetworkWebsiteUrls.Add("jabber.de", "http://www.jabber.de/");
            NetworkWebsiteUrls.Add("jabber.at", "http://planet.jabber.org/");
            NetworkWebsiteUrls.Add("jabber.ccc.de", "http://web.jabber.ccc.de/");
            NetworkWebsiteUrls.Add("xmpp-gmx.gmx.net", "http://planet.jabber.org/");
            NetworkWebsiteUrls.Add("xmpp-webde.gmx.net", "http://planet.jabber.org/");
            NetworkWebsiteUrls.Add("jabber.gmx.net", "http://planet.jabber.org/");
            // XMPP - without federation
            NetworkWebsiteUrls.Add("talk.google.com", "http://www.google.com/talk/");
            NetworkWebsiteUrls.Add("chat.facebook.com", "http://www.facebook.com/");

            // JabbR
            NetworkWebsiteUrls.Add("jabbr.net", "http://jabbr.net/");

            // Campfire
            NetworkWebsiteUrls.Add("Campfire", "http://campfirenow.com");

            // support downloading favicons via https
            var whitelist = Session.CertificateValidator.HostnameWhitelist;

            lock (whitelist) {
                foreach (var url in NetworkWebsiteUrls.Values)
                {
                    var uri      = new Uri(url);
                    var hostname = uri.Host;
                    if (whitelist.Contains(hostname))
                    {
                        continue;
                    }
                    whitelist.Add(hostname);
                }
            }
        }
示例#7
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"
                    );
            }
        }
示例#8
0
 static PersonChatView()
 {
     IconPixbuf = Frontend.LoadIcon(
         "smuxi-person-chat", 16, "person-chat_256x256.png"
         );
 }
示例#9
0
 static SessionChatView()
 {
     IconPixbuf = Frontend.LoadIcon(
         "smuxi-session-chat", 16, "session-chat_256x256.png"
         );
 }
示例#10
0
 static GroupChatView()
 {
     IconPixbuf = Frontend.LoadIcon(
         "smuxi-group-chat", 16, "group-chat_256x256.png"
         );
 }
示例#11
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"
                    );
            }
        }
示例#12
0
 static ProtocolChatView()
 {
     IconPixbuf = Frontend.LoadIcon(
         "smuxi-protocol-chat", 16, "protocol-chat_256x256.png"
         );
 }