diff options
author | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-09 18:37:30 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-09 18:37:30 +0200 |
commit | bced31c677a5bb6399aad890d8e09c741bfc82a6 (patch) | |
tree | 246d75793c7611ca3489a212f378705144eb4522 | |
parent | a03e7e775a9751f87efb8fd7acf226b5eb25f4e3 (diff) | |
download | qmenumodel-bced31c677a5bb6399aad890d8e09c741bfc82a6.tar.gz qmenumodel-bced31c677a5bb6399aad890d8e09c741bfc82a6.tar.bz2 qmenumodel-bced31c677a5bb6399aad890d8e09c741bfc82a6.zip |
Avoid including C headers (glib/gio) in public headers; use "forward declarations" instead.
-rw-r--r-- | libqmenumodel/src/qdbusactiongroup.cpp | 7 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusactiongroup.h | 10 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusmenumodel.cpp | 4 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusmenumodel.h | 4 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusobject.cpp | 9 | ||||
-rw-r--r-- | libqmenumodel/src/qdbusobject.h | 12 | ||||
-rw-r--r-- | libqmenumodel/src/qmenumodel.cpp | 12 | ||||
-rw-r--r-- | libqmenumodel/src/qmenumodel.h | 8 |
8 files changed, 38 insertions, 28 deletions
diff --git a/libqmenumodel/src/qdbusactiongroup.cpp b/libqmenumodel/src/qdbusactiongroup.cpp index fc5b18e..354a08a 100644 --- a/libqmenumodel/src/qdbusactiongroup.cpp +++ b/libqmenumodel/src/qdbusactiongroup.cpp @@ -22,6 +22,7 @@ #include "converter.h" extern "C" { +#include <glib.h> #include <gio/gio.h> } @@ -211,21 +212,21 @@ void QDBusActionGroup::updateActionState(const QString &name, const QVariant &st } /*! \internal */ -void QDBusActionGroup::onActionAdded(GDBusActionGroup *, gchar *name, gpointer data) +void QDBusActionGroup::onActionAdded(GDBusActionGroup *, char *name, void *data) { QDBusActionGroup *self = reinterpret_cast<QDBusActionGroup*>(data); Q_EMIT self->actionAppear(name); } /*! \internal */ -void QDBusActionGroup::onActionRemoved(GDBusActionGroup *, gchar *name, gpointer data) +void QDBusActionGroup::onActionRemoved(GDBusActionGroup *, char *name, void *data) { QDBusActionGroup *self = reinterpret_cast<QDBusActionGroup*>(data); Q_EMIT self->actionVanish(name); } /*! \internal */ -void QDBusActionGroup::onActionStateChanged(GDBusActionGroup *, gchar *name, GVariant *value, gpointer data) +void QDBusActionGroup::onActionStateChanged(GDBusActionGroup *, char *name, GVariant *value, void *data) { QDBusActionGroup *self = reinterpret_cast<QDBusActionGroup*>(data); Q_EMIT self->actionStateChanged(name, Converter::toQVariant(value)); diff --git a/libqmenumodel/src/qdbusactiongroup.h b/libqmenumodel/src/qdbusactiongroup.h index 518f78c..24c124e 100644 --- a/libqmenumodel/src/qdbusactiongroup.h +++ b/libqmenumodel/src/qdbusactiongroup.h @@ -27,6 +27,10 @@ class QStateAction; +typedef struct _GVariant GVariant; +typedef struct _GActionGroup GActionGroup; +typedef struct _GDBusActionGroup GDBusActionGroup; + class QDBusActionGroup : public QObject, public QDBusObject { Q_OBJECT @@ -77,9 +81,9 @@ private: void clear(); // glib slots - static void onActionAdded(GDBusActionGroup *ag, gchar *name, gpointer data); - static void onActionRemoved(GDBusActionGroup *ag, gchar *name, gpointer data); - static void onActionStateChanged(GDBusActionGroup *ag, gchar *name, GVariant *value, gpointer data); + static void onActionAdded(GDBusActionGroup *ag, char *name, void *data); + static void onActionRemoved(GDBusActionGroup *ag, char *name, void *data); + static void onActionStateChanged(GDBusActionGroup *ag, char *name, GVariant *value, void *data); }; #endif diff --git a/libqmenumodel/src/qdbusmenumodel.cpp b/libqmenumodel/src/qdbusmenumodel.cpp index ae88c35..f3da989 100644 --- a/libqmenumodel/src/qdbusmenumodel.cpp +++ b/libqmenumodel/src/qdbusmenumodel.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <gio/gio.h> +} + #include "qdbusmenumodel.h" /*! diff --git a/libqmenumodel/src/qdbusmenumodel.h b/libqmenumodel/src/qdbusmenumodel.h index fdf23f7..5beb3b9 100644 --- a/libqmenumodel/src/qdbusmenumodel.h +++ b/libqmenumodel/src/qdbusmenumodel.h @@ -23,10 +23,6 @@ #include "qdbusobject.h" #include "qmenumodel.h" -extern "C" { -#include <gio/gio.h> -} - class QDBusMenuModel : public QMenuModel, public QDBusObject { Q_OBJECT diff --git a/libqmenumodel/src/qdbusobject.cpp b/libqmenumodel/src/qdbusobject.cpp index 63be580..4520323 100644 --- a/libqmenumodel/src/qdbusobject.cpp +++ b/libqmenumodel/src/qdbusobject.cpp @@ -17,6 +17,11 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <glib-object.h> +#include <gio/gio.h> +} + #include "qdbusobject.h" #include <QDebug> @@ -171,7 +176,7 @@ void QDBusObject::disconnect() } } -void QDBusObject::onServiceAppeared(GDBusConnection *connection, const gchar *, const gchar *, gpointer data) +void QDBusObject::onServiceAppeared(GDBusConnection *connection, const char *, const char *, void *data) { QDBusObject *self = reinterpret_cast<QDBusObject*>(data); @@ -179,7 +184,7 @@ void QDBusObject::onServiceAppeared(GDBusConnection *connection, const gchar *, self->serviceAppear(connection); } -void QDBusObject::onServiceVanished(GDBusConnection *connection, const gchar *, gpointer data) +void QDBusObject::onServiceVanished(GDBusConnection *connection, const char *, void *data) { QDBusObject *self = reinterpret_cast<QDBusObject*>(data); diff --git a/libqmenumodel/src/qdbusobject.h b/libqmenumodel/src/qdbusobject.h index ef2b42f..1c5c08d 100644 --- a/libqmenumodel/src/qdbusobject.h +++ b/libqmenumodel/src/qdbusobject.h @@ -20,14 +20,12 @@ #ifndef QDBUSOBJECT_H #define QDBUSOBJECT_H -extern "C" { -#include <gio/gio.h> -} - #include <QString> #include "dbus-enums.h" +typedef struct _GDBusConnection GDBusConnection; + class QDBusObject { public: @@ -59,7 +57,7 @@ protected: virtual void statusChanged(DBusEnums::ConnectionStatus status) = 0; private: - guint m_watchId; + quint32 m_watchId; DBusEnums::BusType m_busType; QString m_busName; QString m_objectPath; @@ -68,8 +66,8 @@ private: void setStatus(DBusEnums::ConnectionStatus status); // glib slots - static void onServiceAppeared(GDBusConnection *connection, const gchar *name, const gchar *name_owner, gpointer data); - static void onServiceVanished(GDBusConnection *connection, const gchar *name, gpointer data); + static void onServiceAppeared(GDBusConnection *connection, const char *name, const char *name_owner, void *data); + static void onServiceVanished(GDBusConnection *connection, const char *name, void *data); }; #endif diff --git a/libqmenumodel/src/qmenumodel.cpp b/libqmenumodel/src/qmenumodel.cpp index 4c0fc23..a34cb47 100644 --- a/libqmenumodel/src/qmenumodel.cpp +++ b/libqmenumodel/src/qmenumodel.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <gio/gio.h> +} + #include "qmenumodel.h" #include "converter.h" @@ -205,10 +209,10 @@ QVariant QMenuModel::getExtraProperties(const QModelIndex &index) const /*! \internal */ void QMenuModel::onItemsChanged(GMenuModel *, - gint position, - gint removed, - gint added, - gpointer data) + int position, + int removed, + int added, + void *data) { QMenuModel *self = reinterpret_cast<QMenuModel*>(data); diff --git a/libqmenumodel/src/qmenumodel.h b/libqmenumodel/src/qmenumodel.h index 7520480..af27802 100644 --- a/libqmenumodel/src/qmenumodel.h +++ b/libqmenumodel/src/qmenumodel.h @@ -22,9 +22,7 @@ #include <QAbstractListModel> -extern "C" { -#include <gio/gio.h> -} +typedef struct _GMenuModel GMenuModel; class QMenuModel : public QAbstractListModel { @@ -53,14 +51,14 @@ protected: private: GMenuModel *m_menuModel; - guint m_signalChangedId; + quint32 m_signalChangedId; QVariant getStringAttribute(const QModelIndex &index, const QString &attribute) const; QVariant getLink(const QModelIndex &index, const QString &linkName) const; QVariant getExtraProperties(const QModelIndex &index) const; QString parseExtraPropertyName(const QString &name) const; - static void onItemsChanged(GMenuModel *model, gint position, gint removed, gint added, gpointer data); + static void onItemsChanged(GMenuModel *model, int position, int removed, int added, void *data); }; #endif |