Merge lp:~jpds/do-plugins/notification-error-messages into lp:do-plugins

Proposed by Alex Launi
Status: Merged
Merged at revision: 590
Proposed branch: lp:~jpds/do-plugins/notification-error-messages
Merge into: lp:do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp:~jpds/do-plugins/notification-error-messages
Reviewer Review Type Date Requested Status
Chris S. Approve
Review via email: mp+4953@code.launchpad.net

This proposal supersedes a proposal from 2009-03-13.

To post a comment you must log in.
Revision history for this message
Jonathan Davies (jpds) wrote : Posted in a previous version of this proposal

Instead of returning Do saying that there was an error pasting text, throw a notification bubble if no text is provided.

Revision history for this message
Chris S. (cszikszoy) :
review: Approve
Revision history for this message
Chris S. (cszikszoy) wrote :

We should formalize how plugins interact with the user. Using the notification system seems to be a great way to gracefully display errors or small messages.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'LocateFiles/src/LocateFilesAction.cs'
2--- LocateFiles/src/LocateFilesAction.cs 2009-02-28 18:23:20 +0000
3+++ LocateFiles/src/LocateFilesAction.cs 2009-03-14 14:26:14 +0000
4@@ -67,6 +67,13 @@
5
6 files = new List<Item> ();
7 query = (items.First () as ITextItem).Text;
8+
9+ if (string.IsNullOrEmpty(query))
10+ {
11+ Services.Notifications.Notify("Locate Files",
12+ "No text provided for searching.");
13+ yield break;
14+ }
15
16 locate = new System.Diagnostics.Process ();
17 locate.StartInfo.FileName = "locate";
18@@ -90,13 +97,16 @@
19 results++;
20 files.Add (Services.UniverseFactory.NewFileItem (path) as Item);
21 }
22+
23 if (results > 0) {
24 files.Sort (new IFileItemNameComparer (query));
25 foreach (Item file in files)
26 yield return file;
27+ } else {
28+ Services.Notifications.Notify("Locate Files",
29+ Error + query);
30+ yield break;
31 }
32- else
33- yield return new TextItem (Error + query);
34 }
35
36 // Order files by (A) position of query in the file name and
37
38=== modified file 'Pastebin/src/Pastebin.cs'
39--- Pastebin/src/Pastebin.cs 2009-01-22 04:43:21 +0000
40+++ Pastebin/src/Pastebin.cs 2009-03-13 23:11:47 +0000
41@@ -65,7 +65,9 @@
42 catch (Exception e)
43 {
44 Log<Pastebin>.Error (e.ToString ());
45- url = "An error occured while pasting.";
46+ Services.Notifications.Notify("Pastebin",
47+ "An error occured while pasting.");
48+ yield break;
49 }
50
51 return url;
52
53=== modified file 'Pastebin/src/PastebinAction.cs'
54--- Pastebin/src/PastebinAction.cs 2009-01-02 06:17:21 +0000
55+++ Pastebin/src/PastebinAction.cs 2009-03-13 23:00:12 +0000
56@@ -96,6 +96,13 @@
57 text += titem.Text;
58 }
59
60+ if (string.IsNullOrEmpty(text))
61+ {
62+ Services.Notifications.Notify("Pastebin",
63+ "No text provided for pasting.");
64+ yield break;
65+ }
66+
67 IPastebinProvider pastebinProvider = null;
68
69 if (modifierItems.Any ()) {
70
71=== modified file 'RememberTheMilk/src/RTMNewTask.cs'
72--- RememberTheMilk/src/RTMNewTask.cs 2009-01-29 16:58:01 +0000
73+++ RememberTheMilk/src/RTMNewTask.cs 2009-03-16 12:53:58 +0000
74@@ -78,6 +78,12 @@
75 {
76 string listId = String.Empty;
77 string taskData = (items.First () as ITextItem).Text;
78+
79+ if (string.IsNullOrEmpty(taskData)) {
80+ Services.Notifications.Notify("Remember The Milk",
81+ "No title provided for new task.");
82+ yield break;
83+ }
84
85 if (modifierItems.FirstOrDefault () != null)
86 listId = (modifierItems.FirstOrDefault () as RTMListItem).Id;

Subscribers

People subscribed via source and target branches