diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2012-03-20 13:06:03 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2012-03-20 13:10:22 +0100 |
commit | ee4cbc2c85edacab721c710e1f99aedd5c2e3a3a (patch) | |
tree | c315b05296f6d318c1d4ca67ea051e462f1b49d2 | |
parent | 5ebff5337594d690b322078c512eb222d34aaa82 (diff) |
remove GTK pieces
They've moved to systemd-ui.
-rw-r--r-- | Makefile.am | 58 | ||||
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | man/systemadm.xml | 111 | ||||
-rw-r--r-- | src/gnome-ask-password-agent.vala | 266 | ||||
-rw-r--r-- | src/systemadm.vala | 1071 | ||||
-rw-r--r-- | src/systemd-interfaces.vala | 167 | ||||
-rw-r--r-- | src/wraplabel.vala | 73 |
8 files changed, 0 insertions, 1769 deletions
diff --git a/Makefile.am b/Makefile.am index 079c1184a5..547ae0a2ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -177,12 +177,6 @@ bin_PROGRAMS = \ dist_bin_SCRIPTS = \ src/systemd-analyze -if HAVE_GTK -bin_PROGRAMS += \ - systemadm \ - systemd-gnome-ask-password-agent -endif - rootlibexec_PROGRAMS = \ systemd \ systemd-cgroups-agent \ @@ -656,7 +650,6 @@ EXTRA_DIST += \ MANPAGES = \ man/systemd.1 \ man/systemctl.1 \ - man/systemadm.1 \ man/systemd-cgls.1 \ man/systemd-cgtop.1 \ man/systemd-nspawn.1 \ @@ -1036,52 +1029,6 @@ systemd_stdio_bridge_SOURCES = \ systemd_stdio_bridge_LDADD = \ libsystemd-basic.la -systemadm_SOURCES = \ - src/systemadm.vala \ - src/systemd-interfaces.vala \ - src/wraplabel.vala - -systemadm_CFLAGS = \ - $(AM_CFLAGS) \ - $(GTK_CFLAGS) \ - -Wno-unused-variable \ - -Wno-unused-function \ - -Wno-shadow \ - -Wno-format-nonliteral - -systemadm_VALAFLAGS = \ - --pkg=posix \ - --pkg=gtk+-2.0 \ - --pkg=gee-1.0 \ - -g - -systemadm_LDADD = \ - $(GTK_LIBS) - -systemd_gnome_ask_password_agent_SOURCES = \ - src/gnome-ask-password-agent.vala - -systemd_gnome_ask_password_agent_CFLAGS = \ - $(AM_CFLAGS) \ - $(LIBNOTIFY_CFLAGS) \ - $(GTK_CFLAGS) \ - -Wno-unused-variable \ - -Wno-unused-function \ - -Wno-shadow \ - -Wno-format-nonliteral - -systemd_gnome_ask_password_agent_VALAFLAGS = \ - --pkg=posix \ - --pkg=gtk+-2.0 \ - --pkg=linux \ - --pkg=gio-unix-2.0 \ - --pkg=libnotify \ - -g - -systemd_gnome_ask_password_agent_LDADD = \ - $(LIBNOTIFY_LIBS) \ - $(GTK_LIBS) - systemd_tty_ask_password_agent_SOURCES = \ src/tty-ask-password-agent.c \ src/ask-password-api.c \ @@ -2192,11 +2139,6 @@ CLEANFILES += \ src/load-fragment-gperf-nulstr.c \ src/99-systemd.rules -if HAVE_VALAC -CLEANFILES += \ - ${systemadm_SOURCES:.vala=.c} -endif - if HAVE_XSLTPROC XSLTPROC_FLAGS = \ --nonet \ @@ -38,17 +38,14 @@ REQUIREMENTS: libudev >= 172 dbus >= 1.4.0 libcap - gtk+ >= 2.20 (optional) PAM >= 1.1.2 (optional) libcryptsetup (optional) libaudit (optional) libselinux (optional) tcpwrappers (optional) - libnotify (optional) When you build from git you need the following additional dependencies: - vala >= 0.10 docbook-xsl xsltproc automake diff --git a/configure.ac b/configure.ac index 629e505ff9..fa17e8be26 100644 --- a/configure.ac +++ b/configure.ac @@ -372,25 +372,6 @@ if test "x$enable_manpages" != "xno"; then fi AM_CONDITIONAL(ENABLE_MANPAGES, [test "$have_manpages" = "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 glib-2.0 > 2.26 gio-unix-2.0 gee-1.0], - [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no) - if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then - 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(LIBNOTIFY, [ libnotify ]) -fi - -AM_PROG_VALAC([0.10]) -AC_SUBST(VAPIDIR) -AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x) - AC_PATH_PROG([XSLTPROC], [xsltproc]) AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x) @@ -624,7 +605,6 @@ AC_MSG_RESULT([ SysV compatibility: ${SYSTEM_SYSV_COMPAT} SysV init scripts: ${SYSTEM_SYSVINIT_PATH} SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Gtk: ${have_gtk} libcryptsetup: ${have_libcryptsetup} tcpwrap: ${have_tcpwrap} PAM: ${have_pam} diff --git a/man/systemadm.xml b/man/systemadm.xml deleted file mode 100644 index cefc300981..0000000000 --- a/man/systemadm.xml +++ /dev/null @@ -1,111 +0,0 @@ -<?xml version='1.0'?> <!--*-nxml-*--> -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - -<!-- - This file is part of systemd. - - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. ---> - -<refentry id="systemadm"> - - <refentryinfo> - <title>systemadm</title> - <productname>systemd</productname> - - <authorgroup> - <author> - <contrib>Developer</contrib> - <firstname>Lennart</firstname> - <surname>Poettering</surname> - <email>lennart@poettering.net</email> - </author> - </authorgroup> - </refentryinfo> - - <refmeta> - <refentrytitle>systemadm</refentrytitle> - <manvolnum>1</manvolnum> - </refmeta> - - <refnamediv> - <refname>systemadm</refname> - <refpurpose>Graphical frontend for the systemd system - and service manager</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <cmdsynopsis> - <command>systemadm <arg choice="opt" rep="repeat">OPTIONS</arg></command> - </cmdsynopsis> - </refsynopsisdiv> - - <refsect1> - <title>Description</title> - - <para><command>systemadm</command> is a graphical - frontend for the systemd system and service manager - and allows introspection and control of - systemd.</para> - </refsect1> - - <refsect1> - <title>Options</title> - - <para>The following options are understood:</para> - - <variablelist> - <varlistentry> - <term><option>--h</option></term> - <term><option>--help</option></term> - - <listitem><para>Prints a short help - text and exits.</para></listitem> - </varlistentry> - - - <varlistentry> - <term><option>--system</option></term> - - <listitem><para>Connect to the systemd - system - manager. (Default)</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>--user</option></term> - - <listitem><para>Connect to the systemd - manager of the calling - user.</para></listitem> - </varlistentry> - - </variablelist> - - <para>In addition to this a number of parameters - common to all Gtk+ programs are supported.</para> - </refsect1> - - <refsect1> - <title>See Also</title> - <para> - <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, - <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> - </para> - </refsect1> - -</refentry> diff --git a/src/gnome-ask-password-agent.vala b/src/gnome-ask-password-agent.vala deleted file mode 100644 index e23aedbfee..0000000000 --- a/src/gnome-ask-password-agent.vala +++ /dev/null @@ -1,266 +0,0 @@ -/*** - This file is part of systemd. - - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. -***/ - -using Gtk; -using GLib; -using Linux; -using Posix; -using Notify; - -[CCode (cheader_filename = "time.h")] -extern int clock_gettime(int id, out timespec ts); - -public class PasswordDialog : Dialog { - - public Entry entry; - - public PasswordDialog(string message, string icon) { - set_title("System Password"); - set_has_separator(false); - set_border_width(8); - set_default_response(ResponseType.OK); - set_icon_name(icon); - - add_button(Stock.CANCEL, ResponseType.CANCEL); - add_button(Stock.OK, ResponseType.OK); - - Container content = (Container) get_content_area(); - - Box hbox = new HBox(false, 16); - hbox.set_border_width(8); - content.add(hbox); - - Image image = new Image.from_icon_name(icon, IconSize.DIALOG); - hbox.pack_start(image, false, false); - - Box vbox = new VBox(false, 8); - hbox.pack_start(vbox, true, true); - - Label label = new Label(message); - vbox.pack_start(label, false, false); - - entry = new Entry(); - entry.set_visibility(false); - entry.set_activates_default(true); - vbox.pack_start(entry, false, false); - - entry.activate.connect(on_entry_activated); - - show_all(); - } - - public void on_entry_activated() { - response(ResponseType.OK); - } -} - -public class MyStatusIcon : StatusIcon { - - File directory; - File current; - FileMonitor file_monitor; - - string message; - string icon; - string socket; - - PasswordDialog password_dialog; - - public MyStatusIcon() throws GLib.Error { - GLib.Object(icon_name : "dialog-password"); - set_title("System Password Request"); - - directory = File.new_for_path("/run/systemd/ask-password/"); - file_monitor = directory.monitor_directory(0); - file_monitor.changed.connect(file_monitor_changed); - - current = null; - look_for_password(); - - activate.connect(status_icon_activate); - } - - 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) { - try { - look_for_password(); - } catch (Error e) { - show_error(e.message); - } - } - } - - void look_for_password() throws GLib.Error { - - if (current != null) { - if (!current.query_exists()) { - current = null; - if (password_dialog != null) - password_dialog.response(ResponseType.REJECT); - } - } - - if (current == null) { - FileEnumerator enumerator = directory.enumerate_children("standard::name", FileQueryInfoFlags.NOFOLLOW_SYMLINKS); - - FileInfo i; - while ((i = enumerator.next_file()) != null) { - if (!i.get_name().has_prefix("ask.")) - continue; - - current = directory.get_child(i.get_name()); - - if (load_password()) - break; - - current = null; - } - } - - if (current == null) - set_visible(false); - } - - bool load_password() throws GLib.Error { - - KeyFile key_file = new KeyFile(); - - try { - timespec ts; - - key_file.load_from_file(current.get_path(), KeyFileFlags.NONE); - - string not_after_as_string = key_file.get_string("Ask", "NotAfter"); - - clock_gettime(1, out ts); - uint64 now = (ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); - - uint64 not_after; - if (not_after_as_string.scanf("%llu", out not_after) != 1) - return false; - - if (not_after > 0 && not_after < now) - return false; - - socket = key_file.get_string("Ask", "Socket"); - } catch (GLib.Error e) { - return false; - } - - try { - message = key_file.get_string("Ask", "Message").compress(); - } catch (GLib.Error e) { - message = "Please Enter System Password!"; - } - - set_tooltip_text(message); - - try { - icon = key_file.get_string("Ask", "Icon"); - } catch (GLib.Error e) { - icon = "dialog-password"; - } - set_from_icon_name(icon); - - set_visible(true); - - Notification n = new Notification(title, message, icon); - n.set_timeout(5000); - n.show(); - - return true; - } - - void status_icon_activate() { - - if (current == null) - return; - - if (password_dialog != null) { - password_dialog.present(); - return; - } - - password_dialog = new PasswordDialog(message, icon); - - int result = password_dialog.run(); - string password = password_dialog.entry.get_text(); - - password_dialog.destroy(); - password_dialog = null; - - if (result == ResponseType.REJECT || - result == ResponseType.DELETE_EVENT) - return; - - int to_process; - - 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); -#if VALA_0_12 - stream.write(password.data, null); -#else - stream.write(password, password.length, null); -#endif - } catch (Error e) { - show_error(e.message); - } - } -} - -static const OptionEntry entries[] = { - { null } -}; - -void show_error(string e) { - var m = new MessageDialog(null, 0, MessageType.ERROR, ButtonsType.CLOSE, "%s", e); - m.run(); - m.destroy(); -} - -int main(string[] args) { - try { - Gtk.init_with_args(ref args, "[OPTION...]", entries, "systemd-ask-password-agent"); - Notify.init("Password Agent"); - - MyStatusIcon i = new MyStatusIcon(); - Gtk.main(); - - } catch (GLib.Error e) { - show_error(e.message); - } - - return 0; -} diff --git a/src/systemadm.vala b/src/systemadm.vala deleted file mode 100644 index 5971ac07e5..0000000000 --- a/src/systemadm.vala +++ /dev/null @@ -1,1071 +0,0 @@ -/*** - This file is part of systemd. - - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. -***/ - -using Gtk; -using GLib; -using Pango; - -static bool user = false; - -public string format_time(uint64 time_ns) { - if (time_ns <= 0) - return ""; - Time timestamp = Time.local((time_t) (time_ns / 1000000)); - return timestamp.format("%a, %d %b %Y %H:%M:%S"); -} - -public void new_column(TreeView view, int column_id, string title) { - TreeViewColumn col; - col = new TreeViewColumn.with_attributes(title, new CellRendererText(), "text", column_id); - col.set_sort_column_id(column_id); - view.insert_column(col, -1); -} - -public class LeftLabel : Label { - public LeftLabel(string? text = null) { - if (text != null) - set_markup("<b>%s</b>".printf(text)); - set_alignment(0, 0); - set_padding(6, 0); - } -} - -public class RightLabel : WrapLabel { - - public RightLabel(string? text = null) { - set_selectable(true); - set_text_or_na(text); - } - - public void set_text_or_na(string? text = null) { - if (text == null || text == "") - set_markup("<i>n/a</i>"); - else - set_text(text); - } - - public void set_markup_or_na(string? text = null) { - if (text == null || text == "") - set_markup("<i>n/a</i>"); - else - set_markup(text); - } -} - -public class MainWindow : Window { - - private string? current_unit_id; - private uint32 current_job_id; - - private TreeView unit_view; - private TreeView job_view; - - private ListStore unit_model; - private ListStore job_model; - - private Gee.HashMap<string, Unit> unit_map; - - private Button start_button; - private Button stop_button; - private Button restart_button; - private Button reload_button; - private Button cancel_button; - - private Entry unit_load_entry; - private Button unit_load_button; - - private Button server_snapshot_button; - private Button server_reload_button; - - private Manager manager; - - private RightLabel unit_id_label; - private RightLabel unit_dependency_label; - private RightLabel unit_description_label; - private RightLabel unit_load_state_label; - private RightLabel unit_active_state_label; - private RightLabel unit_sub_state_label; - private RightLabel unit_fragment_path_label; - private RightLabel unit_active_enter_timestamp_label; - private RightLabel unit_active_exit_timestamp_label; - private RightLabel unit_can_start_label; - private RightLabel unit_can_reload_label; - private RightLabel unit_cgroup_label; - - private RightLabel job_id_label; - private RightLabel job_state_label; - private RightLabel job_type_label; - - private ComboBox unit_type_combo_box; - private CheckButton inactive_checkbox; - - public MainWindow() throws IOError { - title = user ? "systemd User Service Manager" : "systemd System Manager"; - set_position(WindowPosition.CENTER); - set_default_size(1000, 700); - set_border_width(12); - destroy.connect(Gtk.main_quit); - - Notebook notebook = new Notebook(); - add(notebook); - - Box unit_vbox = new VBox(false, 12); - notebook.append_page(unit_vbox, new Label("Units")); - unit_vbox.set_border_width(12); - - Box job_vbox = new VBox(false, 12); - notebook.append_page(job_vbox, new Label("Jobs")); - job_vbox.set_border_width(12); - - unit_type_combo_box = new ComboBox.text(); - Box type_hbox = new HBox(false, 6); - type_hbox.pack_start(unit_type_combo_box, false, false, 0); - unit_vbox.pack_start(type_hbox, false, false, 0); - - unit_type_combo_box.append_text("All unit types"); - unit_type_combo_box.append_text("Targets"); - unit_type_combo_box.append_text("Services"); - unit_type_combo_box.append_text("Devices"); - unit_type_combo_box.append_text("Mounts"); - unit_type_combo_box.append_text("Automounts"); - unit_type_combo_box.append_text("Swaps"); - unit_type_combo_box.append_text("Sockets"); - unit_type_combo_box.append_text("Paths"); - unit_type_combo_box.append_text("Timers"); - unit_type_combo_box.append_text("Snapshots"); - unit_type_combo_box.set_active(0); // Show All - unit_type_combo_box.changed.connect(unit_type_changed); - - inactive_checkbox = new CheckButton.with_label("inactive too"); - inactive_checkbox.toggled.connect(unit_type_changed); - type_hbox.pack_start(inactive_checkbox, false, false, 0); - - unit_load_entry = new Entry(); - unit_load_button = new Button.with_mnemonic("_Load"); - unit_load_button.set_sensitive(false); - - unit_load_entry.changed.connect(on_unit_load_entry_changed); - unit_load_entry.activate.connect(on_unit_load); - unit_load_button.clicked.connect(on_unit_load); - - Box unit_load_hbox = new HBox(false, 6); - unit_load_hbox.pack_start(unit_load_entry, false, true, 0); - unit_load_hbox.pack_start(unit_load_button, false, true, 0); - - server_snapshot_button = new Button.with_mnemonic("Take S_napshot"); - server_reload_button = new Button.with_mnemonic("Reload _Configuration"); - - server_snapshot_button.clicked.connect(on_server_snapshot); - server_reload_button.clicked.connect(on_server_reload); - - type_hbox.pack_end(server_snapshot_button, false, true, 0); - type_hbox.pack_end(server_reload_button, false, true, 0); - type_hbox.pack_end(unit_load_hbox, false, true, 24); - - unit_model = new ListStore(7, typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Unit)); - job_model = new ListStore(6, typeof(string), typeof(string), typeof(string), typeof(string), typeof(Job), typeof(uint32)); - - unit_map = new Gee.HashMap<string, Unit>(); - - TreeModelFilter unit_model_filter; - unit_model_filter = new TreeModelFilter(unit_model, null); - unit_model_filter.set_visible_func(unit_filter); - - TreeModelSort unit_model_sort = new TreeModelSort.with_model(unit_model_filter); - - unit_view = new TreeView.with_model(unit_model_sort); - job_view = new TreeView.with_model(job_model); - - unit_view.cursor_changed.connect(unit_changed); - job_view.cursor_changed.connect(job_changed); - - new_column(unit_view, 2, "Load State"); - new_column(unit_view, 3, "Active State"); - new_column(unit_view, 4, "Unit State"); - new_column(unit_view, 0, "Unit"); - new_column(unit_view, 5, "Job"); - - new_column(job_view, 0, "Job"); - new_column(job_view, 1, "Unit"); - new_column(job_view, 2, "Type"); - new_column(job_view, 3, "State"); - - ScrolledWindow scroll = new ScrolledWindow(null, null); - scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC); - scroll.set_shadow_type(ShadowType.IN); - scroll.add(unit_view); - unit_vbox.pack_start(scroll, true, true, 0); - - scroll = new ScrolledWindow(null, null); - scroll.set_policy(PolicyType.AUTOMATIC, PolicyType.AUTOMATIC); - scroll.set_shadow_type(ShadowType.IN); - scroll.add(job_view); - job_vbox.pack_start(scroll, true, true, 0); - - unit_id_label = new RightLabel(); - unit_dependency_label = new RightLabel(); - unit_description_label = new RightLabel(); - unit_load_state_label = new RightLabel(); - unit_active_state_label = new RightLabel(); - unit_sub_state_label = new RightLabel(); - unit_fragment_path_label = new RightLabel(); - unit_active_enter_timestamp_label = new RightLabel(); - unit_active_exit_timestamp_label = new RightLabel(); - unit_can_start_label = new RightLabel(); - unit_can_reload_label = new RightLabel(); - unit_cgroup_label = new RightLabel(); - - job_id_label = new RightLabel(); - job_state_label = new RightLabel(); - job_type_label = new RightLabel(); - - unit_dependency_label.set_track_visited_links(false); - unit_dependency_label.set_selectable(true); - unit_dependency_label.activate_link.connect(on_activate_link); - - unit_fragment_path_label.set_track_visited_links(false); - - Table unit_table = new Table(8, 6, false); - unit_table.set_row_spacings(6); - unit_table.set_border_width(0); - unit_vbox.pack_start(unit_table, false, true, 0); - - Table job_table = new Table(2, 2, false); - job_table.set_row_spacings(6); - job_table.set_border_width(0); - job_vbox.pack_start(job_table, false, true, 0); - - unit_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_id_label, 1, 6, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Description:"), 0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_description_label, 1, 6, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Dependencies:"), 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_dependency_label, 1, 6, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Fragment Path:"), 0, 1, 3, 4, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_fragment_path_label, 1, 6, 3, 4, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Control Group:"), 0, 1, 4, 5, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_cgroup_label, 1, 6, 4, 5, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - unit_table.attach(new LeftLabel("Load State:"), 0, 1, 5, 6, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_load_state_label, 1, 2, 5, 6, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Active State:"), 0, 1, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_active_state_label, 1, 2, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Unit State:"), 0, 1, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_sub_state_label, 1, 2, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - unit_table.attach(new LeftLabel("Activated:"), 2, 3, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_active_enter_timestamp_label, 3, 4, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Deactivated:"), 2, 3, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_active_exit_timestamp_label, 3, 4, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - unit_table.attach(new LeftLabel("Can Start/Stop:"), 4, 5, 6, 7, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_can_start_label, 5, 6, 6, 7, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(new LeftLabel("Can Reload:"), 4, 5, 7, 8, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - unit_table.attach(unit_can_reload_label, 5, 6, 7, 8, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - job_table.attach(new LeftLabel("Id:"), 0, 1, 0, 1, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(job_id_label, 1, 2, 0, 1, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(new LeftLabel("State:"), 0, 1, 1, 2, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(job_state_label, 1, 2, 1, 2, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(new LeftLabel("Type:"), 0, 1, 2, 3, AttachOptions.FILL, AttachOptions.FILL, 0, 0); - job_table.attach(job_type_label, 1, 2, 2, 3, AttachOptions.EXPAND|AttachOptions.FILL, AttachOptions.FILL, 0, 0); - - ButtonBox bbox = new HButtonBox(); - bbox.set_layout(ButtonBoxStyle.START); - bbox.set_spacing(6); - unit_vbox.pack_start(bbox, false, true, 0); - - start_button = new Button.with_mnemonic("_Start"); - stop_button = new Button.with_mnemonic("Sto_p"); - reload_button = new Button.with_mnemonic("_Reload"); - restart_button = new Button.with_mnemonic("Res_tart"); - - start_button.clicked.connect(on_start); - stop_button.clicked.connect(on_stop); - reload_button.clicked.connect(on_reload); - restart_button.clicked.connect(on_restart); - - bbox.pack_start(start_button, false, true, 0); - bbox.pack_start(stop_button, false, true, 0); - bbox.pack_start(restart_button, false, true, 0); - bbox.pack_start(reload_button, false, true, 0); - - bbox = new HButtonBox(); - bbox.set_layout(ButtonBoxStyle.START); - bbox.set_spacing(6); - job_vbox.pack_start(bbox, false, true, 0); - - cancel_button = new Button.with_mnemonic("_Cancel"); - - cancel_button.clicked.connect(on_cancel); - - bbox.pack_start(cancel_button, false, true, 0); - - manager = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - "/org/freedesktop/systemd1"); - - manager.unit_new.connect(on_unit_new); - manager.job_new.connect(on_job_new); - manager.unit_removed.connect(on_unit_removed); - manager.job_removed.connect(on_job_removed); - - manager.subscribe(); - - clear_unit(); - clear_job(); - populate_unit_model(); - populate_job_model(); - } - - public void populate_unit_model() throws IOError { - unit_model.clear(); - - var list = manager.list_units(); - - foreach (var i in list) { - TreeIter iter; - - Properties p = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - i.unit_path); - - p.properties_changed.connect(on_unit_changed); - - Unit u = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - i.unit_path); - - unit_map[i.id] = u; - - unit_model.append(out iter); - unit_model.set(iter, - 0, i.id, - 1, i.description, - 2, i.load_state, - 3, i.active_state, - 4, i.sub_state, - 5, i.job_type != "" ? "→ %s".printf(i.job_type) : "", - 6, u); - } - } - - public void populate_job_model() throws IOError { - job_model.clear(); - - var list = manager.list_jobs(); - - foreach (var i in list) { - TreeIter iter; - - Properties p = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - i.job_path); - - p.properties_changed.connect(on_job_changed); - - Job j = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - i.job_path); - - job_model.append(out iter); - job_model.set(iter, - 0, "%u".printf(i.id), - 1, i.name, - 2, "→ %s".printf(i.type), - 3, i.state, - 4, j, - 5, i.id); - } - } - - public Unit? get_current_unit() { - TreePath p; - unit_view.get_cursor(out p, null); - - if (p == null) - return null; - - TreeModel model = unit_view.get_model(); - TreeIter iter; - Unit u; - - model.get_iter(out iter, p); - model.get(iter, 6, out u); - - return u; - } - - public Unit? get_unit(string id) { - return this.unit_map[id]; - } - - public void unit_changed() { - Unit u = get_current_unit(); - - if (u == null) - clear_unit(); - else - show_unit(u); - } - - public void clear_unit() { - current_unit_id = null; - - start_button.set_sensitive(false); - stop_button.set_sensitive(false); - reload_button.set_sensitive(false); - restart_button.set_sensitive(false); - - unit_id_label.set_text_or_na(); - unit_description_label.set_text_or_na(); - unit_description_label.set_text_or_na(); - unit_load_state_label.set_text_or_na(); - unit_active_state_label.set_text_or_na(); - unit_sub_state_label.set_text_or_na(); - unit_fragment_path_label.set_text_or_na(); - unit_active_enter_timestamp_label.set_text_or_na(); - unit_active_exit_timestamp_label.set_text_or_na(); - unit_can_reload_label.set_text_or_na(); - unit_can_start_label.set_text_or_na(); - unit_cgroup_label.set_text_or_na(); - } - - public string format_unit_link(string i, bool link) { - Unit? u = get_unit(i); - if(u == null) - return "<span color='grey'>" + i + "</span"; - - string color; - switch (u.sub_state) { - case "active": color = "blue"; break; - case "dead": color = "red"; break; - case "running": color = "green"; break; - default: color = "black"; break; - } - string span = "<span underline='none' color='" + color + "'>" - + i + "(" + - u.sub_state + ")" + "</span>"; - if(link) - return " <a href='" + i + "'>" + span + "</a>"; - else - return span; - } - - - public string make_dependency_string(string? prefix, string word, string[] dependencies) { - Gee.Collection<unowned string> sorted = new Gee.TreeSet<string>(); - foreach (string i in dependencies) - sorted.add(i); - - bool first = true; - string r; - - if (prefix == null) - r = ""; - else - r = prefix; - - foreach (string i in sorted) { - if (r != "") - r += first ? "\n" : ","; - - if (first) { - r += "<b>" + word + ":</b>"; - first = false; - } - - r += format_unit_link(i, true); - } - - return r; - } - - public void show_unit(Unit unit) { - current_unit_id = unit.id; - - string id_display = format_unit_link(current_unit_id, false); - bool has_alias = false; - foreach (string i in unit.names) { - if (i == current_unit_id) - continue; - - if (!has_alias) { - id_display += " (aliases:"; - has_alias = true; - } - - id_display += " " + i; - } - if(has_alias) - id_display += ")"; - - unit_id_label.set_markup_or_na(id_display); - - string[] - requires = unit.requires, - requires_overridable = unit.requires_overridable, - requisite = unit.requisite, - requisite_overridable = unit.requisite_overridable, - wants = unit.wants, - required_by = unit.required_by, - required_by_overridable = unit.required_by_overridable, - wanted_by = unit.wanted_by, - conflicts = unit.conflicts, - before = unit.before, - after = unit.after; - - unit_dependency_label.set_markup_or_na( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string( - make_dependency_string(null, - "requires", requires), - "overridable requires", requires_overridable), - "requisite", requisite), - "overridable requisite", requisite_overridable), - "wants", wants), - "conflicts", conflicts), - "required by", required_by), - "overridable required by", required_by_overridable), - "wanted by", wanted_by), - "after", after), - "before", before)); - - unit_description_label.set_text_or_na(unit.description); - unit_load_state_label.set_text_or_na(unit.load_state); - unit_active_state_label.set_text_or_na(unit.active_state); - unit_sub_state_label.set_text_or_na(unit.sub_state); - - string fp = unit.fragment_path; - if (fp != "") - unit_fragment_path_label.set_markup_or_na( - "<a href=\"file://" + fp +"\">" + - "<span underline='none' color='black'>" + fp + "</span></a>"); - else - unit_fragment_path_label.set_text_or_na(); - - - unit_active_enter_timestamp_label.set_text_or_na(format_time(unit.active_enter_timestamp)); - - unit_active_exit_timestamp_label.set_text_or_na(format_time(unit.active_exit_timestamp)); - - bool b = unit.can_start; - start_button.set_sensitive(b); - stop_button.set_sensitive(b); - restart_button.set_sensitive(b); - unit_can_start_label.set_text_or_na(b ? "Yes" : "No"); - - b = unit.can_reload; - reload_button.set_sensitive(b); - unit_can_reload_label.set_text_or_na(b ? "Yes" : "No"); - - unit_cgroup_label.set_text_or_na(unit.default_control_group); - } - - public Job? get_current_job() { - TreePath p; - job_view.get_cursor(out p, null); - - if (p == null) - return null; - - TreeIter iter; - TreeModel model = job_view.get_model(); - Job *j; - - model.get_iter(out iter, p); - model.get(iter, 4, out j); - - return j; - } - - public void job_changed() { - Job j = get_current_job(); - - if (j == null) - clear_job(); - else - show_job(j); - } - - public void clear_job() { - current_job_id = 0; - - job_id_label.set_text_or_na(); - job_state_label.set_text_or_na(); - job_type_label.set_text_or_na(); - - cancel_button.set_sensitive(false); - } - - public void show_job(Job job) { - current_job_id = job.id; - - job_id_label.set_text_or_na("%u".printf(current_job_id)); - job_state_label.set_text_or_na(job.state); - job_type_label.set_text_or_na(job.job_type); - - cancel_button.set_sensitive(true); - } - - public void on_start() { - Unit u = get_current_unit(); - - if (u == null) - return; - - try { - u.start("replace"); - } catch (Error e) { - show_error(e.message); - } - } - - public void on_stop() { - Unit u = get_current_unit(); - - if (u == null) - return; - - try { - u.stop("replace"); - } catch (Error e) { - show_error(e.message); - } - } - - public void on_reload() { - Unit u = get_current_unit(); - - if (u == null) - return; - - try { - u.reload("replace"); - } catch (Error e) { - show_error(e.message); - } - } - - public void on_restart() { - Unit u = get_current_unit(); - - if (u == null) - return; - - try { - u.restart("replace"); - } catch (Error e) { - show_error(e.message); - } - } - - public void on_cancel() { - Job j = get_current_job(); - - if (j == null) - return; - - try { - j.cancel(); - } catch (Error e) { - show_error(e.message); - } - } - - public void update_unit_iter(TreeIter iter, string id, Unit u) { - - try { - string t = ""; - Unit.JobLink jl = u.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; - } - - 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 (Error e) { - show_error(e.message); - } - } - - public void on_unit_new(string id, ObjectPath path) { - try { - - Properties p = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - path); - - p.properties_changed.connect(on_unit_changed); - - TreeIter iter; - unit_model.append(out iter); - - Unit u = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - path); - - unit_map[id] = u; - - update_unit_iter(iter, id, u); - } catch (Error e) { - show_error(e.message); - } - } - - public void update_job_iter(TreeIter iter, uint32 id, Job j) { - job_model.set(iter, - 0, "%u".printf(id), - 1, j.unit.id, - 2, "→ %s".printf(j.job_type), - 3, j.state, - 4, j, - 5, id); - } - - public void on_job_new(uint32 id, ObjectPath path) { - - try { - - Properties p = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - path); - - p.properties_changed.connect(on_job_changed); - - TreeIter iter; - job_model.append(out iter); - - Job j = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - path); - - update_job_iter(iter, id, j); - - } catch (Error e) { - show_error(e.message); - } - } - - public void on_unit_removed(string id, ObjectPath path) { - TreeIter iter; - if (!(unit_model.get_iter_first(out iter))) - return; - - do { - string name; - - unit_model.get(iter, 0, out name); - - if (id == name) { - if (current_unit_id == name) - clear_unit(); - - unit_model.remove(iter); - break; - } - - } while (unit_model.iter_next(ref iter)); - - unit_map.unset(id); - } - - public void on_job_removed(uint32 id, ObjectPath path, string res) { - TreeIter iter; - if (!(job_model.get_iter_first(out iter))) - return; - - do { - uint32 j; - - job_model.get(iter, 5, out j); - - if (id == j) { - if (current_job_id == j) - clear_job(); - - job_model.remove(iter); - - break; - } - - } while (job_model.iter_next(ref iter)); - } - - public void on_unit_changed(Properties p, string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties) { - - try { - TreeIter iter; - string id; - - Unit u = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - p.get_name(), - p.get_object_path()); - - if (!(unit_model.get_iter_first(out iter))) - return; - - id = u.id; - - do { - string name; - - unit_model.get(iter, 0, out name); - - if (id == name) { - update_unit_iter(iter, id, u); - - if (current_unit_id == id) - show_unit(u); - - break; - } - - } while (unit_model.iter_next(ref iter)); - - } catch (Error e) { - show_error(e.message); - } - } - - public void on_job_changed(Properties p, string iface, HashTable<string, Value?> changed_properties, string[] invalidated_properties) { - try { - TreeIter iter; - uint32 id; - - 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; - - id = j.id; - - do { - uint32 k; - - job_model.get(iter, 5, out k); - - if (id == k) { - update_job_iter(iter, id, j); - - if (current_job_id == id) - show_job(j); - - break; - } - - } while (job_model.iter_next(ref iter)); - - } catch (Error e) { - show_error(e.message); - } - } - - public bool unit_filter(TreeModel model, TreeIter iter) { - string id, active_state, job; - - model.get(iter, 0, out id, 3, out active_state, 5, out job); - - if (id == null) - return false; - - if (!inactive_checkbox.get_active() - && active_state == "inactive" && job == "") - return false; - - switch (unit_type_combo_box.get_active()) { - case 0: - return true; - case 1: - return id.has_suffix(".target"); - case 2: - return id.has_suffix(".service"); - case 3: - return id.has_suffix(".device"); - case 4: - return id.has_suffix(".mount"); - case 5: - return id.has_suffix(".automount"); - case 6: - return id.has_suffix(".swap"); - case 7: - return id.has_suffix(".socket"); - case 8: - return id.has_suffix(".path"); - case 9: - return id.has_suffix(".timer"); - case 10: - return id.has_suffix(".snapshot"); - default: - assert(false); - return false; - } - } - - public void unit_type_changed() { - TreeModelFilter model = (TreeModelFilter) ((TreeModelSort) unit_view.get_model()).get_model(); - - model.refilter(); - } - - public void on_server_reload() { - try { - manager.reload(); - } catch (Error e) { - show_error(e.message); - } - } - - public void on_server_snapshot() { - try { - manager.create_snapshot(); - - if (unit_type_combo_box.get_active() != 0) - unit_type_combo_box.set_active(8); - - } catch (Error e) { - show_error(e.message); - } - } - - public void on_unit_load() { - string t = unit_load_entry.get_text(); - - if (t == "") - return; - - try { - var path = manager.load_unit(t); - - Unit u = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - path); - - var m = new MessageDialog(this, - DialogFlags.DESTROY_WITH_PARENT, - MessageType.INFO, - ButtonsType.CLOSE, - "Unit available as id %s", u.id); - m.title = "Unit"; - m.run(); - m.destroy(); - - show_unit(u); - } catch (Error e) { - show_error(e.message); - } - } - - public void on_unit_load_entry_changed() { - unit_load_button.set_sensitive(unit_load_entry.get_text() != ""); - } - - public bool on_activate_link(string uri) { - - try { - string path = manager.get_unit(uri); - - Unit u = Bus.get_proxy_sync( - user ? BusType.SESSION : BusType.SYSTEM, - "org.freedesktop.systemd1", - path); - - show_unit(u); - } catch (Error e) { - show_error(e.message); - } - - return true; - } - - public void show_error(string e) { - var m = new MessageDialog(this, - DialogFlags.DESTROY_WITH_PARENT, - MessageType.ERROR, - ButtonsType.CLOSE, "%s", e); - m.title = "Error"; - m.run(); - m.destroy(); - } - -} - -static const OptionEntry entries[] = { - { "user", 0, 0, OptionArg.NONE, out user, "Connect to user service manager", null }, - { "system", 0, OptionFlags.REVERSE, OptionArg.NONE, out user, "Connect to system manager", null }, - { null } -}; - -void show_error(string e) { - var m = new MessageDialog(null, 0, MessageType.ERROR, ButtonsType.CLOSE, "%s", e); - m.run(); - m.destroy(); -} - -int main(string[] args) { - - try { - Gtk.init_with_args(ref args, "[OPTION...]", entries, "systemadm"); - - MainWindow window = new MainWindow(); - window.show_all(); - - Gtk.main(); - } catch (IOError e) { - show_error(e.message); - } catch (GLib.Error e) { - stderr.printf("%s\n", e.message); - } - - return 0; -} diff --git a/src/systemd-interfaces.vala b/src/systemd-interfaces.vala deleted file mode 100644 index a380f7970b..0000000000 --- a/src/systemd-interfaces.vala +++ /dev/null @@ -1,167 +0,0 @@ -/*** - This file is part of systemd. - - Copyright 2010 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with systemd; If not, see <http://www.gnu.org/licenses/>. -***/ - -[DBus (name = "org.freedesktop.systemd1.Manager")] -public interface Manager : DBusProxy { - - public struct UnitInfo { - string id; - string description; - string load_state; - string active_state; - string sub_state; - string following; - ObjectPath unit_path; - uint32 job_id; - string job_type; - ObjectPath job_path; - } - - public struct JobInfo { - uint32 id; - string name; - string type; - string state; - ObjectPath job_path; - ObjectPath unit_path; - } - - public abstract string[] environment { owned get; } - - public abstract UnitInfo[] list_units() throws IOError; - public abstract JobInfo[] list_jobs() throws IOError; - - 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 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 IOError; - - public abstract void clear_jobs() throws IOError; - - public abstract void subscribe() throws IOError; - public abstract void unsubscribe() throws IOError; - - public abstract string dump() throws IOError; - - 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 IOError; - - 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); - public abstract signal void job_new(uint32 id, ObjectPath path); - public abstract signal void job_removed(uint32 id, ObjectPath path, string res); -} - -[DBus (name = "org.freedesktop.systemd1.Unit")] -public interface Unit : DBusProxy { - public struct JobLink { - uint32 id; - ObjectPath path; - } - - public abstract string id { owned get; } - public abstract string[] names { owned get; } - public abstract string following { owned get; } - public abstract string[] requires { owned get; } - public abstract string[] requires_overridable { owned get; } - public abstract string[] requisite { owned get; } - public abstract string[] requisite_overridable { owned get; } - public abstract string[] wants { owned get; } - public abstract string[] required_by { owned get; } - public abstract string[] required_by_overridable { owned get; } - public abstract string[] wanted_by { owned get; } - public abstract string[] conflicts { owned get; } - public abstract string[] conflicted_by { owned get; } - public abstract string[] before { owned get; } - public abstract string[] after { owned get; } - public abstract string[] on_failure { owned get; } - public abstract string description { owned get; } - public abstract string load_state { owned get; } - public abstract string active_state { owned get; } - public abstract string sub_state { owned get; } - public abstract string fragment_path { owned get; } - public abstract uint64 inactive_exit_timestamp { owned get; } - public abstract uint64 active_enter_timestamp { owned get; } - public abstract uint64 active_exit_timestamp { owned get; } - public abstract uint64 inactive_enter_timestamp { owned get; } - public abstract bool can_start { owned get; } - public abstract bool can_stop { owned get; } - public abstract bool can_reload { owned get; } - public abstract JobLink job { owned get; } - public abstract bool recursive_stop { owned get; } - public abstract bool stop_when_unneeded { owned get; } - public abstract bool refuse_manual_start { owned get; } - public abstract bool refuse_manual_stop { owned get; } - public abstract bool default_dependencies { owned get; } - public abstract string default_control_group { owned get; } - public abstract string[] control_groups { owned get; } - public abstract bool need_daemon_reload { owned get; } - public abstract uint64 job_timeout_usec { owned get; } - - 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 IOError; -} - -[DBus (name = "org.freedesktop.systemd1.Job")] -public interface Job : DBusProxy { - public struct UnitLink { - string id; - ObjectPath path; - } - - public abstract uint32 id { owned get; } - public abstract string state { owned get; } - public abstract string job_type { owned get; } - public abstract UnitLink unit { owned get; } - - public abstract void cancel() throws IOError; -} - -[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); -} diff --git a/src/wraplabel.vala b/src/wraplabel.vala deleted file mode 100644 index 49858c3222..0000000000 --- a/src/wraplabel.vala +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2005 VMware, Inc. - -// This is a translation of http://git.gnome.org/browse/meld/tree/meld/ui/wraplabel.py, -// which in turn is a translation of WrapLabel from libview. - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -// Python translation from wrapLabel.{cc|h} by Gian Mario Tagliaretti -// Vala translation from wraplabel.py by Zbigniew Jędrzejewski-Szmek - -public class WrapLabel : Gtk.Label { - private int _wrap_width; - - public WrapLabel(string? text = null) { - this._wrap_width = 0; - var layout = get_layout(); - layout.set_wrap(Pango.WrapMode.WORD_CHAR); - if (text != null) - this.set_text(text); - this.set_alignment(0, 0); - } - - public override void size_request(out Gtk.Requisition requisition) { - int width, height; - var layout = get_layout(); - layout.get_pixel_size(out width, out height); - requisition.width = 0; - requisition.height = height; - } - - public override void size_allocate(Gdk.Rectangle allocation) { - base.size_allocate (allocation); - this._set_wrap_width(allocation.width); - } - - public new void set_text(string str) { - base.set_text(str); - this._set_wrap_width(this._wrap_width); - } - - public new void set_markup(string str) { - base.set_markup(str); - this._set_wrap_width(this._wrap_width); - } - - private void _set_wrap_width(int width) { - if (width == 0) - return; - - var layout = get_layout(); - layout.set_width(width * Pango.SCALE); - if (_wrap_width != width) { - this._wrap_width = width; - this.queue_resize(); - } - } -} |