Skip to content

Commit

Permalink
adding FolderWatch subscriber plugin code and updating a few connecto…
Browse files Browse the repository at this point in the history
…r files
  • Loading branch information
briandunnington committed Feb 24, 2012
1 parent 74f27c9 commit c6451c1
Show file tree
Hide file tree
Showing 23 changed files with 1,090 additions and 151 deletions.
1 change: 0 additions & 1 deletion Growl Connectors/Javascript/default.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<html>
<head>
<script src="swfobject.js"></script>
<script src="growl.js"></script>

<link rel="stylesheet" href="/gfw/reset.css" media="all">
Expand Down
216 changes: 114 additions & 102 deletions Growl Connectors/Javascript/growl.js
Original file line number Diff line number Diff line change
@@ -1,109 +1,121 @@
Growl = function(){
var swfID = "growlconnector";
var swf;
var scope = "Growl";
var containerID = null;
var defaultContainerID = "growlconnectorcontainer";
var password = null;
var passwordHashAlgorithm;
var encryptionAlgorithm;

function generateSWF(containerID, scope) {
var so = new SWFObject("GrowlFlashConnector.swf", swfID, "1", "1", "8", "#ff00ff");
so.addParam("allowScriptAccess", "always");
so.addVariable("scope", scope);
so.write(containerID);
}

function oncallbackInternal(notificationID, action, context, type, timestamp) {}
function onokInternal() {}
function onerrorInternal(response) {}
function onsecurityerrorInternal(){}

return {
oncallback : oncallbackInternal,
onerror : onerrorInternal,
onok : onokInternal,
onsecurityerror : onsecurityerrorInternal,

onready : function(){
swf = document.getElementById(swfID);
swf.setPassword(password);
swf.setPasswordHashAlgorithm(passwordHashAlgorithm);
swf.setEncryptionAlgorithm(encryptionAlgorithm);
//alert("ready");
Growl.onready2();
},

onready2 : function(){},

init : function(config){
passwordHashAlgorithm = Growl.PasswordHashAlgorithm.MD5;
encryptionAlgorithm = Growl.EncryptionAlgorithm.PlainText;
Growl.onerror = onerrorInternal;

if(config && config.scope) scope = config.scope;
if(config && config.containerID) containerID = config.containerID;
if(config && config.password) password = config.password;
if(config && config.passwordHashAlgorithm) passwordHashAlgorithm = config.passwordHashAlgorithm;
if(config && config.encryptionAlgorithm) encryptionAlgorithm = config.encryptionAlgorithm;
if(config && config.oncallback) Growl.oncallback = config.oncallback;
if(config && config.onok) Growl.onok = config.onok;
if(config && config.onerror) Growl.onerror = config.onerror;
if(config && config.onready2) Growl.onready2 = config.onready2;
if(config && config.onnotrunning) Growl.onsecurityerror = config.onnotrunning;

if(!containerID){
var container = document.createElement("div");
container.id = defaultContainerID;
document.body.appendChild(container);
containerID = container.id;
}
generateSWF(containerID, scope);
},

register : function(application, notificationTypes){
swf.register(application, notificationTypes);
},

notify : function(appName, notification){
if(!notification.id) notification.id = new Date().getTime();
swf.notify(appName, notification);
},

debug : function(msg){
//alert(msg);
prompt("DEBUG:", msg);
}
}
}();

Growl.Application = function(){
this.name = null;
this.icon = null;
this.customAttributes = {};
Growl = function () {
var swfID = "growlconnector";
var swfUrl = "GrowlFlashConnector.swf";
var swf;
var scope = "Growl";
var containerID = null;
var defaultContainerID = "growlconnectorcontainer";
var password = null;
var passwordHashAlgorithm;
var encryptionAlgorithm;

function generateSWF(containerID, scope, swfUrl) {
document.getElementById(containerID).innerHTML += "<!--[if IE]> \
<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='1' height='1' id='growlconnector' name='growlconnector'> \
<param name='movie' value='" + swfUrl + "'> \
<param name='allowscriptaccess' value='always'> \
<param name='flashvars' value='scope=" + scope + "'> \
</object> \
<![endif]--> \
<![if !IE]> \
<embed id='growlconnector' \
name='growlconnector' \
src='" + swfUrl + "' \
width='1' \
height='1' \
allowscriptaccess='always' \
type='application/x-shockwave-flash' \
flashvars='scope=" + scope + "' \
/> \
<![endif]>";
}

function oncallbackInternal(notificationID, action, context, type, timestamp) { }
function onerrorInternal(response) { }

return {
oncallback: oncallbackInternal,
onerror: onerrorInternal,

onok: function () {
//alert("ok");
},

onready: function () {
swf = document.getElementById(swfID);
swf.setPassword(password);
swf.setPasswordHashAlgorithm(passwordHashAlgorithm);
swf.setEncryptionAlgorithm(encryptionAlgorithm);
Growl.onready2();
},

onready2: function () { },

init: function (config) {
passwordHashAlgorithm = Growl.PasswordHashAlgorithm.MD5;
encryptionAlgorithm = Growl.EncryptionAlgorithm.PlainText;
Growl.onerror = onerrorInternal;

if (config && config.scope) scope = config.scope;
if (config && config.containerID) containerID = config.containerID;
if (config && config.swfUrl) swfUrl = config.swfUrl;
if (config && config.password) password = config.password;
if (config && config.passwordHashAlgorithm) passwordHashAlgorithm = config.passwordHashAlgorithm;
if (config && config.encryptionAlgorithm) encryptionAlgorithm = config.encryptionAlgorithm;
if (config && config.oncallback) Growl.oncallback = config.oncallback;
if (config && config.onerror) Growl.onerror = config.onerror;
if (config && config.onready2) Growl.onready2 = config.onready2;

if (!containerID) {
var container = document.createElement("div");
container.id = defaultContainerID;
document.body.appendChild(container);
containerID = container.id;
}
generateSWF(containerID, scope, swfUrl);
},

register: function (application, notificationTypes) {
swf.register(application, notificationTypes);
},

notify: function (appName, notification) {
if (!notification.id) notification.id = new Date().getTime();
swf.notify(appName, notification);
},

debug: function (msg) {
prompt("DEBUG:", msg);
}
}
} ();

Growl.Application = function () {
this.name = null;
this.icon = null;
this.customAttributes = {};
}

Growl.NotificationType = function(){
this.name = null;
this.displayName = null;
this.icon = null;
this.enabled = false;
Growl.NotificationType = function () {
this.name = null;
this.displayName = null;
this.icon = null;
this.enabled = false;
}

Growl.Notification = function(){
this.id = null;
this.name = null;
this.title = null;
this.text = null;
this.icon = null;
this.priority = Growl.Priority.Normal;
this.sticky = false;
this.callback = {};
this.callback.context = null;
this.callback.type = null;
this.callback.target = null;
this.callback.method = Growl.CallbackTargetMethod.Get;
Growl.Notification = function () {
this.id = null;
this.name = null;
this.title = null;
this.text = null;
this.icon = null;
this.priority = Growl.Priority.Normal;
this.sticky = false;
this.callback = {};
this.callback.context = null;
this.callback.type = null;
this.callback.target = null;
this.callback.method = Growl.CallbackTargetMethod.Get;
}

Growl.PasswordHashAlgorithm = {};
Expand Down
8 changes: 0 additions & 8 deletions Growl Connectors/Javascript/swfobject.js

This file was deleted.

Binary file modified Growl Connectors/NET/libraries/Growl.Connector.dll
Binary file not shown.
Binary file modified Growl Connectors/NET/libraries/Growl.CoreLibrary.dll
Binary file not shown.
Binary file modified Growl Extras/Growl Display SDK/libraries/Growl.CoreLibrary.dll
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace GrowlExtras.ITunesPlugin
{
internal class GrowlPlugin : ITunesHandler
{
string id = "ITunesGrowlPluginNotification";

// old
private Growl.UDPLegacy.MessageSender udpGrowl;
private Growl.UDPLegacy.NotificationType udpNotificationType;
Expand Down Expand Up @@ -138,7 +140,7 @@ void Notify(object iTrack)

//Growl.CoreLibrary.Resource albumIcon = artworkFilePath;
Growl.CoreLibrary.Resource albumIcon = (artworkData != null ? new Growl.CoreLibrary.BinaryData(artworkData) : null);
Growl.Connector.Notification notification = new Growl.Connector.Notification(application.Name, nt1.Name, callback.Data, title, text, albumIcon, false, Growl.Connector.Priority.Normal, null);
Growl.Connector.Notification notification = new Growl.Connector.Notification(application.Name, nt1.Name, id, title, text, albumIcon, false, Growl.Connector.Priority.Normal, id);

notification.CustomTextAttributes.Add("iTunes-Artist", song.Artist);
notification.CustomTextAttributes.Add("iTunes-Album", song.Album);
Expand Down
49 changes: 49 additions & 0 deletions Growl Extras/Growl.Subscribers.FolderWatch/FolderWatchHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Text;
using Growl.Destinations;

namespace Growl.Subscribers.FolderWatch
{
public class FolderWatchHandler : ISubscriptionHandler
{
public static System.Drawing.Image Icon = Properties.Resources.folderwatch;

#region IDestinationHandler Members

public string Name
{
get
{
return "Folder Watch";
}
}

public List<Type> Register()
{
List<Type> list = new List<Type>();
list.Add(typeof(FolderWatchSubscription));
return list;
}

public List<DestinationListItem> GetListItems()
{
List<DestinationListItem> list = new List<DestinationListItem>();
SubscriptionListItem item = new SubscriptionListItem("Get notified of changes to local folders", Icon, this); // TODO: LOCAL: LOCALIZE:
list.Add(item);
return list;
}

public DestinationSettingsPanel GetSettingsPanel(DestinationListItem dbli)
{
return new FolderWatchSettings();
}

public DestinationSettingsPanel GetSettingsPanel(DestinationBase db)
{
return new FolderWatchSettings();
}

#endregion
}
}
Loading

0 comments on commit c6451c1

Please sign in to comment.