diff options
Diffstat (limited to 'perl-install/dbus_object.pm')
| -rw-r--r-- | perl-install/dbus_object.pm | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/perl-install/dbus_object.pm b/perl-install/dbus_object.pm index 445fc73ba..5c59de7e0 100644 --- a/perl-install/dbus_object.pm +++ b/perl-install/dbus_object.pm @@ -1,8 +1,10 @@ package dbus_object; -sub system_bus() { +sub system_bus { + my %params = @_; + #- use nomainloop => 1 to disable Net::DBus::Reactor main loop require Net::DBus; - Net::DBus->system; + Net::DBus->system(%params); } sub new { @@ -23,11 +25,6 @@ sub attach_object { $o->{object} = $service->get_object($o->{path}, $o->{interface}); } -sub dispatch { - my ($o) = @_; - $o->{bus}{connection}->dispatch; -} - sub call_method { my ($o, $method, @args) = @_; $o->{object}->$method(@args); @@ -41,22 +38,26 @@ sub safe_call_method { }; if ($@) { print STDERR "($method) exception: $@\n"; - $o->dispatch; + $o->{bus}{connection}->dispatch; return; } @ret; } -sub set_gtk2_watch { +sub set_gtk3_watch { my ($o) = @_; + set_gtk3_watch_helper($o->{bus}); +} - $o->{bus}{connection}->set_watch_callbacks(sub { +sub set_gtk3_watch_helper { + my ($bus) = @_; + $bus->{connection}->set_watch_callbacks(sub { my ($con, $watch) = @_; my $flags = $watch->get_flags; require Net::DBus::Binding::Watch; - require Gtk2::Helper; + require Gtk3::Helper; if ($flags & &Net::DBus::Binding::Watch::READABLE) { - Gtk2::Helper->add_watch($watch->get_fileno, 'in', sub { + Gtk3::Helper->add_watch($watch->get_fileno, 'in', sub { $watch->handle(&Net::DBus::Binding::Watch::READABLE); $con->dispatch; 1; @@ -65,7 +66,7 @@ sub set_gtk2_watch { #- do nothing for WRITABLE watch, we dispatch when needed }, undef, undef); #- do nothing when watch is disabled or toggled yet - $o->dispatch; + $bus->{connection}->dispatch; } 1; |
