Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -ruBbdN meiga/src/gui/Gui.vala meiga-vala0.14/src/gui/Gui.vala
- --- meiga/src/gui/Gui.vala 2012-01-07 14:09:40.727327359 +0100
- +++ meiga-vala0.14/src/gui/Gui.vala 2012-01-08 02:22:03.735934311 +0100
- @@ -30,6 +30,38 @@
- const string UI_PATH = "ui:"+Config.DATADIR+"/meiga/ui";
- +[DBus (name = "com.igalia.Meiga", signals="model_changed, log_changed")]
- +interface IMeiga : GLib.Object {
- + public signal void model_changed();
- + public signal void log_changed();
- + public abstract void register_path(string real_path, string logical_path) throws IOError;
- + public abstract void unregister_path(string logical_path) throws IOError;
- + public abstract uint get_gui_pid() throws IOError;
- + public abstract string get_display() throws IOError;
- + public abstract void register_gui(uint gui_pid, string display) throws IOError;
- + public abstract HashTable<string,string> get_paths() throws IOError;
- + public abstract string get_paths_as_string() throws IOError;
- + public abstract string get_public_url() throws IOError;
- + public abstract int get_redirection_type() throws IOError;
- + public abstract void set_redirection_type(int redirection_type) throws IOError;
- + public abstract int get_redirection_status() throws IOError;
- + public abstract uint get_port() throws IOError;
- + public abstract void set_port(uint port) throws IOError;
- + public abstract bool get_ssl() throws IOError;
- + public abstract void set_ssl(bool ssl) throws IOError;
- + public abstract string get_auth_user() throws IOError;
- + public abstract void set_auth_user(string auth_user) throws IOError;
- + public abstract string get_auth_md5passwd() throws IOError;
- + public abstract void set_auth_md5passwd(string auth_md5passwd) throws IOError;
- + public abstract void set_ssh_host(string ssh_host) throws IOError;
- + public abstract void set_ssh_port(string ssh_port) throws IOError;
- + public abstract void set_ssh_user(string ssh_user) throws IOError;
- + public abstract void set_ssh_password(string ssh_password) throws IOError;
- + public abstract void shutdown() throws IOError;
- + public abstract string get_pending_log(uint start) throws IOError;
- + public abstract string get_requests_stats() throws IOError;
- +}
- +
- public class Gui : GLib.Object {
- // Private attributes
- @@ -67,8 +99,8 @@
- private uint pid;
- private string display;
- - private dynamic DBus.Object _remote = null;
- - private dynamic DBus.Object remote {
- + private IMeiga _remote = null;
- + private IMeiga remote {
- // Maybe remote DBUS service isn't immediately available, so by using
- // this lazy init we give it the opportunity to be contacted each time
- // we call for it
- @@ -252,11 +284,11 @@
- private void dbus_init() {
- try {
- - var conn = DBus.Bus.get(DBus.BusType.SESSION);
- - _remote = conn.get_object (
- + _remote = Bus.get_proxy_sync (
- + BusType.SESSION,
- "com.igalia.Meiga",
- - "/com/igalia/Meiga",
- - "com.igalia.Meiga");
- + "/com/igalia/Meiga"
- + );
- } catch (Error e) {
- log(_("Error looking for DBUS server: %s\n").printf(e.message));
- }
- @@ -273,8 +305,8 @@
- // Attach to remote signals
- if (_remote != null) {
- - _remote.ModelChanged += this.on_remote_model_changed;
- - _remote.LogChanged += this.on_remote_log_changed;
- + _remote.model_changed.connect(this.on_remote_model_changed);
- + _remote.log_changed.connect(this.on_remote_log_changed);
- }
- on_remote_model_changed();
- diff -ruBbdN meiga/src/server/MeigaServer.vala meiga-vala0.14/src/server/MeigaServer.vala
- --- meiga/src/server/MeigaServer.vala 2012-01-07 14:09:40.730660674 +0100
- +++ meiga-vala0.14/src/server/MeigaServer.vala 2012-01-08 02:23:07.718921018 +0100
- @@ -211,9 +211,17 @@
- }
- private void initialize_dbus() {
- - try {
- - this.exposed=new Meiga(this);
- + Bus.own_name (
- + BusType.SESSION,
- + "com.igalia.Meiga",
- + BusNameOwnerFlags.NONE,
- + this.on_bus_aquired,
- + () => {},
- + () => log(_("Could not aquire name\n"))
- + );
- + /*
- + // Old dbus-glib method
- var conn = DBus.Bus.get(DBus.BusType.SESSION);
- dynamic DBus.Object bus = conn.get_object(
- "org.freedesktop.DBus",
- @@ -226,7 +234,15 @@
- } else {
- log(_("Not registering DBUS service: not primary owner"));
- }
- - } catch (Error e) {
- + */
- + }
- +
- + public void on_bus_aquired (DBusConnection conn) {
- + try {
- + this.exposed=new Meiga(this);
- + log(_("Registering DBUS service"));
- + conn.register_object ("/com/igalia/Meiga", this.exposed);
- + } catch (IOError e) {
- log(_("Error registering DBUS server: %s").printf(e.message));
- }
- }
Add Comment
Please, Sign In to add comment