← Back to team overview

ayatana-commits team mailing list archive

[Branch ~agateau/libindicate-qt/trunk] Rev 112: Bind methods to access the optional DBusMenu of an indicate server.

 

------------------------------------------------------------
revno: 112
committer: Aurelien Gateau <aurelien.gateau@xxxxxxxxxxxxx>
branch nick: libindicate-qt
timestamp: Mon 2010-03-08 10:02:19 +0100
message:
  Bind methods to access the optional DBusMenu of an indicate server.
modified:
  CMakeLists.txt
  src/qindicatelistener.cpp
  src/qindicatelistener.h


--
lp:libindicate-qt
https://code.launchpad.net/~agateau/libindicate-qt/trunk

Your team ayatana-commits is subscribed to branch lp:libindicate-qt.
To unsubscribe from this branch go to https://code.launchpad.net/~agateau/libindicate-qt/trunk/+edit-subscription.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2010-02-19 13:53:20 +0000
+++ CMakeLists.txt	2010-03-08 09:02:19 +0000
@@ -1,12 +1,12 @@
 project(libindicate_qt)
 cmake_minimum_required(VERSION 2.6)
-set(indicate_qt_VERSION 0.2.4)
+set(indicate_qt_VERSION 0.2.5)
 
 # Bump this one when a binary-incompatible change is introduced
 set(indicate_qt_lib_SOVERSION 1)
 
 # Bump this one when the API is extended in a binary-compatible way
-set(indicate_qt_lib_API_VERSION 3)
+set(indicate_qt_lib_API_VERSION 4)
 
 # Bump this one when changes do not extend the API
 set(indicate_qt_lib_PATCH_VERSION 0)

=== modified file 'src/qindicatelistener.cpp'
--- src/qindicatelistener.cpp	2010-02-15 17:46:17 +0000
+++ src/qindicatelistener.cpp	2010-03-08 09:02:19 +0000
@@ -234,6 +234,12 @@
         serverGetPropertyCB(listener, server, Q_ARG(int, value), data);
     }
 
+    static void serverGetQStringPropertyCB(IndicateListener* listener,
+        IndicateListenerServer* server, gchar* value, gpointer data)
+    {
+        serverGetPropertyCB(listener, server, Q_ARG(QString, QString::fromAscii(value)), data);
+    }
+
 private:
     static void serverGetPropertyCB(IndicateListener* listener,
         IndicateListenerServer* _server, QGenericArgument arg, gpointer data)
@@ -315,6 +321,26 @@
         GetPropertyHelper::serverGetUIntPropertyCB, helper);
 }
 
+void Listener::getServerMenuObjectPath(
+    QIndicate::Listener::Server* server,
+    QObject* receiver,
+    const char* slot)
+{
+    GetPropertyHelper* helper = new GetPropertyHelper(receiver, slot);
+
+    indicate_listener_server_get_menu(d->mGListener,
+        reinterpret_cast<IndicateListenerServer*>(server),
+        GetPropertyHelper::serverGetQStringPropertyCB, helper);
+}
+
+QString Listener::getServerMenuDBusName(QIndicate::Listener::Server* server)
+{
+    const gchar* value = indicate_listener_server_get_dbusname(
+        reinterpret_cast<IndicateListenerServer*>(server));
+
+    return QString::fromAscii(value);
+}
+
 void Listener::display(
     QIndicate::Listener::Server* server,
     QIndicate::Listener::Indicator* indicator)

=== modified file 'src/qindicatelistener.h'
--- src/qindicatelistener.h	2010-02-15 17:48:20 +0000
+++ src/qindicatelistener.h	2010-03-08 09:02:19 +0000
@@ -111,6 +111,23 @@
     void getServerCount(QIndicate::Listener::Server* server,
                         QObject* receiver, const char* slot);
 
+    /**
+     * Ask a server for the object path of its associated DBusMenu. Result will
+     * be sent to receiver slot, which should have the following signature:
+     *
+     *   QIndicate::Listener::Server*,
+     *   QString value
+     */
+    void getServerMenuObjectPath(QIndicate::Listener::Server* server,
+                                 QObject* receiver, const char* slot);
+
+    /**
+     * Ask a server for the dbus name of its associated DBusMenu. Note: unlike
+     * the other "getServer..." methods, this one returns the answer immediatly,
+     * following libindicate design.
+     */
+    QString getServerMenuDBusName(QIndicate::Listener::Server* server);
+
     void display(QIndicate::Listener::Server* server, QIndicate::Listener::Indicator* indicator);
 
     bool getInterest(QIndicate::Listener::Server*, QIndicate::Interest);