~ubuntu-branches/debian/jessie/betaradio/jessie

« back to all changes in this revision

Viewing changes to src/betaradio.vala

  • Committer: Package Import Robot
  • Author(s): Shih-Yuan Lee (FourDollars)
  • Date: 2014-08-18 11:50:45 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140818115045-6ymj9l9xbb0lgtbp
Tags: 1.6-1
* New upstream release.
* debian/control:
  - Update Debian Policy version to 3.9.5
* debian/compat,
  debian/control: 
  - Update debhelper to 9
* debian/patches/fix_desktop.patch:
  - Fix lintian tags: desktop-entry-lacks-keywords-entry and
  desktop-entry-uses-reserved-category.
* debian/copyright: Fix lintian tag, out-of-date-copyright-format-uri.
* debian/control: Update Vcs-Browser to GitHub.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
 */
19
19
 
 
20
using X;
20
21
using Gtk;
21
22
using Gst;
22
23
 
23
24
class BetaRadio : GLib.Object {
 
25
    private Gtk.Menu menu = null;
24
26
    private AnyTray.Icon icon = null;
25
 
    private Gtk.Menu menu = null;
26
27
 
27
28
    public static int main (string[] args) {
28
 
        Gdk.threads_init();
 
29
        X.init_threads();
 
30
        Gtk.init(ref args);
29
31
        Gst.init(ref args);
30
 
        Gtk.init(ref args);
31
32
 
32
33
        Intl.bindtextdomain( Config.PACKAGE_NAME, Config.LOCALEDIR );
33
34
        Intl.bind_textdomain_codeset( Config.PACKAGE_NAME, "UTF-8" );
34
35
        Intl.textdomain( Config.PACKAGE_NAME );
35
36
 
36
 
        var app = new GLib.Application("org.sylee.betaradio", GLib.ApplicationFlags.FLAGS_NONE);
 
37
        if (Thread.supported () == false) {
 
38
            stderr.printf("Threads are not supported!\n");
 
39
            return -1;
 
40
        }
 
41
 
 
42
        var app = new GLib.Application("com.google.code.p.betaradio", GLib.ApplicationFlags.FLAGS_NONE);
37
43
 
38
44
        bool is_running = false;
39
45
        app.activate.connect(() => {
40
46
            if (is_running) return;
41
47
            is_running = true;
42
48
 
43
 
            Gdk.threads_enter();
44
49
            var instance = new BetaRadio();
45
50
            Gtk.main();
46
 
            Gdk.threads_leave();
 
51
            instance = null;
47
52
        });
48
53
 
49
54
        return app.run();
54
59
        icon.set_text(_("Data Synchronizing ..."));
55
60
 
56
61
        try {
57
 
            Thread.create<void*> ( () => {
58
 
                Gdk.threads_enter();
 
62
            Thread.create<void*>(() => {
59
63
                menu = new Gtk.Menu();
60
64
                unowned SList<Gtk.RadioMenuItem> group = null;
61
65
 
92
96
 
93
97
                icon.set_text(_("BetaRadio Tuner"));
94
98
 
95
 
                Gdk.threads_leave();
96
99
                return null;
97
100
            }, true);
98
101
        } catch(GLib.ThreadError e) {
101
104
    }
102
105
 
103
106
    private unowned SList<Gtk.RadioMenuItem> getMenu(Gtk.Menu menu, SList<Gtk.RadioMenuItem> group) {
104
 
        var list = new JsonSoup.http("http://betaradio.googlecode.com/svn/trunk/utils/list.json");
 
107
        var list = new JsonSoup.http("https://betaradio.googlecode.com/git/utils/list.json");
105
108
        if (list.is_array() == false) {
106
109
            var conn_err = new Gtk.MenuItem.with_label(_("Connection failed. Please restart this program."));
107
110
            menu.append(conn_err);
148
151
                submenu.append(radio);
149
152
                radio.toggled.connect( (e) => {
150
153
                    if (e.get_active() == true) {
151
 
                        GstPlayer.get_instance().play(url);
 
154
                        GstPlayer.get_instance().play(title, url);
152
155
                        icon.set_text(title);
153
156
                    }
154
157
                });
170
173
            menu.append(radio);
171
174
            radio.toggled.connect( (e) => {
172
175
                if (e.get_active() == true) {
173
 
                    GstPlayer.get_instance().play(url);
 
176
                    GstPlayer.get_instance().play(title, url);
174
177
                    icon.set_text(title);
175
178
                }
176
179
            });