summaryrefslogtreecommitdiffstats
path: root/mdkonline.xml
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2006-03-07 11:15:41 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2006-03-07 11:15:41 +0000
commitfa44bed911d47e793dd0a207f692fb185fa485da (patch)
tree5ff41f2047117f56d490b7080a14434055631050 /mdkonline.xml
parent902062888801680200d9d80874f2de79ccd7ba24 (diff)
downloadmgaonline-fa44bed911d47e793dd0a207f692fb185fa485da.tar
mgaonline-fa44bed911d47e793dd0a207f692fb185fa485da.tar.gz
mgaonline-fa44bed911d47e793dd0a207f692fb185fa485da.tar.bz2
mgaonline-fa44bed911d47e793dd0a207f692fb185fa485da.tar.xz
mgaonline-fa44bed911d47e793dd0a207f692fb185fa485da.zip
(install_pkgs) use --auto with gurpmi in order not to ask confirmation
for installing bundle
Diffstat (limited to 'mdkonline.xml')
0 files changed, 0 insertions, 0 deletions
ref='#n46'>46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
package dbus_object;

sub system_bus {
    my %params = @_;
    #- use nomainloop => 1 to disable Net::DBus::Reactor main loop
    require Net::DBus;
    Net::DBus->system(%params);
}

sub new {
    my ($type, $bus, $service, $path, $interface) = @_;
    my $o = {
	bus => $bus,
	service => $service,
	path => $path,
	interface => $interface,
    };
    attach_object($o);
    bless $o, $type;
}

sub attach_object {
    my ($o) = @_;
    my $service = $o->{bus}->get_service($o->{service});
    $o->{object} = $service->get_object($o->{path}, $o->{interface});
}

sub call_method {
    my ($o, $method, @args) = @_;
    $o->{object}->$method(@args);
}

sub safe_call_method {
    my ($o, $method, @args) = @_;
    my @ret;
    eval {
        @ret = $o->call_method($method, @args);
    };
    if ($@) {
        print STDERR "($method) exception: $@\n";
        $o->{bus}{connection}->dispatch;
        return;
    }
    @ret;
}

sub set_gtk3_watch {
    my ($o) = @_;
    set_gtk3_watch_helper($o->{bus});
}

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 Gtk3::Helper;
        if ($flags & &Net::DBus::Binding::Watch::READABLE) {
            Gtk3::Helper->add_watch($watch->get_fileno, 'in', sub {
                $watch->handle(&Net::DBus::Binding::Watch::READABLE);
                $con->dispatch;
                1;
            });
        }
        #- do nothing for WRITABLE watch, we dispatch when needed
    }, undef, undef); #- do nothing when watch is disabled or toggled yet

    $bus->{connection}->dispatch;
}

1;