Fix preprocessor directives for AppIndicator support

This commit is contained in:
Bertrand Lorentz 2011-06-13 00:51:07 +02:00
parent e1ecdfb800
commit 8da87a775a
2 changed files with 13 additions and 10 deletions

View file

@ -7,6 +7,9 @@ TARGET = exe
LINK = $(REF_SPARKLESHARE) $(NOTIFY_SHARP_LIBS) $(WEBKIT_SHARP_LIBS) LINK = $(REF_SPARKLESHARE) $(NOTIFY_SHARP_LIBS) $(WEBKIT_SHARP_LIBS)
if HAVE_APP_INDICATOR
BUILD_DEFINES="-define:HAVE_APP_INDICATOR"
endif
SOURCES = \ SOURCES = \
SparkleAbout.cs \ SparkleAbout.cs \

View file

@ -19,7 +19,7 @@ using System;
using System.IO; using System.IO;
using System.Timers; using System.Timers;
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
using AppIndicator; using AppIndicator;
#endif #endif
using Gtk; using Gtk;
@ -37,7 +37,7 @@ namespace SparkleShare {
private string StateText; private string StateText;
private Menu Menu; private Menu Menu;
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
private ApplicationIndicator indicator; private ApplicationIndicator indicator;
#else #else
private StatusIcon status_icon; private StatusIcon status_icon;
@ -55,7 +55,7 @@ namespace SparkleShare {
AnimationFrames = CreateAnimationFrames (); AnimationFrames = CreateAnimationFrames ();
Animation = CreateAnimation (); Animation = CreateAnimation ();
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
this.indicator = new ApplicationIndicator ("sparkleshare", this.indicator = new ApplicationIndicator ("sparkleshare",
"process-syncing-sparkleshare-i", Category.ApplicationStatus) { "process-syncing-sparkleshare-i", Category.ApplicationStatus) {
@ -145,7 +145,7 @@ namespace SparkleShare {
icon_name += "i"; icon_name += "i";
Application.Invoke (delegate { Application.Invoke (delegate {
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
this.indicator.IconName = icon_name; this.indicator.IconName = icon_name;
#else #else
this.status_icon.Pixbuf = SparkleUIHelpers.GetIcon (icon_name, 24); this.status_icon.Pixbuf = SparkleUIHelpers.GetIcon (icon_name, 24);
@ -292,7 +292,7 @@ namespace SparkleShare {
Menu.Add (quit_item); Menu.Add (quit_item);
Menu.ShowAll (); Menu.ShowAll ();
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
this.indicator.Menu = Menu; this.indicator.Menu = Menu;
#endif #endif
} }
@ -321,7 +321,7 @@ namespace SparkleShare {
Menu.ShowAll (); Menu.ShowAll ();
} }
#if !HAVE_APP_INDICATOR
// Makes the menu visible // Makes the menu visible
private void ShowMenu (object o, EventArgs args) private void ShowMenu (object o, EventArgs args)
{ {
@ -334,7 +334,7 @@ namespace SparkleShare {
{ {
StatusIcon.PositionMenu (menu, out x, out y, out push_in, this.status_icon.Handle); StatusIcon.PositionMenu (menu, out x, out y, out push_in, this.status_icon.Handle);
} }
#endif
// The state when there's nothing going on // The state when there's nothing going on
private void SetNormalState () private void SetNormalState ()
@ -352,7 +352,7 @@ namespace SparkleShare {
StateText = _("Welcome to SparkleShare!"); StateText = _("Welcome to SparkleShare!");
Application.Invoke (delegate { Application.Invoke (delegate {
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
this.indicator.IconName = "process-syncing-sparkleshare-i"; this.indicator.IconName = "process-syncing-sparkleshare-i";
#else #else
this.status_icon.Pixbuf = AnimationFrames [0]; this.status_icon.Pixbuf = AnimationFrames [0];
@ -364,7 +364,7 @@ namespace SparkleShare {
StateText = _("Not everything is synced"); StateText = _("Not everything is synced");
Application.Invoke (delegate { Application.Invoke (delegate {
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
this.indicator.IconName = "sparkleshare-syncing-error"; this.indicator.IconName = "sparkleshare-syncing-error";
#else #else
this.status_icon.Pixbuf = SparkleUIHelpers.GetIcon ("sparkleshare-syncing-error", 24); this.status_icon.Pixbuf = SparkleUIHelpers.GetIcon ("sparkleshare-syncing-error", 24);
@ -373,7 +373,7 @@ namespace SparkleShare {
} else { } else {
StateText = _("Up to date") + " (" + SparkleShare.Controller.FolderSize + ")"; StateText = _("Up to date") + " (" + SparkleShare.Controller.FolderSize + ")";
Application.Invoke (delegate { Application.Invoke (delegate {
#ifdef USE_APPINDICATOR #if HAVE_APP_INDICATOR
this.indicator.IconName = "process-syncing-sparkleshare-i"; this.indicator.IconName = "process-syncing-sparkleshare-i";
#else #else
this.status_icon.Pixbuf = AnimationFrames [0]; this.status_icon.Pixbuf = AnimationFrames [0];