mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
vala: convert from dbus-glib to gdbus
This commit is contained in:
parent
9a57c62944
commit
26742b3fd8
@ -933,7 +933,6 @@ systemadm_SOURCES = \
|
||||
|
||||
systemadm_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(DBUSGLIB_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
-Wno-unused-variable \
|
||||
-Wno-unused-function \
|
||||
@ -941,13 +940,11 @@ systemadm_CFLAGS = \
|
||||
-Wno-format-nonliteral
|
||||
|
||||
systemadm_VALAFLAGS = \
|
||||
--pkg=dbus-glib-1 \
|
||||
--pkg=posix \
|
||||
--pkg=gtk+-2.0 \
|
||||
-g
|
||||
|
||||
systemadm_LDADD = \
|
||||
$(DBUSGLIB_LIBS) \
|
||||
$(GTK_LIBS)
|
||||
|
||||
systemd_gnome_ask_password_agent_SOURCES = \
|
||||
@ -955,7 +952,6 @@ systemd_gnome_ask_password_agent_SOURCES = \
|
||||
|
||||
systemd_gnome_ask_password_agent_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(DBUSGLIB_CFLAGS) \
|
||||
$(LIBNOTIFY_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
-Wno-unused-variable \
|
||||
@ -964,7 +960,6 @@ systemd_gnome_ask_password_agent_CFLAGS = \
|
||||
-Wno-format-nonliteral
|
||||
|
||||
systemd_gnome_ask_password_agent_VALAFLAGS = \
|
||||
--pkg=dbus-glib-1 \
|
||||
--pkg=posix \
|
||||
--pkg=gtk+-2.0 \
|
||||
--pkg=linux \
|
||||
@ -978,7 +973,6 @@ systemd_gnome_ask_password_agent_VALAFLAGS += \
|
||||
-g
|
||||
|
||||
systemd_gnome_ask_password_agent_LDADD = \
|
||||
$(DBUSGLIB_LIBS) \
|
||||
$(LIBNOTIFY_LIBS) \
|
||||
$(GTK_LIBS)
|
||||
|
||||
|
10
configure.ac
10
configure.ac
@ -244,21 +244,17 @@ AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
|
||||
have_gtk=no
|
||||
AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
|
||||
if test "x$enable_gtk" != "xno"; then
|
||||
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 gio-unix-2.0 ],
|
||||
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
|
||||
[AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
|
||||
AC_MSG_ERROR([*** gtk support requested but libraries not found])
|
||||
AC_MSG_ERROR([*** gtk support requested but libraries not found])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
|
||||
|
||||
if test "$have_gtk" = "yes"; then
|
||||
PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
|
||||
AC_SUBST(DBUSGLIB_CFLAGS)
|
||||
AC_SUBST(DBUSGLIB_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
|
||||
PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
|
||||
|
||||
@ -267,7 +263,7 @@ if test "$have_gtk" = "yes"; then
|
||||
fi
|
||||
AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
|
||||
|
||||
AM_PROG_VALAC([0.10])
|
||||
AM_PROG_VALAC([0.11])
|
||||
AC_SUBST(VAPIDIR)
|
||||
AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
using Gtk;
|
||||
using GLib;
|
||||
using DBus;
|
||||
using Linux;
|
||||
using Posix;
|
||||
using Notify;
|
||||
@ -102,14 +101,19 @@ public class MyStatusIcon : StatusIcon {
|
||||
activate.connect(status_icon_activate);
|
||||
}
|
||||
|
||||
void file_monitor_changed(GLib.File file, GLib.File? other_file, GLib.FileMonitorEvent event_type) throws GLib.Error {
|
||||
void file_monitor_changed(GLib.File file, GLib.File? other_file, GLib.FileMonitorEvent event_type) {
|
||||
|
||||
if (!file.get_basename().has_prefix("ask."))
|
||||
return;
|
||||
|
||||
if (event_type == FileMonitorEvent.CREATED ||
|
||||
event_type == FileMonitorEvent.DELETED)
|
||||
look_for_password();
|
||||
event_type == FileMonitorEvent.DELETED) {
|
||||
try {
|
||||
look_for_password();
|
||||
} catch (Error e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void look_for_password() throws GLib.Error {
|
||||
@ -198,7 +202,7 @@ public class MyStatusIcon : StatusIcon {
|
||||
return true;
|
||||
}
|
||||
|
||||
void status_icon_activate() throws GLib.Error {
|
||||
void status_icon_activate() {
|
||||
|
||||
if (current == null)
|
||||
return;
|
||||
@ -222,24 +226,28 @@ public class MyStatusIcon : StatusIcon {
|
||||
|
||||
int to_process;
|
||||
|
||||
Process.spawn_async_with_pipes(
|
||||
null,
|
||||
{ "/usr/bin/pkexec", "/lib/systemd/systemd-reply-password", result == ResponseType.OK ? "1" : "0", socket },
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
out to_process,
|
||||
null,
|
||||
null);
|
||||
try {
|
||||
Process.spawn_async_with_pipes(
|
||||
null,
|
||||
{ "/usr/bin/pkexec", "/lib/systemd/systemd-reply-password", result == ResponseType.OK ? "1" : "0", socket },
|
||||
null,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
out to_process,
|
||||
null,
|
||||
null);
|
||||
|
||||
OutputStream stream = new UnixOutputStream(to_process, true);
|
||||
OutputStream stream = new UnixOutputStream(to_process, true);
|
||||
|
||||
#if LIBNOTIFY07
|
||||
stream.write(password.data, null);
|
||||
stream.write(password.data, null);
|
||||
#else
|
||||
stream.write(password, password.length, null);
|
||||
stream.write(password, password.length, null);
|
||||
#endif
|
||||
} catch (Error e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,8 +269,6 @@ int main(string[] args) {
|
||||
MyStatusIcon i = new MyStatusIcon();
|
||||
Gtk.main();
|
||||
|
||||
} catch (DBus.Error e) {
|
||||
show_error(e.message);
|
||||
} catch (GLib.Error e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
using Gtk;
|
||||
using GLib;
|
||||
using DBus;
|
||||
using Pango;
|
||||
|
||||
static bool user = false;
|
||||
@ -79,7 +78,6 @@ public class MainWindow : Window {
|
||||
private Button server_snapshot_button;
|
||||
private Button server_reload_button;
|
||||
|
||||
private Connection bus;
|
||||
private Manager manager;
|
||||
|
||||
private RightLabel unit_id_label;
|
||||
@ -102,9 +100,9 @@ public class MainWindow : Window {
|
||||
|
||||
private ComboBox unit_type_combo_box;
|
||||
|
||||
public MainWindow() throws DBus.Error {
|
||||
public MainWindow() throws IOError {
|
||||
title = user ? "systemd User Service Manager" : "systemd System Manager";
|
||||
position = WindowPosition.CENTER;
|
||||
set_position(WindowPosition.CENTER);
|
||||
set_default_size(1000, 700);
|
||||
set_border_width(12);
|
||||
destroy.connect(Gtk.main_quit);
|
||||
@ -297,12 +295,10 @@ public class MainWindow : Window {
|
||||
|
||||
bbox.pack_start(cancel_button, false, true, 0);
|
||||
|
||||
bus = DBus.Bus.get(user ? DBus.BusType.SESSION : DBus.BusType.SYSTEM);
|
||||
|
||||
manager = bus.get_object(
|
||||
manager = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
"/org/freedesktop/systemd1",
|
||||
"org.freedesktop.systemd1.Manager") as Manager;
|
||||
"/org/freedesktop/systemd1");
|
||||
|
||||
manager.unit_new.connect(on_unit_new);
|
||||
manager.job_new.connect(on_job_new);
|
||||
@ -317,7 +313,7 @@ public class MainWindow : Window {
|
||||
populate_job_model();
|
||||
}
|
||||
|
||||
public void populate_unit_model() throws DBus.Error {
|
||||
public void populate_unit_model() throws IOError {
|
||||
unit_model.clear();
|
||||
|
||||
var list = manager.list_units();
|
||||
@ -325,18 +321,17 @@ public class MainWindow : Window {
|
||||
foreach (var i in list) {
|
||||
TreeIter iter;
|
||||
|
||||
Properties p = bus.get_object(
|
||||
Properties p = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
i.unit_path,
|
||||
"org.freedesktop.DBus.Properties") as Properties;
|
||||
|
||||
i.unit_path);
|
||||
|
||||
p.properties_changed.connect(on_unit_changed);
|
||||
|
||||
Unit u = bus.get_object(
|
||||
Unit u = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
i.unit_path,
|
||||
"org.freedesktop.systemd1.Unit") as Unit;
|
||||
i.unit_path);
|
||||
|
||||
unit_model.append(out iter);
|
||||
unit_model.set(iter,
|
||||
@ -350,7 +345,7 @@ public class MainWindow : Window {
|
||||
}
|
||||
}
|
||||
|
||||
public void populate_job_model() throws DBus.Error {
|
||||
public void populate_job_model() throws IOError {
|
||||
job_model.clear();
|
||||
|
||||
var list = manager.list_jobs();
|
||||
@ -358,17 +353,17 @@ public class MainWindow : Window {
|
||||
foreach (var i in list) {
|
||||
TreeIter iter;
|
||||
|
||||
Properties p = bus.get_object(
|
||||
Properties p = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
i.job_path,
|
||||
"org.freedesktop.DBus.Properties") as Properties;
|
||||
i.job_path);
|
||||
|
||||
p.properties_changed.connect(on_job_changed);
|
||||
|
||||
Job j = bus.get_object(
|
||||
Job j = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
i.job_path,
|
||||
"org.freedesktop.systemd1.Job") as Job;
|
||||
i.job_path);
|
||||
|
||||
job_model.append(out iter);
|
||||
job_model.set(iter,
|
||||
@ -601,7 +596,7 @@ public class MainWindow : Window {
|
||||
|
||||
try {
|
||||
u.start("replace");
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -614,7 +609,7 @@ public class MainWindow : Window {
|
||||
|
||||
try {
|
||||
u.stop("replace");
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -627,7 +622,7 @@ public class MainWindow : Window {
|
||||
|
||||
try {
|
||||
u.reload("replace");
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -640,7 +635,7 @@ public class MainWindow : Window {
|
||||
|
||||
try {
|
||||
u.restart("replace");
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -653,52 +648,61 @@ public class MainWindow : Window {
|
||||
|
||||
try {
|
||||
j.cancel();
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void update_unit_iter(TreeIter iter, string id, Unit u) {
|
||||
|
||||
string t = "";
|
||||
Unit.JobLink jl = u.job;
|
||||
try {
|
||||
string t = "";
|
||||
Unit.JobLink jl = u.job;
|
||||
|
||||
if (jl.id != 0) {
|
||||
Job j = bus.get_object(
|
||||
"org.freedesktop.systemd1",
|
||||
jl.path,
|
||||
"org.freedesktop.systemd1.Job") as Job;
|
||||
if (jl.id != 0) {
|
||||
Job j = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
jl.path);
|
||||
|
||||
t = j.job_type;
|
||||
t = j.job_type;
|
||||
}
|
||||
|
||||
unit_model.set(iter,
|
||||
0, id,
|
||||
1, u.description,
|
||||
2, u.load_state,
|
||||
3, u.active_state,
|
||||
4, u.sub_state,
|
||||
5, t != "" ? "→ %s".printf(t) : "",
|
||||
6, u);
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
|
||||
unit_model.set(iter,
|
||||
0, id,
|
||||
1, u.description,
|
||||
2, u.load_state,
|
||||
3, u.active_state,
|
||||
4, u.sub_state,
|
||||
5, t != "" ? "→ %s".printf(t) : "",
|
||||
6, u);
|
||||
}
|
||||
|
||||
public void on_unit_new(string id, ObjectPath path) {
|
||||
Properties p = bus.get_object(
|
||||
"org.freedesktop.systemd1",
|
||||
path,
|
||||
"org.freedesktop.DBus.Properties") as Properties;
|
||||
try {
|
||||
|
||||
p.properties_changed.connect(on_unit_changed);
|
||||
Properties p = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
path);
|
||||
|
||||
TreeIter iter;
|
||||
unit_model.append(out iter);
|
||||
p.properties_changed.connect(on_unit_changed);
|
||||
|
||||
Unit u = bus.get_object(
|
||||
"org.freedesktop.systemd1",
|
||||
path,
|
||||
"org.freedesktop.systemd1.Unit") as Unit;
|
||||
TreeIter iter;
|
||||
unit_model.append(out iter);
|
||||
|
||||
update_unit_iter(iter, id, u);
|
||||
Unit u = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
path);
|
||||
|
||||
update_unit_iter(iter, id, u);
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void update_job_iter(TreeIter iter, uint32 id, Job j) {
|
||||
@ -713,22 +717,28 @@ public class MainWindow : Window {
|
||||
|
||||
public void on_job_new(uint32 id, ObjectPath path) {
|
||||
|
||||
Properties p = bus.get_object(
|
||||
"org.freedesktop.systemd1",
|
||||
path,
|
||||
"org.freedesktop.DBus.Properties") as Properties;
|
||||
try {
|
||||
|
||||
p.properties_changed.connect(on_job_changed);
|
||||
Properties p = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
path);
|
||||
|
||||
TreeIter iter;
|
||||
job_model.append(out iter);
|
||||
p.properties_changed.connect(on_job_changed);
|
||||
|
||||
Job j = bus.get_object(
|
||||
"org.freedesktop.systemd1",
|
||||
path,
|
||||
"org.freedesktop.systemd1.Job") as Job;
|
||||
TreeIter iter;
|
||||
job_model.append(out iter);
|
||||
|
||||
update_job_iter(iter, id, j);
|
||||
Job j = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
path);
|
||||
|
||||
update_job_iter(iter, id, j);
|
||||
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void on_unit_removed(string id, ObjectPath path) {
|
||||
@ -775,65 +785,76 @@ public class MainWindow : Window {
|
||||
}
|
||||
|
||||
public void on_unit_changed(Properties p, string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties) {
|
||||
TreeIter iter;
|
||||
string id;
|
||||
|
||||
Unit u = bus.get_object(
|
||||
p.get_bus_name(),
|
||||
p.get_path(),
|
||||
"org.freedesktop.systemd1.Unit") as Unit;
|
||||
try {
|
||||
TreeIter iter;
|
||||
string id;
|
||||
|
||||
if (!(unit_model.get_iter_first(out iter)))
|
||||
return;
|
||||
Unit u = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
p.get_name(),
|
||||
p.get_object_path());
|
||||
|
||||
id = u.id;
|
||||
if (!(unit_model.get_iter_first(out iter)))
|
||||
return;
|
||||
|
||||
do {
|
||||
string name;
|
||||
id = u.id;
|
||||
|
||||
unit_model.get(iter, 0, out name);
|
||||
do {
|
||||
string name;
|
||||
|
||||
if (id == name) {
|
||||
update_unit_iter(iter, id, u);
|
||||
unit_model.get(iter, 0, out name);
|
||||
|
||||
if (current_unit_id == id)
|
||||
show_unit(u);
|
||||
if (id == name) {
|
||||
update_unit_iter(iter, id, u);
|
||||
|
||||
break;
|
||||
}
|
||||
if (current_unit_id == id)
|
||||
show_unit(u);
|
||||
|
||||
} while (unit_model.iter_next(ref iter));
|
||||
break;
|
||||
}
|
||||
|
||||
} while (unit_model.iter_next(ref iter));
|
||||
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public void on_job_changed(Properties p, string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties) {
|
||||
TreeIter iter;
|
||||
uint32 id;
|
||||
try {
|
||||
TreeIter iter;
|
||||
uint32 id;
|
||||
|
||||
Job j = bus.get_object(
|
||||
p.get_bus_name(),
|
||||
p.get_path(),
|
||||
"org.freedesktop.systemd1.Job") as Job;
|
||||
Job j = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
p.get_name(),
|
||||
p.get_object_path());
|
||||
|
||||
if (!(job_model.get_iter_first(out iter)))
|
||||
return;
|
||||
if (!(job_model.get_iter_first(out iter)))
|
||||
return;
|
||||
|
||||
id = j.id;
|
||||
id = j.id;
|
||||
|
||||
do {
|
||||
uint32 k;
|
||||
do {
|
||||
uint32 k;
|
||||
|
||||
job_model.get(iter, 5, out k);
|
||||
job_model.get(iter, 5, out k);
|
||||
|
||||
if (id == k) {
|
||||
update_job_iter(iter, id, j);
|
||||
if (id == k) {
|
||||
update_job_iter(iter, id, j);
|
||||
|
||||
if (current_job_id == id)
|
||||
show_job(j);
|
||||
if (current_job_id == id)
|
||||
show_job(j);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} while (job_model.iter_next(ref iter));
|
||||
} while (job_model.iter_next(ref iter));
|
||||
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
public bool unit_filter(TreeModel model, TreeIter iter) {
|
||||
@ -886,7 +907,7 @@ public class MainWindow : Window {
|
||||
public void on_server_reload() {
|
||||
try {
|
||||
manager.reload();
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -898,7 +919,7 @@ public class MainWindow : Window {
|
||||
if (unit_type_combo_box.get_active() != 0)
|
||||
unit_type_combo_box.set_active(8);
|
||||
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -912,10 +933,10 @@ public class MainWindow : Window {
|
||||
try {
|
||||
var path = manager.load_unit(t);
|
||||
|
||||
Unit u = bus.get_object(
|
||||
Unit u = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
path,
|
||||
"org.freedesktop.systemd1.Unit") as Unit;
|
||||
path);
|
||||
|
||||
var m = new MessageDialog(this,
|
||||
DialogFlags.DESTROY_WITH_PARENT,
|
||||
@ -927,7 +948,7 @@ public class MainWindow : Window {
|
||||
m.destroy();
|
||||
|
||||
show_unit(u);
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
}
|
||||
@ -941,13 +962,13 @@ public class MainWindow : Window {
|
||||
try {
|
||||
string path = manager.get_unit(uri);
|
||||
|
||||
Unit u = bus.get_object(
|
||||
Unit u = Bus.get_proxy_sync(
|
||||
user ? BusType.SESSION : BusType.SYSTEM,
|
||||
"org.freedesktop.systemd1",
|
||||
path,
|
||||
"org.freedesktop.systemd1.Unit") as Unit;
|
||||
path);
|
||||
|
||||
show_unit(u);
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
}
|
||||
|
||||
@ -987,7 +1008,7 @@ int main(string[] args) {
|
||||
window.show_all();
|
||||
|
||||
Gtk.main();
|
||||
} catch (DBus.Error e) {
|
||||
} catch (IOError e) {
|
||||
show_error(e.message);
|
||||
} catch (GLib.Error e) {
|
||||
show_error(e.message);
|
||||
|
@ -17,10 +17,8 @@
|
||||
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
***/
|
||||
|
||||
using DBus;
|
||||
|
||||
[DBus (name = "org.freedesktop.systemd1.Manager")]
|
||||
public interface Manager : DBus.Object {
|
||||
public interface Manager : DBusProxy {
|
||||
|
||||
public struct UnitInfo {
|
||||
string id;
|
||||
@ -46,43 +44,43 @@ public interface Manager : DBus.Object {
|
||||
|
||||
public abstract string[] environment { owned get; }
|
||||
|
||||
public abstract UnitInfo[] list_units() throws DBus.Error;
|
||||
public abstract JobInfo[] list_jobs() throws DBus.Error;
|
||||
public abstract UnitInfo[] list_units() throws IOError;
|
||||
public abstract JobInfo[] list_jobs() throws IOError;
|
||||
|
||||
public abstract ObjectPath get_unit(string name) throws DBus.Error;
|
||||
public abstract ObjectPath get_unit_by_pid(uint32 pid) throws DBus.Error;
|
||||
public abstract ObjectPath load_unit(string name) throws DBus.Error;
|
||||
public abstract ObjectPath get_job(uint32 id) throws DBus.Error;
|
||||
public abstract ObjectPath get_unit(string name) throws IOError;
|
||||
public abstract ObjectPath get_unit_by_pid(uint32 pid) throws IOError;
|
||||
public abstract ObjectPath load_unit(string name) throws IOError;
|
||||
public abstract ObjectPath get_job(uint32 id) throws IOError;
|
||||
|
||||
public abstract ObjectPath start_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath stop_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath reload_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath restart_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath try_restart_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath reload_or_restart_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath reload_or_try_restart_unit(string name, string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath start_unit(string name, string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath stop_unit(string name, string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath reload_unit(string name, string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath restart_unit(string name, string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath try_restart_unit(string name, string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath reload_or_restart_unit(string name, string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath reload_or_try_restart_unit(string name, string mode = "replace") throws IOError;
|
||||
|
||||
public abstract void reset_failed_unit(string name = "") throws DBus.Error;
|
||||
public abstract void reset_failed_unit(string name = "") throws IOError;
|
||||
|
||||
public abstract void clear_jobs() throws DBus.Error;
|
||||
public abstract void clear_jobs() throws IOError;
|
||||
|
||||
public abstract void subscribe() throws DBus.Error;
|
||||
public abstract void unsubscribe() throws DBus.Error;
|
||||
public abstract void subscribe() throws IOError;
|
||||
public abstract void unsubscribe() throws IOError;
|
||||
|
||||
public abstract string dump() throws DBus.Error;
|
||||
public abstract string dump() throws IOError;
|
||||
|
||||
public abstract void reload() throws DBus.Error;
|
||||
public abstract void reexecute() throws DBus.Error;
|
||||
public abstract void exit() throws DBus.Error;
|
||||
public abstract void halt() throws DBus.Error;
|
||||
public abstract void power_off() throws DBus.Error;
|
||||
public abstract void reboot() throws DBus.Error;
|
||||
public abstract void kexec() throws DBus.Error;
|
||||
public abstract void reload() throws IOError;
|
||||
public abstract void reexecute() throws IOError;
|
||||
public abstract void exit() throws IOError;
|
||||
public abstract void halt() throws IOError;
|
||||
public abstract void power_off() throws IOError;
|
||||
public abstract void reboot() throws IOError;
|
||||
public abstract void kexec() throws IOError;
|
||||
|
||||
public abstract ObjectPath create_snapshot(string name = "", bool cleanup = false) throws DBus.Error;
|
||||
public abstract ObjectPath create_snapshot(string name = "", bool cleanup = false) throws IOError;
|
||||
|
||||
public abstract void set_environment(string[] names) throws DBus.Error;
|
||||
public abstract void unset_environment(string[] names) throws DBus.Error;
|
||||
public abstract void set_environment(string[] names) throws IOError;
|
||||
public abstract void unset_environment(string[] names) throws IOError;
|
||||
|
||||
public abstract signal void unit_new(string id, ObjectPath path);
|
||||
public abstract signal void unit_removed(string id, ObjectPath path);
|
||||
@ -91,7 +89,7 @@ public interface Manager : DBus.Object {
|
||||
}
|
||||
|
||||
[DBus (name = "org.freedesktop.systemd1.Unit")]
|
||||
public interface Unit : DBus.Object {
|
||||
public interface Unit : DBusProxy {
|
||||
public struct JobLink {
|
||||
uint32 id;
|
||||
ObjectPath path;
|
||||
@ -136,19 +134,19 @@ public interface Unit : DBus.Object {
|
||||
public abstract bool need_daemon_reload { owned get; }
|
||||
public abstract uint64 job_timeout_usec { owned get; }
|
||||
|
||||
public abstract ObjectPath start(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath stop(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath reload(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath restart(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath try_restart(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath reload_or_restart(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath reload_or_try_restart(string mode = "replace") throws DBus.Error;
|
||||
public abstract ObjectPath start(string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath stop(string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath reload(string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath restart(string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath try_restart(string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath reload_or_restart(string mode = "replace") throws IOError;
|
||||
public abstract ObjectPath reload_or_try_restart(string mode = "replace") throws IOError;
|
||||
|
||||
public abstract void reset_failed() throws DBus.Error;
|
||||
public abstract void reset_failed() throws IOError;
|
||||
}
|
||||
|
||||
[DBus (name = "org.freedesktop.systemd1.Job")]
|
||||
public interface Job : DBus.Object {
|
||||
public interface Job : DBusProxy {
|
||||
public struct UnitLink {
|
||||
string id;
|
||||
ObjectPath path;
|
||||
@ -159,11 +157,11 @@ public interface Job : DBus.Object {
|
||||
public abstract string job_type { owned get; }
|
||||
public abstract UnitLink unit { owned get; }
|
||||
|
||||
public abstract void cancel() throws DBus.Error;
|
||||
public abstract void cancel() throws IOError;
|
||||
}
|
||||
|
||||
[DBus (name = "org.freedesktop.DBus.Properties")]
|
||||
public interface Properties : DBus.Object {
|
||||
public abstract Value? get(string iface, string property) throws DBus.Error;
|
||||
public abstract signal void properties_changed(string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties);
|
||||
[DBus (name = "org.freedesktop.Properties")]
|
||||
public interface Properties : DBusProxy {
|
||||
public abstract Variant? get(string iface, string property) throws IOError;
|
||||
public abstract signal void properties_changed(string iface, HashTable<string, Variant?> changed_properties, string[] invalidated_properties);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user