~ubuntu-branches/ubuntu/lucid/gmusicbrowser/lucid

« back to all changes in this revision

Viewing changes to gmusicbrowser_dbus.pm

  • Committer: Bazaar Package Importer
  • Author(s): James Westby, Arnaud Soyez, James Westby
  • Date: 2008-11-27 00:53:40 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20081127005340-odrpldkb6gjs6zdj
Tags: 1.0.1-0ubuntu1
[ Arnaud Soyez ]
* New upstream version. (LP: #302422)

[ James Westby ]
* Drop suggests on flac123 as it has been removed, remove it from the
  description ogg123 in vorbis-tools (already suggested is plays flac)
  (LP: #301652)
* Change gmusicbrowser_123.pm to use ogg123 instead of flac123.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
use strict;
9
9
use warnings;
10
10
 
11
 
package GMBDBusObject;
 
11
package GMB::DBus::Object;
12
12
 
13
13
use base 'Net::DBus::Object';
14
14
use Net::DBus::Exporter 'org.gmusicbrowser';
116
116
 
117
117
use Net::DBus;
118
118
use Net::DBus::Service;
119
 
use Net::DBus::Reactor;
 
119
 
 
120
my $not_glib_dbus;
 
121
my $bus;
 
122
eval { require Net::DBus::GLib; $bus=Net::DBus::GLib->session; };
 
123
unless ($bus)
 
124
{       #warn "Net::DBus::GLib not found (not very important)\n";
 
125
        $not_glib_dbus=1;
 
126
        $bus= Net::DBus->session;
 
127
}
120
128
 
121
129
Glib::Idle->add(\&init); #initialize once the main gmb init is finished
122
130
 
123
131
sub init
124
 
{       my $bus = Net::DBus->session;
125
 
        my $service = $bus->export_service('org.gmusicbrowser');
126
 
        my $object = GMBDBusObject->new($service);
 
132
{       #my $bus = Net::DBus->session;
 
133
        my $service= $bus->export_service('org.gmusicbrowser');
 
134
        my $object = GMB::DBus::Object->new($service);
 
135
        DBus_mainloop_hack() if $not_glib_dbus;
 
136
        0; #called in an idle, return 0 to run only once
 
137
}
127
138
 
 
139
sub DBus_mainloop_hack
 
140
{       # use Net::DBus internals to connect it to the Glib mainloop, though unlikely, it may break with future version of Net::DBus
 
141
        use Net::DBus::Reactor;
128
142
        my $reactor=Net::DBus::Reactor->main;
129
 
        # use Net::DBus internals to connect it to the Glib mainloop, though unlikely, it may break with future version of Net::DBus
 
143
 
130
144
        for my $ref (['in','read'],['out','write'], ['err','exception'])
131
145
        {       my ($type1,$type2)=@$ref;
132
146
                for my $fd (keys %{$reactor->{fds}{$type2}})
140
154
                }
141
155
        }
142
156
 
143
 
        0; #called in an idle, return 0 to run only once
 
157
        # run the dbus mainloop once so that events already pending are processed
 
158
        # needed if events already waiting when gmb is starting
 
159
                my $timeout=$reactor->add_timeout(1, Net::DBus::Callback->new( method => sub {} ));
 
160
                Net::DBus::Reactor->main->step;
 
161
                $reactor->remove_timeout($timeout);
144
162
}
145
163
 
146
164
1;