Merge lp:~mardy/shotwell/lp1060586 into lp:~ubuntu-desktop/shotwell/ubuntu

Proposed by Alberto Mardegan
Status: Merged
Merged at revision: 88
Proposed branch: lp:~mardy/shotwell/lp1060586
Merge into: lp:~ubuntu-desktop/shotwell/ubuntu
Diff against target: 152 lines (+91/-11)
1 file modified
debian/patches/06_uoa.patch (+91/-11)
To merge this branch: bzr merge lp:~mardy/shotwell/lp1060586
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+127737@code.launchpad.net

Description of the change

Better handling of missing publishing services

When there are no publishing services available:
- if all plugins are disabled, show the error message to instruct the user
  about re-enabling them.
- if some plugins are enabled but they miss a corresponding account (or the
  account is disabled), bring up the Online Accounts panel.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/patches/06_uoa.patch'
2--- debian/patches/06_uoa.patch 2012-09-24 08:34:40 +0000
3+++ debian/patches/06_uoa.patch 2012-10-03 12:25:18 +0000
4@@ -2606,10 +2606,18 @@
5 </packing>
6 </child>
7 diff --git a/po/shotwell-core/shotwell.pot b/po/shotwell-core/shotwell.pot
8-index df41958..cee8286 100644
9+index df41958..7c8619c 100644
10 --- a/po/shotwell-core/shotwell.pot
11 +++ b/po/shotwell-core/shotwell.pot
12-@@ -2326,6 +2326,10 @@ msgstr ""
13+@@ -2122,6 +2122,7 @@ msgid "RAW"
14+ msgstr ""
15+
16+ #: src/photos/RawSupport.vala:297 src/MediaPage.vala:413
17++#: misc/shotwell.application:2
18+ msgid "Shotwell"
19+ msgstr ""
20+
21+@@ -2326,6 +2327,10 @@ msgstr ""
22 msgid "Publish photos and videos _to"
23 msgstr ""
24
25@@ -2620,15 +2628,11 @@
26 #: src/publishing/PublishingUI.vala:354
27 msgid "Unable to publish"
28 msgstr ""
29-@@ -3932,3 +3936,19 @@ msgstr ""
30+@@ -3932,3 +3937,15 @@ msgstr ""
31 #: ui/shotwell.glade:995
32 msgid "Plugins"
33 msgstr ""
34 +
35-+#: misc/shotwell.application:2
36-+msgid "Shotwell"
37-+msgstr ""
38-+
39 +#: misc/shotwell.application:9
40 +msgid "Publish your pictures to Picasa"
41 +msgstr ""
42@@ -2720,7 +2724,7 @@
43
44 }
45 diff --git a/src/publishing/PublishingUI.vala b/src/publishing/PublishingUI.vala
46-index b7f7f75..a3d404c 100644
47+index b7f7f75..2a72b43 100644
48 --- a/src/publishing/PublishingUI.vala
49 +++ b/src/publishing/PublishingUI.vala
50 @@ -130,6 +130,11 @@ public class LoginWaitPane : StaticMessagePane {
51@@ -2753,6 +2757,15 @@
52 publishables = new Spit.Publishing.Publishable[0];
53 bool has_photos = false;
54 bool has_videos = false;
55+@@ -198,7 +207,7 @@ public class PublishingDialog : Gtk.Dialog {
56+ // get the name of the service the user last used
57+ string? last_used_service = Config.Facade.get_instance().get_last_used_service();
58+
59+- Spit.Publishing.Service[] loaded_services = load_services(has_photos, has_videos);
60++ Spit.Publishing.Service[] loaded_services = load_services(has_photos, has_videos, null);
61+ int ticker = 0;
62+ int last_used_index = -1;
63+ foreach (Spit.Publishing.Service service in loaded_services) {
64 @@ -206,9 +215,28 @@ public class PublishingDialog : Gtk.Dialog {
65 if (last_used_service != null && last_used_service == curr_service_id)
66 last_used_index = ticker;
67@@ -2784,15 +2797,82 @@
68 if (last_used_index >= 0)
69 service_selector_box.set_active(last_used_index);
70 else
71-@@ -296,6 +324,7 @@ public class PublishingDialog : Gtk.Dialog {
72+@@ -289,24 +317,35 @@ public class PublishingDialog : Gtk.Dialog {
73+ return loaded_services;
74+ }
75+
76+- private static Spit.Publishing.Service[] load_services(bool has_photos, bool has_videos) {
77++ private static Spit.Publishing.Service[] load_services(bool has_photos, bool has_videos,
78++ out bool has_disabled_services) {
79+ assert (has_photos || has_videos);
80+
81+ Spit.Publishing.Service[] filtered_services = new Spit.Publishing.Service[0];
82 Spit.Publishing.Service[] all_services = load_all_services();
83
84++ has_disabled_services = false;
85 foreach (Spit.Publishing.Service service in all_services) {
86-+ if (!service.is_enabled()) continue;
87++ bool supports_media = false;
88
89 if (has_photos && !has_videos) {
90 if ((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.PHOTO) != 0)
91-@@ -384,21 +413,34 @@ public class PublishingDialog : Gtk.Dialog {
92+- filtered_services += service;
93++ supports_media = true;
94+ } else if (!has_photos && has_videos) {
95+ if ((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.VIDEO) != 0)
96+- filtered_services += service;
97++ supports_media = true;
98+ } else {
99+ if (((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.PHOTO) != 0) &&
100+ ((service.get_supported_media() & Spit.Publishing.Publisher.MediaType.VIDEO) != 0))
101++ supports_media = true;
102++ }
103++
104++ if (supports_media) {
105++ if (service.is_enabled()) {
106+ filtered_services += service;
107++ } else {
108++ has_disabled_services = true;
109++ }
110+ }
111+ }
112+
113+@@ -345,15 +384,29 @@ public class PublishingDialog : Gtk.Dialog {
114+ Gee.ArrayList<Video> videos = new Gee.ArrayList<Video>();
115+ MediaSourceCollection.filter_media(to_publish, photos, videos);
116+
117++ bool has_disabled_services = false;
118+ Spit.Publishing.Service[] avail_services =
119+- load_services((photos.size > 0), (videos.size > 0));
120++ load_services((photos.size > 0), (videos.size > 0), out has_disabled_services);
121+
122+ if (avail_services.length == 0) {
123+- // There are no enabled publishing services that accept this media type,
124+- // warn the user.
125+- AppWindow.error_message_with_title(_("Unable to publish"),
126+- _("Shotwell cannot publish the selected items because you do not have a compatible publishing plugin enabled. To correct this, choose <b>Edit %s Preferences</b> and enable one or more of the publishing plugins on the <b>Plugins</b> tab.").printf("▸"),
127+- null, false);
128++ if (has_disabled_services) {
129++ try
130++ {
131++ DesktopAppInfo app_info =
132++ new DesktopAppInfo ("gnome-credentials-panel.desktop");
133++ GLib.Process.spawn_command_line_async(app_info.get_commandline() + " application=shotwell");
134++ }
135++ catch (Error e)
136++ {
137++ warning ("Error launching Online Accounts: %s", e.message);
138++ }
139++ } else {
140++ // There are no enabled publishing services that accept this media type,
141++ // warn the user.
142++ AppWindow.error_message_with_title(_("Unable to publish"),
143++ _("Shotwell cannot publish the selected items because you do not have a compatible publishing plugin enabled. To correct this, choose <b>Edit %s Preferences</b> and enable one or more of the publishing plugins on the <b>Plugins</b> tab.").printf("▸"),
144++ null, false);
145++ }
146+
147+ return;
148+ }
149+@@ -384,21 +437,34 @@ public class PublishingDialog : Gtk.Dialog {
150 }
151
152 private void on_service_changed() {

Subscribers

People subscribed via source and target branches