Back to index

easystroke  0.5.5.1
Classes | Defines | Typedefs | Functions
dbus-server.cc File Reference
#include <dbus/dbus-protocol.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-bindings.h>
#include <stdio.h>
#include "dbus-server.h"

Go to the source code of this file.

Classes

struct  _ServerObject
struct  _ServerObjectClass

Defines

#define SERVER_OBJECT_TYPE   (server_object_get_type())

Typedefs

typedef struct _ServerObject ServerObject
typedef struct _ServerObjectClass ServerObjectClass

Functions

void run_by_name (const char *str)
static gboolean server_send (ServerObject *obj, const char *str, GError **error)
static void server_object_class_init (ServerObjectClass *klass)
static void server_object_init (ServerObject *obj)
 G_DEFINE_TYPE (ServerObject, server_object, G_TYPE_OBJECT)
int start_dbus ()

Class Documentation

struct _ServerObject

Definition at line 24 of file dbus-server.cc.

Class Members
GObject object
struct _ServerObjectClass

Definition at line 28 of file dbus-server.cc.

Class Members
GObjectClass object_class

Define Documentation

#define SERVER_OBJECT_TYPE   (server_object_get_type())

Definition at line 22 of file dbus-server.cc.


Typedef Documentation

typedef struct _ServerObject ServerObject

Function Documentation

G_DEFINE_TYPE ( ServerObject  ,
server_object  ,
G_TYPE_OBJECT   
)
void run_by_name ( const char *  str)

Definition at line 1048 of file main.cc.

                                  {
       if (!strcmp(str, "")) {
              win->show_hide();
              return;
       }
       for (ActionDB::const_iterator i = actions.begin(); i != actions.end(); i++) {
              if (i->second.name == std::string(str)) {
                     if (i->second.action)
                            queue(sigc::bind(sigc::ptr_fun(do_run_by_name), i->second.action));
                     return;
              }
       }
       printf(_("Warning: No action \"%s\" defined\n"), str);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void server_object_class_init ( ServerObjectClass klass) [static]

Definition at line 41 of file dbus-server.cc.

                                                               {
       dbus_g_object_type_install_info(G_TYPE_FROM_CLASS(klass), &dbus_glib_server_object_info);
}
static void server_object_init ( ServerObject obj) [static]

Definition at line 45 of file dbus-server.cc.

{}
static gboolean server_send ( ServerObject obj,
const char *  str,
GError **  error 
) [static]

Definition at line 34 of file dbus-server.cc.

                                                                                {
       run_by_name(str);
       return TRUE;
}

Here is the call graph for this function:

int start_dbus ( )

Definition at line 49 of file dbus-server.cc.

                 {
       DBusGConnection *connection;
       DBusGProxy *proxy;
       GError *error = NULL;
       ServerObject *obj;
       guint32 request_name_ret;

       connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
       if (!connection)
              return false;

       proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
       if (!org_freedesktop_DBus_request_name(proxy, "org.easystroke", 0, &request_name_ret, &error))
              return false;

       if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
              return -1;

       g_object_unref(proxy);

       obj =(ServerObject *)g_object_new(SERVER_OBJECT_TYPE, NULL);
       dbus_g_connection_register_g_object(connection, "/org/easystroke", G_OBJECT(obj));
       return true;
}

Here is the caller graph for this function: