~bryanfritt/compiz/compiz-ezoom_More-Specific-Zooms_1201061

« back to all changes in this revision

Viewing changes to plugins/dbus/src/dbus.h

  • Committer: Tarmac
  • Author(s): Sami Jaktholm
  • Date: 2013-07-09 03:56:13 UTC
  • mfrom: (3753.5.2 fix-749084)
  • Revision ID: tarmac-20130709035613-mp1q2zrf8y4ofxgt
Port dbus introspection to compiz 0.9.
- move xml creation to a separate class (IntrospectionResponse) for easier
  memory management (allocate buffer and writer in ctor, free in dtor).
- move duplicated response sending code to a separate method that takes
  IntrospectionResponse and sends the resulting xml.
- Refactor handle*IntrospectMessage to work with compiz 0.9 interfaces.

This also fixes the broken list method which was a result of logic error. The
code to invoke list handler was never reached.

This fixes most of the issues noted in bug 749084. Fixes: https://bugs.launchpad.net/bugs/749084.

Approved by PS Jenkins bot, MC Return.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#define COMPIZ_DBUS_GET_MEMBER_NAME                 "get"
48
48
#define COMPIZ_DBUS_GET_METADATA_MEMBER_NAME        "getMetadata"
49
49
#define COMPIZ_DBUS_LIST_MEMBER_NAME                "list"
50
 
#define COMPIZ_DBUS_GET_PLUGINS_MEMBER_NAME         "getPlugins"
51
50
#define COMPIZ_DBUS_GET_PLUGIN_METADATA_MEMBER_NAME "getPluginMetadata"
52
51
 
53
52
#define COMPIZ_DBUS_CHANGED_SIGNAL_NAME             "changed"
58
57
#define DBUS_FILE_WATCH_HOME    2
59
58
#define DBUS_FILE_WATCH_NUM     3
60
59
 
 
60
class IntrospectionResponse
 
61
{
 
62
    public:
 
63
        IntrospectionResponse ();
 
64
        ~IntrospectionResponse ();
 
65
 
 
66
        void
 
67
        addArgument (const char *type,
 
68
                     const char *direction);
 
69
 
 
70
        void
 
71
        addMethod (const char *name,
 
72
                   int        nArgs,
 
73
                   ...);
 
74
 
 
75
        void
 
76
        addSignal (const char *name,
 
77
                   int        nArgs,
 
78
                   ...);
 
79
 
 
80
        void addNode (const char *name);
 
81
 
 
82
        void startInterface ();
 
83
        void endInterface ();
 
84
 
 
85
        const char* finishAndGetXml ();
 
86
 
 
87
    private:
 
88
        xmlBufferPtr xmlBuf;
 
89
        xmlTextWriterPtr xmlWriter;
 
90
};
 
91
 
61
92
class DbusScreen :
62
93
    public PluginClassHandler <DbusScreen, CompScreen>,
63
94
    public ScreenInterface
83
114
        CompOption::Vector &
84
115
        getOptionsFromPath (const std::vector<CompString>& path);
85
116
 
 
117
        static bool
 
118
        sendIntrospectResponse (DBusConnection        *connection,
 
119
                                DBusMessage           *message,
 
120
                                IntrospectionResponse &response);
 
121
 
 
122
        bool
 
123
        handleRootIntrospectMessage (DBusConnection *connection,
 
124
                                     DBusMessage    *message);
 
125
 
 
126
        bool
 
127
        handlePluginIntrospectMessage (DBusConnection *connection,
 
128
                                       DBusMessage    *message);
 
129
 
 
130
        bool
 
131
        handleScreenIntrospectMessage (DBusConnection           *connection,
 
132
                                       DBusMessage              *message,
 
133
                                       std::vector<CompString>& path);
 
134
 
 
135
        bool
 
136
        handleOptionIntrospectMessage (DBusConnection           *connection,
 
137
                                       DBusMessage              *message,
 
138
                                       std::vector<CompString>& path);
 
139
 
86
140
        bool
87
141
        handleActionMessage (DBusConnection                 *connection,
88
142
                             DBusMessage                    *message,