Guest User

Untitled

a guest
May 31st, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vala 0.95 KB | None | 0 0
  1. bool nautilus_sendto_installed = Environment.find_program_in_path(SENDTO_EXEC) != null;
  2.     if (!nautilus_sendto_installed)
  3.     {
  4.        DBus.Connection connection;
  5.  
  6.        try {
  7.          connection = DBus.Bus.get (DBus.BusType.SESSION);
  8.        } catch (DBus.Error error) {
  9.          warning ("Error: %s\n", error.message);
  10.          return;
  11.        };
  12.  
  13.        DBus.Object object = connection.get_object ("org.freedesktop.PackageKit",
  14.                                                    "org/freedesktop/PackageKit",
  15.                                                    "org.freedesktop.PackageKit.Modify");
  16.        GLib.Error error;
  17.        if (!object.call ("InstallPackageNames", out error,
  18.                          typeof (string), "nautilus-sendto",
  19.                          typeof (string), "",
  20.                          GLib.Type.INVALID, GLib.Type.INVALID))
  21.        {
  22.          warning ("Error: %s\n", error.message);
  23.          return;
  24.        }
  25.      }
Add Comment
Please, Sign In to add comment