Guest User

Untitled

a guest
May 18th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.65 KB | None | 0 0
  1. diff -ruBbdN meiga/src/gui/Gui.vala meiga-vala0.14/src/gui/Gui.vala
  2. --- meiga/src/gui/Gui.vala  2012-01-07 14:09:40.727327359 +0100
  3. +++ meiga-vala0.14/src/gui/Gui.vala 2012-01-08 02:22:03.735934311 +0100
  4. @@ -30,6 +30,38 @@
  5.  
  6.  const string UI_PATH = "ui:"+Config.DATADIR+"/meiga/ui";
  7.  
  8. +[DBus (name = "com.igalia.Meiga", signals="model_changed, log_changed")]
  9. +interface IMeiga : GLib.Object {
  10. +  public signal void model_changed();
  11. +  public signal void log_changed();
  12. +  public abstract void register_path(string real_path, string logical_path) throws IOError;
  13. +  public abstract void unregister_path(string logical_path) throws IOError;
  14. +  public abstract uint get_gui_pid() throws IOError;
  15. +  public abstract string get_display() throws IOError;
  16. +  public abstract void register_gui(uint gui_pid, string display) throws IOError;
  17. +  public abstract HashTable<string,string> get_paths() throws IOError;
  18. +  public abstract string get_paths_as_string() throws IOError;
  19. +  public abstract string get_public_url() throws IOError;
  20. +  public abstract int get_redirection_type() throws IOError;
  21. +  public abstract void set_redirection_type(int redirection_type) throws IOError;
  22. +  public abstract int get_redirection_status() throws IOError;
  23. +  public abstract uint get_port() throws IOError;
  24. +  public abstract void set_port(uint port) throws IOError;
  25. +  public abstract bool get_ssl() throws IOError;
  26. +  public abstract void set_ssl(bool ssl) throws IOError;
  27. +  public abstract string get_auth_user() throws IOError;
  28. +  public abstract void set_auth_user(string auth_user) throws IOError;
  29. +  public abstract string get_auth_md5passwd() throws IOError;
  30. +  public abstract void set_auth_md5passwd(string auth_md5passwd) throws IOError;
  31. +  public abstract void set_ssh_host(string ssh_host) throws IOError;
  32. +  public abstract void set_ssh_port(string ssh_port) throws IOError;
  33. +  public abstract void set_ssh_user(string ssh_user) throws IOError;
  34. +  public abstract void set_ssh_password(string ssh_password) throws IOError;
  35. +  public abstract void shutdown() throws IOError;
  36. +  public abstract string get_pending_log(uint start) throws IOError;
  37. +  public abstract string get_requests_stats() throws IOError;
  38. +}
  39. +
  40.  public class Gui : GLib.Object {
  41.  
  42.    // Private attributes
  43. @@ -67,8 +99,8 @@
  44.    private uint pid;
  45.    private string display;
  46.  
  47. -  private dynamic DBus.Object _remote = null;
  48. -  private dynamic DBus.Object remote {
  49. +  private IMeiga _remote = null;
  50. +  private IMeiga remote {
  51.      // Maybe remote DBUS service isn't immediately available, so by using
  52.      // this lazy init we give it the opportunity to be contacted each time
  53.      // we call for it
  54. @@ -252,11 +284,11 @@
  55.  
  56.    private void dbus_init() {
  57.      try {
  58. -      var conn = DBus.Bus.get(DBus.BusType.SESSION);
  59. -     _remote = conn.get_object (
  60. +      _remote = Bus.get_proxy_sync (
  61. +        BusType.SESSION,
  62.                                  "com.igalia.Meiga",
  63. -                                "/com/igalia/Meiga",
  64. -                                "com.igalia.Meiga");
  65. +        "/com/igalia/Meiga"
  66. +      );
  67.      } catch (Error e) {
  68.       log(_("Error looking for DBUS server: %s\n").printf(e.message));
  69.      }
  70. @@ -273,8 +305,8 @@
  71.  
  72.     // Attach to remote signals
  73.     if (_remote != null) {
  74. -     _remote.ModelChanged += this.on_remote_model_changed;
  75. -     _remote.LogChanged += this.on_remote_log_changed;
  76. +      _remote.model_changed.connect(this.on_remote_model_changed);
  77. +      _remote.log_changed.connect(this.on_remote_log_changed);
  78.     }
  79.  
  80.     on_remote_model_changed();
  81. diff -ruBbdN meiga/src/server/MeigaServer.vala meiga-vala0.14/src/server/MeigaServer.vala
  82. --- meiga/src/server/MeigaServer.vala   2012-01-07 14:09:40.730660674 +0100
  83. +++ meiga-vala0.14/src/server/MeigaServer.vala  2012-01-08 02:23:07.718921018 +0100
  84. @@ -211,9 +211,17 @@
  85.    }
  86.  
  87.    private void initialize_dbus() {
  88. -   try {
  89. -     this.exposed=new Meiga(this);
  90. +    Bus.own_name (
  91. +      BusType.SESSION,
  92. +      "com.igalia.Meiga",
  93. +      BusNameOwnerFlags.NONE,
  94. +      this.on_bus_aquired,
  95. +      () => {},
  96. +      () => log(_("Could not aquire name\n"))
  97. +    );
  98.  
  99. +    /*
  100. +    // Old dbus-glib method
  101.       var conn = DBus.Bus.get(DBus.BusType.SESSION);
  102.       dynamic DBus.Object bus = conn.get_object(
  103.                                                 "org.freedesktop.DBus",
  104. @@ -226,7 +234,15 @@
  105.       } else {
  106.         log(_("Not registering DBUS service: not primary owner"));
  107.       }
  108. -   } catch (Error e) {
  109. +    */
  110. +  }
  111. +
  112. +  public void on_bus_aquired (DBusConnection conn) {
  113. +    try {
  114. +      this.exposed=new Meiga(this);
  115. +      log(_("Registering DBUS service"));
  116. +      conn.register_object ("/com/igalia/Meiga", this.exposed);
  117. +    } catch (IOError e) {
  118.       log(_("Error registering DBUS server: %s").printf(e.message));
  119.     }
  120.    }
Add Comment
Please, Sign In to add comment