[statusicon] Remove dependancy on SparkleLib
This commit is contained in:
parent
1cc492f23f
commit
3a2c82ff27
|
@ -56,9 +56,6 @@ namespace SparkleShare {
|
||||||
public event OnErrorEventHandler OnError;
|
public event OnErrorEventHandler OnError;
|
||||||
public delegate void OnErrorEventHandler ();
|
public delegate void OnErrorEventHandler ();
|
||||||
|
|
||||||
public event OnFirstRunEventHandler OnFirstRun;
|
|
||||||
public delegate void OnFirstRunEventHandler ();
|
|
||||||
|
|
||||||
public event OnInvitationEventHandler OnInvitation;
|
public event OnInvitationEventHandler OnInvitation;
|
||||||
public delegate void OnInvitationEventHandler (string invitation_file_path);
|
public delegate void OnInvitationEventHandler (string invitation_file_path);
|
||||||
|
|
||||||
|
@ -139,6 +136,23 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List <string> Folders
|
||||||
|
{
|
||||||
|
|
||||||
|
get
|
||||||
|
{
|
||||||
|
List <string> folders = new List <string> ();
|
||||||
|
|
||||||
|
foreach (SparkleRepo repo in Repositories)
|
||||||
|
folders.Add (repo.LocalPath);
|
||||||
|
|
||||||
|
return folders;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates a folder in the user's home folder to store configuration
|
// Creates a folder in the user's home folder to store configuration
|
||||||
private void CreateConfigurationFolders ()
|
private void CreateConfigurationFolders ()
|
||||||
{
|
{
|
||||||
|
@ -668,17 +682,8 @@ namespace SparkleShare {
|
||||||
target_folder_name += " (" + i + ")";
|
target_folder_name += " (" + i + ")";
|
||||||
|
|
||||||
|
|
||||||
fetcher.CloningStarted += delegate {
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + canonical_name + "] Cloning Repository");
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
fetcher.CloningFinished += delegate {
|
fetcher.CloningFinished += delegate {
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + canonical_name + "] Repository cloned");
|
|
||||||
|
|
||||||
SparkleHelpers.ClearAttributes (tmp_folder);
|
SparkleHelpers.ClearAttributes (tmp_folder);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -690,7 +695,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + name + "] Error moving folder: " + e.Message);
|
SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,14 +711,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
fetcher.CloningFailed += delegate {
|
fetcher.CloningFailed += delegate {
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Git", "[" + canonical_name + "] Cloning failed");
|
|
||||||
|
|
||||||
if (Directory.Exists (tmp_folder)) {
|
if (Directory.Exists (tmp_folder)) {
|
||||||
|
|
||||||
SparkleHelpers.ClearAttributes (tmp_folder);
|
SparkleHelpers.ClearAttributes (tmp_folder);
|
||||||
Directory.Delete (tmp_folder, true);
|
Directory.Delete (tmp_folder, true);
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Config", "[" + name + "] Deleted temporary directory");
|
SparkleHelpers.DebugInfo ("Config", "Deleted temporary directory: " + tmp_folder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,7 @@
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using Mono.Unix;
|
using Mono.Unix;
|
||||||
using SparkleLib;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
@ -162,26 +158,23 @@ namespace SparkleShare {
|
||||||
Menu.Add (new SeparatorMenuItem ());
|
Menu.Add (new SeparatorMenuItem ());
|
||||||
Menu.Add (folder_action.CreateMenuItem ());
|
Menu.Add (folder_action.CreateMenuItem ());
|
||||||
|
|
||||||
if (SparkleShare.Controller.Repositories.Count > 0) {
|
if (SparkleShare.Controller.Folders.Count > 0) {
|
||||||
|
|
||||||
// Creates a menu item for each repository with a link to their logs
|
// Creates a menu item for each repository with a link to their logs
|
||||||
foreach (SparkleRepo repo in SparkleShare.Controller.Repositories) {
|
foreach (string path in SparkleShare.Controller.Folders) {
|
||||||
|
|
||||||
folder_action = new Gtk.Action ("", repo.Name) {
|
folder_action = new Gtk.Action ("", path) {
|
||||||
IconName = "folder",
|
IconName = "folder",
|
||||||
IsImportant = true
|
IsImportant = true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (repo.HasUnsyncedChanges)
|
// if (repo.HasUnsyncedChanges)
|
||||||
folder_action.IconName = "dialog-error";
|
// folder_action.IconName = "dialog-error";
|
||||||
|
|
||||||
folder_action.Activated += OpenEventLogDelegate (repo.LocalPath);
|
folder_action.Activated += OpenEventLogDelegate (path);
|
||||||
|
|
||||||
MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();
|
MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem ();
|
||||||
|
|
||||||
if (repo.Description != null)
|
|
||||||
menu_item.TooltipText = repo.Description;
|
|
||||||
|
|
||||||
Menu.Add (menu_item);
|
Menu.Add (menu_item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -337,7 +330,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Animation.Stop ();
|
Animation.Stop ();
|
||||||
|
|
||||||
if (SparkleShare.Controller.Repositories.Count == 0) {
|
if (SparkleShare.Controller.Folders.Count == 0) {
|
||||||
|
|
||||||
StateText = _("No folders yet");
|
StateText = _("No folders yet");
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
|
|
Loading…
Reference in a new issue