Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-mono-tools.git;a=commitdiff;h=bfa68d5db553a08fc59cb217bdeb21b993e530a8

commit bfa68d5db553a08fc59cb217bdeb21b993e530a8
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Sat Aug 28 13:01:41 2010 +0200

*added object Notification for update should be use by --update
*and can release a first version
*added .desktop

diff --git a/frugal-mono-tools/IconSummaryBody.cs 
b/frugal-mono-tools/IconSummaryBody.cs
new file mode 100644
index 0000000..11a302f
--- /dev/null
+++ b/frugal-mono-tools/IconSummaryBody.cs
@@ -0,0 +1,183 @@
+////////////////////////////////////////////////////////////////////////////////
+//3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
+//      10        20        30        40        50        60        70        
80
+//
+// Info:
+//    Example of how to use libnotify correctly and at the same time comply to
+//    the new jaunty notification spec (read: visual guidelines)
+//
+/*
+ *  Copyright (C) 2010 by Gaetan Gourdin <bouleet...@frogdev.info>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+using System;
+using Notifications;
+
+public class IconSummaryBody
+{
+       enum Capability {
+               CAP_ACTIONS = 0,
+               CAP_BODY,
+               CAP_BODY_HYPERLINKS,
+               CAP_BODY_IMAGES,
+               CAP_BODY_MARKUP,
+               CAP_ICON_MULTI,
+               CAP_ICON_STATIC,
+               CAP_SOUND,
+               CAP_IMAGE_SVG,
+               CAP_SYNCHRONOUS,
+               CAP_APPEND,
+               CAP_LAYOUT_ICON_ONLY,
+               CAP_MAX}
+
+       bool[] m_capabilities = {false,  // actions
+                                       false,  // body
+                                       false,  // body-hyperlinks
+                                       false,  // body-imges
+                                       false,  // body-markup
+                                       false,  // icon-multi
+                                       false,  // icon-static
+                                       false,  // sound
+                                       false,  // image/svg+xml
+                                       false,  // synchronous-hint
+                                       false,  // append-hint
+                                       false}; // icon-only-hint
+
+       private void InitCaps ()
+       {
+
+               if (Global.Capabilities == null)
+                       return;
+
+               if (Array.IndexOf (Global.Capabilities, "actions") > -1)
+                       m_capabilities[(int) Capability.CAP_ACTIONS] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "body") > -1)
+                       m_capabilities[(int) Capability.CAP_BODY] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "body-hyperlinks") > -1)
+                       m_capabilities[(int) Capability.CAP_BODY_HYPERLINKS] = 
true;
+
+               if (Array.IndexOf (Global.Capabilities, "body-images") > -1)
+                       m_capabilities[(int) Capability.CAP_BODY_IMAGES] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "body-markup") > -1)
+                       m_capabilities[(int) Capability.CAP_BODY_MARKUP] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "icon-multi") > -1)
+                       m_capabilities[(int) Capability.CAP_ICON_MULTI] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "icon-static") > -1)
+                       m_capabilities[(int) Capability.CAP_ICON_STATIC] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "sound") > -1)
+                       m_capabilities[(int) Capability.CAP_SOUND] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "image/svg+xml") > -1)
+                       m_capabilities[(int) Capability.CAP_IMAGE_SVG] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "private-synchronous") 
> -1)
+                       m_capabilities[(int) Capability.CAP_SYNCHRONOUS] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "append") > -1)
+                       m_capabilities[(int) Capability.CAP_APPEND] = true;
+
+               if (Array.IndexOf (Global.Capabilities, "private-icon-only") > 
-1)
+                       m_capabilities[(int) Capability.CAP_LAYOUT_ICON_ONLY] = 
true;
+       }
+
+       private void PrintCaps ()
+       {
+               Console.WriteLine ("Name:          "
+                                  + Global.ServerInformation.Name);
+               Console.WriteLine ("Vendor:        "
+                                  + Global.ServerInformation.Vendor);
+               Console.WriteLine ("Version:       "
+                                  + Global.ServerInformation.Version);
+               Console.WriteLine ("Spec. Version: "
+                                  + Global.ServerInformation.SpecVersion);
+
+               Console.WriteLine ("Supported capabilities/hints:");
+               if (m_capabilities[(int) Capability.CAP_ACTIONS])
+                       Console.WriteLine ("\tactions");
+               if (m_capabilities[(int) Capability.CAP_BODY])
+                       Console.WriteLine ("\tbody");
+               if (m_capabilities[(int) Capability.CAP_BODY_HYPERLINKS])
+                       Console.WriteLine ("\tbody-hyperlinks");
+               if (m_capabilities[(int) Capability.CAP_BODY_IMAGES])
+                       Console.WriteLine ("\tbody-images");
+               if (m_capabilities[(int) Capability.CAP_BODY_MARKUP])
+                       Console.WriteLine ("\tbody-markup");
+               if (m_capabilities[(int) Capability.CAP_ICON_MULTI])
+                       Console.WriteLine ("\ticon-multi");
+               if (m_capabilities[(int) Capability.CAP_ICON_STATIC])
+                       Console.WriteLine ("\ticon-static");
+               if (m_capabilities[(int) Capability.CAP_SOUND])
+                       Console.WriteLine ("\tsound");
+               if (m_capabilities[(int) Capability.CAP_IMAGE_SVG])
+                       Console.WriteLine ("\timage/svg+xml");
+               if (m_capabilities[(int) Capability.CAP_SYNCHRONOUS])
+                       Console.WriteLine ("\tprivate-synchronous");
+               if (m_capabilities[(int) Capability.CAP_APPEND])
+                       Console.WriteLine ("\tappend");
+               if (m_capabilities[(int) Capability.CAP_LAYOUT_ICON_ONLY])
+                       Console.WriteLine ("\tprivate-icon-only");
+
+               Console.WriteLine ("Notes:");
+               if (Global.ServerInformation.Name == "notify-osd")
+               {
+                       Console.WriteLine ("\tx- and y-coordinates hints are 
ignored");
+                       Console.WriteLine ("\texpire-timeout is ignored");
+                       Console.WriteLine ("\tbody-markup is accepted but 
filtered");
+               }
+               else
+                       Console.WriteLine ("\tnone");
+       }
+
+
+       public IconSummaryBody()
+       {
+               try{
+               // call this so we can savely use the m_capabilities array later
+               InitCaps ();
+
+               // show what's supported
+               PrintCaps ();
+               }
+               catch{}
+       }
+
+       public void ShowMessage (string title,string message)
+       {
+               try{
+               Notification n = new Notification(title,message,
+                                                  
"notification-message-IM");//TODO : use an icon
+               n.Show ();
+               }
+               catch{}
+       }
+
+       public void ShowMessage (string title,string message,Gdk.Pixbuf image )
+       {
+               try{
+               Notification n = new Notification(title,message,
+                                                 image);
+               n.Show ();
+               }
+               catch{}
+       }
+}
diff --git a/frugal-mono-tools/frugal-mono-tools.csproj 
b/frugal-mono-tools/frugal-mono-tools.csproj
index fb88087..4bbf046 100644
--- a/frugal-mono-tools/frugal-mono-tools.csproj
+++ b/frugal-mono-tools/frugal-mono-tools.csproj
@@ -85,4 +85,8 @@
<None Include="LICENCE" />
<None Include="Changelog" />
</ItemGroup>
+  <ItemGroup>
+    <Content Include="frugal-tools-gnome.desktop" />
+    <Content Include="frugal-tools-kde.desktop" />
+  </ItemGroup>
</Project>
\ No newline at end of file
diff --git a/frugal-mono-tools/frugal-tools-gnome.desktop 
b/frugal-mono-tools/frugal-tools-gnome.desktop
new file mode 100644
index 0000000..44321fc
--- /dev/null
+++ b/frugal-mono-tools/frugal-tools-gnome.desktop
@@ -0,0 +1,13 @@
+
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=frugalware configuration
+Exec=gksu frugal-mono-tools
+Terminal=false
+
+GenericName=frugalware configuration
+Comment=Tools for configure Frugalware
+Icon=FrugalTools.png
+Categories=Application;GTK;System;
+OnlyShowIn=GNOME;
diff --git a/frugal-mono-tools/frugal-tools-kde.desktop 
b/frugal-mono-tools/frugal-tools-kde.desktop
new file mode 100644
index 0000000..499f12b
--- /dev/null
+++ b/frugal-mono-tools/frugal-tools-kde.desktop
@@ -0,0 +1,13 @@
+
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Name=frugalware configuration
+Exec=kdesu frugal-mono-tools
+Terminal=false
+
+GenericName=frugalware configuration
+Comment=Tools for configure Frugalware
+Icon=FrugalTools.png
+Categories=Application;GTK;System;
+OnlyShowIn=KDE;
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to