forked from cromer/pamac-classic
do not refresh is refresh_period is 0
This commit is contained in:
parent
c6eac457a6
commit
859f2de6c1
@ -40,9 +40,11 @@ binaries: pamac-refresh pamac-daemon pamac-tray pamac-updater pamac-manager
|
|||||||
clean:
|
clean:
|
||||||
rm -f *.c pamac-refresh pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install
|
rm -f *.c pamac-refresh pamac-daemon pamac-tray pamac-updater pamac-manager pamac-install
|
||||||
|
|
||||||
pamac-refresh: refresh.vala
|
pamac-refresh: pamac_config.vala refresh.vala
|
||||||
valac -o pamac-refresh \
|
valac -o pamac-refresh \
|
||||||
|
-X -w \
|
||||||
--pkg=gio-2.0 \
|
--pkg=gio-2.0 \
|
||||||
|
pamac_config.vala \
|
||||||
refresh.vala
|
refresh.vala
|
||||||
|
|
||||||
pamac-tray: ../vapi/libalpm.vapi ../util/alpm-util.c common.vala alpm_config.vala pamac_config.vala tray.vala
|
pamac-tray: ../vapi/libalpm.vapi ../util/alpm-util.c common.vala alpm_config.vala pamac_config.vala tray.vala
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* pamac-vala
|
* pamac-vala
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Guillaume Benoit <guillaume@manjaro.org>
|
* Copyright (C) 2014-2015 Guillaume Benoit <guillaume@manjaro.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -68,7 +68,7 @@ bool check_pamac_running () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_refresh_finished () {
|
void on_refresh_finished () {
|
||||||
if (check_pamac_running () == false) {
|
if (!check_pamac_running ()) {
|
||||||
try {
|
try {
|
||||||
pamac_daemon.quit ();
|
pamac_daemon.quit ();
|
||||||
} catch (IOError e) {
|
} catch (IOError e) {
|
||||||
@ -79,16 +79,20 @@ void on_refresh_finished () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
if (check_pamac_running () == false) {
|
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||||
try {
|
// if refresh period is 0, just exit
|
||||||
pamac_daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.manjaro.pamac",
|
if (pamac_config.refresh_period != 0) {
|
||||||
"/org/manjaro/pamac");
|
if (!check_pamac_running ()) {
|
||||||
pamac_daemon.refresh_finished.connect (on_refresh_finished);
|
try {
|
||||||
pamac_daemon.start_refresh (0);
|
pamac_daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.manjaro.pamac",
|
||||||
loop = new MainLoop ();
|
"/org/manjaro/pamac");
|
||||||
loop.run ();
|
pamac_daemon.refresh_finished.connect (on_refresh_finished);
|
||||||
} catch (IOError e) {
|
pamac_daemon.start_refresh (0);
|
||||||
stderr.printf ("IOError: %s\n", e.message);
|
loop = new MainLoop ();
|
||||||
|
loop.run ();
|
||||||
|
} catch (IOError e) {
|
||||||
|
stderr.printf ("IOError: %s\n", e.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user