summaryrefslogtreecommitdiff
path: root/src/publishing/SuccessPaneWidget.vala
blob: 05b0c160a54ca311e836cb9550748c17c341e1b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Copyright 2016 Software Freedom Conservancy Inc.
 * Copyright 2019 Jens Georg <mail@jensge.org>
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

namespace PublishingUI {

public class SuccessPane : StaticMessagePane {
    public SuccessPane(Spit.Publishing.Publisher.MediaType published_media, int num_uploaded = 1) {
        string? message_string = null;

        // Here, we check whether more than one item is being uploaded, and if so, display
        // an alternate message.
        if (published_media == Spit.Publishing.Publisher.MediaType.VIDEO) {
            message_string = ngettext ("The selected video was successfully published.",
                                       "The selected videos were successfully published.",
                                       num_uploaded);
        }
        else if (published_media == Spit.Publishing.Publisher.MediaType.PHOTO) {
            message_string = ngettext ("The selected photo was successfully published.",
                                       "The selected photos were successfully published.",
                                       num_uploaded);
        }
        else if (published_media == (Spit.Publishing.Publisher.MediaType.PHOTO
                                     | Spit.Publishing.Publisher.MediaType.VIDEO)) {
            message_string = _("The selected photos/videos were successfully published.");
        }
        else {
            assert_not_reached ();
        }

        base(message_string);
    }
}
}