This commit is contained in:
Hylke Bons 2011-07-08 22:52:55 +01:00
parent 4b74b09f75
commit 763dcd1200
6 changed files with 32 additions and 69 deletions

View file

@ -13,23 +13,22 @@ endif
SOURCES = \
SparkleAbout.cs \
SparkleBubble.cs \
SparkleBubbles.cs \
SparkleBubblesController.cs \
SparkleController.cs \
SparkleEntry.cs \
SparkleEventLog.cs \
SparkleEventLogController.cs \
SparkleInfobar.cs \
SparkleIntro.cs \
SparkleLinController.cs \
SparkleSetup.cs \
SparkleSetupController.cs \
SparkleSetupWindow.cs \
SparkleShare.cs \
SparkleSpinner.cs \
SparkleStatusIcon.cs \
SparkleStatusIconController.cs \
SparkleUI.cs \
SparkleUIHelpers.cs \
SparkleWindow.cs
SparkleUIHelpers.cs
include $(top_srcdir)/build/build.mk

View file

@ -16,26 +16,41 @@
using System;
using Gtk;
using Notifications;
namespace SparkleShare {
public class SparkleBubble : Notification {
public class SparkleBubbles {
public SparkleBubble (string title, string subtext) : base (title, subtext)
public SparkleBubblesController Controller = new SparkleBubblesController ();
public SparkleBubbles ()
{
IconName = "folder-sparkleshare";
Timeout = 4500;
Urgency = Urgency.Low;
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
Notification notification = new Notification () {
Timeout = 5 * 1000;
Urgency = Urgency.Low;
}
if (image_path != null)
Icon = new Gdk.Pixbuf (image_path);
else
IconName = "folder-sparkleshare";
notification.Show ();
};
}
// Checks whether the system allows adding buttons to a notification,
// prevents error messages in Ubuntu.
new public void AddAction (string action, string label, ActionHandler handler)
{
if (Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1)
base.AddAction (action, label, handler);
}
// new public void AddAction (string action, string label, ActionHandler handler)
// {
// if (Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1)
// base.AddAction (action, label, handler);
// }
}
}

View file

@ -1,50 +0,0 @@
// SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
//
// 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 3 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, see <http://www.gnu.org/licenses/>.
using Gtk;
namespace SparkleShare {
// An infobar
public class SparkleInfobar : EventBox {
public SparkleInfobar (string icon_name, string title, string text)
{
Window window = new Window (WindowType.Popup) {
Name = "gtk-tooltip"
};
window.EnsureStyle ();
Style = window.Style;
Label label = new Label () {
Markup = "<b>" + title + "</b>\n" + text
};
HBox hbox = new HBox (false, 12) {
BorderWidth = 12
};
hbox.PackStart (new Image (SparkleUIHelpers.GetIcon (icon_name, 24)),
false, false, 0);
hbox.PackStart (label, false, false, 0);
Add (hbox);
}
}
}

View file

@ -38,17 +38,13 @@
<Reference Include="Mono.Posix" />
</ItemGroup>
<ItemGroup>
<Compile Include="SparkleBubble.cs" />
<Compile Include="SparkleIntro.cs" />
<Compile Include="SparkleShare.cs" />
<Compile Include="SparkleSpinner.cs" />
<Compile Include="SparkleStatusIcon.cs" />
<Compile Include="SparkleUI.cs" />
<Compile Include="SparkleWindow.cs" />
<Compile Include="SparkleEntry.cs" />
<Compile Include="SparkleEventLog.cs" />
<Compile Include="SparkleUIHelpers.cs" />
<Compile Include="SparkleInfobar.cs" />
<Compile Include="SparkleController.cs" />
<Compile Include="SparkleAbout.cs" />
<Compile Include="SparkleLinController.cs" />
@ -56,6 +52,9 @@
<Compile Include="SparkleEventLogController.cs" />
<Compile Include="SparkleSetupController.cs" />
<Compile Include="SparkleStatusIconController.cs" />
<Compile Include="SparkleBubbles.cs" />
<Compile Include="SparkleSetup.cs" />
<Compile Include="SparkleSetupWindow.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SparkleLib\SparkleLib.csproj">