/srv/mercurial-server/detachablepurple: bb06e9bd2edd: Moved and ...
Gilles Bedel
gillux at cpw.pidgin.im
Fri Jun 15 22:01:51 EDT 2012
Changeset: bb06e9bd2edd30a21fbce34c816afe2fca634caa
Author: Gilles Bedel <gillux at cpw.pidgin.im>
Date: 2012-05-29 15:38 +0000
Branch: cpw.gillux.detachablepurple
URL: http://hg.pidgin.im/srv/mercurial-server/detachablepurple/rev/bb06e9bd2edd
Description:
Moved and renamed the D-Bus path names #define's.
Putting these in public headers is only relevant for well-known names.
Otherwise we keep them private in the .c file.
diffstat:
libpurple/dbus-purple.h | 9 ---------
libpurple/dbus-server.h | 5 +++++
libpurple/dbus/account.c | 4 +++-
libpurple/dbus/blist.c | 2 +-
libpurple/dbus/buddy.c | 6 ++++--
libpurple/dbus/chat.c | 4 +++-
libpurple/dbus/connection.c | 4 +++-
libpurple/dbus/contact.c | 4 +++-
libpurple/dbus/group.c | 6 ++++--
9 files changed, 26 insertions(+), 18 deletions(-)
diffs (195 lines):
diff --git a/libpurple/dbus-purple.h b/libpurple/dbus-purple.h
--- a/libpurple/dbus-purple.h
+++ b/libpurple/dbus-purple.h
@@ -29,31 +29,22 @@
#define DBUS_INTERFACE_PURPLE "im.pidgin.purple.PurpleInterface"
#define DBUS_PURPLE_SERVICE "im.pidgin.purple"
-#define DBUS_ACCOUNT_PATH "/im/pidgin/purple/account"
#define DBUS_ACCOUNT_INTERFACE "im.pidgin.purple.account"
-#define DBUS_BLIST_PATH "/im/pidgin/purple/blist"
#define DBUS_BLIST_INTERFACE "im.pidgin.purple.blist"
-#define DBUS_BUDDY_PATH "/im/pidgin/purple/buddy"
#define DBUS_BUDDY_INTERFACE "im.pidgin.purple.buddy"
-#define DBUS_CHAT_PATH "/im/pidgin/purple/chat"
#define DBUS_CHAT_INTERFACE "im.pidgin.purple.chat"
-#define DBUS_CONNECTION_PATH "/im/pidgin/purple/connection"
#define DBUS_CONNECTION_INTERFACE "im.pidgin.purple.connection"
-#define DBUS_CONTACT_PATH "/im/pidgin/purple/contact"
#define DBUS_CONTACT_INTERFACE "im.pidgin.purple.contact"
-#define DBUS_GROUP_PATH "/im/pidgin/purple/group"
#define DBUS_GROUP_INTERFACE "im.pidgin.purple.group"
-#define DBUS_CONSTRUCTOR_PATH "/im/pidgin/purple/constructor"
#define DBUS_CONSTRUCTOR_INTERFACE "im.pidgin.purple.constructor"
-#define DBUS_CALLBACK_PATH "/im/pidgin/purple/callback"
#define DBUS_CALLBACK_INTERFACE "im.pidgin.purple.callback"
#endif /* _DBUS_PURPLE_H_ */
diff --git a/libpurple/dbus-server.h b/libpurple/dbus-server.h
--- a/libpurple/dbus-server.h
+++ b/libpurple/dbus-server.h
@@ -91,6 +91,11 @@
#define DBUS_TIMEOUT_MSEC (20 * 1000)
+/** Well-known D-Bus path names. */
+#define DBUS_CONSTRUCTOR_PATH "/im/pidgin/purple/constructor"
+#define DBUS_CALLBACK_PATH "/im/pidgin/purple/callback"
+#define DBUS_BLIST_PATH "/im/pidgin/purple/blist"
+
/**
Initializes purple dbus pointer registration engine.
diff --git a/libpurple/dbus/account.c b/libpurple/dbus/account.c
--- a/libpurple/dbus/account.c
+++ b/libpurple/dbus/account.c
@@ -35,6 +35,8 @@
/* D-Bus methods and callbacks implementations. */
static GVariant *account_unregister_cb(PurpleAccount *account, gboolean have_callback);
+#define DBUS_ACCOUNT_BASEPATH "/im/pidgin/purple/account"
+
/**
* Callback called on the client when the user accepted an auth request.
* It runs the RunRequest method on the daemon, with the original request id,
@@ -112,7 +114,7 @@
id2 = purple_dbus_sanitize_dbus_path(id);
g_free(id);
- id = g_strjoin("/", DBUS_ACCOUNT_PATH, id2, NULL);
+ id = g_strjoin("/", DBUS_ACCOUNT_BASEPATH, id2, NULL);
g_free(id2);
return id;
diff --git a/libpurple/dbus/blist.c b/libpurple/dbus/blist.c
--- a/libpurple/dbus/blist.c
+++ b/libpurple/dbus/blist.c
@@ -29,7 +29,7 @@
#include "dbus/blist.xml.h"
#include "dbus/constructor.h"
#include "dbus-maybe.h"
-#include "dbus-purple.h"
+#include "dbus-server.h"
/* The type PurpleBuddyList is only defined in libpurple/blist.c. While we
* don't strictly need it, we use it here and there for the sake of
diff --git a/libpurple/dbus/buddy.c b/libpurple/dbus/buddy.c
--- a/libpurple/dbus/buddy.c
+++ b/libpurple/dbus/buddy.c
@@ -28,6 +28,8 @@
#include "dbus-server.h"
#include "pobject.h"
+#define DBUS_BUDDY_BASEPATH "/im/pidgin/purple/buddy"
+
static char *
purple_buddy_build_dbus_path(PurpleObject *pobject)
{
@@ -42,10 +44,10 @@
* name, to make a meaningful path. */
if (name) {
name_valid = purple_dbus_sanitize_dbus_path(name);
- path = g_strdup_printf(DBUS_BUDDY_PATH "/%u_%s", buddy_id++, name_valid);
+ path = g_strdup_printf(DBUS_BUDDY_BASEPATH "/%u_%s", buddy_id++, name_valid);
g_free(name_valid);
} else {
- path = g_strdup_printf(DBUS_BUDDY_PATH "/%u", buddy_id++);
+ path = g_strdup_printf(DBUS_BUDDY_BASEPATH "/%u", buddy_id++);
}
return path;
diff --git a/libpurple/dbus/chat.c b/libpurple/dbus/chat.c
--- a/libpurple/dbus/chat.c
+++ b/libpurple/dbus/chat.c
@@ -29,13 +29,15 @@
#include "dbus-server.h"
#include "pobject.h"
+#define DBUS_CHAT_BASEPATH "/im/pidgin/purple/chat"
+
static char *
purple_chat_build_dbus_path(PurpleObject *pobject)
{
static unsigned int chat_id = 0;
/* There is nothing to identify chats but this internal id. */
- return g_strdup_printf(DBUS_CHAT_PATH "/%u", chat_id++);
+ return g_strdup_printf(DBUS_CHAT_BASEPATH "/%u", chat_id++);
}
static void
diff --git a/libpurple/dbus/connection.c b/libpurple/dbus/connection.c
--- a/libpurple/dbus/connection.c
+++ b/libpurple/dbus/connection.c
@@ -28,6 +28,8 @@
#include "dbus-purple.h"
#include "pobject.h"
+#define DBUS_CONNECTION_BASEPATH "/im/pidgin/purple/connection"
+
static char*
purple_connection_build_dbus_path(PurpleObject *pobject)
{
@@ -40,7 +42,7 @@
username = purple_account_get_username(account);
proto = purple_account_get_protocol_id(account);
- path = g_strjoin("/", DBUS_CONNECTION_PATH, proto, username, NULL);
+ path = g_strjoin("/", DBUS_CONNECTION_BASEPATH, proto, username, NULL);
path_valid = purple_dbus_sanitize_dbus_path(path);
g_free(path);
diff --git a/libpurple/dbus/contact.c b/libpurple/dbus/contact.c
--- a/libpurple/dbus/contact.c
+++ b/libpurple/dbus/contact.c
@@ -28,6 +28,8 @@
#include "dbus-server.h"
#include "pobject.h"
+#define DBUS_CONTACT_BASEPATH "/im/pidgin/purple/contact"
+
static char *
purple_contact_build_dbus_path(PurpleObject *pobj)
{
@@ -35,7 +37,7 @@
/* Contacts have nothing unique nor that identify themselves
* at the time they are created. So we use a poor id. */
- return g_strdup_printf(DBUS_CONTACT_PATH "/%u", contact_id++);
+ return g_strdup_printf(DBUS_CONTACT_BASEPATH "/%u", contact_id++);
}
static void
diff --git a/libpurple/dbus/group.c b/libpurple/dbus/group.c
--- a/libpurple/dbus/group.c
+++ b/libpurple/dbus/group.c
@@ -28,6 +28,8 @@
#include "dbus-server.h"
#include "pobject.h"
+#define DBUS_GROUP_BASEPATH "/im/pidgin/purple/group"
+
static char *
purple_group_build_dbus_path(PurpleObject *pobject)
{
@@ -43,10 +45,10 @@
* meaningful, since groups are rarely renamed. */
if (name) {
name_valid = purple_dbus_sanitize_dbus_path(name);
- path = g_strdup_printf(DBUS_GROUP_PATH "/%u_%s", group_id++, name_valid);
+ path = g_strdup_printf(DBUS_GROUP_BASEPATH "/%u_%s", group_id++, name_valid);
g_free(name_valid);
} else {
- path = g_strdup_printf(DBUS_GROUP_PATH "/%u", group_id++);
+ path = g_strdup_printf(DBUS_GROUP_BASEPATH "/%u", group_id++);
}
return path;
More information about the Commits
mailing list