Merge lp:~matthew-pirocchi/docky/dropbox into lp:docky

Proposed by Matthew Pirocchi
Status: Needs review
Proposed branch: lp:~matthew-pirocchi/docky/dropbox
Merge into: lp:docky
Diff against target: 983 lines (+850/-3)
15 files modified
Docky-2.sln (+7/-0)
StandardPlugins/Dropbox/Dropbox.csproj (+81/-0)
StandardPlugins/Dropbox/Makefile.am (+32/-0)
StandardPlugins/Dropbox/Resources/Dropbox.addin.xml.in (+22/-0)
StandardPlugins/Dropbox/src/DropboxConfig.cs (+137/-0)
StandardPlugins/Dropbox/src/DropboxConfigDialog.cs (+47/-0)
StandardPlugins/Dropbox/src/DropboxConnection.cs (+112/-0)
StandardPlugins/Dropbox/src/DropboxDockItem.cs (+215/-0)
StandardPlugins/Dropbox/src/DropboxItemProvider.cs (+53/-0)
StandardPlugins/Dropbox/src/DropboxPreferences.cs (+45/-0)
StandardPlugins/Dropbox/src/DropboxStatus.cs (+68/-0)
StandardPlugins/Dropbox/src/DropboxStatusType.cs (+27/-0)
StandardPlugins/GMail/gtk-gui/gui.stetic (+0/-3)
StandardPlugins/Makefile.am (+2/-0)
configure.ac (+2/-0)
To merge this branch: bzr merge lp:~matthew-pirocchi/docky/dropbox
Reviewer Review Type Date Requested Status
Egon Geerardyn (community) Approve
Docky Core Pending
Review via email: mp+16559@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Matthew Pirocchi (matthew-pirocchi) wrote :

This plugin is intended to replace the functionality of the Dropbox notification area icon. It's missing some features that are locked up in the closed-source dropboxd daemon, such as the ability to change preferences. Its main functionality is to show the status of the user's dropbox, and open it when clicked. It also offers some of the links from the notification area icon's right-click menu. It's pretty rough, so let me know about anything that needs to be improved.

lp:~matthew-pirocchi/docky/dropbox updated
996. By Matthew Pirocchi

Replaced ugly if-else block with switch.

997. By Matthew Pirocchi

Merge trunk.

998. By Matthew Pirocchi

Merge trunk.

999. By Matthew Pirocchi

Merge trunk.

1000. By Matthew Pirocchi

Implemented basic settings dialog (still need to implement browsing).

1001. By Matthew Pirocchi

Some visual tweaks (need to check the HIG for more).

1002. By Matthew Pirocchi

Added folder browser.

1003. By Matthew Pirocchi

Made settings dialog more HIG-compliant.

1004. By Matthew Pirocchi

Made label bold.

1005. By Matthew Pirocchi

Save preferences 2 seconds after the last time the Entry was changed.

1006. By Matthew Pirocchi

Cleanup, particularly changing access levels.

1007. By Matthew Pirocchi

Change icons.

1008. By Matthew Pirocchi

Cut down on magic numbers/strings, and improved localization.

1009. By Matthew Pirocchi

Added explanation to Config dialog.

Revision history for this message
Egon Geerardyn (egon-geerardyn-gmail) :
review: Approve

Unmerged revisions

1009. By Matthew Pirocchi

Added explanation to Config dialog.

1008. By Matthew Pirocchi

Cut down on magic numbers/strings, and improved localization.

1007. By Matthew Pirocchi

Change icons.

1006. By Matthew Pirocchi

Cleanup, particularly changing access levels.

1005. By Matthew Pirocchi

Save preferences 2 seconds after the last time the Entry was changed.

1004. By Matthew Pirocchi

Made label bold.

1003. By Matthew Pirocchi

Made settings dialog more HIG-compliant.

1002. By Matthew Pirocchi

Added folder browser.

1001. By Matthew Pirocchi

Some visual tweaks (need to check the HIG for more).

1000. By Matthew Pirocchi

Implemented basic settings dialog (still need to implement browsing).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Docky-2.sln'
2--- Docky-2.sln 2009-12-14 06:34:21 +0000
3+++ Docky-2.sln 2010-01-02 04:47:13 +0000
4@@ -35,6 +35,8 @@
5 EndProject
6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NPR", "StandardPlugins\NPR\NPR.csproj", "{C65612E7-55E9-4B63-BB47-5DFD4ACE80E5}"
7 EndProject
8+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dropbox", "StandardPlugins\Dropbox\Dropbox.csproj", "{F1AE2203-7485-4D1C-B6D2-881AC961BBFD}"
9+EndProject
10 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Docky.Widgets", "Docky.Widgets\Docky.Widgets.csproj", "{9CF2F475-7848-4333-9A35-93E8224653B3}"
11 EndProject
12 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Docky.DBus", "Docky.DBus\Docky.DBus.csproj", "{487D3B93-FAAF-4734-B337-85810A60ACCF}"
13@@ -113,6 +115,10 @@
14 {C65612E7-55E9-4B63-BB47-5DFD4ACE80E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
15 {C65612E7-55E9-4B63-BB47-5DFD4ACE80E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
16 {C65612E7-55E9-4B63-BB47-5DFD4ACE80E5}.Release|Any CPU.Build.0 = Release|Any CPU
17+ {F1AE2203-7485-4D1C-B6D2-881AC961BBFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+ {F1AE2203-7485-4D1C-B6D2-881AC961BBFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+ {F1AE2203-7485-4D1C-B6D2-881AC961BBFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+ {F1AE2203-7485-4D1C-B6D2-881AC961BBFD}.Release|Any CPU.Build.0 = Release|Any CPU
21 {FF0B1BB8-6069-4074-BF42-A138D1F99D89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 {FF0B1BB8-6069-4074-BF42-A138D1F99D89}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 {FF0B1BB8-6069-4074-BF42-A138D1F99D89}.Release|Any CPU.ActiveCfg = Release|Any CPU
24@@ -130,6 +136,7 @@
25 {74197632-9339-426E-B947-DE34766931E1} = {8D4EE2FA-9CF2-4890-B14A-1BA8752404FE}
26 {C4C77D82-2659-4F06-9AD9-08AC0BAD8C1A} = {8D4EE2FA-9CF2-4890-B14A-1BA8752404FE}
27 {C65612E7-55E9-4B63-BB47-5DFD4ACE80E5} = {8D4EE2FA-9CF2-4890-B14A-1BA8752404FE}
28+ {F1AE2203-7485-4D1C-B6D2-881AC961BBFD} = {8D4EE2FA-9CF2-4890-B14A-1BA8752404FE}
29 EndGlobalSection
30 GlobalSection(MonoDevelopProperties) = preSolution
31 version = 2.0
32
33=== added directory 'StandardPlugins/Dropbox'
34=== added file 'StandardPlugins/Dropbox/Dropbox.csproj'
35--- StandardPlugins/Dropbox/Dropbox.csproj 1970-01-01 00:00:00 +0000
36+++ StandardPlugins/Dropbox/Dropbox.csproj 2010-01-02 04:47:13 +0000
37@@ -0,0 +1,81 @@
38+<?xml version="1.0" encoding="utf-8"?>
39+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
40+ <PropertyGroup>
41+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
42+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
43+ <ProductVersion>9.0.21022</ProductVersion>
44+ <SchemaVersion>2.0</SchemaVersion>
45+ <ProjectGuid>{F1AE2203-7485-4D1C-B6D2-881AC961BBFD}</ProjectGuid>
46+ <OutputType>Exe</OutputType>
47+ <RootNamespace>Dropbox</RootNamespace>
48+ <AssemblyName>Dropbox</AssemblyName>
49+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
50+ <ReleaseVersion>2.0</ReleaseVersion>
51+ </PropertyGroup>
52+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
53+ <DebugSymbols>true</DebugSymbols>
54+ <DebugType>full</DebugType>
55+ <Optimize>false</Optimize>
56+ <OutputPath>bin\Debug</OutputPath>
57+ <DefineConstants>DEBUG</DefineConstants>
58+ <ErrorReport>prompt</ErrorReport>
59+ <WarningLevel>4</WarningLevel>
60+ </PropertyGroup>
61+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
62+ <DebugType>none</DebugType>
63+ <Optimize>false</Optimize>
64+ <OutputPath>bin\Release</OutputPath>
65+ <ErrorReport>prompt</ErrorReport>
66+ <WarningLevel>4</WarningLevel>
67+ </PropertyGroup>
68+ <ItemGroup>
69+ <Folder Include="Resources\" />
70+ <Folder Include="src\" />
71+ </ItemGroup>
72+ <ItemGroup>
73+ <None Include="Resources\Dropbox.addin.xml" />
74+ </ItemGroup>
75+ <ItemGroup>
76+ <Compile Include="src\DropboxItemProvider.cs" />
77+ <Compile Include="src\DropboxDockItem.cs" />
78+ <Compile Include="src\DropboxConnection.cs" />
79+ <Compile Include="src\DropboxStatus.cs" />
80+ <Compile Include="src\DropboxStatusType.cs" />
81+ <Compile Include="src\DropboxConfig.cs" />
82+ <Compile Include="src\DropboxPreferences.cs" />
83+ <Compile Include="src\DropboxConfigDialog.cs" />
84+ </ItemGroup>
85+ <ItemGroup>
86+ <ProjectReference Include="..\..\Docky.Items\Docky.Items.csproj">
87+ <Project>{AB6E0EDD-6443-4F99-9EAC-DABC906F080D}</Project>
88+ <Name>Docky.Items</Name>
89+ </ProjectReference>
90+ <ProjectReference Include="..\..\Docky.Services\Docky.Services.csproj">
91+ <Project>{8A6E0EDD-6443-4F99-9EAC-D9CC906F080D}</Project>
92+ <Name>Docky.Services</Name>
93+ </ProjectReference>
94+ <ProjectReference Include="..\..\Docky.Widgets\Docky.Widgets.csproj">
95+ <Project>{9CF2F475-7848-4333-9A35-93E8224653B3}</Project>
96+ <Name>Docky.Widgets</Name>
97+ </ProjectReference>
98+ <ProjectReference Include="..\..\Docky.CairoHelper\Docky.CairoHelper.csproj">
99+ <Project>{B23E0EDD-6443-4F99-9EAC-B7CC906F080D}</Project>
100+ <Name>Docky.CairoHelper</Name>
101+ </ProjectReference>
102+ </ItemGroup>
103+ <ItemGroup>
104+ <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
105+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
106+ <Reference Include="Mono.Posix" />
107+ <Reference Include="System" />
108+ <Reference Include="System.Core">
109+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
110+ </Reference>
111+ <Reference Include="gio-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
112+ <SpecificVersion>False</SpecificVersion>
113+ <HintPath>..\..\build\gio-sharp.dll</HintPath>
114+ </Reference>
115+ <Reference Include="Mono.Cairo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
116+ </ItemGroup>
117+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
118+</Project>
119\ No newline at end of file
120
121=== added file 'StandardPlugins/Dropbox/Makefile.am'
122--- StandardPlugins/Dropbox/Makefile.am 1970-01-01 00:00:00 +0000
123+++ StandardPlugins/Dropbox/Makefile.am 2010-01-02 04:47:13 +0000
124@@ -0,0 +1,32 @@
125+# Simple component buildsystem
126+include $(top_srcdir)/build.rules.docklets.mk
127+
128+ASSEMBLY = Dropbox
129+
130+FILES = \
131+ src/DropboxConfig.cs \
132+ src/DropboxConfigDialog.cs \
133+ src/DropboxConnection.cs \
134+ src/DropboxDockItem.cs \
135+ src/DropboxItemProvider.cs \
136+ src/DropboxPreferences.cs \
137+ src/DropboxStatus.cs \
138+ src/DropboxStatusType.cs
139+
140+RESOURCES = \
141+ Resources/Dropbox.addin.xml
142+
143+PROJECT_REFERENCES = \
144+ Docky.CairoHelper \
145+ Docky.Items \
146+ Docky.Services \
147+ Docky.Widgets
148+
149+REFERENCES = \
150+ System \
151+ System.Core \
152+ Mono.Posix \
153+ $(MONO_CAIRO_LIBS) \
154+ $(GCONF_SHARP_20_LIBS) \
155+ $(GIO_SHARP_LIBS) \
156+ $(GTK_SHARP_20_LIBS)
157
158=== added directory 'StandardPlugins/Dropbox/Resources'
159=== added file 'StandardPlugins/Dropbox/Resources/Dropbox.addin.xml.in'
160--- StandardPlugins/Dropbox/Resources/Dropbox.addin.xml.in 1970-01-01 00:00:00 +0000
161+++ StandardPlugins/Dropbox/Resources/Dropbox.addin.xml.in 2010-01-02 04:47:13 +0000
162@@ -0,0 +1,22 @@
163+<Addin
164+ id="Dropbox"
165+ namespace="Docky"
166+ version="1.0"
167+ isroot="false"
168+ defaultEnabled="false"
169+ name="Dropbox"
170+>
171+
172+ <Dependencies>
173+ <Addin id="Items" version="1.0" />
174+ </Dependencies>
175+
176+ <Runtime>
177+ <Import assembly="Dropbox.dll"/>
178+ </Runtime>
179+
180+ <Extension path="/Docky/ItemProvider">
181+ <ItemProvider type="Dropbox.DropboxItemProvider" />
182+ </Extension>
183+
184+</Addin>
185
186=== added directory 'StandardPlugins/Dropbox/src'
187=== added file 'StandardPlugins/Dropbox/src/DropboxConfig.cs'
188--- StandardPlugins/Dropbox/src/DropboxConfig.cs 1970-01-01 00:00:00 +0000
189+++ StandardPlugins/Dropbox/src/DropboxConfig.cs 2010-01-02 04:47:13 +0000
190@@ -0,0 +1,137 @@
191+//
192+// Copyright (C) 2009 Matthew Pirocchi
193+//
194+// This program is free software: you can redistribute it and/or modify
195+// it under the terms of the GNU General Public License as published by
196+// the Free Software Foundation, either version 3 of the License, or
197+// (at your option) any later version.
198+//
199+// This program is distributed in the hope that it will be useful,
200+// but WITHOUT ANY WARRANTY; without even the implied warranty of
201+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
202+// GNU General Public License for more details.
203+//
204+// You should have received a copy of the GNU General Public License
205+// along with this program. If not, see <http://www.gnu.org/licenses/>.
206+//
207+
208+using System;
209+using Mono.Unix;
210+using Gtk;
211+
212+namespace Dropbox {
213+ public class DropboxConfig : Gtk.VBox {
214+ Entry dropboxPathEntry;
215+
216+ uint UpdateTimer { get; set; }
217+ const uint UpdateInterval = 2000;
218+
219+ public Window ParentWin { get; set; }
220+
221+ public string DropboxPath {
222+ get {
223+ if (dropboxPathEntry != null)
224+ return dropboxPathEntry.Text;
225+ return "";
226+ }
227+ set {
228+ if (dropboxPathEntry != null)
229+ dropboxPathEntry.Text = value;
230+ }
231+ }
232+
233+ public DropboxConfig ()
234+ {
235+ Alignment frameAlignment = new Alignment (0, 0, 1, 1) {
236+ TopPadding = 5,
237+ LeftPadding = 5,
238+ RightPadding = 5,
239+ BottomPadding = 5
240+ };
241+ PackStart (frameAlignment, false, false, 0);
242+ Frame frame = new Frame {
243+ ShadowType = ShadowType.None,
244+ LabelWidget = new Label
245+ (String.Format ("<b>{0}</b>", Catalog.GetString ("Dropbox Location"))) {
246+ UseMarkup = true
247+ }
248+ };
249+ frameAlignment.Add (frame);
250+
251+ Alignment vboxAlignment = new Alignment (0, 0, 1, 1) {
252+ TopPadding = 6,
253+ LeftPadding = 12,
254+ RightPadding = 12
255+ };
256+ frame.Add (vboxAlignment);
257+ VBox vbox = new VBox ();
258+ vboxAlignment.Add (vbox);
259+
260+ HBox hbox = new HBox (false, 6);
261+ vbox.PackStart (hbox);
262+
263+ dropboxPathEntry = new Entry (DropboxPreferences.DropboxPath);
264+ hbox.PackStart (dropboxPathEntry);
265+ dropboxPathEntry.Changed += delegate { ResetTimer (); };
266+
267+ Button button = new Button {
268+ Label = Catalog.GetString ("Browse")
269+ };
270+ hbox.PackStart (button, false, false, 0);
271+ button.Clicked += delegate { BrowseDropboxPath (); };
272+
273+ Alignment detailsAlignment = new Alignment (0, 0, 1, 1) {
274+ TopPadding = 6
275+ };
276+ vbox.PackStart (detailsAlignment);
277+ string details =
278+ "Select the current location of your Dropbox. " +
279+ "Changing this does not change the location of your Dropbox, " +
280+ "it merely informs the docklet of your Dropbox's location.";
281+ Label detailsLabel = new Label (Catalog.GetString (details)) {
282+ Wrap = true
283+ };
284+ detailsAlignment.Add (detailsLabel);
285+
286+ }
287+
288+ public void Save ()
289+ {
290+ DropboxPreferences.DropboxPath = DropboxPath;
291+ }
292+
293+ void ResetTimer ()
294+ {
295+ StopTimer ();
296+
297+ UpdateTimer = GLib.Timeout.Add (UpdateInterval, () => {
298+ Save ();
299+ UpdateTimer = 0;
300+ return false;
301+ });
302+ }
303+
304+ void StopTimer ()
305+ {
306+ if (UpdateTimer != 0)
307+ GLib.Source.Remove (UpdateTimer);
308+ UpdateTimer = 0;
309+ }
310+
311+ void BrowseDropboxPath ()
312+ {
313+ FileChooserDialog dialog = new FileChooserDialog
314+ (Catalog.GetString ("Select Dropbox Location"),
315+ ParentWin, FileChooserAction.SelectFolder);
316+ dialog.AddButton (Stock.Cancel, ResponseType.Cancel);
317+ dialog.AddButton (Stock.Open, ResponseType.Ok);
318+ int response = dialog.Run ();
319+ string filename = dialog.Filename;
320+ dialog.Destroy ();
321+
322+ if (response == (int) ResponseType.Ok)
323+ DropboxPath = filename;
324+ }
325+
326+ }
327+}
328
329=== added file 'StandardPlugins/Dropbox/src/DropboxConfigDialog.cs'
330--- StandardPlugins/Dropbox/src/DropboxConfigDialog.cs 1970-01-01 00:00:00 +0000
331+++ StandardPlugins/Dropbox/src/DropboxConfigDialog.cs 2010-01-02 04:47:13 +0000
332@@ -0,0 +1,47 @@
333+//
334+// Copyright (C) 2009 Matthew Pirocchi
335+//
336+// This program is free software: you can redistribute it and/or modify
337+// it under the terms of the GNU General Public License as published by
338+// the Free Software Foundation, either version 3 of the License, or
339+// (at your option) any later version.
340+//
341+// This program is distributed in the hope that it will be useful,
342+// but WITHOUT ANY WARRANTY; without even the implied warranty of
343+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
344+// GNU General Public License for more details.
345+//
346+// You should have received a copy of the GNU General Public License
347+// along with this program. If not, see <http://www.gnu.org/licenses/>.
348+//
349+
350+using Mono.Unix;
351+using Gtk;
352+using Docky.Widgets;
353+
354+namespace Dropbox {
355+ class DropboxConfigDialog : ConfigDialog {
356+ DropboxConfig dropboxConfig;
357+
358+ public DropboxConfigDialog (DropboxConfig config) :
359+ base (Catalog.GetString ("Dropbox Preferences"),
360+ new Widget [] { config })
361+ {
362+ dropboxConfig = config;
363+ dropboxConfig.ParentWin = this;
364+ }
365+
366+ protected override void OnClose ()
367+ {
368+ base.OnClose ();
369+ dropboxConfig.Save ();
370+ }
371+
372+ protected override void OnResponse (ResponseType response_id)
373+ {
374+ base.OnResponse (response_id);
375+ dropboxConfig.Save ();
376+ }
377+
378+ }
379+}
380\ No newline at end of file
381
382=== added file 'StandardPlugins/Dropbox/src/DropboxConnection.cs'
383--- StandardPlugins/Dropbox/src/DropboxConnection.cs 1970-01-01 00:00:00 +0000
384+++ StandardPlugins/Dropbox/src/DropboxConnection.cs 2010-01-02 04:47:13 +0000
385@@ -0,0 +1,112 @@
386+//
387+// Copyright (C) 2009 Matthew Pirocchi
388+//
389+// This program is free software: you can redistribute it and/or modify
390+// it under the terms of the GNU General Public License as published by
391+// the Free Software Foundation, either version 3 of the License, or
392+// (at your option) any later version.
393+//
394+// This program is distributed in the hope that it will be useful,
395+// but WITHOUT ANY WARRANTY; without even the implied warranty of
396+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
397+// GNU General Public License for more details.
398+//
399+// You should have received a copy of the GNU General Public License
400+// along with this program. If not, see <http://www.gnu.org/licenses/>.
401+//
402+
403+using System;
404+using System.Net;
405+using System.Net.Sockets;
406+using System.IO;
407+using System.Text;
408+using Mono.Unix;
409+
410+namespace Dropbox {
411+ public class DropboxConnection {
412+ public bool Connected { get; set; }
413+ public Socket CmdSocket { get; set; }
414+ public Socket IfaceSocket { get; set; }
415+ public string Status {
416+ get { return GetStatus (DropboxLocation); }
417+ }
418+
419+ string DropboxLocation { get; set; }
420+ string CmdSocketLocation { get; set; }
421+ string IfaceSocketLocation { get; set; }
422+
423+ const string statusQuery = "icon_overlay_file_status\npath\t{0}\ndone\n";
424+
425+ public DropboxConnection ()
426+ {
427+ Connected = false;
428+ DropboxLocation = ExpandUser ("~/Dropbox/");
429+ CmdSocketLocation = ExpandUser ("~/.dropbox/command_socket");
430+ IfaceSocketLocation = ExpandUser ("~/.dropbox/iface_socket");
431+ }
432+
433+ static string ExpandUser (string path)
434+ {
435+ if (path.Substring (0, 2) == "~/") {
436+ string home = System.Environment.GetFolderPath
437+ (System.Environment.SpecialFolder.Personal);
438+ return Path.Combine (home, path.Substring (2));
439+ }
440+
441+ return path;
442+ }
443+
444+ public bool Connect () {
445+ return Connect (CmdSocketLocation, IfaceSocketLocation);
446+ }
447+
448+ public bool Connect (string cmdSocket, string ifaceSocket)
449+ {
450+ IfaceSocket = new Socket (AddressFamily.Unix, SocketType.Stream,
451+ ProtocolType.IP);
452+ CmdSocket = new Socket (AddressFamily.Unix, SocketType.Stream,
453+ ProtocolType.IP);
454+
455+ try {
456+ UnixEndPoint cmdEndPoint = new UnixEndPoint (cmdSocket);
457+ CmdSocket.Connect (cmdEndPoint);
458+ UnixEndPoint ifaceEndPoint = new UnixEndPoint (ifaceSocket);
459+ IfaceSocket.Connect (ifaceEndPoint);
460+#pragma warning disable 168
461+ } catch (Exception e) {
462+ Connected = false;
463+ return false;
464+ }
465+#pragma warning restore 168
466+
467+ Connected = true;
468+ return true;
469+ }
470+
471+ public void Disconnect ()
472+ {
473+ CmdSocket.Close ();
474+ IfaceSocket.Close ();
475+ Connected = false;
476+ }
477+
478+ public string GetStatus (string file)
479+ {
480+ if (!Connected)
481+ return "not connected";
482+
483+ string message = String.Format (statusQuery, file);
484+ CmdSocket.Send (Encoding.UTF8.GetBytes (message));
485+
486+ byte [] bytes = new byte [512];
487+ CmdSocket.Receive (bytes);
488+ string result = Encoding.UTF8.GetString (bytes);
489+ string [] results = result.Split ('\n');
490+
491+ if (results [0] != "ok")
492+ return results [1];
493+
494+ return results [1].Split ('\t') [1];
495+ }
496+ }
497+}
498\ No newline at end of file
499
500=== added file 'StandardPlugins/Dropbox/src/DropboxDockItem.cs'
501--- StandardPlugins/Dropbox/src/DropboxDockItem.cs 1970-01-01 00:00:00 +0000
502+++ StandardPlugins/Dropbox/src/DropboxDockItem.cs 2010-01-02 04:47:13 +0000
503@@ -0,0 +1,215 @@
504+//
505+// Copyright (C) 2009 Matthew Pirocchi
506+//
507+// This program is free software: you can redistribute it and/or modify
508+// it under the terms of the GNU General Public License as published by
509+// the Free Software Foundation, either version 3 of the License, or
510+// (at your option) any later version.
511+//
512+// This program is distributed in the hope that it will be useful,
513+// but WITHOUT ANY WARRANTY; without even the implied warranty of
514+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
515+// GNU General Public License for more details.
516+//
517+// You should have received a copy of the GNU General Public License
518+// along with this program. If not, see <http://www.gnu.org/licenses/>.
519+//
520+
521+using System;
522+using System.Collections.Generic;
523+using System.Collections.ObjectModel;
524+using System.Linq;
525+using System.Text;
526+
527+using Cairo;
528+using Mono.Unix;
529+
530+using GConf;
531+using GLib;
532+
533+using Docky.CairoHelper;
534+using Docky.Items;
535+using Docky.Menus;
536+using Docky.Services;
537+using Docky.Widgets;
538+
539+namespace Dropbox
540+{
541+ public class DropboxDockItem : IconDockItem
542+ {
543+ public File OwnedFile { get; private set; }
544+ public DropboxStatus Status { get; protected set; }
545+ public DropboxStatusType DropboxState { get; protected set; }
546+
547+ static ConfigDialog config;
548+
549+ string dropboxName;
550+ const string defaultDropboxPath = "~/Dropbox";
551+
552+ public DropboxDockItem ()
553+ {
554+ dropboxName = Catalog.GetString ("Dropbox");
555+
556+ string dropboxUri = ExpandUser (defaultDropboxPath);
557+ string preferencesUri = DropboxPreferences.DropboxPath;
558+ if (preferencesUri == "")
559+ DropboxPreferences.DropboxPath = dropboxUri;
560+ else
561+ dropboxUri = ExpandUser (DropboxPreferences.DropboxPath);
562+
563+ OwnedFile = FileFactory.NewForPath (dropboxUri);
564+
565+ Status = new DropboxStatus ();
566+ Status.DropboxChecked += DropboxCheckedHandler;
567+
568+ HoverText = dropboxName;
569+ Icon = "dropbox";
570+ }
571+
572+ static string ExpandUser (string path)
573+ {
574+ if (path.Substring (0, 2) == "~/") {
575+ string home = System.Environment.GetFolderPath
576+ (System.Environment.SpecialFolder.Personal);
577+ return System.IO.Path.Combine (home, path.Substring (2));
578+ }
579+
580+ return path;
581+ }
582+
583+ void DropboxCheckedHandler (object obj, EventArgs e)
584+ {
585+ Gtk.Application.Invoke (delegate {
586+ string statusText;
587+ switch (Status.Status) {
588+ case DropboxStatusType.NotConnected:
589+ statusText = Catalog.GetString ("Not connected");
590+ DropboxState = DropboxStatusType.NotConnected;
591+ State &= ~ItemState.Wait;
592+ break;
593+ case DropboxStatusType.Syncing:
594+ statusText = Catalog.GetString ("Syncing");
595+ DropboxState = DropboxStatusType.Syncing;
596+ State |= ItemState.Wait;
597+ break;
598+ case DropboxStatusType.UpToDate:
599+ statusText = Catalog.GetString ("All files up to date");
600+ DropboxState = DropboxStatusType.UpToDate;
601+ State &= ~ItemState.Wait;
602+ break;
603+ default:
604+ statusText = "";
605+ DropboxState = DropboxStatusType.None;
606+ State &= ~ItemState.Wait;
607+ break;
608+ }
609+
610+ QueueRedraw ();
611+
612+ if (statusText != "")
613+ HoverText = String.Format ("{0} - {1}", dropboxName, statusText);
614+ else
615+ HoverText = dropboxName;
616+ });
617+ }
618+
619+ public override string UniqueID ()
620+ {
621+ return "DropboxID";
622+ }
623+
624+ protected override ClickAnimation OnClicked
625+ (uint button, Gdk.ModifierType mod, double xPercent, double yPercent)
626+ {
627+ if (button == 1) {
628+ OpenDropbox ();
629+ return ClickAnimation.Bounce;
630+ }
631+
632+ return ClickAnimation.None;
633+ }
634+
635+ protected override MenuList OnGetMenuItems ()
636+ {
637+ MenuList list = new MenuList ();
638+ list[MenuListContainer.Actions].Add
639+ (new Docky.Menus.MenuItem
640+ (Catalog.GetString ("_Open Dropbox Folder"),
641+ Gtk.Stock.Open,
642+ (o, a) => OpenDropbox ()));
643+ list[MenuListContainer.Actions].Add
644+ (new Docky.Menus.MenuItem
645+ (Catalog.GetString ("_Launch Dropbox Website"),
646+ Icon,
647+ (o, a) => LaunchUrl ("https://www.dropbox.com/home")));
648+
649+ list[MenuListContainer.CustomOne].Add
650+ (new Docky.Menus.MenuItem
651+ (Catalog.GetString ("_Help Center"),
652+ Gtk.Stock.Help,
653+ (o, a) => LaunchUrl ("https://www.dropbox.com/help")));
654+ list[MenuListContainer.CustomOne].Add
655+ (new Docky.Menus.MenuItem
656+ (Catalog.GetString ("_Tour"),
657+ Gtk.Stock.Help,
658+ (o, a) => LaunchUrl ("https://www.dropbox.com/tour")));
659+ list[MenuListContainer.CustomOne].Add
660+ (new Docky.Menus.MenuItem
661+ (Catalog.GetString ("_Forums"),
662+ Gtk.Stock.Help,
663+ (o, a) => LaunchUrl ("http://forums.dropbox.com/")));
664+
665+ list[MenuListContainer.Footer].Add
666+ (new Docky.Menus.MenuItem
667+ (Catalog.GetString ("_Settings"),
668+ Gtk.Stock.Preferences,
669+ (o, a) => ShowConfig ()));
670+ list[MenuListContainer.Footer].Add
671+ (new Docky.Menus.MenuItem
672+ (Catalog.GetString ("_Upgrade My Dropbox"),
673+ Icon,
674+ (o, a) => LaunchUrl ("https://www.dropbox.com/plans")));
675+
676+ return list;
677+ }
678+
679+ void OpenDropbox ()
680+ {
681+ DockServices.System.Open (OwnedFile);
682+ }
683+
684+ void LaunchUrl (string url)
685+ {
686+ DockServices.System.Open (url);
687+ }
688+
689+ protected override Gdk.Pixbuf ProcessPixbuf (Gdk.Pixbuf pbuf)
690+ {
691+ if (DropboxState == DropboxStatusType.NotConnected)
692+ return DockServices.Drawing.MonochromePixbuf (pbuf);
693+
694+ return pbuf;
695+ }
696+
697+ protected override void PostProcessIconSurface (DockySurface surface)
698+ {
699+ if (DropboxState == DropboxStatusType.NotConnected)
700+ MakeTransparent (surface);
701+ }
702+
703+ void MakeTransparent (DockySurface surface)
704+ {
705+ surface.Context.Color = new Cairo.Color (0, 0, 0, 0);
706+ surface.Context.Operator = Operator.Source;
707+ surface.Context.PaintWithAlpha (.5);
708+ }
709+
710+ static void ShowConfig ()
711+ {
712+ if (config == null)
713+ config = new DropboxConfigDialog (new DropboxConfig ());
714+
715+ config.Show ();
716+ }
717+ }
718+}
719\ No newline at end of file
720
721=== added file 'StandardPlugins/Dropbox/src/DropboxItemProvider.cs'
722--- StandardPlugins/Dropbox/src/DropboxItemProvider.cs 1970-01-01 00:00:00 +0000
723+++ StandardPlugins/Dropbox/src/DropboxItemProvider.cs 2010-01-02 04:47:13 +0000
724@@ -0,0 +1,53 @@
725+//
726+// Copyright (C) 2009 Matthew Pirocchi
727+//
728+// This program is free software: you can redistribute it and/or modify
729+// it under the terms of the GNU General Public License as published by
730+// the Free Software Foundation, either version 3 of the License, or
731+// (at your option) any later version.
732+//
733+// This program is distributed in the hope that it will be useful,
734+// but WITHOUT ANY WARRANTY; without even the implied warranty of
735+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
736+// GNU General Public License for more details.
737+//
738+// You should have received a copy of the GNU General Public License
739+// along with this program. If not, see <http://www.gnu.org/licenses/>.
740+//
741+
742+using System;
743+using System.Collections.Generic;
744+
745+using Docky.Items;
746+
747+namespace Dropbox
748+{
749+ public class DropboxItemProvider : AbstractDockItemProvider
750+ {
751+ #region IDockItemProvider implementation
752+
753+ public override string Name {
754+ get {
755+ return "Dropbox";
756+ }
757+ }
758+
759+ public override string Icon { get { return "dropbox"; } }
760+
761+ public override void Dispose ()
762+ {
763+ dropbox.Dispose ();
764+ }
765+
766+ #endregion
767+
768+ DropboxDockItem dropbox;
769+
770+ public DropboxItemProvider ()
771+ {
772+ dropbox = new DropboxDockItem ();
773+
774+ Items = dropbox.AsSingle<AbstractDockItem> ();
775+ }
776+ }
777+}
778\ No newline at end of file
779
780=== added file 'StandardPlugins/Dropbox/src/DropboxPreferences.cs'
781--- StandardPlugins/Dropbox/src/DropboxPreferences.cs 1970-01-01 00:00:00 +0000
782+++ StandardPlugins/Dropbox/src/DropboxPreferences.cs 2010-01-02 04:47:13 +0000
783@@ -0,0 +1,45 @@
784+//
785+// Copyright (C) 2009 Matthew Pirocchi
786+//
787+// This program is free software: you can redistribute it and/or modify
788+// it under the terms of the GNU General Public License as published by
789+// the Free Software Foundation, either version 3 of the License, or
790+// (at your option) any later version.
791+//
792+// This program is distributed in the hope that it will be useful,
793+// but WITHOUT ANY WARRANTY; without even the implied warranty of
794+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
795+// GNU General Public License for more details.
796+//
797+// You should have received a copy of the GNU General Public License
798+// along with this program. If not, see <http://www.gnu.org/licenses/>.
799+//
800+
801+using System;
802+using Docky.Services;
803+
804+namespace Dropbox {
805+ internal class DropboxPreferences {
806+ const string DropboxPathKey = "DropboxPath";
807+
808+ public static IPreferences prefs =
809+ DockServices.Preferences.Get<DropboxPreferences> ();
810+
811+ public static event EventHandler DropboxPathChanged;
812+
813+ public static string DropboxPath {
814+ get { return prefs.Get<string> (DropboxPathKey, ""); }
815+ set {
816+ prefs.Set<string> (DropboxPathKey, value);
817+ OnDropboxPathChanged ();
818+ }
819+ }
820+
821+ static void OnDropboxPathChanged ()
822+ {
823+ if (DropboxPathChanged != null)
824+ DropboxPathChanged (null, EventArgs.Empty);
825+ }
826+
827+ }
828+}
829\ No newline at end of file
830
831=== added file 'StandardPlugins/Dropbox/src/DropboxStatus.cs'
832--- StandardPlugins/Dropbox/src/DropboxStatus.cs 1970-01-01 00:00:00 +0000
833+++ StandardPlugins/Dropbox/src/DropboxStatus.cs 2010-01-02 04:47:13 +0000
834@@ -0,0 +1,68 @@
835+//
836+// Copyright (C) 2009 Matthew Pirocchi
837+//
838+// This program is free software: you can redistribute it and/or modify
839+// it under the terms of the GNU General Public License as published by
840+// the Free Software Foundation, either version 3 of the License, or
841+// (at your option) any later version.
842+//
843+// This program is distributed in the hope that it will be useful,
844+// but WITHOUT ANY WARRANTY; without even the implied warranty of
845+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
846+// GNU General Public License for more details.
847+//
848+// You should have received a copy of the GNU General Public License
849+// along with this program. If not, see <http://www.gnu.org/licenses/>.
850+//
851+
852+using System;
853+using Gtk;
854+using Docky.Services;
855+
856+namespace Dropbox {
857+ public class DropboxStatus {
858+ public DropboxStatusType Status { get; set; }
859+
860+ public event EventHandler DropboxChecked;
861+
862+ DropboxConnection Dropbox { get; set; }
863+
864+ uint UpdateTimer { get; set; }
865+ const uint UpdateInterval = 1000;
866+
867+ public DropboxStatus ()
868+ {
869+ Dropbox = new DropboxConnection ();
870+ Dropbox.Connect ();
871+
872+ GLib.Timeout.Add (UpdateInterval, () => {
873+ CheckStatus ();
874+ return true;
875+ });
876+ }
877+
878+ void CheckStatus ()
879+ {
880+ DockServices.System.RunOnThread (() => {
881+ if (DockServices.System.NetworkConnected) {
882+ string status = Dropbox.Status;
883+ if (status == "not connected")
884+ Status = DropboxStatusType.NotConnected;
885+ else if (status == "syncing")
886+ Status = DropboxStatusType.Syncing;
887+ else if (status == "up to date")
888+ Status = DropboxStatusType.UpToDate;
889+ } else
890+ Status = DropboxStatusType.NotConnected;
891+
892+ Gtk.Application.Invoke (delegate { OnDropboxChecked (); });
893+ });
894+ }
895+
896+ void OnDropboxChecked ()
897+ {
898+ if (DropboxChecked != null)
899+ DropboxChecked (null, EventArgs.Empty);
900+ }
901+ }
902+}
903\ No newline at end of file
904
905=== added file 'StandardPlugins/Dropbox/src/DropboxStatusType.cs'
906--- StandardPlugins/Dropbox/src/DropboxStatusType.cs 1970-01-01 00:00:00 +0000
907+++ StandardPlugins/Dropbox/src/DropboxStatusType.cs 2010-01-02 04:47:13 +0000
908@@ -0,0 +1,27 @@
909+//
910+// Copyright (C) 2009 Matthew Pirocchi
911+//
912+// This program is free software: you can redistribute it and/or modify
913+// it under the terms of the GNU General Public License as published by
914+// the Free Software Foundation, either version 3 of the License, or
915+// (at your option) any later version.
916+//
917+// This program is distributed in the hope that it will be useful,
918+// but WITHOUT ANY WARRANTY; without even the implied warranty of
919+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
920+// GNU General Public License for more details.
921+//
922+// You should have received a copy of the GNU General Public License
923+// along with this program. If not, see <http://www.gnu.org/licenses/>.
924+//
925+
926+namespace Dropbox
927+{
928+ public enum DropboxStatusType
929+ {
930+ None,
931+ UpToDate,
932+ Syncing,
933+ NotConnected
934+ }
935+}
936\ No newline at end of file
937
938=== modified file 'StandardPlugins/GMail/gtk-gui/gui.stetic'
939--- StandardPlugins/GMail/gtk-gui/gui.stetic 2009-12-08 08:26:26 +0000
940+++ StandardPlugins/GMail/gtk-gui/gui.stetic 2010-01-02 04:47:13 +0000
941@@ -5,9 +5,6 @@
942 <target-gtk-version>2.12</target-gtk-version>
943 </configuration>
944 <import>
945- <widget-library name="../../../Docky.Services/bin/Debug/Docky.Services.dll" />
946- <widget-library name="../../../Docky.Items/bin/Debug/Docky.Items.dll" />
947- <widget-library name="../../../Docky.Widgets/bin/Debug/Docky.Widgets.dll" />
948 <widget-library name="../bin/Debug/GMail.dll" internal="true" />
949 </import>
950 <widget class="Gtk.Bin" id="GMail.GMailLabelConfig" design-size="300 300">
951
952=== modified file 'StandardPlugins/Makefile.am'
953--- StandardPlugins/Makefile.am 2009-12-04 07:54:33 +0000
954+++ StandardPlugins/Makefile.am 2010-01-02 04:47:13 +0000
955@@ -3,6 +3,7 @@
956 Bookmarks \
957 Clock \
958 CPUMonitor \
959+ Dropbox \
960 GMail \
961 Mounter \
962 NetworkManager \
963@@ -16,6 +17,7 @@
964 Bookmarks \
965 Clock \
966 CPUMonitor \
967+ Dropbox \
968 GMail \
969 Mounter \
970 NetworkManager \
971
972=== modified file 'configure.ac'
973--- configure.ac 2009-12-23 16:35:51 +0000
974+++ configure.ac 2010-01-02 04:47:13 +0000
975@@ -202,6 +202,8 @@
976 StandardPlugins/Clock/Themes/Default24/Makefile
977 StandardPlugins/CPUMonitor/Makefile
978 StandardPlugins/CPUMonitor/Resources/CPUMonitor.addin.xml
979+StandardPlugins/Dropbox/Makefile
980+StandardPlugins/Dropbox/Resources/Dropbox.addin.xml
981 StandardPlugins/GMail/Makefile
982 StandardPlugins/GMail/Resources/GMail.addin.xml
983 StandardPlugins/Mounter/Makefile

Subscribers

People subscribed via source and target branches

to status/vote changes: