Exemplo n.º 1
0
        public bool Equal(GLib.Icon icon2)
        {
            bool raw_ret = g_icon_equal(Handle, icon2 == null ? IntPtr.Zero : icon2.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
Exemplo n.º 2
0
 public EmblemedIcon(GLib.Icon icon, GLib.Emblem emblem) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(EmblemedIcon))
     {
         throw new InvalidOperationException("Can't override this constructor.");
     }
     Raw = g_emblemed_icon_new(icon == null ? IntPtr.Zero : icon.Handle, emblem == null ? IntPtr.Zero : emblem.Handle);
 }
Exemplo n.º 3
0
        public static GLib.Icon TypeGetIcon(string type)
        {
            IntPtr native_type = GLib.Marshaller.StringToPtrGStrdup(type);
            IntPtr raw_ret     = g_content_type_get_icon(native_type);

            GLib.Icon ret = GLib.IconAdapter.GetObject(raw_ret, false);
            GLib.Marshaller.Free(native_type);
            return(ret);
        }
Exemplo n.º 4
0
        public IconEmblem(int position, GLib.Icon icon, int size)
        {
            Position = position;
            IconSize = size;
            Gtk.IconInfo info = Gtk.IconTheme.Default.LookupByGIcon(icon, size, Gtk.IconLookupFlags.GenericFallback);
            if (info == null)
            {
                Log <IconEmblem> .Warn("IconInfo lookup failed, using fallback of '{0}'", Gtk.Stock.Cancel);

                Icon = Gtk.Stock.Cancel;
                return;
            }
            ForcePixbuf = info.LoadIcon();
        }
Exemplo n.º 5
0
 public Emblem(GLib.Icon icon) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(Emblem))
     {
         ArrayList vals  = new ArrayList();
         ArrayList names = new ArrayList();
         if (icon != null)
         {
             names.Add("icon");
             vals.Add(new GLib.Value(icon));
         }
         CreateNativeObject((string[])names.ToArray(typeof(string)), (GLib.Value[])vals.ToArray(typeof(GLib.Value)));
         return;
     }
     Raw = g_emblem_new(icon == null ? IntPtr.Zero : icon.Handle);
 }
Exemplo n.º 6
0
 protected void SetIconFromGIcon(GLib.Icon gIcon)
 {
     Icon = DockServices.Drawing.IconFromGIcon(gIcon);
 }
Exemplo n.º 7
0
 public static IconInfo LookupByGIcon(this IconTheme theme, GLib.Icon icon, int size, Gtk.IconLookupFlags flags)
 {
     return(NativeInterop.IconThemeLookUpByGIcon(theme, icon, size, (int)flags));
 }
Exemplo n.º 8
0
 public static Gtk.Image NewFromIcon(GLib.Icon icon, Gtk.IconSize size)
 {
     return(new Gtk.Image(gtk_image_new_from_gicon(icon == null ? IntPtr.Zero : icon.Handle, (int)size)));
 }
Exemplo n.º 9
0
        void ShowSource(ChatView chatView, MessageModel msg)
        {
            Trace.Call(chatView, msg);

            string sourceId;
            var    time = (Int64)((msg.TimeStamp - UnixEpoch).TotalMilliseconds * 1000L);

            if (Sources.TryGetValue(chatView, out sourceId))
            {
                // update time of existing source
                App.SetSourceTime(sourceId, time);
                return;
            }

            // TODO: TEST ME!
            sourceId = chatView.ID;
            string iconName = null;
            string label    = null;

            if (chatView is PersonChatView)
            {
                iconName = "smuxi-person-chat";
                label    = chatView.Name;
            }
            else if (chatView is GroupChatView)
            {
                iconName = "smuxi-group-chat";
                var nick = GetNick(msg);
                if (nick == null)
                {
                    label = chatView.Name;
                }
                else
                {
                    label = String.Format("{0} ({1})", chatView.Name, nick);
                }
            }

            var theme = Gtk.IconTheme.Default;

            GLib.Icon icon = null;
            if (Frontend.HasSystemIconTheme &&
                iconName != null && theme.HasIcon(iconName))
            {
                icon = new GLib.ThemedIcon(iconName);
            }
            else if (iconName != null && theme.HasIcon(iconName))
            {
                // icon wasn't in the system icon theme
                var iconInfo = theme.LookupIcon(iconName, 256, Gtk.IconLookupFlags.UseBuiltin);
                if (!String.IsNullOrEmpty(iconInfo.Filename) &&
                    File.Exists(iconInfo.Filename))
                {
                    icon = new GLib.FileIcon(
                        GLib.FileFactory.NewForPath(iconInfo.Filename)
                        );
                }
            }
            App.AppendSource(sourceId, icon, label);
            App.SetSourceTime(sourceId, time);
            App.DrawAttention(sourceId);
            Sources.Add(chatView, sourceId);
        }