diff options
-rw-r--r-- | TODO | 22 | ||||
-rw-r--r-- | configure.ac | 76 | ||||
-rw-r--r-- | docs/reference/ytstenut/Makefile.am | 12 | ||||
-rw-r--r-- | docs/reference/ytstenut/ytstenut-docs.xml.in | 34 | ||||
-rw-r--r-- | docs/reference/ytstenut/ytstenut-sections.txt | 328 | ||||
-rw-r--r-- | examples/Makefile.am | 8 | ||||
-rw-r--r-- | examples/echo.c | 84 | ||||
-rw-r--r-- | examples/invocation-message.c | 58 | ||||
-rw-r--r-- | examples/status.c | 64 | ||||
-rw-r--r-- | examples/video-profile/Makefile.am | 8 | ||||
-rw-r--r-- | examples/video-profile/mock-player.c | 86 | ||||
-rw-r--r-- | examples/video-profile/player.c | 46 | ||||
-rw-r--r-- | examples/video-profile/remote.c | 120 | ||||
-rw-r--r-- | tests/Makefile.am | 20 | ||||
-rw-r--r-- | tests/file-transfer.c | 56 | ||||
-rw-r--r-- | tests/local-connection.c | 56 | ||||
-rw-r--r-- | tests/message-send.c | 62 | ||||
-rw-r--r-- | tests/message.c | 24 | ||||
-rw-r--r-- | tests/metadata-service.c | 40 | ||||
-rw-r--r-- | tests/status-set.c | 58 | ||||
-rw-r--r-- | tests/status.c | 52 | ||||
-rw-r--r-- | ytstenut/Makefile.am | 230 | ||||
-rw-r--r-- | ytstenut/empathy-tp-file.c | 32 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-adapter.c (renamed from ytstenut/profile/ytsg-profile-adapter.c) | 68 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-adapter.h | 61 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-impl.c (renamed from ytstenut/profile/ytsg-profile-impl.c) | 118 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-impl.h (renamed from ytstenut/profile/ytsg-profile-impl.h) | 44 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-proxy.c (renamed from ytstenut/profile/ytsg-profile-proxy.c) | 82 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-proxy.h | 60 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile.c (renamed from ytstenut/profile/ytsg-profile.c) | 56 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile.h (renamed from ytstenut/profile/ytsg-profile.h) | 46 | ||||
-rw-r--r-- | ytstenut/profile/ytsg-profile-adapter.h | 61 | ||||
-rw-r--r-- | ytstenut/profile/ytsg-profile-proxy.h | 60 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-content.c (renamed from ytstenut/video-profile/ytsg-vp-content.c) | 44 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-content.h (renamed from ytstenut/video-profile/ytsg-vp-content.h) | 52 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-playable-proxy.c (renamed from ytstenut/video-profile/ytsg-vp-playable-proxy.c) | 42 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-playable-proxy.h (renamed from ytstenut/video-profile/ytsg-vp-playable-proxy.h) | 44 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-playable.c (renamed from ytstenut/video-profile/ytsg-vp-playable.c) | 44 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-playable.h (renamed from ytstenut/video-profile/ytsg-vp-playable.h) | 44 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-player-adapter.c (renamed from ytstenut/video-profile/ytsg-vp-player-adapter.c) | 118 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-player-adapter.h | 65 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-player-proxy.c (renamed from ytstenut/video-profile/ytsg-vp-player-proxy.c) | 138 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-player-proxy.h (renamed from ytstenut/video-profile/ytsg-vp-player-proxy.h) | 46 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-player.c (renamed from ytstenut/video-profile/ytsg-vp-player.c) | 112 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-player.h (renamed from ytstenut/video-profile/ytsg-vp-player.h) | 72 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-query.c (renamed from ytstenut/video-profile/ytsg-vp-query.c) | 46 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-query.h (renamed from ytstenut/video-profile/ytsg-vp-query.h) | 42 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transcript-adapter.c (renamed from ytstenut/video-profile/ytsg-vp-transcript-adapter.c) | 90 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transcript-adapter.h | 66 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transcript-proxy.c (renamed from ytstenut/video-profile/ytsg-vp-transcript-proxy.c) | 84 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transcript-proxy.h | 66 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transcript.c (renamed from ytstenut/video-profile/ytsg-vp-transcript.c) | 28 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transcript.h (renamed from ytstenut/video-profile/ytsg-vp-transcript.h) | 40 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transfer.c (renamed from ytstenut/video-profile/ytsg-vp-transfer.c) | 40 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transfer.h (renamed from ytstenut/video-profile/ytsg-vp-transfer.h) | 48 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transmission.c (renamed from ytstenut/video-profile/ytsg-vp-transmission.c) | 20 | ||||
-rw-r--r-- | ytstenut/video-profile/yts-vp-transmission.h (renamed from ytstenut/video-profile/ytsg-vp-transmission.h) | 36 | ||||
-rw-r--r-- | ytstenut/video-profile/ytsg-vp-player-adapter.h | 65 | ||||
-rw-r--r-- | ytstenut/video-profile/ytsg-vp-transcript-adapter.h | 66 | ||||
-rw-r--r-- | ytstenut/video-profile/ytsg-vp-transcript-proxy.h | 66 | ||||
-rw-r--r-- | ytstenut/yts-capability-status.c (renamed from ytstenut/ytsg-capability-status.c) | 22 | ||||
-rw-r--r-- | ytstenut/yts-capability-status.h | 64 | ||||
-rw-r--r-- | ytstenut/yts-capability.c (renamed from ytstenut/ytsg-capability.c) | 12 | ||||
-rw-r--r-- | ytstenut/yts-capability.h (renamed from ytstenut/ytsg-capability.h) | 30 | ||||
-rw-r--r-- | ytstenut/yts-caps.h (renamed from ytstenut/ytsg-caps.h) | 90 | ||||
-rw-r--r-- | ytstenut/yts-client.c (renamed from ytstenut/ytsg-client.c) | 1126 | ||||
-rw-r--r-- | ytstenut/yts-client.h | 158 | ||||
-rw-r--r-- | ytstenut/yts-contact.c (renamed from ytstenut/ytsg-contact.c) | 548 | ||||
-rw-r--r-- | ytstenut/yts-contact.h | 122 | ||||
-rw-r--r-- | ytstenut/yts-debug.h (renamed from ytstenut/ytsg-debug.h) | 90 | ||||
-rw-r--r-- | ytstenut/yts-enum-types.c.in (renamed from ytstenut/ytsg-enum-types.c.in) | 2 | ||||
-rw-r--r-- | ytstenut/yts-enum-types.h.in (renamed from ytstenut/ytsg-enum-types.h.in) | 8 | ||||
-rw-r--r-- | ytstenut/yts-error-message.c (renamed from ytstenut/ytsg-error-message.c) | 22 | ||||
-rw-r--r-- | ytstenut/yts-error-message.h (renamed from ytstenut/ytsg-error-message.h) | 44 | ||||
-rw-r--r-- | ytstenut/yts-error.c (renamed from ytstenut/ytsg-error.c) | 68 | ||||
-rw-r--r-- | ytstenut/yts-error.h | 70 | ||||
-rw-r--r-- | ytstenut/yts-event-message.c (renamed from ytstenut/ytsg-event-message.c) | 22 | ||||
-rw-r--r-- | ytstenut/yts-event-message.h (renamed from ytstenut/ytsg-event-message.h) | 44 | ||||
-rw-r--r-- | ytstenut/yts-invocation-message.c (renamed from ytstenut/ytsg-invocation-message.c) | 22 | ||||
-rw-r--r-- | ytstenut/yts-invocation-message.h | 65 | ||||
-rw-r--r-- | ytstenut/yts-main.c (renamed from ytstenut/ytsg-main.c) | 150 | ||||
-rw-r--r-- | ytstenut/yts-main.h (renamed from ytstenut/ytsg-main.h) | 10 | ||||
-rw-r--r-- | ytstenut/yts-message.c (renamed from ytstenut/ytsg-message.c) | 84 | ||||
-rw-r--r-- | ytstenut/yts-message.h | 86 | ||||
-rw-r--r-- | ytstenut/yts-metadata-service.c (renamed from ytstenut/ytsg-metadata-service.c) | 196 | ||||
-rw-r--r-- | ytstenut/yts-metadata-service.h | 75 | ||||
-rw-r--r-- | ytstenut/yts-metadata.c (renamed from ytstenut/ytsg-metadata.c) | 228 | ||||
-rw-r--r-- | ytstenut/yts-metadata.h | 92 | ||||
-rw-r--r-- | ytstenut/yts-private.h (renamed from ytstenut/ytsg-private.h) | 74 | ||||
-rw-r--r-- | ytstenut/yts-proxy-service.c (renamed from ytstenut/ytsg-proxy-service.c) | 162 | ||||
-rw-r--r-- | ytstenut/yts-proxy-service.h (renamed from ytstenut/ytsg-proxy-service.h) | 52 | ||||
-rw-r--r-- | ytstenut/yts-proxy.c (renamed from ytstenut/ytsg-proxy.c) | 64 | ||||
-rw-r--r-- | ytstenut/yts-proxy.h (renamed from ytstenut/ytsg-proxy.h) | 48 | ||||
-rw-r--r-- | ytstenut/yts-response-message.c (renamed from ytstenut/ytsg-response-message.c) | 22 | ||||
-rw-r--r-- | ytstenut/yts-response-message.h | 64 | ||||
-rw-r--r-- | ytstenut/yts-roster.c (renamed from ytstenut/ytsg-roster.c) | 306 | ||||
-rw-r--r-- | ytstenut/yts-roster.h | 93 | ||||
-rw-r--r-- | ytstenut/yts-service-adapter.c (renamed from ytstenut/ytsg-service-adapter.c) | 86 | ||||
-rw-r--r-- | ytstenut/yts-service-adapter.h (renamed from ytstenut/ytsg-service-adapter.h) | 62 | ||||
-rw-r--r-- | ytstenut/yts-service.c (renamed from ytstenut/ytsg-service.c) | 198 | ||||
-rw-r--r-- | ytstenut/yts-service.h | 98 | ||||
-rw-r--r-- | ytstenut/yts-status.c (renamed from ytstenut/ytsg-status.c) | 84 | ||||
-rw-r--r-- | ytstenut/yts-status.h | 85 | ||||
-rw-r--r-- | ytstenut/yts-types.h (renamed from ytstenut/ytsg-types.h) | 64 | ||||
-rw-r--r-- | ytstenut/yts-version.h.in (renamed from ytstenut/ytsg-version.h.in) | 50 | ||||
-rw-r--r-- | ytstenut/ytsg-capability-status.h | 64 | ||||
-rw-r--r-- | ytstenut/ytsg-client.h | 158 | ||||
-rw-r--r-- | ytstenut/ytsg-contact.h | 122 | ||||
-rw-r--r-- | ytstenut/ytsg-error.h | 70 | ||||
-rw-r--r-- | ytstenut/ytsg-invocation-message.h | 65 | ||||
-rw-r--r-- | ytstenut/ytsg-message.h | 86 | ||||
-rw-r--r-- | ytstenut/ytsg-metadata-service.h | 75 | ||||
-rw-r--r-- | ytstenut/ytsg-metadata.h | 92 | ||||
-rw-r--r-- | ytstenut/ytsg-response-message.h | 64 | ||||
-rw-r--r-- | ytstenut/ytsg-roster.h | 93 | ||||
-rw-r--r-- | ytstenut/ytsg-service.h | 98 | ||||
-rw-r--r-- | ytstenut/ytsg-status.h | 85 | ||||
-rw-r--r-- | ytstenut/ytstenut.h | 64 |
118 files changed, 5077 insertions, 5077 deletions
@@ -1,16 +1,16 @@ TODO -* ytsg_client_connect_to_mesh() -> ytsg_client_connect() +* yts_client_connect_to_mesh() -> yts_client_connect() * Need to pass jid, or better sending service, with received message. * Roster should be created with _new() instead of _get() from client. -* Should send-file really be with YtsgContact? Why not Service? Which service is receiving the file? +* Should send-file really be with YtsContact? Why not Service? Which service is receiving the file? * Get rid of --enable-docs and adhere to --enable-gtk-doc only. -* Add checking and error reporting when service name doesn't conform when creating YtsgClient. -* ytsg_client_set_status_by_capability() is not in the docs. +* Add checking and error reporting when service name doesn't conform when creating YtsClient. +* yts_client_set_status_by_capability() is not in the docs. * Add "services" property to Contact. * Should allow xml inside messages? -* There should be a common (abstract?) base-class that YtsgMetadata and YtsgInvocationMessage etc derive from -- YtsgDatagram probably. -* YtsgService should maybe be YtsgRemoteService. +* There should be a common (abstract?) base-class that YtsMetadata and YtsInvocationMessage etc derive from -- YtsDatagram probably. +* YtsService should maybe be YtsRemoteService. * The pc file name should contain the API version. * Look at using xml-rpc * Globally rename "com.meego.xpmn.ytstenut" to "org.freedesktop.ytstenut". @@ -19,21 +19,21 @@ TODO * Implement generic service proxy and replace MetadataService with it. * Implement capabilities boxed type and use it everywhere. * Implement error message handling on the client side, or do away with it altogether, or maybe rename to exception. Or maybe just make it an event? -* Use exported symbols list when linking and generate sections.txt from it and, say, sections.txt.in, using "ytsg_client_*" and the like. +* Use exported symbols list when linking and generate sections.txt from it and, say, sections.txt.in, using "yts_client_*" and the like. * Merge Event and Response classes, and use them instead of InvocationData, so they just need to be filled and sent out. * Maybe the message class should be initially unowned as well. * ServiceAdapater and Proxy classes should probably be abstract, maybe have a generic implementation subclass one day. * Every response should possibly be an error I guess. * Should there be a response for void returning invocations, and should it just be a NULL error if all went well? -- probably not, but there should be a response signal for every method in case an error occurred ... YES. * Service should probably be called something else. Probably Facet. A Profile is made up of Facets, consisting of Aspects. Liking it. Very leet. -* Should probably pull out all of the profile handling of YtsgClient into a class of its own. YtsgServiceManager? +* Should probably pull out all of the profile handling of YtsClient into a class of its own. YtsServiceManager? * InvocationID should carry the info to find back the method, obsoleting the hash tables. Would that work? * After registering the proxy, the server side should notify all properties so they are synched. Hmm but that would sync them to all listeners, need a special mode for that. Also should have batch synch later probably. -* When proxy dies, should not the server be aware of it through TP? Seems ytsg_client_cleanup_contact does not run. Maybe a refcounting thing? +* When proxy dies, should not the server be aware of it through TP? Seems yts_client_cleanup_contact does not run. Maybe a refcounting thing? * fqc-id should probably be a quark and named fqc-quark. -* Every service interface method should return YtsgReturn, which takes an error or a variant on the server side, and an invocation_id on the client side. +* Every service interface method should return YtsReturn, which takes an error or a variant on the server side, and an invocation_id on the client side. * Do roundtrip-based property-set in proxies. Needs helper setters a la Transcript. -* Allow multiple services being implemented by a single object. YtsgCapabilities.capabilitiy must become plural, and ServiceAdapter hold the capability itself. +* Allow multiple services being implemented by a single object. YtsCapabilities.capabilitiy must become plural, and ServiceAdapter hold the capability itself. Code Review ----------- diff --git a/configure.ac b/configure.ac index 4edc0cc..1eb8060 100644 --- a/configure.ac +++ b/configure.ac @@ -1,26 +1,26 @@ -m4_define([ytsg_major_version], [0]) -m4_define([ytsg_minor_version], [3]) -m4_define([ytsg_micro_version], [0]) -m4_define([ytsg_version], - [ytsg_major_version.ytsg_minor_version.ytsg_micro_version]) +m4_define([yts_major_version], [0]) +m4_define([yts_minor_version], [3]) +m4_define([yts_micro_version], [0]) +m4_define([yts_version], + [yts_major_version.yts_minor_version.yts_micro_version]) -m4_define([ytsg_api_version], [1.0]) +m4_define([yts_api_version], [1.0]) # increase the interface age of 2 for each release # set to 0 if the API changes -m4_define([ytsg_interface_age], [0]) -m4_define([ytsg_binary_age], [m4_eval(100 * ytsg_minor_version + ytsg_micro_version)]) +m4_define([yts_interface_age], [0]) +m4_define([yts_binary_age], [m4_eval(100 * yts_minor_version + yts_micro_version)]) -m4_define([ytsg_lt_current], [m4_eval(100 * ytsg_minor_version + ytsg_micro_version - ytsg_interface_age)]) -m4_define([ytsg_lt_revision], [ytsg_interface_age]) -m4_define([ytsg_lt_age], [m4_eval(ytsg_binary_age - ytsg_interface_age)]) +m4_define([yts_lt_current], [m4_eval(100 * yts_minor_version + yts_micro_version - yts_interface_age)]) +m4_define([yts_lt_revision], [yts_interface_age]) +m4_define([yts_lt_age], [m4_eval(yts_binary_age - yts_interface_age)]) # defaults m4_define([default_enable_cache], [no]) AC_PREREQ([2.59]) -AC_INIT([ytstenut], [ytsg_version], [http://ytstenut.meego.com]) +AC_INIT([ytstenut], [yts_version], [http://ytstenut.meego.com]) AC_CONFIG_MACRO_DIR([build/autotools]) AC_CONFIG_SRCDIR(ytstenut/ytstenut.h) @@ -29,16 +29,16 @@ AM_INIT_AUTOMAKE([tar-ustar dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],[]) -YTSG_MAJOR_VERSION=ytsg_major_version -YTSG_MINOR_VERSION=ytsg_minor_version -YTSG_MICRO_VERSION=ytsg_micro_version -YTSG_VERSION=ytsg_version -YTSG_API_VERSION=ytsg_api_version -AC_SUBST(YTSG_MAJOR_VERSION) -AC_SUBST(YTSG_MINOR_VERSION) -AC_SUBST(YTSG_MICRO_VERSION) -AC_SUBST(YTSG_VERSION) -AC_SUBST(YTSG_API_VERSION) +YTS_MAJOR_VERSION=yts_major_version +YTS_MINOR_VERSION=yts_minor_version +YTS_MICRO_VERSION=yts_micro_version +YTS_VERSION=yts_version +YTS_API_VERSION=yts_api_version +AC_SUBST(YTS_MAJOR_VERSION) +AC_SUBST(YTS_MINOR_VERSION) +AC_SUBST(YTS_MICRO_VERSION) +AC_SUBST(YTS_VERSION) +AC_SUBST(YTS_API_VERSION) AM_CONFIG_HEADER([config.h]) @@ -59,7 +59,7 @@ AC_SUBST(GLIB_PREFIX) TELEPATHY_VERSION=">= 0.11.7" AC_SUBST(TELEPATHY_VERSION) -YTSG_PC_MODULES="$YTSG_PC_MODULES telepathy-glib $TELEPATHY_VERSION telepathy-ytstenut-glib gio-unix-2.0 rest-0.7 glib-2.0 gobject-2.0" +YTS_PC_MODULES="$YTS_PC_MODULES telepathy-glib $TELEPATHY_VERSION telepathy-ytstenut-glib gio-unix-2.0 rest-0.7 glib-2.0 gobject-2.0" AC_ARG_ENABLE([docs], [AC_HELP_STRING([--enable-docs=@<:@no/yes@:>@], @@ -69,7 +69,7 @@ AC_ARG_ENABLE([docs], AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"]) -m4_define([debug_default], [m4_if(m4_eval(ytsg_minor_version % 2), [1], [yes], [minimum])]) +m4_define([debug_default], [m4_if(m4_eval(yts_minor_version % 2), [1], [yes], [minimum])]) AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@], [Control Ytstenut debugging level @<:@default=debug_default@:>@])], @@ -81,19 +81,19 @@ AS_CASE([$enable_debug], [yes], [ test "$cflags_set" = set || CFLAGS="$CFLAGS -g -O0" - YTSG_DEBUG_CFLAGS="-DYTSG_ENABLE_DEBUG" + YTS_DEBUG_CFLAGS="-DYTS_ENABLE_DEBUG" ], [minimum], - [YTSG_DEBUG_CFLAGS="-DYTSG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"], + [YTS_DEBUG_CFLAGS="-DYTS_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"], [no], - [YTSG_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"], + [YTS_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"], [AC_MSG_ERROR([Unknown argument for --enable-debug])] ) -AC_SUBST(YTSG_DEBUG_CFLAGS) +AC_SUBST(YTS_DEBUG_CFLAGS) have_introspection=no AC_ARG_WITH(introspection, @@ -105,7 +105,7 @@ AC_ARG_WITH(introspection, if test x$with_introspection != xno; then PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0, have_introspection=yes, have_introspection=no) if test x$have_introspection = xyes; then - YTSG_PC_MODULES="$YTSG_PC_MODULES gobject-introspection-1.0" + YTS_PC_MODULES="$YTS_PC_MODULES gobject-introspection-1.0" AC_DEFINE(HAVE_INTROSPECTION, 1, [Define if GObject introspection is available]) G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0` AC_SUBST(G_IR_SCANNER) @@ -125,7 +125,7 @@ if test x$with_introspection != xno; then fi AM_CONDITIONAL(WITH_INTROSPECTION, test "$have_introspection" = "yes") -PKG_CHECK_MODULES(YTSG, $YTSG_PC_MODULES) +PKG_CHECK_MODULES(YTS, $YTS_PC_MODULES) AC_ARG_ENABLE([profile], [AC_HELP_STRING([--enable-profile], @@ -143,15 +143,15 @@ AC_SUBST(GLIB_GENMARSHAL) GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` AC_SUBST(GLIB_MKENUMS) -YTSG_LT_CURRENT=ytsg_lt_current -YTSG_LT_REV=ytsg_lt_revision -YTSG_AGE=ytsg_lt_age -YTSG_LT_VERSION="$YTSG_LT_CURRENT:$YTSG_LT_REV:$YTSG_LT_AGE" +YTS_LT_CURRENT=yts_lt_current +YTS_LT_REV=yts_lt_revision +YTS_AGE=yts_lt_age +YTS_LT_VERSION="$YTS_LT_CURRENT:$YTS_LT_REV:$YTS_LT_AGE" -YTSG_LT_LDFLAGS="-version-info $YTSG_LT_VERSION" +YTS_LT_LDFLAGS="-version-info $YTS_LT_VERSION" -AC_SUBST(YTSG_LT_VERSION) -AC_SUBST(YTSG_LT_LDFLAGS) +AC_SUBST(YTS_LT_VERSION) +AC_SUBST(YTS_LT_LDFLAGS) AC_OUTPUT([ Makefile @@ -162,7 +162,7 @@ AC_OUTPUT([ examples/Makefile examples/video-profile/Makefile ytstenut/Makefile - ytstenut/ytsg-version.h + ytstenut/yts-version.h ytstenut/ytstenut-1.pc tests/Makefile ]) diff --git a/docs/reference/ytstenut/Makefile.am b/docs/reference/ytstenut/Makefile.am index 65a989e..3424069 100644 --- a/docs/reference/ytstenut/Makefile.am +++ b/docs/reference/ytstenut/Makefile.am @@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = 1.6 DOC_MODULE=ytstenut # Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=$(YTSG_VERSION) +#DOC_MODULE_VERSION=$(YTS_VERSION) # The top-level SGML file. You can change this if you want to. @@ -17,7 +17,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml DOC_SOURCE_DIR=../../../ytstenut # Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS=--type-init-func="ytsg_init (NULL, NULL)" +SCANGOBJ_OPTIONS=--type-init-func="yts_init (NULL, NULL)" # Extra options to supply to gtkdoc-scan. # e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" @@ -55,8 +55,8 @@ EXTRA_HFILES= # Header files to ignore when scanning. Use base file name, no paths # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h IGNORE_HFILES= \ - ytsg-marshal.h \ - ytsg-enum-types.h + yts-marshal.h \ + yts-enum-types.h # Images to copy into HTML directory. @@ -77,8 +77,8 @@ expand_content_files= # signals and properties. # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -INCLUDES=-I$(top_srcdir)/ytstenut $(YTSG_CFLAGS) -GTKDOC_LIBS=$(top_builddir)/ytstenut/libytstenut-@YTSG_API_VERSION@.la $(YTSG_LIBS) +INCLUDES=-I$(top_srcdir)/ytstenut $(YTS_CFLAGS) +GTKDOC_LIBS=$(top_builddir)/ytstenut/libytstenut-@YTS_API_VERSION@.la $(YTS_LIBS) # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make diff --git a/docs/reference/ytstenut/ytstenut-docs.xml.in b/docs/reference/ytstenut/ytstenut-docs.xml.in index 2be0605..63702fb 100644 --- a/docs/reference/ytstenut/ytstenut-docs.xml.in +++ b/docs/reference/ytstenut/ytstenut-docs.xml.in @@ -4,7 +4,7 @@ <!ENTITY version "@PLUGIN_VERSION@"> ]> -<book id="ytsg" xmlns:xi="http://www.w3.org/2003/XInclude"> +<book id="yts" xmlns:xi="http://www.w3.org/2003/XInclude"> <bookinfo> <title>Ytstenut-glib</title> <releaseinfo>For ytstenut &version;</releaseinfo> @@ -39,40 +39,40 @@ <xi:include href="xml/overview.xml"/> - <part id="ytsg-reference"> + <part id="yts-reference"> <title>Reference</title> - <chapter id="ytsg-classes"> + <chapter id="yts-classes"> <title>Ytstenut-glib Objects</title> - <xi:include href="xml/ytsg-types.xml"/> - <xi:include href="xml/ytsg-error.xml"/> - <xi:include href="xml/ytsg-client.xml"/> - <xi:include href="xml/ytsg-roster.xml"/> - <xi:include href="xml/ytsg-contact.xml"/> - <xi:include href="xml/ytsg-service.xml"/> - <xi:include href="xml/ytsg-metadata-service.xml"/> - <xi:include href="xml/ytsg-caps.xml"/> - <xi:include href="xml/ytsg-metadata.xml"/> - <xi:include href="xml/ytsg-status.xml"/> - <xi:include href="xml/ytsg-message.xml"/> + <xi:include href="xml/yts-types.xml"/> + <xi:include href="xml/yts-error.xml"/> + <xi:include href="xml/yts-client.xml"/> + <xi:include href="xml/yts-roster.xml"/> + <xi:include href="xml/yts-contact.xml"/> + <xi:include href="xml/yts-service.xml"/> + <xi:include href="xml/yts-metadata-service.xml"/> + <xi:include href="xml/yts-caps.xml"/> + <xi:include href="xml/yts-metadata.xml"/> + <xi:include href="xml/yts-status.xml"/> + <xi:include href="xml/yts-message.xml"/> </chapter> </part> - <part id="ytsg-index"> + <part id="yts-index"> <title>Index of all symbols</title> <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include> </part> - <part id="ytsg-appendices"> + <part id="yts-appendices"> <title>Appendices</title> - <appendix id="ytsg-license"> + <appendix id="yts-license"> <title>License</title> </appendix> diff --git a/docs/reference/ytstenut/ytstenut-sections.txt b/docs/reference/ytstenut/ytstenut-sections.txt index 04ff0ba..e558beb 100644 --- a/docs/reference/ytstenut/ytstenut-sections.txt +++ b/docs/reference/ytstenut/ytstenut-sections.txt @@ -1,214 +1,214 @@ <SECTION> -<FILE>ytsg-client</FILE> -<TITLE>YtsgClient</TITLE> -YtsgClient -YtsgClientClass -ytsg_client_new -ytsg_client_disconnect -ytsg_client_connect -ytsg_client_set_capabilities -ytsg_client_get_roster -ytsg_client_emit_error -ytsg_client_set_incoming_file_directory -ytsg_client_get_incoming_file_directory -ytsg_client_get_jid -ytsg_client_get_uid -ytsg_client_set_status +<FILE>yts-client</FILE> +<TITLE>YtsClient</TITLE> +YtsClient +YtsClientClass +yts_client_new +yts_client_disconnect +yts_client_connect +yts_client_set_capabilities +yts_client_get_roster +yts_client_emit_error +yts_client_set_incoming_file_directory +yts_client_get_incoming_file_directory +yts_client_get_jid +yts_client_get_uid +yts_client_set_status <SUBSECTION Standard> -YTSG_CLIENT -YTSG_IS_CLIENT -YTSG_TYPE_CLIENT -ytsg_client_get_type -YTSG_CLIENT_CLASS -YTSG_IS_CLIENT_CLASS -YTSG_CLIENT_GET_CLASS +YTS_CLIENT +YTS_IS_CLIENT +YTS_TYPE_CLIENT +yts_client_get_type +YTS_CLIENT_CLASS +YTS_IS_CLIENT_CLASS +YTS_CLIENT_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-roster</FILE> -<TITLE>YtsgRoster</TITLE> -YtsgRoster -YtsgRosterClass -ytsg_roster_get_contacts -ytsg_roster_find_contact_by_jid -ytsg_roster_find_contact_by_capability -ytsg_roster_get_client +<FILE>yts-roster</FILE> +<TITLE>YtsRoster</TITLE> +YtsRoster +YtsRosterClass +yts_roster_get_contacts +yts_roster_find_contact_by_jid +yts_roster_find_contact_by_capability +yts_roster_get_client <SUBSECTION Standard> -YTSG_ROSTER -YTSG_IS_ROSTER -YTSG_TYPE_ROSTER -ytsg_roster_get_type -YTSG_ROSTER_CLASS -YTSG_IS_ROSTER_CLASS -YTSG_ROSTER_GET_CLASS +YTS_ROSTER +YTS_IS_ROSTER +YTS_TYPE_ROSTER +yts_roster_get_type +YTS_ROSTER_CLASS +YTS_IS_ROSTER_CLASS +YTS_ROSTER_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-status</FILE> -<TITLE>YtsgStatus</TITLE> -YtsgStatus -YtsgStatusClass -ytsg_status_new +<FILE>yts-status</FILE> +<TITLE>YtsStatus</TITLE> +YtsStatus +YtsStatusClass +yts_status_new <SUBSECTION Standard> -YTSG_STATUS -YTSG_IS_STATUS -YTSG_TYPE_STATUS -ytsg_status_get_type -YTSG_STATUS_CLASS -YTSG_IS_STATUS_CLASS -YTSG_STATUS_GET_CLASS +YTS_STATUS +YTS_IS_STATUS +YTS_TYPE_STATUS +yts_status_get_type +YTS_STATUS_CLASS +YTS_IS_STATUS_CLASS +YTS_STATUS_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-metadata-service</FILE> -<TITLE>YtsgMetadataService</TITLE> -YtsgMetadataService -YtsgMetadataServiceClass -ytsg_metadata_service_send_metadata +<FILE>yts-metadata-service</FILE> +<TITLE>YtsMetadataService</TITLE> +YtsMetadataService +YtsMetadataServiceClass +yts_metadata_service_send_metadata <SUBSECTION Standard> -YTSG_METADATA_SERVICE -YTSG_IS_METADATA_SERVICE -YTSG_TYPE_METADATA_SERVICE -ytsg_metadata_service_get_type -YTSG_METADATA_SERVICE_CLASS -YTSG_IS_METADATA_SERVICE_CLASS -YTSG_METADATA_SERVICE_GET_CLASS +YTS_METADATA_SERVICE +YTS_IS_METADATA_SERVICE +YTS_TYPE_METADATA_SERVICE +yts_metadata_service_get_type +YTS_METADATA_SERVICE_CLASS +YTS_IS_METADATA_SERVICE_CLASS +YTS_METADATA_SERVICE_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-message</FILE> -<TITLE>YtsgMessage</TITLE> -YtsgMessage -YtsgMessageClass -ytsg_message_new +<FILE>yts-message</FILE> +<TITLE>YtsMessage</TITLE> +YtsMessage +YtsMessageClass +yts_message_new <SUBSECTION Standard> -YTSG_MESSAGE -YTSG_IS_MESSAGE -YTSG_TYPE_MESSAGE -ytsg_message_get_type -YTSG_MESSAGE_CLASS -YTSG_IS_MESSAGE_CLASS -YTSG_MESSAGE_GET_CLASS +YTS_MESSAGE +YTS_IS_MESSAGE +YTS_TYPE_MESSAGE +yts_message_get_type +YTS_MESSAGE_CLASS +YTS_IS_MESSAGE_CLASS +YTS_MESSAGE_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-metadata</FILE> -<TITLE>YtsgMetadata</TITLE> -YtsgMetadata -YtsgMetadataClass -ytsg_metadata_get_attribute -ytsg_metadata_add_attribute -ytsg_metadata_to_string -ytsg_metadata_is_equal -ytsg_metadata_get_root_node +<FILE>yts-metadata</FILE> +<TITLE>YtsMetadata</TITLE> +YtsMetadata +YtsMetadataClass +yts_metadata_get_attribute +yts_metadata_add_attribute +yts_metadata_to_string +yts_metadata_is_equal +yts_metadata_get_root_node <SUBSECTION Standard> -YTSG_METADATA -YTSG_IS_METADATA -YTSG_TYPE_METADATA -ytsg_metadata_get_type -YTSG_METADATA_CLASS -YTSG_IS_METADATA_CLASS -YTSG_METADATA_GET_CLASS +YTS_METADATA +YTS_IS_METADATA +YTS_TYPE_METADATA +yts_metadata_get_type +YTS_METADATA_CLASS +YTS_IS_METADATA_CLASS +YTS_METADATA_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-contact</FILE> -<TITLE>YtsgContact</TITLE> -YtsgContact -YtsgContactClass -ytsg_contact_get_jid -ytsg_contact_get_name -ytsg_contact_get_tp_contact -ytsg_contact_get_icon -ytsg_contact_has_capability -ytsg_contact_send_file -ytsg_contact_cancel_file +<FILE>yts-contact</FILE> +<TITLE>YtsContact</TITLE> +YtsContact +YtsContactClass +yts_contact_get_jid +yts_contact_get_name +yts_contact_get_tp_contact +yts_contact_get_icon +yts_contact_has_capability +yts_contact_send_file +yts_contact_cancel_file <SUBSECTION Standard> -YTSG_CONTACT -YTSG_IS_CONTACT -YTSG_TYPE_CONTACT -ytsg_contact_get_type -YTSG_CONTACT_CLASS -YTSG_IS_CONTACT_CLASS -YTSG_CONTACT_GET_CLASS +YTS_CONTACT +YTS_IS_CONTACT +YTS_TYPE_CONTACT +yts_contact_get_type +YTS_CONTACT_CLASS +YTS_IS_CONTACT_CLASS +YTS_CONTACT_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-service</FILE> -<TITLE>YtsgService</TITLE> -YtsgService -YtsgServiceClass -ytsg_service_get_uid -ytsg_service_get_jid -ytsg_service_get_client +<FILE>yts-service</FILE> +<TITLE>YtsService</TITLE> +YtsService +YtsServiceClass +yts_service_get_uid +yts_service_get_jid +yts_service_get_client <SUBSECTION Standard> -YTSG_SERVICE -YTSG_IS_SERVICE -YTSG_TYPE_SERVICE -ytsg_service_get_type -YTSG_SERVICE_CLASS -YTSG_IS_SERVICE_CLASS -YTSG_SERVICE_GET_CLASS +YTS_SERVICE +YTS_IS_SERVICE +YTS_TYPE_SERVICE +yts_service_get_type +YTS_SERVICE_CLASS +YTS_IS_SERVICE_CLASS +YTS_SERVICE_GET_CLASS </SECTION> <SECTION> -<FILE>ytsg-main</FILE> -ytsg_init -ytsg_get_option_group +<FILE>yts-main</FILE> +yts_init +yts_get_option_group </SECTION> <SECTION> -<FILE>ytsg-caps</FILE> -YtsgCaps -YTSG_CAPS_S_UNDEFINED -YTSG_CAPS_UI_UNDEFINED -YTSG_CAPS_UNDEFINED -YTSG_CAPS_S_AUDIO -YTSG_CAPS_UI_AUDIO -YTSG_CAPS_AUDIO -YTSG_CAPS_S_VIDEO -YTSG_CAPS_UI_VIDEO -YTSG_CAPS_VIDEO -YTSG_CAPS_S_IMAGE -YTSG_CAPS_UI_IMAGE -YTSG_CAPS_IMAGE -YTSG_CAPS_S_HTML -YTSG_CAPS_UI_HTML -YTSG_CAPS_HTML -YTSG_CAPS_S_CONTROL -YTSG_CAPS_UI_CONTROL -YTSG_CAPS_CONTROL +<FILE>yts-caps</FILE> +YtsCaps +YTS_CAPS_S_UNDEFINED +YTS_CAPS_UI_UNDEFINED +YTS_CAPS_UNDEFINED +YTS_CAPS_S_AUDIO +YTS_CAPS_UI_AUDIO +YTS_CAPS_AUDIO +YTS_CAPS_S_VIDEO +YTS_CAPS_UI_VIDEO +YTS_CAPS_VIDEO +YTS_CAPS_S_IMAGE +YTS_CAPS_UI_IMAGE +YTS_CAPS_IMAGE +YTS_CAPS_S_HTML +YTS_CAPS_UI_HTML +YTS_CAPS_HTML +YTS_CAPS_S_CONTROL +YTS_CAPS_UI_CONTROL +YTS_CAPS_CONTROL </SECTION> <SECTION> -<FILE>ytsg-debug</FILE> -YTSG_NOTE -YTSG_TIMESTAMP -YTSG_MARK +<FILE>yts-debug</FILE> +YTS_NOTE +YTS_TIMESTAMP +YTS_MARK </SECTION> <SECTION> -<FILE>ytsg-version</FILE> -YTSG_MAJOR_VERSION -YTSG_MINOR_VERSION -YTSG_MICRO_VERSION -YTSG_VERSION -YTSG_VERSION_S -YTSG_VERSION_HEX -YTSG_CHECK_VERSION +<FILE>yts-version</FILE> +YTS_MAJOR_VERSION +YTS_MINOR_VERSION +YTS_MICRO_VERSION +YTS_VERSION +YTS_VERSION_S +YTS_VERSION_HEX +YTS_CHECK_VERSION </SECTION> <SECTION> -<FILE>ytsg-error</FILE> -YtsgError -ytsg_error_get_code -ytsg_error_get_atom -ytsg_error_new_atom +<FILE>yts-error</FILE> +YtsError +yts_error_get_code +yts_error_get_atom +yts_error_new_atom </SECTION> <SECTION> -<FILE>ytsg-types</FILE> -YtsgProtocol -YtsgPresence +<FILE>yts-types</FILE> +YtsProtocol +YtsPresence </SECTION> diff --git a/examples/Makefile.am b/examples/Makefile.am index d82ddaa..6d268ea 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -4,14 +4,14 @@ SUBDIRS = video-profile AM_CPPFLAGS = \ -I$(top_srcdir) \ -DG_DISABLE_DEPRECATED \ - $(YTSG_DEBUG_CFLAGS) \ + $(YTS_DEBUG_CFLAGS) \ $(NULL) -AM_CFLAGS = $(YTSG_CFLAGS) +AM_CFLAGS = $(YTS_CFLAGS) -AM_LDFLAGS = ../ytstenut/libytstenut-@YTSG_API_VERSION@.la +AM_LDFLAGS = ../ytstenut/libytstenut-@YTS_API_VERSION@.la -LDADD = $(YTSG_LIBS) +LDADD = $(YTS_LIBS) noinst_PROGRAMS = \ invocation-message \ diff --git a/examples/echo.c b/examples/echo.c index 902ee81..f5eaff2 100644 --- a/examples/echo.c +++ b/examples/echo.c @@ -13,44 +13,44 @@ */ static void -_client_authenticated (YtsgClient *client, +_client_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_ready (YtsgClient *client, +_client_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_disconnected (YtsgClient *client, +_client_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_message (YtsgClient *client, - YtsgMessage *msg, +_client_message (YtsClient *client, + YtsMessage *msg, void *data) { char const *text; g_debug ("%s()", __FUNCTION__); - g_return_if_fail (YTSG_IS_MESSAGE (msg)); + g_return_if_fail (YTS_IS_MESSAGE (msg)); - text = ytsg_metadata_get_attribute (YTSG_METADATA (msg), "message"); + text = yts_metadata_get_attribute (YTS_METADATA (msg), "message"); g_debug ("Message is \"%s\"", text); } static gboolean -_client_incoming_file (YtsgClient *client, +_client_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, @@ -62,15 +62,15 @@ _client_incoming_file (YtsgClient *client, } static void -_client_roster_service_added (YtsgRoster *roster, - YtsgService *service, +_client_roster_service_added (YtsRoster *roster, + YtsService *service, void *data) { char const *uid; char const *jid; - uid = ytsg_service_get_uid (service); - jid = ytsg_service_get_jid (service); + uid = yts_service_get_uid (service); + jid = yts_service_get_jid (service); if (0 == g_strcmp0 (uid, SERVER_UID)) { @@ -78,12 +78,12 @@ _client_roster_service_added (YtsgRoster *roster, "message", "hello world", NULL }; - YtsgMetadata *message = (YtsgMetadata*)ytsg_message_new ((const char**)&payload); + YtsMetadata *message = (YtsMetadata*)yts_message_new ((const char**)&payload); g_debug ("%s() %s %s", __FUNCTION__, uid, jid); g_debug ("Sending message \"%s\"", payload[1]); - ytsg_metadata_service_send_metadata ((YtsgMetadataService *)service, + yts_metadata_service_send_metadata ((YtsMetadataService *)service, message); } } @@ -91,11 +91,11 @@ _client_roster_service_added (YtsgRoster *roster, static int run_client (void) { - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; GMainLoop *mainloop; - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, CLIENT_UID); + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, CLIENT_UID); g_signal_connect (client, "authenticated", G_CALLBACK (_client_authenticated), NULL); g_signal_connect (client, "ready", @@ -107,11 +107,11 @@ run_client (void) g_signal_connect (client, "incoming-file", G_CALLBACK (_client_incoming_file), NULL); - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); g_signal_connect (roster, "service-added", G_CALLBACK (_client_roster_service_added), NULL); - ytsg_client_connect (client); + yts_client_connect (client); mainloop = g_main_loop_new (NULL, false); g_main_loop_run (mainloop); @@ -125,58 +125,58 @@ run_client (void) */ typedef struct { - YtsgMetadataService *service; + YtsMetadataService *service; } ServerData; static void -_server_authenticated (YtsgClient *client, +_server_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_ready (YtsgClient *client, +_server_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_disconnected (YtsgClient *client, +_server_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_message (YtsgClient *client, - YtsgMessage *msg, +_server_message (YtsClient *client, + YtsMessage *msg, ServerData *self) { g_debug ("%s() know client: %s", __FUNCTION__, self->service ? "yes" : "no"); - g_return_if_fail (YTSG_IS_MESSAGE (msg)); + g_return_if_fail (YTS_IS_MESSAGE (msg)); if (self->service) { - YtsgMetadata *message; + YtsMetadata *message; char const *payload[] = { "message", "foo", NULL }; - char const *text = ytsg_metadata_get_attribute (YTSG_METADATA (msg), + char const *text = yts_metadata_get_attribute (YTS_METADATA (msg), "message"); g_debug ("%s() echoing \"%s\"", __FUNCTION__, text); payload[1] = text; - message = (YtsgMetadata*)ytsg_message_new ((const char**)&payload); - ytsg_metadata_service_send_metadata ((YtsgMetadataService *)self->service, + message = (YtsMetadata*)yts_message_new ((const char**)&payload); + yts_metadata_service_send_metadata ((YtsMetadataService *)self->service, message); } } static gboolean -_server_incoming_file (YtsgClient *client, +_server_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, @@ -188,15 +188,15 @@ _server_incoming_file (YtsgClient *client, } static void -_server_roster_service_added (YtsgRoster *roster, - YtsgService *service, +_server_roster_service_added (YtsRoster *roster, + YtsService *service, ServerData *self) { char const *uid; char const *jid; - uid = ytsg_service_get_uid (service); - jid = ytsg_service_get_jid (service); + uid = yts_service_get_uid (service); + jid = yts_service_get_jid (service); g_debug ("%s() %s %s", __FUNCTION__, uid, jid); @@ -204,19 +204,19 @@ _server_roster_service_added (YtsgRoster *roster, * it shows up in our roster? */ if (0 == g_strcmp0 (uid, CLIENT_UID)) { /* Should probably take a weak ref here. */ - self->service = YTSG_METADATA_SERVICE (service); + self->service = YTS_METADATA_SERVICE (service); } } static int run_server (void) { - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; GMainLoop *mainloop; ServerData self = { NULL, }; - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, SERVER_UID); + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, SERVER_UID); g_signal_connect (client, "authenticated", G_CALLBACK (_server_authenticated), NULL); g_signal_connect (client, "ready", @@ -228,11 +228,11 @@ run_server (void) g_signal_connect (client, "incoming-file", G_CALLBACK (_server_incoming_file), NULL); - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); g_signal_connect (roster, "service-added", G_CALLBACK (_server_roster_service_added), &self); - ytsg_client_connect (client); + yts_client_connect (client); mainloop = g_main_loop_new (NULL, false); g_main_loop_run (mainloop); @@ -259,7 +259,7 @@ main (int argc, context = g_option_context_new ("- Ytstenut echo example"); g_option_context_add_main_entries (context, entries, NULL); - g_option_context_add_group (context, ytsg_get_option_group ()); + g_option_context_add_group (context, yts_get_option_group ()); g_option_context_parse (context, &argc, &argv, &error); if (error) { g_warning ("%s : %s", G_STRLOC, error->message); diff --git a/examples/invocation-message.c b/examples/invocation-message.c index 26032e2..c3d7b7e 100644 --- a/examples/invocation-message.c +++ b/examples/invocation-message.c @@ -15,29 +15,29 @@ */ static void -_client_authenticated (YtsgClient *client, +_client_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_ready (YtsgClient *client, +_client_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_disconnected (YtsgClient *client, +_client_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_message (YtsgClient *client, - YtsgMessage *msg, +_client_message (YtsClient *client, + YtsMessage *msg, void *data) { g_debug ("%s()", __FUNCTION__); @@ -45,7 +45,7 @@ _client_message (YtsgClient *client, } static gboolean -_client_incoming_file (YtsgClient *client, +_client_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, @@ -57,24 +57,24 @@ _client_incoming_file (YtsgClient *client, } static void -_client_roster_service_added (YtsgRoster *roster, - YtsgService *service, +_client_roster_service_added (YtsRoster *roster, + YtsService *service, void *data) { char const *uid; - uid = ytsg_service_get_uid (service); + uid = yts_service_get_uid (service); if (0 == g_strcmp0 (uid, SERVER_UID)) { GVariant *args = g_variant_new_parsed ( "[ {\"arg1\", <1>}, {\"arg2\", <\"two\">} ]"); - YtsgMetadata *message = ytsg_invocation_message_new ("1", + YtsMetadata *message = yts_invocation_message_new ("1", CAPABILITY, "method1", args); - ytsg_metadata_service_send_metadata (YTSG_METADATA_SERVICE (service), + yts_metadata_service_send_metadata (YTS_METADATA_SERVICE (service), message); } } @@ -82,11 +82,11 @@ _client_roster_service_added (YtsgRoster *roster, static int run_client (void) { - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; GMainLoop *mainloop; - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, CLIENT_UID); + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, CLIENT_UID); g_signal_connect (client, "authenticated", G_CALLBACK (_client_authenticated), NULL); g_signal_connect (client, "ready", @@ -98,11 +98,11 @@ run_client (void) g_signal_connect (client, "incoming-file", G_CALLBACK (_client_incoming_file), NULL); - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); g_signal_connect (roster, "service-added", G_CALLBACK (_client_roster_service_added), NULL); - ytsg_client_connect (client); + yts_client_connect (client); mainloop = g_main_loop_new (NULL, false); g_main_loop_run (mainloop); @@ -116,37 +116,37 @@ run_client (void) */ static void -_server_authenticated (YtsgClient *client, +_server_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_ready (YtsgClient *client, +_server_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_disconnected (YtsgClient *client, +_server_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_message (YtsgClient *client, - YtsgMessage *msg, +_server_message (YtsClient *client, + YtsMessage *msg, void *data) { char const *method; char const *args; char *unescaped_args; - method = ytsg_metadata_get_attribute (YTSG_METADATA (msg), "aspect"); - args = ytsg_metadata_get_attribute (YTSG_METADATA (msg), "arguments"); + method = yts_metadata_get_attribute (YTS_METADATA (msg), "aspect"); + args = yts_metadata_get_attribute (YTS_METADATA (msg), "arguments"); unescaped_args = g_uri_unescape_string (args, NULL); g_debug ("%s() %s %s", __FUNCTION__, method, unescaped_args); @@ -155,7 +155,7 @@ _server_message (YtsgClient *client, } static gboolean -_server_incoming_file (YtsgClient *client, +_server_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, @@ -169,11 +169,11 @@ _server_incoming_file (YtsgClient *client, static int run_server (void) { - YtsgClient *client; + YtsClient *client; GMainLoop *mainloop; - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, SERVER_UID); - ytsg_client_set_capabilities (client, + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, SERVER_UID); + yts_client_set_capabilities (client, g_quark_from_static_string (CAPABILITY)); g_signal_connect (client, "authenticated", G_CALLBACK (_server_authenticated), NULL); @@ -186,7 +186,7 @@ run_server (void) g_signal_connect (client, "incoming-file", G_CALLBACK (_server_incoming_file), NULL); - ytsg_client_connect (client); + yts_client_connect (client); mainloop = g_main_loop_new (NULL, false); g_main_loop_run (mainloop); @@ -213,7 +213,7 @@ main (int argc, context = g_option_context_new ("- Ytstenut status test"); g_option_context_add_main_entries (context, entries, NULL); - g_option_context_add_group (context, ytsg_get_option_group ()); + g_option_context_add_group (context, yts_get_option_group ()); g_option_context_parse (context, &argc, &argv, &error); if (error) { g_warning ("%s : %s", G_STRLOC, error->message); diff --git a/examples/status.c b/examples/status.c index 1c13866..b0173af 100644 --- a/examples/status.c +++ b/examples/status.c @@ -15,29 +15,29 @@ */ static void -_client_authenticated (YtsgClient *client, +_client_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_ready (YtsgClient *client, +_client_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_disconnected (YtsgClient *client, +_client_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_message (YtsgClient *client, - YtsgMessage *msg, +_client_message (YtsClient *client, + YtsMessage *msg, void *data) { g_debug ("%s()", __FUNCTION__); @@ -45,7 +45,7 @@ _client_message (YtsgClient *client, } static gboolean -_client_incoming_file (YtsgClient *client, +_client_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, @@ -57,29 +57,29 @@ _client_incoming_file (YtsgClient *client, } static void -_server_status (YtsgClient *client, - YtsgStatus *status, +_server_status (YtsClient *client, + YtsStatus *status, void *data) { char *dump; g_debug ("%s()", __FUNCTION__); - dump = ytsg_metadata_to_string (YTSG_METADATA (status)); + dump = yts_metadata_to_string (YTS_METADATA (status)); g_debug (dump); g_free (dump); } static void -_client_roster_service_added (YtsgRoster *roster, - YtsgService *service, +_client_roster_service_added (YtsRoster *roster, + YtsService *service, void *data) { char const *uid; char const *jid; - uid = ytsg_service_get_uid (service); - jid = ytsg_service_get_jid (service); + uid = yts_service_get_uid (service); + jid = yts_service_get_jid (service); if (0 == g_strcmp0 (uid, SERVER_UID)) { @@ -87,7 +87,7 @@ _client_roster_service_added (YtsgRoster *roster, "ping", "pong", NULL }; - YtsgMetadata *message = (YtsgMetadata*)ytsg_message_new ((const char**)&payload); + YtsMetadata *message = (YtsMetadata*)yts_message_new ((const char**)&payload); /* Hook up to server status changes. */ g_signal_connect (service, "status", @@ -97,7 +97,7 @@ _client_roster_service_added (YtsgRoster *roster, g_debug ("%s() %s %s", __FUNCTION__, uid, jid); g_debug ("Sending message \"%s\"", payload[1]); - ytsg_metadata_service_send_metadata ((YtsgMetadataService *)service, + yts_metadata_service_send_metadata ((YtsMetadataService *)service, message); } } @@ -105,11 +105,11 @@ _client_roster_service_added (YtsgRoster *roster, static int run_client (void) { - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; GMainLoop *mainloop; - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, CLIENT_UID); + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, CLIENT_UID); g_signal_connect (client, "authenticated", G_CALLBACK (_client_authenticated), NULL); g_signal_connect (client, "ready", @@ -121,11 +121,11 @@ run_client (void) g_signal_connect (client, "incoming-file", G_CALLBACK (_client_incoming_file), NULL); - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); g_signal_connect (roster, "service-added", G_CALLBACK (_client_roster_service_added), NULL); - ytsg_client_connect (client); + yts_client_connect (client); mainloop = g_main_loop_new (NULL, false); g_main_loop_run (mainloop); @@ -139,29 +139,29 @@ run_client (void) */ static void -_server_authenticated (YtsgClient *client, +_server_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_ready (YtsgClient *client, +_server_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_disconnected (YtsgClient *client, +_server_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_server_message (YtsgClient *client, - YtsgMessage *msg, +_server_message (YtsClient *client, + YtsMessage *msg, void *data) { char const *property_name; @@ -172,12 +172,12 @@ _server_message (YtsgClient *client, property_name = "urn:ytstenut:capabilities:" CAPABILITY; - ytsg_client_set_status_by_capability (client, + yts_client_set_status_by_capability (client, property_name, "Foo"); } static gboolean -_server_incoming_file (YtsgClient *client, +_server_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, @@ -191,11 +191,11 @@ _server_incoming_file (YtsgClient *client, static int run_server (void) { - YtsgClient *client; + YtsClient *client; GMainLoop *mainloop; - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, SERVER_UID); - ytsg_client_set_capabilities (client, + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, SERVER_UID); + yts_client_set_capabilities (client, g_quark_from_static_string (CAPABILITY)); g_signal_connect (client, "authenticated", G_CALLBACK (_server_authenticated), NULL); @@ -208,7 +208,7 @@ run_server (void) g_signal_connect (client, "incoming-file", G_CALLBACK (_server_incoming_file), NULL); - ytsg_client_connect (client); + yts_client_connect (client); mainloop = g_main_loop_new (NULL, false); g_main_loop_run (mainloop); @@ -235,7 +235,7 @@ main (int argc, context = g_option_context_new ("- Ytstenut status test"); g_option_context_add_main_entries (context, entries, NULL); - g_option_context_add_group (context, ytsg_get_option_group ()); + g_option_context_add_group (context, yts_get_option_group ()); g_option_context_parse (context, &argc, &argv, &error); if (error) { g_warning ("%s : %s", G_STRLOC, error->message); diff --git a/examples/video-profile/Makefile.am b/examples/video-profile/Makefile.am index db61fdc..352bdf2 100644 --- a/examples/video-profile/Makefile.am +++ b/examples/video-profile/Makefile.am @@ -2,14 +2,14 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -DG_DISABLE_DEPRECATED \ - $(YTSG_DEBUG_CFLAGS) \ + $(YTS_DEBUG_CFLAGS) \ $(NULL) -AM_CFLAGS = $(YTSG_CFLAGS) +AM_CFLAGS = $(YTS_CFLAGS) -AM_LDFLAGS = ../../ytstenut/libytstenut-@YTSG_API_VERSION@.la +AM_LDFLAGS = ../../ytstenut/libytstenut-@YTS_API_VERSION@.la -LDADD = $(YTSG_LIBS) +LDADD = $(YTS_LIBS) noinst_PROGRAMS = \ player \ diff --git a/examples/video-profile/mock-player.c b/examples/video-profile/mock-player.c index dc9e9dd..69acd17 100644 --- a/examples/video-profile/mock-player.c +++ b/examples/video-profile/mock-player.c @@ -22,22 +22,22 @@ #include "mock-player.h" static void -_capability_interface_init (YtsgCapability *interface); +_capability_interface_init (YtsCapability *interface); static void -_player_interface_init (YtsgVPPlayerInterface *interface); +_player_interface_init (YtsVPPlayerInterface *interface); static void -_transcript_interface_init (YtsgVPPlayerInterface *interface); +_transcript_interface_init (YtsVPPlayerInterface *interface); G_DEFINE_TYPE_WITH_CODE (MockPlayer, mock_player, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (YTSG_TYPE_CAPABILITY, + G_IMPLEMENT_INTERFACE (YTS_TYPE_CAPABILITY, _capability_interface_init) - G_IMPLEMENT_INTERFACE (YTSG_VP_TYPE_PLAYER, + G_IMPLEMENT_INTERFACE (YTS_VP_TYPE_PLAYER, _player_interface_init) - G_IMPLEMENT_INTERFACE (YTSG_VP_TYPE_TRANSCRIPT, + G_IMPLEMENT_INTERFACE (YTS_VP_TYPE_TRANSCRIPT, _transcript_interface_init)) #define GET_PRIVATE(o) \ @@ -46,16 +46,16 @@ G_DEFINE_TYPE_WITH_CODE (MockPlayer, enum { PROP_0, - /* YtsgCapability */ + /* YtsCapability */ PROP_CAPABILITY_FQC_IDS, - /* YtsgVPPlayer */ + /* YtsVPPlayer */ PROP_PLAYER_PLAYABLE, PROP_PLAYER_PLAYING, PROP_PLAYER_VOLUME, PROP_PLAYER_PLAYABLE_URI, - /* YtsgVPTranscript */ + /* YtsVPTranscript */ PROP_TRANSCRIPT_AVAILABLE_LOCALES, PROP_TRANSCRIPT_CURRENT_TEXT, PROP_TRANSCRIPT_LOCALE @@ -63,7 +63,7 @@ enum { typedef struct { - /* YtsgVPPlayer */ + /* YtsVPPlayer */ char const *const *playlist; unsigned current; @@ -71,7 +71,7 @@ typedef struct { double volume; char *playable_uri; - /* YtsgVPTranscript */ + /* YtsVPTranscript */ char const *const *available_locales; char *current_text; @@ -80,45 +80,45 @@ typedef struct { } MockPlayerPrivate; /* - * YtsgCapability implementation + * YtsCapability implementation */ static void -_capability_interface_init (YtsgCapability *interface) +_capability_interface_init (YtsCapability *interface) { /* Nothing to do, it's just about overriding the "fqc-id" property */ } /* - * YtsgVPPlayer + * YtsVPPlayer */ static void -_player_play (YtsgVPPlayer *self) +_player_play (YtsVPPlayer *self) { MockPlayerPrivate *priv = GET_PRIVATE (self); - g_debug ("YtsgVPPlayer.play() with playing=%s", + g_debug ("YtsVPPlayer.play() with playing=%s", priv->playing ? "true" : "false"); /* Let the property setter do the work. */ - ytsg_vp_player_set_playing (self, true); + yts_vp_player_set_playing (self, true); } static void -_player_pause (YtsgVPPlayer *self) +_player_pause (YtsVPPlayer *self) { MockPlayerPrivate *priv = GET_PRIVATE (self); - g_debug ("YtsgVPPlayer.pause() with playing=%s", + g_debug ("YtsVPPlayer.pause() with playing=%s", priv->playing ? "true" : "false"); /* Let the property setter do the work. */ - ytsg_vp_player_set_playing (self, false); + yts_vp_player_set_playing (self, false); } static void -_player_next (YtsgVPPlayer *self, +_player_next (YtsVPPlayer *self, char const *invocation_id) { MockPlayerPrivate *priv = GET_PRIVATE (self); @@ -129,14 +129,14 @@ _player_next (YtsgVPPlayer *self, priv->current++; } - g_debug ("YtsgVPPlayer.next() -- %s", next); + g_debug ("YtsVPPlayer.next() -- %s", next); /* Return true if we skipped to the next item in the playlist. */ - ytsg_vp_player_next_return (self, invocation_id, (bool) next); + yts_vp_player_next_return (self, invocation_id, (bool) next); } static void -_player_prev (YtsgVPPlayer *self, +_player_prev (YtsVPPlayer *self, char const *invocation_id) { MockPlayerPrivate *priv = GET_PRIVATE (self); @@ -149,14 +149,14 @@ _player_prev (YtsgVPPlayer *self, priv->current--; } - g_debug ("YtsgVPPlayer.prev() -- %s", prev); + g_debug ("YtsVPPlayer.prev() -- %s", prev); /* Return true if we skipped to the previous item in the playlist. */ - ytsg_vp_player_prev_return (self, invocation_id, (bool) prev); + yts_vp_player_prev_return (self, invocation_id, (bool) prev); } static void -_player_interface_init (YtsgVPPlayerInterface *interface) +_player_interface_init (YtsVPPlayerInterface *interface) { interface->play = _player_play; interface->pause = _player_pause; @@ -165,7 +165,7 @@ _player_interface_init (YtsgVPPlayerInterface *interface) } /* - * YtsgVPTranscript + * YtsVPTranscript */ static bool @@ -195,7 +195,7 @@ _transcript_emit_text (MockPlayer *self) } static void -_transcript_interface_init (YtsgVPPlayerInterface *interface) +_transcript_interface_init (YtsVPPlayerInterface *interface) { /* No methods to override. */ } @@ -215,19 +215,19 @@ _get_property (GObject *object, switch (property_id) { /* - * YtsgCapability + * YtsCapability */ case PROP_CAPABILITY_FQC_IDS: { char *fcq_ids[] = { - YTSG_VP_PLAYER_FQC_ID, - YTSG_VP_TRANSCRIPT_FQC_ID, + YTS_VP_PLAYER_FQC_ID, + YTS_VP_TRANSCRIPT_FQC_ID, NULL }; g_value_set_boxed (value, fcq_ids); } break; /* - * YtsgVPPlayer + * YtsVPPlayer */ case PROP_PLAYER_PLAYABLE: @@ -245,7 +245,7 @@ _get_property (GObject *object, break; /* - * YtsgVPTranscript + * YtsVPTranscript */ case PROP_TRANSCRIPT_AVAILABLE_LOCALES: @@ -274,7 +274,7 @@ _set_property (GObject *object, switch (property_id) { /* - * YtsgVPPlayer + * YtsVPPlayer */ case PROP_PLAYER_PLAYABLE: @@ -285,7 +285,7 @@ _set_property (GObject *object, case PROP_PLAYER_PLAYING: { bool playing = g_value_get_boolean (value); if (playing != priv->playing) { - g_debug ("YtsgVPPlayer.playing = %s", playing ? "true" : "false"); + g_debug ("YtsVPPlayer.playing = %s", playing ? "true" : "false"); priv->playing = playing; g_object_notify (object, "playing"); @@ -301,7 +301,7 @@ _set_property (GObject *object, case PROP_PLAYER_VOLUME: { double volume = g_value_get_double (value); if (volume != priv->volume) { - g_debug ("YtsgVPPlayer.volume = %.2f", volume); + g_debug ("YtsVPPlayer.volume = %.2f", volume); priv->volume = volume; g_object_notify (object, "volume"); } @@ -317,13 +317,13 @@ _set_property (GObject *object, if (playable_uri) { priv->playable_uri = g_strdup (playable_uri); } - g_debug ("YtsgVPPlayer.playable-uri = %s", priv->playable_uri); + g_debug ("YtsVPPlayer.playable-uri = %s", priv->playable_uri); g_object_notify (object, "playable-uri"); } } break; /* - * YtsgVPTranscript + * YtsVPTranscript */ case PROP_TRANSCRIPT_LOCALE: { @@ -347,7 +347,7 @@ _set_property (GObject *object, } else if (locale_idx != priv->locale_idx) { priv->locale_idx = locale_idx; - g_debug ("YtsgVPTranscript.locale = %s", + g_debug ("YtsVPTranscript.locale = %s", priv->available_locales[priv->locale_idx]); g_object_notify (object, "locale"); } @@ -383,13 +383,13 @@ mock_player_class_init (MockPlayerClass *klass) object_class->set_property = _set_property; object_class->dispose = _dispose; - /* YtsgCapability */ + /* YtsCapability */ g_object_class_override_property (object_class, PROP_CAPABILITY_FQC_IDS, "fqc-ids"); - /* YtsgVPPlayer */ + /* YtsVPPlayer */ g_object_class_override_property (object_class, PROP_PLAYER_PLAYABLE, @@ -407,7 +407,7 @@ mock_player_class_init (MockPlayerClass *klass) PROP_PLAYER_PLAYABLE_URI, "playable-uri"); - /* YtsgVPTranscript */ + /* YtsVPTranscript */ g_object_class_override_property (object_class, PROP_TRANSCRIPT_AVAILABLE_LOCALES, diff --git a/examples/video-profile/player.c b/examples/video-profile/player.c index 8647902..15f5cb5 100644 --- a/examples/video-profile/player.c +++ b/examples/video-profile/player.c @@ -31,21 +31,21 @@ */ static void -_client_authenticated (YtsgClient *client, +_client_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_ready (YtsgClient *client, +_client_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_disconnected (YtsgClient *client, +_client_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); @@ -53,13 +53,13 @@ _client_disconnected (YtsgClient *client, /* Messages that are not handled by any service are emitted by the client. */ static void -_client_message (YtsgClient *client, - YtsgMessage *message, +_client_message (YtsClient *client, + YtsMessage *message, void *data) { char *message_xml; - message_xml = ytsg_metadata_to_string (YTSG_METADATA (message)); + message_xml = yts_metadata_to_string (YTS_METADATA (message)); g_debug ("%s() %s", __FUNCTION__, message_xml); g_free (message_xml); } @@ -69,32 +69,32 @@ _client_message (YtsgClient *client, */ static void -_roster_contact_added (YtsgRoster *roster, - YtsgContact *contact, +_roster_contact_added (YtsRoster *roster, + YtsContact *contact, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_roster_contact_removed (YtsgRoster *roster, - YtsgContact *contact, +_roster_contact_removed (YtsRoster *roster, + YtsContact *contact, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_roster_service_added (YtsgRoster *roster, - YtsgService *service, +_roster_service_added (YtsRoster *roster, + YtsService *service, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_roster_service_removed (YtsgRoster *roster, - YtsgService *contact, +_roster_service_removed (YtsRoster *roster, + YtsService *contact, void *data) { g_debug ("%s()", __FUNCTION__); @@ -107,8 +107,8 @@ _player_notify_current_text (MockPlayer *player, { char *current_text; - current_text = ytsg_vp_transcript_get_current_text ( - YTSG_VP_TRANSCRIPT (player)); + current_text = yts_vp_transcript_get_current_text ( + YTS_VP_TRANSCRIPT (player)); g_debug ("%s() '%s'", __FUNCTION__, current_text); @@ -124,8 +124,8 @@ main (int argc, char **argv) { GOptionContext *context; - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; MockPlayer *player; GMainLoop *mainloop; GError *error = NULL; @@ -136,7 +136,7 @@ main (int argc, /* Initialisation and command-line argument handling. */ context = g_option_context_new ("- mock player"); g_option_context_add_main_entries (context, entries, NULL); - g_option_context_add_group (context, ytsg_get_option_group ()); + g_option_context_add_group (context, yts_get_option_group ()); g_option_context_parse (context, &argc, &argv, &error); if (error) { g_warning ("%s : %s", G_STRLOC, error->message); @@ -145,7 +145,7 @@ main (int argc, } /* The client object represents an ytstenut application. */ - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "org.freedesktop.ytstenut.MockPlayer"); g_signal_connect (client, "authenticated", G_CALLBACK (_client_authenticated), NULL); @@ -157,7 +157,7 @@ main (int argc, G_CALLBACK (_client_message), NULL); /* The roster object tracks other devices and services as they come and go. */ - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); g_signal_connect (roster, "contact-added", G_CALLBACK (_roster_contact_added), NULL); g_signal_connect (roster, "contact-removed", @@ -169,13 +169,13 @@ main (int argc, /* Instantiate and publish example player object so others can access it. */ player = mock_player_new (); - ytsg_client_register_service (client, YTSG_CAPABILITY (player)); + yts_client_register_service (client, YTS_CAPABILITY (player)); g_signal_connect (player, "notify::current-text", G_CALLBACK (_player_notify_current_text), NULL); /* Activate the client. */ - ytsg_client_connect (client); + yts_client_connect (client); /* Run application. */ mainloop = g_main_loop_new (NULL, false); diff --git a/examples/video-profile/remote.c b/examples/video-profile/remote.c index 55aeeaf..a8088fe 100644 --- a/examples/video-profile/remote.c +++ b/examples/video-profile/remote.c @@ -54,87 +54,87 @@ typedef struct { static GMainLoop *_mainloop = NULL; static void -_client_authenticated (YtsgClient *client, +_client_authenticated (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_ready (YtsgClient *client, +_client_ready (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_disconnected (YtsgClient *client, +_client_disconnected (YtsClient *client, void *data) { g_debug ("%s()", __FUNCTION__); } static void -_client_message (YtsgClient *client, - YtsgMessage *message, +_client_message (YtsClient *client, + YtsMessage *message, void *data) { char *message_xml; - message_xml = ytsg_metadata_to_string (YTSG_METADATA (message)); + message_xml = yts_metadata_to_string (YTS_METADATA (message)); g_debug ("%s() %s", __FUNCTION__, message_xml); g_free (message_xml); } static void -_player_notify_playing (YtsgVPPlayer *player, +_player_notify_playing (YtsVPPlayer *player, GParamSpec *pspec, void *data) { - g_debug ("YtsgVPPlayer.playing = %s", - ytsg_vp_player_get_playing (player) ? "true" : "false"); + g_debug ("YtsVPPlayer.playing = %s", + yts_vp_player_get_playing (player) ? "true" : "false"); } static void -_player_notify_volume (YtsgVPPlayer *player, +_player_notify_volume (YtsVPPlayer *player, GParamSpec *pspec, void *data) { - g_debug ("YtsgVPPlayer.volume = %.2f", ytsg_vp_player_get_volume (player)); + g_debug ("YtsVPPlayer.volume = %.2f", yts_vp_player_get_volume (player)); } static void -_player_notify_playable_uri (YtsgVPPlayer *player, +_player_notify_playable_uri (YtsVPPlayer *player, GParamSpec *pspec, void *data) { char *playable_uri; - playable_uri = ytsg_vp_player_get_playable_uri (player); - g_debug ("YtsgVPPlayer.playable-uri = %s", playable_uri); + playable_uri = yts_vp_player_get_playable_uri (player); + g_debug ("YtsVPPlayer.playable-uri = %s", playable_uri); g_free (playable_uri); } static void -_player_next_response (YtsgVPPlayer *player, +_player_next_response (YtsVPPlayer *player, char const *invocation_id, bool return_value, void *data) { - g_debug ("YtsgVPPlayer.next() returned %s", return_value ? "true" : "false"); + g_debug ("YtsVPPlayer.next() returned %s", return_value ? "true" : "false"); } static void -_player_prev_response (YtsgVPPlayer *player, +_player_prev_response (YtsVPPlayer *player, char const *invocation_id, bool return_value, void *data) { - g_debug ("YtsgVPPlayer.prev() returned %s", return_value ? "true" : "false"); + g_debug ("YtsVPPlayer.prev() returned %s", return_value ? "true" : "false"); } static void -use_player (YtsgVPPlayer *player, +use_player (YtsVPPlayer *player, Options *options) { // FIXME @@ -154,45 +154,45 @@ use_player (YtsgVPPlayer *player, switch (options->command) { case COMMAND_PLAYER_PLAYING: if (0 == g_strcmp0 (options->player_playing, "true")) { - ytsg_vp_player_set_playing (YTSG_VP_PLAYER (player), true); + yts_vp_player_set_playing (YTS_VP_PLAYER (player), true); } else if (0 == g_strcmp0 (options->player_playing, "false")) { - ytsg_vp_player_set_playing (YTSG_VP_PLAYER (player), false); + yts_vp_player_set_playing (YTS_VP_PLAYER (player), false); } else { - bool playing = ytsg_vp_player_get_playing (YTSG_VP_PLAYER (player)); - g_debug ("YtsgVPPlayer.playing = %s", playing ? "true" : "false"); + bool playing = yts_vp_player_get_playing (YTS_VP_PLAYER (player)); + g_debug ("YtsVPPlayer.playing = %s", playing ? "true" : "false"); } break; case COMMAND_PLAYER_VOLUME: if (options->player_volume >= 0.0) { - ytsg_vp_player_set_volume (YTSG_VP_PLAYER (player), + yts_vp_player_set_volume (YTS_VP_PLAYER (player), options->player_volume); } else { - double volume = ytsg_vp_player_get_volume (YTSG_VP_PLAYER (player)); - g_debug ("YtsgVPPlayer.volume = %.2f", volume); + double volume = yts_vp_player_get_volume (YTS_VP_PLAYER (player)); + g_debug ("YtsVPPlayer.volume = %.2f", volume); } break; case COMMAND_PLAYER_PLAYABLE_URI: if (options->player_playable_uri) { - ytsg_vp_player_set_playable_uri (YTSG_VP_PLAYER (player), + yts_vp_player_set_playable_uri (YTS_VP_PLAYER (player), options->player_playable_uri); } else { - char *playable_uri = ytsg_vp_player_get_playable_uri ( - YTSG_VP_PLAYER (player)); - g_debug ("YtsgVPPlayer.playable_uri = %s", playable_uri); + char *playable_uri = yts_vp_player_get_playable_uri ( + YTS_VP_PLAYER (player)); + g_debug ("YtsVPPlayer.playable_uri = %s", playable_uri); g_free (playable_uri); } break; case COMMAND_PLAYER_PLAY: - ytsg_vp_player_play (YTSG_VP_PLAYER (player)); + yts_vp_player_play (YTS_VP_PLAYER (player)); break; case COMMAND_PLAYER_PAUSE: - ytsg_vp_player_pause (YTSG_VP_PLAYER (player)); + yts_vp_player_pause (YTS_VP_PLAYER (player)); break; case COMMAND_PLAYER_NEXT: - ytsg_vp_player_next (YTSG_VP_PLAYER (player), NULL); + yts_vp_player_next (YTS_VP_PLAYER (player), NULL); break; case COMMAND_PLAYER_PREV: - ytsg_vp_player_prev (YTSG_VP_PLAYER (player), NULL); + yts_vp_player_prev (YTS_VP_PLAYER (player), NULL); break; default: g_debug ("%s : command %i not handled", G_STRLOC, options->command); @@ -200,19 +200,19 @@ use_player (YtsgVPPlayer *player, } static void -_transcript_notify_current_text (YtsgVPTranscript *transcript, +_transcript_notify_current_text (YtsVPTranscript *transcript, GParamSpec *pspec, void *data) { char *current_text; - current_text = ytsg_vp_transcript_get_current_text (transcript); - g_debug ("YtsgVPTranscript.current-text = '%s'", current_text); + current_text = yts_vp_transcript_get_current_text (transcript); + g_debug ("YtsVPTranscript.current-text = '%s'", current_text); g_free (current_text); } static void -use_transcript (YtsgVPTranscript *transcript, +use_transcript (YtsVPTranscript *transcript, Options *options) { char **locales; @@ -222,10 +222,10 @@ use_transcript (YtsgVPTranscript *transcript, // FIXME g_object_ref (transcript); - locales = ytsg_vp_transcript_get_available_locales (transcript); + locales = yts_vp_transcript_get_available_locales (transcript); locales_str = g_strjoinv (", ", locales); - locale = ytsg_vp_transcript_get_locale (transcript); + locale = yts_vp_transcript_get_locale (transcript); g_signal_connect (transcript, "notify::current-text", G_CALLBACK (_transcript_notify_current_text), NULL); @@ -239,17 +239,17 @@ use_transcript (YtsgVPTranscript *transcript, } static void -_proxy_service_proxy_created (YtsgProxyService *service, - YtsgProxy *proxy, +_proxy_service_proxy_created (YtsProxyService *service, + YtsProxy *proxy, Options *options) { - if (YTSG_VP_IS_PLAYER (proxy)) { + if (YTS_VP_IS_PLAYER (proxy)) { - use_player (YTSG_VP_PLAYER (proxy), options); + use_player (YTS_VP_PLAYER (proxy), options); - } else if (YTSG_VP_IS_TRANSCRIPT (proxy)) { + } else if (YTS_VP_IS_TRANSCRIPT (proxy)) { - use_transcript (YTSG_VP_TRANSCRIPT (proxy), options); + use_transcript (YTS_VP_TRANSCRIPT (proxy), options); } else { @@ -260,15 +260,15 @@ _proxy_service_proxy_created (YtsgProxyService *service, } static void -_roster_service_added (YtsgRoster *roster, - YtsgService *service, +_roster_service_added (YtsRoster *roster, + YtsService *service, Options *options) { char const *uid; char const *jid; - uid = ytsg_service_get_uid (service); - jid = ytsg_service_get_jid (service); + uid = yts_service_get_uid (service); + jid = yts_service_get_jid (service); g_debug ("%s() %s %s", __FUNCTION__, uid, jid); @@ -279,14 +279,14 @@ _roster_service_added (YtsgRoster *roster, g_signal_connect (service, "proxy-created", G_CALLBACK (_proxy_service_proxy_created), options); - ret = ytsg_proxy_service_create_proxy (YTSG_PROXY_SERVICE (service), - YTSG_VP_PLAYER_FQC_ID); + ret = yts_proxy_service_create_proxy (YTS_PROXY_SERVICE (service), + YTS_VP_PLAYER_FQC_ID); if (!ret) { g_critical ("%s : Failed to create player", G_STRLOC); } - ret = ytsg_proxy_service_create_proxy (YTSG_PROXY_SERVICE (service), - YTSG_VP_TRANSCRIPT_FQC_ID); + ret = yts_proxy_service_create_proxy (YTS_PROXY_SERVICE (service), + YTS_VP_TRANSCRIPT_FQC_ID); if (!ret) { g_critical ("%s : Failed to create transcript", G_STRLOC); } @@ -299,8 +299,8 @@ main (int argc, { GOptionContext *context; GOptionGroup *group; - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; GError *error = NULL; Options options; @@ -330,7 +330,7 @@ main (int argc, g_option_group_add_entries (group, player_entries); g_option_context_set_main_group (context, group); - g_option_context_add_group (context, ytsg_get_option_group ()); + g_option_context_add_group (context, yts_get_option_group ()); g_option_context_parse (context, &argc, &argv, &error); if (error) { g_warning ("%s : %s", G_STRLOC, error->message); @@ -356,7 +356,7 @@ main (int argc, g_debug ("No command given, use --help to display commands."); } - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "org.freedesktop.ytstenut.MockPlayerRemote"); g_signal_connect (client, "authenticated", G_CALLBACK (_client_authenticated), &options); @@ -367,11 +367,11 @@ main (int argc, g_signal_connect (client, "message", G_CALLBACK (_client_message), &options); - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); g_signal_connect (roster, "service-added", G_CALLBACK (_roster_service_added), &options); - ytsg_client_connect (client); + yts_client_connect (client); _mainloop = g_main_loop_new (NULL, false); g_main_loop_run (_mainloop); diff --git a/tests/Makefile.am b/tests/Makefile.am index 1efcedb..67492ec 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -6,35 +6,35 @@ AM_CPPFLAGS = \ -DG_DISABLE_DEPRECATED \ -DG_DISABLE_SINGLE_INCLUDES \ -DG_LOG_DOMAIN=\"YtstenutGlib\" \ - $(YTSG_DEBUG_CFLAGS) \ + $(YTS_DEBUG_CFLAGS) \ $(NULL) -AM_CFLAGS = $(YTSG_CFLAGS) +AM_CFLAGS = $(YTS_CFLAGS) -AM_LDFLAGS = ../ytstenut/libytstenut-@YTSG_API_VERSION@.la +AM_LDFLAGS = ../ytstenut/libytstenut-@YTS_API_VERSION@.la check_PROGRAMS = $(TESTS) message_SOURCES = message.c -message_LDADD = $(YTSG_LIBS) +message_LDADD = $(YTS_LIBS) status_SOURCES = status.c -status_LDADD = $(YTSG_LIBS) +status_LDADD = $(YTS_LIBS) metadata_service_SOURCES = metadata-service.c -metadata_service_LDADD = $(YTSG_LIBS) +metadata_service_LDADD = $(YTS_LIBS) local_connection_SOURCES = local-connection.c -local_connection_LDADD = $(YTSG_LIBS) +local_connection_LDADD = $(YTS_LIBS) ## File transfer can't be tested this way, because it is not possible to do ## FT to self (i.e., there would need to be two separate contacts, but as we ## only have one contact per device, that would mean two machines ... #file_transfer_SOURCES = file-transfer.c -#file_transfer_LDADD = $(YTSG_LIBS) +#file_transfer_LDADD = $(YTS_LIBS) message_send_SOURCES = message-send.c -message_send_LDADD = $(YTSG_LIBS) +message_send_LDADD = $(YTS_LIBS) status_set_SOURCES = status-set.c -status_set_LDADD = $(YTSG_LIBS) +status_set_LDADD = $(YTS_LIBS) diff --git a/tests/file-transfer.c b/tests/file-transfer.c index 03c33dc..419c670 100644 --- a/tests/file-transfer.c +++ b/tests/file-transfer.c @@ -20,9 +20,9 @@ * */ -#include <ytstenut/ytsg-private.h> -#include <ytstenut/ytsg-client.h> -#include <ytstenut/ytsg-main.h> +#include <ytstenut/yts-private.h> +#include <ytstenut/yts-client.h> +#include <ytstenut/yts-main.h> #include <string.h> @@ -31,8 +31,8 @@ static gboolean ready1 = FALSE; static gboolean ready2 = FALSE; static int retval = -2; -static YtsgClient *client1 = NULL; -static YtsgClient *client2 = NULL; +static YtsClient *client1 = NULL; +static YtsClient *client2 = NULL; static GMainLoop *loop = NULL; static gboolean @@ -48,13 +48,13 @@ timeout_test_cb (gpointer data) } static void -authenticated_cb (YtsgClient *client, gpointer data) +authenticated_cb (YtsClient *client, gpointer data) { retval += 1; } static void -incoming_file_finished_cb (YtsgClient *client, +incoming_file_finished_cb (YtsClient *client, const char *s1, const char *s2, gboolean r, @@ -67,7 +67,7 @@ incoming_file_finished_cb (YtsgClient *client, } static gboolean -incoming_file_cb (YtsgClient *client, +incoming_file_cb (YtsClient *client, const char *from, const char *name, guint64 size, @@ -82,14 +82,14 @@ incoming_file_cb (YtsgClient *client, } static void -service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) +service_added_cb (YtsRoster *roster, YtsService *service, gpointer data) { - YtsgClient *client = ytsg_roster_get_client (roster); - YtsgContact *contact = ytsg_service_get_contact (service); - const char *jid = ytsg_contact_get_jid (contact); - const char *sid = ytsg_service_get_uid (service); + YtsClient *client = yts_roster_get_client (roster); + YtsContact *contact = yts_service_get_contact (service); + const char *jid = yts_contact_get_jid (contact); + const char *sid = yts_service_get_uid (service); - static YtsgService *to = NULL; + static YtsService *to = NULL; if (client == client1 && strstr (sid, "com.meego.ytstenut.FileTransferTest2")) { @@ -108,7 +108,7 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) if (ready1 && ready2) { GFile *file = g_file_new_for_path ("file-transfer.c"); - YtsgError e; + YtsError e; retval = 1; @@ -121,15 +121,15 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) g_signal_connect (client2, "incoming-file", G_CALLBACK (incoming_file_cb), NULL); - e = ytsg_contact_send_file (ytsg_service_get_contact (to), file); + e = yts_contact_send_file (yts_service_get_contact (to), file); g_object_unref (file); - if (ytsg_error_get_code (e) != YTSG_ERROR_SUCCESS) + if (yts_error_get_code (e) != YTS_ERROR_SUCCESS) { g_message ("Send file status %d:%d", - ytsg_error_get_atom (e), - ytsg_error_get_code (e)); + yts_error_get_atom (e), + yts_error_get_code (e)); g_main_loop_quit (loop); } } @@ -138,30 +138,30 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) int main (int argc, char **argv) { - YtsgRoster *roster1; - YtsgRoster *roster2; + YtsRoster *roster1; + YtsRoster *roster2; - ytsg_init (0, NULL); + yts_init (0, NULL); loop = g_main_loop_new (NULL, FALSE); - client1 = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client1 = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.FileTransferTest1"); g_signal_connect (client1, "authenticated", G_CALLBACK (authenticated_cb), NULL); - roster1 = ytsg_client_get_roster (client1); + roster1 = yts_client_get_roster (client1); g_signal_connect (roster1, "service-added", G_CALLBACK (service_added_cb), NULL); - ytsg_client_connect (client1); + yts_client_connect (client1); - client2 = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client2 = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.FileTransferTest2"); g_signal_connect (client2, "authenticated", G_CALLBACK (authenticated_cb), NULL); - roster2 = ytsg_client_get_roster (client2); + roster2 = yts_client_get_roster (client2); g_signal_connect (roster2, "service-added", G_CALLBACK (service_added_cb), NULL); - ytsg_client_connect (client2); + yts_client_connect (client2); g_timeout_add_seconds (TEST_LENGTH, timeout_test_cb, loop); diff --git a/tests/local-connection.c b/tests/local-connection.c index 594f7b5..02b0e54 100644 --- a/tests/local-connection.c +++ b/tests/local-connection.c @@ -20,11 +20,11 @@ * */ -#include <ytstenut/ytsg-metadata-service.h> -#include <ytstenut/ytsg-private.h> -#include <ytstenut/ytsg-client.h> -#include <ytstenut/ytsg-status.h> -#include <ytstenut/ytsg-main.h> +#include <ytstenut/yts-metadata-service.h> +#include <ytstenut/yts-private.h> +#include <ytstenut/yts-client.h> +#include <ytstenut/yts-status.h> +#include <ytstenut/yts-main.h> #include <string.h> @@ -72,9 +72,9 @@ timeout_presence_cb (gpointer data) * to the client applications. */ static void -authenticated_cb (YtsgClient *client, gpointer data) +authenticated_cb (YtsClient *client, gpointer data) { - g_message ("Client %s authenticated", ytsg_client_get_jid (client)); + g_message ("Client %s authenticated", yts_client_get_jid (client)); retval = 0; @@ -85,26 +85,26 @@ authenticated_cb (YtsgClient *client, gpointer data) * Sample callback for the 'disconnected' signal. */ static void -disconnected_cb (YtsgClient *client, gpointer data) +disconnected_cb (YtsClient *client, gpointer data) { g_message ("Client disconnected"); } /* - * Sample callback for the YtsgContact 'notify::status' signal; this allows the + * Sample callback for the YtsContact 'notify::status' signal; this allows the * application to monitor status of items in the roster. * * (As a general rule, items that are not in available state should be hidden * in the UI.) */ static void -contact_status_cb (YtsgContact *item, GParamSpec *spec, gpointer data) +contact_status_cb (YtsContact *item, GParamSpec *spec, gpointer data) { g_message ("Status change on %p", item); #if 0 - const YtsgStatus *status = ytsg_contact_get_status (item); + const YtsStatus *status = yts_contact_get_status (item); - ytsg_status_dump (status); + yts_status_dump (status); #endif } @@ -115,19 +115,19 @@ static gboolean timeout_cb (gpointer data) { #if 0 - YtsgContact *item = data; - ytsg_contact_send_command (item, YTSG_CAPS_VIDEO, YTSG_ACTIVITY_PLAY, + YtsContact *item = data; + yts_contact_send_command (item, YTS_CAPS_VIDEO, YTS_ACTIVITY_PLAY, "http://youtube.com/something", 0, NULL); #endif return FALSE; } /* - * Callback for the YtsgRoster 'contact-added' signal; the roster UI in the + * Callback for the YtsRoster 'contact-added' signal; the roster UI in the * application will need to connect to this. */ static void -contact_added_cb (YtsgRoster *client, YtsgContact *item, gpointer data) +contact_added_cb (YtsRoster *client, YtsContact *item, gpointer data) { g_message ("Roster: added %p", item); @@ -141,24 +141,24 @@ contact_added_cb (YtsgRoster *client, YtsgContact *item, gpointer data) } /* - * Callback for the YtsgRoster 'item-removed' signal; application roster UI will + * Callback for the YtsRoster 'item-removed' signal; application roster UI will * need to connect to this to monitor when items are removed. * * NB: if the application took reference to the item, it should unref the * object when it receives this signal. */ static void -contact_removed_cb (YtsgRoster *client, YtsgContact *item, gpointer data) +contact_removed_cb (YtsRoster *client, YtsContact *item, gpointer data) { g_message ("Roster: removed %p", item); } /* - * Callback for the YtsgClient 'message' signal. Applications should rarely need + * Callback for the YtsClient 'message' signal. Applications should rarely need * to connect to this signal (see the 'command' signal instead). */ static void -message_cb (YtsgClient *client, YtsgMessage *msg, gpointer data) +message_cb (YtsClient *client, YtsMessage *msg, gpointer data) { g_debug ("Got message"); } @@ -167,15 +167,15 @@ message_cb (YtsgClient *client, YtsgMessage *msg, gpointer data) int main (int argc, char **argv) { - YtsgClient *client; - YtsgRoster *roster; + YtsClient *client; + YtsRoster *roster; GMainLoop *loop; /* * Initialize stuff needed for telepathy and the GObject type system. */ - ytsg_init (0, NULL); + yts_init (0, NULL); /* * create a main loop for this app @@ -186,10 +186,10 @@ main (int argc, char **argv) loop = g_main_loop_new (NULL, FALSE); /* - * Construct the YtsgClient object and connect to it's signals that interest + * Construct the YtsClient object and connect to it's signals that interest * us. */ - client = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.LocalConnectionTest"); g_signal_connect (client, "authenticated", @@ -199,10 +199,10 @@ main (int argc, char **argv) g_signal_connect (client, "message", G_CALLBACK (message_cb), NULL); - roster = ytsg_client_get_roster (client); + roster = yts_client_get_roster (client); /* - * Connect to any YtsgRoster object signals that we care about. + * Connect to any YtsRoster object signals that we care about. * * NB: at this point the roster is empty, i.e., you cannot start populating * the UI here. @@ -215,7 +215,7 @@ main (int argc, char **argv) /* * Initiate network connection. */ - ytsg_client_connect (client); + yts_client_connect (client); g_timeout_add_seconds (TEST_LENGTH, timeout_test_cb, loop); diff --git a/tests/message-send.c b/tests/message-send.c index 0ea6821..f854dc9 100644 --- a/tests/message-send.c +++ b/tests/message-send.c @@ -20,9 +20,9 @@ * */ -#include <ytstenut/ytsg-private.h> -#include <ytstenut/ytsg-client.h> -#include <ytstenut/ytsg-main.h> +#include <ytstenut/yts-private.h> +#include <ytstenut/yts-client.h> +#include <ytstenut/yts-main.h> #include <string.h> @@ -31,8 +31,8 @@ static gboolean ready1 = FALSE; static gboolean ready2 = FALSE; static int retval = -2; -static YtsgClient *client1 = NULL; -static YtsgClient *client2 = NULL; +static YtsClient *client1 = NULL; +static YtsClient *client2 = NULL; static GMainLoop *loop = NULL; static gboolean @@ -48,35 +48,35 @@ timeout_test_cb (gpointer data) } static void -authenticated_cb (YtsgClient *client, gpointer data) +authenticated_cb (YtsClient *client, gpointer data) { retval += 1; } static void -message_cb (YtsgClient *client, YtsgMessage *msg, gpointer data) +message_cb (YtsClient *client, YtsMessage *msg, gpointer data) { - YtsgMetadata *md = (YtsgMetadata*)msg; + YtsMetadata *md = (YtsMetadata*)msg; - g_assert (YTSG_IS_MESSAGE (msg)); + g_assert (YTS_IS_MESSAGE (msg)); - g_assert_cmpstr ("v1", ==, ytsg_metadata_get_attribute (md, "a1")); - g_assert_cmpstr ("v2", ==, ytsg_metadata_get_attribute (md, "a2")); + g_assert_cmpstr ("v1", ==, yts_metadata_get_attribute (md, "a1")); + g_assert_cmpstr ("v2", ==, yts_metadata_get_attribute (md, "a2")); retval = 0; g_main_loop_quit (loop); } static void -service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) +service_added_cb (YtsRoster *roster, YtsService *service, gpointer data) { - YtsgClient *client = ytsg_roster_get_client (roster); - YtsgContact *contact = ytsg_service_get_contact (service); - const char *jid = ytsg_contact_get_jid (contact); - const char *sid = ytsg_service_get_uid (service); + YtsClient *client = yts_roster_get_client (roster); + YtsContact *contact = yts_service_get_contact (service); + const char *jid = yts_contact_get_jid (contact); + const char *sid = yts_service_get_uid (service); gboolean our = FALSE; - static YtsgService *service2 = NULL; + static YtsService *service2 = NULL; g_debug ("Service %s:%s", jid, sid); @@ -100,8 +100,8 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) */ if (our && ready1 && ready2) { - YtsgError e; - YtsgMetadata *metadata; + YtsError e; + YtsMetadata *metadata; const char *attributes[] = { "a1", "v1", @@ -109,44 +109,44 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) NULL }; - metadata = (YtsgMetadata*)ytsg_message_new ((const char**)&attributes); + metadata = (YtsMetadata*)yts_message_new ((const char**)&attributes); g_debug ("Both test services are ready, sending message"); - e = ytsg_metadata_service_send_metadata ((YtsgMetadataService *)service2, + e = yts_metadata_service_send_metadata ((YtsMetadataService *)service2, metadata); - g_assert (ytsg_error_get_code (e) == YTSG_ERROR_PENDING); + g_assert (yts_error_get_code (e) == YTS_ERROR_PENDING); } } int main (int argc, char **argv) { - YtsgRoster *roster1; - YtsgRoster *roster2; + YtsRoster *roster1; + YtsRoster *roster2; - ytsg_init (0, NULL); + yts_init (0, NULL); loop = g_main_loop_new (NULL, FALSE); - client1 = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client1 = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.SendMessageTest1"); g_signal_connect (client1, "authenticated", G_CALLBACK (authenticated_cb), NULL); - roster1 = ytsg_client_get_roster (client1); + roster1 = yts_client_get_roster (client1); g_signal_connect (roster1, "service-added", G_CALLBACK (service_added_cb), NULL); - ytsg_client_connect (client1); + yts_client_connect (client1); - client2 = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client2 = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.SendMessageTest2"); g_signal_connect (client2, "authenticated", G_CALLBACK (authenticated_cb), NULL); - roster2 = ytsg_client_get_roster (client2); + roster2 = yts_client_get_roster (client2); g_signal_connect (roster2, "service-added", G_CALLBACK (service_added_cb), NULL); - ytsg_client_connect (client2); + yts_client_connect (client2); g_timeout_add_seconds (TEST_LENGTH, timeout_test_cb, loop); diff --git a/tests/message.c b/tests/message.c index edb7ded..05d5d12 100644 --- a/tests/message.c +++ b/tests/message.c @@ -20,15 +20,15 @@ * */ -#include <ytstenut/ytsg-message.h> -#include <ytstenut/ytsg-private.h> +#include <ytstenut/yts-message.h> +#include <ytstenut/yts-private.h> #include <string.h> int main (int argc, char **argv) { - YtsgMessage *message; - YtsgMetadata *mdata; + YtsMessage *message; + YtsMetadata *mdata; const char *attrs[] = {"a1", "v1", "a2", "v2", NULL}; const char *a1, *a2, *a3; RestXmlNode *child; @@ -38,23 +38,23 @@ main (int argc, char **argv) g_thread_init (NULL); g_type_init (); - message = ytsg_message_new (attrs); - mdata = (YtsgMetadata*)message; + message = yts_message_new (attrs); + mdata = (YtsMetadata*)message; - ytsg_metadata_add_attribute (mdata, "a3", "v3"); - a1 = ytsg_metadata_get_attribute (mdata, "a1"); - a2 = ytsg_metadata_get_attribute (mdata, "a2"); - a3 = ytsg_metadata_get_attribute (mdata, "a3"); + yts_metadata_add_attribute (mdata, "a3", "v3"); + a1 = yts_metadata_get_attribute (mdata, "a1"); + a2 = yts_metadata_get_attribute (mdata, "a2"); + a3 = yts_metadata_get_attribute (mdata, "a3"); g_assert_cmpstr (a1, ==, "v1"); g_assert_cmpstr (a2, ==, "v2"); g_assert_cmpstr (a3, ==, "v3"); - child = rest_xml_node_add_child (ytsg_metadata_get_root_node (mdata),"c1"); + child = rest_xml_node_add_child (yts_metadata_get_root_node (mdata),"c1"); rest_xml_node_add_attr (child, "ca1", "cv1"); - h = _ytsg_metadata_extract (mdata, &body); + h = _yts_metadata_extract (mdata, &body); g_assert (h); g_assert_cmpstr (body, ==, "<c1 ca1='cv1'></c1>"); diff --git a/tests/metadata-service.c b/tests/metadata-service.c index 0e054bb..553559b 100644 --- a/tests/metadata-service.c +++ b/tests/metadata-service.c @@ -20,9 +20,9 @@ * */ -#include <ytstenut/ytsg-metadata-service.h> -#include <ytstenut/ytsg-private.h> -#include <ytstenut/ytsg-status.h> +#include <ytstenut/yts-metadata-service.h> +#include <ytstenut/yts-private.h> +#include <ytstenut/yts-status.h> #include <string.h> #define MYUID "com.meego.ytstenut.TestService" @@ -33,31 +33,31 @@ static gboolean got_status_signal = FALSE; static gboolean got_message_signal = FALSE; static void -status_cb (YtsgMetadataService *service, YtsgStatus *status, gpointer data) +status_cb (YtsMetadataService *service, YtsStatus *status, gpointer data) { - YtsgStatus *s2 = data; + YtsStatus *s2 = data; got_status_signal = TRUE; - g_assert (ytsg_metadata_is_equal ((YtsgMetadata*)status, (YtsgMetadata*)s2)); + g_assert (yts_metadata_is_equal ((YtsMetadata*)status, (YtsMetadata*)s2)); } static void -message_cb (YtsgMetadataService *service, YtsgMessage *message, gpointer data) +message_cb (YtsMetadataService *service, YtsMessage *message, gpointer data) { - YtsgMessage *m2 = data; + YtsMessage *m2 = data; got_message_signal = TRUE; - g_assert (ytsg_metadata_is_equal ((YtsgMetadata*)message, (YtsgMetadata*)m2)); + g_assert (yts_metadata_is_equal ((YtsMetadata*)message, (YtsMetadata*)m2)); } int main (int argc, char **argv) { - YtsgService *service; - YtsgStatus *status; - YtsgMessage *message; + YtsService *service; + YtsStatus *status; + YtsMessage *message; const char *uid; g_thread_init (NULL); @@ -67,7 +67,7 @@ main (int argc, char **argv) * The metadata-serivice-test property allows for partial construction of * the object, so we can run some rudimentary tests. */ - service = g_object_new (YTSG_TYPE_METADATA_SERVICE, + service = g_object_new (YTS_TYPE_METADATA_SERVICE, "metadata-service-test", TRUE, "uid", MYUID, "type", "application", @@ -75,28 +75,28 @@ main (int argc, char **argv) g_assert (service); - uid = ytsg_service_get_uid (service); + uid = yts_service_get_uid (service); g_assert_cmpstr (MYUID, ==, uid); - status = (YtsgStatus*)_ytsg_metadata_new_from_xml (STATUS_XML); - g_assert (YTSG_IS_STATUS (status)); + status = (YtsStatus*)_yts_metadata_new_from_xml (STATUS_XML); + g_assert (YTS_IS_STATUS (status)); g_signal_connect (service, "status", G_CALLBACK (status_cb), status); - _ytsg_metadata_service_received_status ((YtsgMetadataService*)service, + _yts_metadata_service_received_status ((YtsMetadataService*)service, STATUS_XML); g_assert (got_status_signal); - message = (YtsgMessage*)_ytsg_metadata_new_from_xml (MESSAGE_XML); - g_assert (YTSG_IS_MESSAGE (message)); + message = (YtsMessage*)_yts_metadata_new_from_xml (MESSAGE_XML); + g_assert (YTS_IS_MESSAGE (message)); g_signal_connect (service, "message", G_CALLBACK (message_cb), message); - _ytsg_metadata_service_received_message ((YtsgMetadataService*)service, + _yts_metadata_service_received_message ((YtsMetadataService*)service, MESSAGE_XML); g_assert (got_message_signal); diff --git a/tests/status-set.c b/tests/status-set.c index 1ff88ee..9de338f 100644 --- a/tests/status-set.c +++ b/tests/status-set.c @@ -20,9 +20,9 @@ * */ -#include <ytstenut/ytsg-private.h> -#include <ytstenut/ytsg-client.h> -#include <ytstenut/ytsg-main.h> +#include <ytstenut/yts-private.h> +#include <ytstenut/yts-client.h> +#include <ytstenut/yts-main.h> #include <string.h> @@ -31,8 +31,8 @@ static gboolean ready1 = FALSE; static gboolean ready2 = FALSE; static int retval = -2; -static YtsgClient *client1 = NULL; -static YtsgClient *client2 = NULL; +static YtsClient *client1 = NULL; +static YtsClient *client2 = NULL; static GMainLoop *loop = NULL; static gboolean @@ -48,17 +48,17 @@ timeout_test_cb (gpointer data) } static void -authenticated_cb (YtsgClient *client, gpointer data) +authenticated_cb (YtsClient *client, gpointer data) { retval += 1; } static void -status_cb (YtsgClient *client, YtsgStatus *status, gpointer data) +status_cb (YtsClient *client, YtsStatus *status, gpointer data) { - YtsgMetadata *md = (YtsgMetadata*)status; + YtsMetadata *md = (YtsMetadata*)status; - g_assert (YTSG_IS_STATUS (status)); + g_assert (YTS_IS_STATUS (status)); /* TODO -- check what is in the status ... */ retval = 0; @@ -67,15 +67,15 @@ status_cb (YtsgClient *client, YtsgStatus *status, gpointer data) } static void -service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) +service_added_cb (YtsRoster *roster, YtsService *service, gpointer data) { - YtsgClient *client = ytsg_roster_get_client (roster); - YtsgContact *contact = ytsg_service_get_contact (service); - const char *jid = ytsg_contact_get_jid (contact); - const char *sid = ytsg_service_get_uid (service); + YtsClient *client = yts_roster_get_client (roster); + YtsContact *contact = yts_service_get_contact (service); + const char *jid = yts_contact_get_jid (contact); + const char *sid = yts_service_get_uid (service); gboolean our = FALSE; - static YtsgService *service2 = NULL; + static YtsService *service2 = NULL; g_debug ("Service %s:%s", jid, sid); @@ -99,7 +99,7 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) */ if (our && ready1 && ready2) { - YtsgStatus *status; + YtsStatus *status; const char *attributes[] = { "capability", "urn:ytstenut:capabilities:yts-caps-video", @@ -110,9 +110,9 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) g_debug ("Both test services are ready, setting status"); - status = ytsg_status_new ((const char**)&attributes); + status = yts_status_new ((const char**)&attributes); - ytsg_client_set_status_by_capability (client1, + yts_client_set_status_by_capability (client1, "urn:ytstenut:capabilities:yts-caps-video", "yts-activity-playing"); } @@ -121,32 +121,32 @@ service_added_cb (YtsgRoster *roster, YtsgService *service, gpointer data) int main (int argc, char **argv) { - YtsgRoster *roster1; - YtsgRoster *roster2; + YtsRoster *roster1; + YtsRoster *roster2; - ytsg_init (0, NULL); + yts_init (0, NULL); loop = g_main_loop_new (NULL, FALSE); - client1 = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client1 = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.SetStatusTest1"); - ytsg_client_set_capabilities (client1, YTSG_CAPS_VIDEO); + yts_client_set_capabilities (client1, YTS_CAPS_VIDEO); g_signal_connect (client1, "authenticated", G_CALLBACK (authenticated_cb), NULL); - roster1 = ytsg_client_get_roster (client1); + roster1 = yts_client_get_roster (client1); g_signal_connect (roster1, "service-added", G_CALLBACK (service_added_cb), NULL); - ytsg_client_connect (client1); + yts_client_connect (client1); - client2 = ytsg_client_new (YTSG_PROTOCOL_LOCAL_XMPP, + client2 = yts_client_new (YTS_PROTOCOL_LOCAL_XMPP, "com.meego.ytstenut.SetStatusTest2"); - ytsg_client_set_capabilities (client2, YTSG_CAPS_VIDEO); + yts_client_set_capabilities (client2, YTS_CAPS_VIDEO); g_signal_connect (client2, "authenticated", G_CALLBACK (authenticated_cb), NULL); - roster2 = ytsg_client_get_roster (client2); + roster2 = yts_client_get_roster (client2); g_signal_connect (roster2, "service-added", G_CALLBACK (service_added_cb), NULL); - ytsg_client_connect (client2); + yts_client_connect (client2); g_timeout_add_seconds (TEST_LENGTH, timeout_test_cb, loop); diff --git a/tests/status.c b/tests/status.c index 7ea854e..e794593 100644 --- a/tests/status.c +++ b/tests/status.c @@ -20,15 +20,15 @@ * */ -#include <ytstenut/ytsg-status.h> -#include <ytstenut/ytsg-message.h> +#include <ytstenut/yts-status.h> +#include <ytstenut/yts-message.h> #include <string.h> int main (int argc, char **argv) { - YtsgStatus *status1, *status2; - YtsgMessage *message; + YtsStatus *status1, *status2; + YtsMessage *message; const char *attrs[] = { "capability", "urn:ytstenut:capabilities:yts-caps-video", "activity", "yts-activity-playing", @@ -40,29 +40,29 @@ main (int argc, char **argv) g_thread_init (NULL); g_type_init (); - status1 = ytsg_status_new (attrs); + status1 = yts_status_new (attrs); - ytsg_metadata_add_attribute ((YtsgMetadata*)status1, "a3", "v3"); - a1 = ytsg_metadata_get_attribute ((YtsgMetadata*)status1, "a1"); - a2 = ytsg_metadata_get_attribute ((YtsgMetadata*)status1, "a2"); - a3 = ytsg_metadata_get_attribute ((YtsgMetadata*)status1, "a3"); + yts_metadata_add_attribute ((YtsMetadata*)status1, "a3", "v3"); + a1 = yts_metadata_get_attribute ((YtsMetadata*)status1, "a1"); + a2 = yts_metadata_get_attribute ((YtsMetadata*)status1, "a2"); + a3 = yts_metadata_get_attribute ((YtsMetadata*)status1, "a3"); g_assert_cmpstr (a1, ==, "v1"); g_assert_cmpstr (a2, ==, "v2"); g_assert_cmpstr (a3, ==, "v3"); - status2 = ytsg_status_new (attrs); + status2 = yts_status_new (attrs); - g_assert (!ytsg_metadata_is_equal ((YtsgMetadata*)status1, - (YtsgMetadata*)status2)); + g_assert (!yts_metadata_is_equal ((YtsMetadata*)status1, + (YtsMetadata*)status2)); - ytsg_metadata_add_attribute ((YtsgMetadata*)status2, "a3", "v3"); + yts_metadata_add_attribute ((YtsMetadata*)status2, "a3", "v3"); - g_assert (ytsg_metadata_is_equal ((YtsgMetadata*)status1, - (YtsgMetadata*)status2)); + g_assert (yts_metadata_is_equal ((YtsMetadata*)status1, + (YtsMetadata*)status2)); - top1 = ytsg_metadata_get_root_node ((YtsgMetadata*)status1); - top2 = ytsg_metadata_get_root_node ((YtsgMetadata*)status2); + top1 = yts_metadata_get_root_node ((YtsMetadata*)status1); + top2 = yts_metadata_get_root_node ((YtsMetadata*)status2); child11 = rest_xml_node_add_child (top1, "t"); child12 = rest_xml_node_add_child (top1, "t"); @@ -70,24 +70,24 @@ main (int argc, char **argv) child21 = rest_xml_node_add_child (top2, "t"); child22 = rest_xml_node_add_child (top2, "t"); - g_assert (ytsg_metadata_is_equal ((YtsgMetadata*)status1, - (YtsgMetadata*)status2)); + g_assert (yts_metadata_is_equal ((YtsMetadata*)status1, + (YtsMetadata*)status2)); rest_xml_node_add_attr (child11, "a4", "v4"); rest_xml_node_add_attr (child21, "a4", "v4"); - g_assert (ytsg_metadata_is_equal ((YtsgMetadata*)status1, - (YtsgMetadata*)status2)); + g_assert (yts_metadata_is_equal ((YtsMetadata*)status1, + (YtsMetadata*)status2)); rest_xml_node_add_attr (child21, "a5", "v5"); - g_assert (!ytsg_metadata_is_equal ((YtsgMetadata*)status1, - (YtsgMetadata*)status2)); + g_assert (!yts_metadata_is_equal ((YtsMetadata*)status1, + (YtsMetadata*)status2)); - message = ytsg_message_new (NULL); + message = yts_message_new (NULL); - g_assert (!ytsg_metadata_is_equal ((YtsgMetadata*)status1, - (YtsgMetadata*)message)); + g_assert (!yts_metadata_is_equal ((YtsMetadata*)status1, + (YtsMetadata*)message)); return 0; } diff --git a/ytstenut/Makefile.am b/ytstenut/Makefile.am index 460b45b..fd900b9 100644 --- a/ytstenut/Makefile.am +++ b/ytstenut/Makefile.am @@ -9,165 +9,165 @@ AM_CPPFLAGS = \ -DG_DISABLE_DEPRECATED \ -DG_DISABLE_SINGLE_INCLUDES \ -DG_LOG_DOMAIN=\"YtstenutGlib\" \ - $(YTSG_DEBUG_CFLAGS) \ + $(YTS_DEBUG_CFLAGS) \ $(NULL) -AM_CFLAGS = $(YTSG_CFLAGS) +AM_CFLAGS = $(YTS_CFLAGS) source_h = \ $(srcdir)/empathy-tp-file.h \ - $(srcdir)/ytsg-capability.h \ - $(srcdir)/ytsg-caps.h \ - $(srcdir)/ytsg-client.h \ - $(srcdir)/ytsg-contact.h \ - $(srcdir)/ytsg-debug.h \ - $(srcdir)/ytsg-error.h \ - $(srcdir)/ytsg-main.h \ - $(srcdir)/ytsg-message.h \ - $(srcdir)/ytsg-metadata.h \ - $(srcdir)/ytsg-metadata-service.h \ - $(srcdir)/ytsg-roster.h \ - $(srcdir)/ytsg-service.h \ - $(srcdir)/ytsg-status.h \ - $(srcdir)/ytsg-types.h \ - $(srcdir)/ytsg-version.h \ + $(srcdir)/yts-capability.h \ + $(srcdir)/yts-caps.h \ + $(srcdir)/yts-client.h \ + $(srcdir)/yts-contact.h \ + $(srcdir)/yts-debug.h \ + $(srcdir)/yts-error.h \ + $(srcdir)/yts-main.h \ + $(srcdir)/yts-message.h \ + $(srcdir)/yts-metadata.h \ + $(srcdir)/yts-metadata-service.h \ + $(srcdir)/yts-roster.h \ + $(srcdir)/yts-service.h \ + $(srcdir)/yts-status.h \ + $(srcdir)/yts-types.h \ + $(srcdir)/yts-version.h \ \ - $(srcdir)/ytsg-capability-status.h \ - $(srcdir)/ytsg-error-message.h \ - $(srcdir)/ytsg-event-message.h \ - $(srcdir)/ytsg-invocation-message.h \ - $(srcdir)/ytsg-proxy.h \ - $(srcdir)/ytsg-proxy-service.h \ - $(srcdir)/ytsg-response-message.h \ - $(srcdir)/ytsg-service-adapter.h \ + $(srcdir)/yts-capability-status.h \ + $(srcdir)/yts-error-message.h \ + $(srcdir)/yts-event-message.h \ + $(srcdir)/yts-invocation-message.h \ + $(srcdir)/yts-proxy.h \ + $(srcdir)/yts-proxy-service.h \ + $(srcdir)/yts-response-message.h \ + $(srcdir)/yts-service-adapter.h \ \ - $(srcdir)/video-profile/ytsg-vp-content.h \ - $(srcdir)/video-profile/ytsg-vp-playable.h \ - $(srcdir)/video-profile/ytsg-vp-player.h \ - $(srcdir)/video-profile/ytsg-vp-query.h \ - $(srcdir)/video-profile/ytsg-vp-transcript.h \ - $(srcdir)/video-profile/ytsg-vp-transfer.h \ - $(srcdir)/video-profile/ytsg-vp-transmission.h \ + $(srcdir)/video-profile/yts-vp-content.h \ + $(srcdir)/video-profile/yts-vp-playable.h \ + $(srcdir)/video-profile/yts-vp-player.h \ + $(srcdir)/video-profile/yts-vp-query.h \ + $(srcdir)/video-profile/yts-vp-transcript.h \ + $(srcdir)/video-profile/yts-vp-transfer.h \ + $(srcdir)/video-profile/yts-vp-transmission.h \ $(NULL) source_c = \ $(srcdir)/empathy-tp-file.c \ - $(srcdir)/ytsg-capability.c \ - $(srcdir)/ytsg-client.c \ - $(srcdir)/ytsg-contact.c \ - $(srcdir)/ytsg-enum-types.c \ - $(srcdir)/ytsg-error.c \ - $(srcdir)/ytsg-main.c \ - $(srcdir)/ytsg-marshal.c \ - $(srcdir)/ytsg-message.c \ - $(srcdir)/ytsg-metadata.c \ - $(srcdir)/ytsg-metadata-service.c \ - $(srcdir)/ytsg-roster.c \ - $(srcdir)/ytsg-service.c \ - $(srcdir)/ytsg-status.c \ + $(srcdir)/yts-capability.c \ + $(srcdir)/yts-client.c \ + $(srcdir)/yts-contact.c \ + $(srcdir)/yts-enum-types.c \ + $(srcdir)/yts-error.c \ + $(srcdir)/yts-main.c \ + $(srcdir)/yts-marshal.c \ + $(srcdir)/yts-message.c \ + $(srcdir)/yts-metadata.c \ + $(srcdir)/yts-metadata-service.c \ + $(srcdir)/yts-roster.c \ + $(srcdir)/yts-service.c \ + $(srcdir)/yts-status.c \ \ - $(srcdir)/ytsg-capability-status.c \ - $(srcdir)/ytsg-error-message.c \ - $(srcdir)/ytsg-event-message.c \ - $(srcdir)/ytsg-invocation-message.c \ - $(srcdir)/ytsg-proxy.c \ - $(srcdir)/ytsg-proxy-service.c \ - $(srcdir)/ytsg-response-message.c \ - $(srcdir)/ytsg-service-adapter.c \ + $(srcdir)/yts-capability-status.c \ + $(srcdir)/yts-error-message.c \ + $(srcdir)/yts-event-message.c \ + $(srcdir)/yts-invocation-message.c \ + $(srcdir)/yts-proxy.c \ + $(srcdir)/yts-proxy-service.c \ + $(srcdir)/yts-response-message.c \ + $(srcdir)/yts-service-adapter.c \ \ - $(srcdir)/profile/ytsg-profile.c \ - $(srcdir)/profile/ytsg-profile-impl.c \ - $(srcdir)/profile/ytsg-profile-proxy.c \ - $(srcdir)/profile/ytsg-profile-adapter.c \ + $(srcdir)/profile/yts-profile.c \ + $(srcdir)/profile/yts-profile-impl.c \ + $(srcdir)/profile/yts-profile-proxy.c \ + $(srcdir)/profile/yts-profile-adapter.c \ \ - $(srcdir)/video-profile/ytsg-vp-content.c \ - $(srcdir)/video-profile/ytsg-vp-playable.c \ - $(srcdir)/video-profile/ytsg-vp-playable-proxy.c \ - $(srcdir)/video-profile/ytsg-vp-player.c \ - $(srcdir)/video-profile/ytsg-vp-player-adapter.c \ - $(srcdir)/video-profile/ytsg-vp-player-proxy.c \ - $(srcdir)/video-profile/ytsg-vp-query.c \ - $(srcdir)/video-profile/ytsg-vp-transcript.c \ - $(srcdir)/video-profile/ytsg-vp-transcript-adapter.c \ - $(srcdir)/video-profile/ytsg-vp-transcript-proxy.c \ - $(srcdir)/video-profile/ytsg-vp-transfer.c \ - $(srcdir)/video-profile/ytsg-vp-transmission.c \ + $(srcdir)/video-profile/yts-vp-content.c \ + $(srcdir)/video-profile/yts-vp-playable.c \ + $(srcdir)/video-profile/yts-vp-playable-proxy.c \ + $(srcdir)/video-profile/yts-vp-player.c \ + $(srcdir)/video-profile/yts-vp-player-adapter.c \ + $(srcdir)/video-profile/yts-vp-player-proxy.c \ + $(srcdir)/video-profile/yts-vp-query.c \ + $(srcdir)/video-profile/yts-vp-transcript.c \ + $(srcdir)/video-profile/yts-vp-transcript-adapter.c \ + $(srcdir)/video-profile/yts-vp-transcript-proxy.c \ + $(srcdir)/video-profile/yts-vp-transfer.c \ + $(srcdir)/video-profile/yts-vp-transmission.c \ $(NULL) private_h = \ - $(srcdir)/ytsg-private.h \ + $(srcdir)/yts-private.h \ \ - $(srcdir)/profile/ytsg-profile.h \ - $(srcdir)/profile/ytsg-profile-impl.h \ - $(srcdir)/profile/ytsg-profile-proxy.h \ - $(srcdir)/profile/ytsg-profile-adapter.h \ + $(srcdir)/profile/yts-profile.h \ + $(srcdir)/profile/yts-profile-impl.h \ + $(srcdir)/profile/yts-profile-proxy.h \ + $(srcdir)/profile/yts-profile-adapter.h \ \ - $(srcdir)/video-profile/ytsg-vp-playable-proxy.h \ - $(srcdir)/video-profile/ytsg-vp-player-adapter.h \ - $(srcdir)/video-profile/ytsg-vp-player-proxy.h \ - $(srcdir)/video-profile/ytsg-vp-transcript-adapter.h \ - $(srcdir)/video-profile/ytsg-vp-transcript-proxy.h \ + $(srcdir)/video-profile/yts-vp-playable-proxy.h \ + $(srcdir)/video-profile/yts-vp-player-adapter.h \ + $(srcdir)/video-profile/yts-vp-player-proxy.h \ + $(srcdir)/video-profile/yts-vp-transcript-adapter.h \ + $(srcdir)/video-profile/yts-vp-transcript-proxy.h \ $(NULL) -libytstenut_@YTSG_API_VERSION@_la_SOURCES = $(source_h) \ +libytstenut_@YTS_API_VERSION@_la_SOURCES = $(source_h) \ $(private_h) \ $(source_c) -STAMPS = stamp-marshal.h stamp-ytsg-enum-types.h +STAMPS = stamp-marshal.h stamp-yts-enum-types.h -ENUMS = ytsg-enum-types.h \ - ytsg-enum-types.c +ENUMS = yts-enum-types.h \ + yts-enum-types.c -ytsg-enum-types.h: stamp-ytsg-enum-types.h +yts-enum-types.h: stamp-yts-enum-types.h @true -stamp-ytsg-enum-types.h: $(source_h) Makefile +stamp-yts-enum-types.h: $(source_h) Makefile $(QUIET_GEN)( $(GLIB_MKENUMS) \ - --template $(srcdir)/ytsg-enum-types.h.in \ + --template $(srcdir)/yts-enum-types.h.in \ $(source_h) ) >> xgen-ceth && \ - (cmp -s xgen-ceth ytsg-enum-types.h || cp xgen-ceth ytsg-enum-types.h) && \ + (cmp -s xgen-ceth yts-enum-types.h || cp xgen-ceth yts-enum-types.h) && \ rm -f xgen-ceth && \ echo timestamp > $(@F) -ytsg-enum-types.c: ytsg-enum-types.h +yts-enum-types.c: yts-enum-types.h $(QUIET_GEN)( $(GLIB_MKENUMS) \ - --template $(srcdir)/ytsg-enum-types.c.in \ + --template $(srcdir)/yts-enum-types.c.in \ $(source_h) ) >> xgen-cetc && \ - cp xgen-cetc ytsg-enum-types.c && \ + cp xgen-cetc yts-enum-types.c && \ rm -f xgen-cetc -MARSHALS = ytsg-marshal.c ytsg-marshal.h +MARSHALS = yts-marshal.c yts-marshal.h -ytsg-marshal.h: stamp-marshal.h +yts-marshal.h: stamp-marshal.h @true stamp-marshal.h: marshal.list $(QUIET_GEN)$(GLIB_GENMARSHAL) \ - --prefix=ytsg_marshal \ + --prefix=yts_marshal \ --header \ $(srcdir)/marshal.list > xgen-cmh \ - && (cmp -s xgen-cmh ytsg-marshal.h || cp xgen-cmh ytsg-marshal.h ) \ + && (cmp -s xgen-cmh yts-marshal.h || cp xgen-cmh yts-marshal.h ) \ && rm -f xgen-cmh \ && echo timestamp > $(@F) -ytsg-marshal.c: ytsg-marshal.h Makefile - $(QUIET_GEN)( echo "#include \"ytsg-marshal.h\"" ; \ +yts-marshal.c: yts-marshal.h Makefile + $(QUIET_GEN)( echo "#include \"yts-marshal.h\"" ; \ $(GLIB_GENMARSHAL) \ - --prefix=ytsg_marshal \ + --prefix=yts_marshal \ --body \ $(srcdir)/marshal.list --body ) >> xgen-cmc \ - && cp xgen-cmc ytsg-marshal.c \ + && cp xgen-cmc yts-marshal.c \ && rm -f xgen-cmc -libytstenut_@YTSG_API_VERSION@_la_LDFLAGS = $(YTSG_LT_LDFLAGS) \ +libytstenut_@YTS_API_VERSION@_la_LDFLAGS = $(YTS_LT_LDFLAGS) \ -no-undefined -libytstenut_@YTSG_API_VERSION@_la_LIBADD = $(YTSG_LIBS) +libytstenut_@YTS_API_VERSION@_la_LIBADD = $(YTS_LIBS) -lib_LTLIBRARIES = libytstenut-@YTSG_API_VERSION@.la +lib_LTLIBRARIES = libytstenut-@YTS_API_VERSION@.la -ytstenutheadersdir = $(includedir)/ytstenut-$(YTSG_API_VERSION)/ytstenut +ytstenutheadersdir = $(includedir)/ytstenut-$(YTS_API_VERSION)/ytstenut ytstenutheaders_HEADERS = \ $(source_h) \ - $(srcdir)/ytsg-enum-types.h \ - $(srcdir)/ytsg-marshal.h \ + $(srcdir)/yts-enum-types.h \ + $(srcdir)/yts-marshal.h \ $(srcdir)/ytstenut.h \ $(NULL) @@ -175,25 +175,25 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = ytstenut-1.pc if WITH_INTROSPECTION -Ytsg-@YTSG_API_VERSION@.gir: $(G_IR_SCANNER) libytstenut-@YTSG_API_VERSION@.la +Yts-@YTS_API_VERSION@.gir: $(G_IR_SCANNER) libytstenut-@YTS_API_VERSION@.la $(QUIET_GEN) $(G_IR_SCANNER) -v \ - --namespace=Ytsg --nsversion=@YTSG_API_VERSION@ \ - --strip-prefix=Ytsg \ + --namespace=Yts --nsversion=@YTS_API_VERSION@ \ + --strip-prefix=Yts \ $(INCLUDES_FOR_GIR) \ - $(YTSG_CFLAGS) \ + $(YTS_CFLAGS) \ $(AM_CPPFLAGS) \ - --add-init-section="ytsg_init(0,NULL);"\ + --add-init-section="yts_init(0,NULL);"\ --c-include='ytstenut/ytstenut.h' \ --include=GObject-2.0 \ --include=TelepathyGLib-0.12 \ - --library=libytstenut-@YTSG_API_VERSION@.la \ + --library=libytstenut-@YTS_API_VERSION@.la \ --libtool="$(top_builddir)/libtool" \ --pkg gobject-2.0 \ --output $@ \ $(ytstenutheaders_HEADERS) \ $(source_c) -BUILT_GIRSOURCES += Ytsg-@YTSG_API_VERSION@.gir +BUILT_GIRSOURCES += Yts-@YTS_API_VERSION@.gir # G_IR_GIRDIR/G_IR_TYPELIBDIR aren't the right place to # install anything - we need to install inside our prefix. @@ -220,11 +220,11 @@ BUILT_SOURCES += $(MARSHALS) $(ENUMS) CLEANFILES += $(BUILT_SOURCES) $(STAMPS) ytstenut-1.pc EXTRA_DIST = marshal.list \ - ytsg-enum-types.h.in \ - ytsg-enum-types.c.in \ - ytsg-version.h.in \ + yts-enum-types.h.in \ + yts-enum-types.c.in \ + yts-version.h.in \ ytstenut-1.pc.in \ $(NULL) -DISTCLEANFILES= ytsg-version.h \ +DISTCLEANFILES= yts-version.h \ $(NULL) diff --git a/ytstenut/empathy-tp-file.c b/ytstenut/empathy-tp-file.c index dc8aecb..395e79b 100644 --- a/ytstenut/empathy-tp-file.c +++ b/ytstenut/empathy-tp-file.c @@ -54,8 +54,8 @@ #include <telepathy-glib/interfaces.h> #include "empathy-tp-file.h" -#include "ytsg-marshal.h" -#include "ytsg-debug.h" +#include "yts-marshal.h" +#include "yts-debug.h" #if 0 #include "empathy-time.h" @@ -185,7 +185,7 @@ tp_file_get_available_socket_types_cb (TpProxy *proxy, } out: - YTSG_NOTE (FILE_TRANSFER, "Socket address type: %u, access control %u", + YTS_NOTE (FILE_TRANSFER, "Socket address type: %u, access control %u", priv->socket_address_type, priv->socket_access_control); } @@ -198,7 +198,7 @@ tp_file_invalidated_cb (TpProxy *proxy, { EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - YTSG_NOTE (FILE_TRANSFER, "Channel invalidated: %s", message); + YTS_NOTE (FILE_TRANSFER, "Channel invalidated: %s", message); if (priv->state != TP_FILE_TRANSFER_STATE_COMPLETED && priv->state != TP_FILE_TRANSFER_STATE_CANCELLED) @@ -218,7 +218,7 @@ ft_operation_close_clean (EmpathyTpFile *tp_file) if (priv->is_closed) return; - YTSG_NOTE (FILE_TRANSFER, "FT operation close clean"); + YTS_NOTE (FILE_TRANSFER, "FT operation close clean"); priv->is_closed = TRUE; @@ -235,7 +235,7 @@ ft_operation_close_with_error (EmpathyTpFile *tp_file, if (priv->is_closed) return; - YTSG_NOTE (FILE_TRANSFER, "FT operation close with error %s", error->message); + YTS_NOTE (FILE_TRANSFER, "FT operation close with error %s", error->message); priv->is_closed = TRUE; @@ -259,7 +259,7 @@ splice_stream_ready_cb (GObject *source, g_output_stream_splice_finish (G_OUTPUT_STREAM (source), res, &error); - YTSG_NOTE (FILE_TRANSFER, "Splice stream ready cb, error %p", error); + YTS_NOTE (FILE_TRANSFER, "Splice stream ready cb, error %p", error); if (error != NULL) { @@ -291,7 +291,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) error = g_error_new_literal (EMPATHY_FT_ERROR_QUARK, EMPATHY_FT_ERROR_NOT_SUPPORTED, _("Socket type not supported")); - YTSG_NOTE (FILE_TRANSFER, "Socket not supported, closing channel"); + YTS_NOTE (FILE_TRANSFER, "Socket not supported, closing channel"); ft_operation_close_with_error (tp_file, error); g_clear_error (&error); @@ -308,7 +308,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) error = g_error_new_literal (EMPATHY_FT_ERROR_QUARK, EMPATHY_FT_ERROR_SOCKET, g_strerror (code)); - YTSG_NOTE (FILE_TRANSFER, "Failed to create socket, closing channel"); + YTS_NOTE (FILE_TRANSFER, "Failed to create socket, closing channel"); ft_operation_close_with_error (tp_file, error); g_clear_error (&error); @@ -350,7 +350,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) error = g_error_new_literal (EMPATHY_FT_ERROR_QUARK, EMPATHY_FT_ERROR_SOCKET, g_strerror (code)); - YTSG_NOTE (FILE_TRANSFER, "Failed to connect socket, closing channel"); + YTS_NOTE (FILE_TRANSFER, "Failed to connect socket, closing channel"); ft_operation_close_with_error (tp_file, error); close (fd); @@ -359,7 +359,7 @@ tp_file_start_transfer (EmpathyTpFile *tp_file) return; } - YTSG_NOTE (FILE_TRANSFER, "Start the transfer"); + YTS_NOTE (FILE_TRANSFER, "Start the transfer"); #if 0 priv->start_time = empathy_time_get_current (); @@ -451,7 +451,7 @@ tp_file_state_changed_cb (TpChannel *proxy, if (state == priv->state) return; - YTSG_NOTE (FILE_TRANSFER, "File transfer state changed:\n" + YTS_NOTE (FILE_TRANSFER, "File transfer state changed:\n" "old state = %u, state = %u, reason = %u\n" "\tincoming = %s, in_stream = %s, out_stream = %s", priv->state, state, reason, @@ -527,7 +527,7 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy, if (myerr != NULL) { - YTSG_NOTE (FILE_TRANSFER, "Error: %s", myerr->message); + YTS_NOTE (FILE_TRANSFER, "Error: %s", myerr->message); ft_operation_close_with_error (tp_file, myerr); g_clear_error (&myerr); return; @@ -568,7 +568,7 @@ ft_operation_provide_or_accept_file_cb (TpChannel *proxy, priv->port = g_value_get_uint (v); } - YTSG_NOTE (FILE_TRANSFER, + YTS_NOTE (FILE_TRANSFER, "Got socket address: %s, port (not zero if IPV4): %d", priv->socket_address->data, priv->port); @@ -673,7 +673,7 @@ channel_closed_cb (TpChannel *proxy, EmpathyTpFilePriv *priv = GET_PRIV (tp_file); gboolean cancel = GPOINTER_TO_INT (user_data); - YTSG_NOTE (FILE_TRANSFER, "Channel is closed, should cancel %s", + YTS_NOTE (FILE_TRANSFER, "Channel is closed, should cancel %s", cancel ? "True" : "False"); if (priv->cancellable != NULL && @@ -687,7 +687,7 @@ close_channel_internal (EmpathyTpFile *tp_file, { EmpathyTpFilePriv *priv = GET_PRIV (tp_file); - YTSG_NOTE (FILE_TRANSFER, "Closing channel, should cancel %s", cancel ? + YTS_NOTE (FILE_TRANSFER, "Closing channel, should cancel %s", cancel ? "True" : "False"); tp_cli_channel_call_close (priv->channel, -1, diff --git a/ytstenut/profile/ytsg-profile-adapter.c b/ytstenut/profile/yts-profile-adapter.c index ad8a2d1..53d8eb3 100644 --- a/ytstenut/profile/ytsg-profile-adapter.c +++ b/ytstenut/profile/yts-profile-adapter.c @@ -20,33 +20,33 @@ #include <stdbool.h> -#include "ytsg-profile.h" -#include "ytsg-profile-adapter.h" +#include "yts-profile.h" +#include "yts-profile-adapter.h" -G_DEFINE_TYPE (YtsgProfileAdapter, - ytsg_profile_adapter, - YTSG_TYPE_SERVICE_ADAPTER) +G_DEFINE_TYPE (YtsProfileAdapter, + yts_profile_adapter, + YTS_TYPE_SERVICE_ADAPTER) #define GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - YTSG_TYPE_PROFILE_ADAPTER, \ - YtsgProfileAdapterPrivate)) + YTS_TYPE_PROFILE_ADAPTER, \ + YtsProfileAdapterPrivate)) typedef struct { - YtsgProfile *profile; -} YtsgProfileAdapterPrivate; + YtsProfile *profile; +} YtsProfileAdapterPrivate; /* - * YtsgServiceAdapter overrides + * YtsServiceAdapter overrides */ static bool -_service_adapter_invoke (YtsgServiceAdapter *self, +_service_adapter_invoke (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments) { - YtsgProfileAdapterPrivate *priv = GET_PRIVATE (self); + YtsProfileAdapterPrivate *priv = GET_PRIVATE (self); /* Methods */ @@ -55,7 +55,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING)) { char const *capability = g_variant_get_string (arguments, NULL); - ytsg_profile_register_proxy (priv->profile, + yts_profile_register_proxy (priv->profile, invocation_id, capability); @@ -64,7 +64,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING)) { char const *capability = g_variant_get_string (arguments, NULL); - ytsg_profile_unregister_proxy (priv->profile, + yts_profile_unregister_proxy (priv->profile, invocation_id, capability); @@ -86,7 +86,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, } /* - * YtsgProfileAdapter + * YtsProfileAdapter */ enum { @@ -96,32 +96,32 @@ enum { }; static void -_profile_register_proxy_response (YtsgProfile *profile, +_profile_register_proxy_response (YtsProfile *profile, char const *invocation_id, GVariant *return_value, - YtsgProfileAdapter *self) + YtsProfileAdapter *self) { - ytsg_service_adapter_send_response (YTSG_SERVICE_ADAPTER (self), + yts_service_adapter_send_response (YTS_SERVICE_ADAPTER (self), invocation_id, return_value); } static void -_profile_unregister_proxy_response (YtsgProfile *profile, +_profile_unregister_proxy_response (YtsProfile *profile, char const *invocation_id, bool return_value, - YtsgProfileAdapter *self) + YtsProfileAdapter *self) { - ytsg_service_adapter_send_response (YTSG_SERVICE_ADAPTER (self), + yts_service_adapter_send_response (YTS_SERVICE_ADAPTER (self), invocation_id, g_variant_new_boolean (return_value)); } static void -_profile_destroyed (YtsgProfileAdapter *self, +_profile_destroyed (YtsProfileAdapter *self, void *stale_profile_ptr) { - YtsgProfileAdapterPrivate *priv = GET_PRIVATE (self); + YtsProfileAdapterPrivate *priv = GET_PRIVATE (self); priv->profile = NULL; g_object_unref (self); @@ -133,11 +133,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgProfileAdapterPrivate *priv = GET_PRIVATE (object); + YtsProfileAdapterPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_SERVICE_ADAPTER_FQC_ID: - g_value_set_string (value, YTSG_PROFILE_FQC_ID); + g_value_set_string (value, YTS_PROFILE_FQC_ID); break; case PROP_SERVICE_ADAPTER_SERVICE: g_value_set_object (value, priv->profile); @@ -153,7 +153,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgProfileAdapterPrivate *priv = GET_PRIVATE (object); + YtsProfileAdapterPrivate *priv = GET_PRIVATE (object); switch (property_id) { @@ -162,9 +162,9 @@ _set_property (GObject *object, /* Construct-only */ g_return_if_fail (priv->profile == NULL); - g_return_if_fail (YTSG_IS_PROFILE (g_value_get_object (value))); + g_return_if_fail (YTS_IS_PROFILE (g_value_get_object (value))); - priv->profile = YTSG_PROFILE (g_value_get_object (value)); + priv->profile = YTS_PROFILE (g_value_get_object (value)); g_object_weak_ref (G_OBJECT (priv->profile), (GWeakNotify) _profile_destroyed, object); @@ -183,7 +183,7 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgProfileAdapterPrivate *priv = GET_PRIVATE (object); + YtsProfileAdapterPrivate *priv = GET_PRIVATE (object); if (priv->profile) { g_warning ("%s : Adapter disposed with adaptee still referenced.", @@ -194,16 +194,16 @@ _dispose (GObject *object) priv->profile = NULL; } - G_OBJECT_CLASS (ytsg_profile_adapter_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_profile_adapter_parent_class)->dispose (object); } static void -ytsg_profile_adapter_class_init (YtsgProfileAdapterClass *klass) +yts_profile_adapter_class_init (YtsProfileAdapterClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - YtsgServiceAdapterClass *adapter_class = YTSG_SERVICE_ADAPTER_CLASS (klass); + YtsServiceAdapterClass *adapter_class = YTS_SERVICE_ADAPTER_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgProfileAdapterPrivate)); + g_type_class_add_private (klass, sizeof (YtsProfileAdapterPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -223,7 +223,7 @@ ytsg_profile_adapter_class_init (YtsgProfileAdapterClass *klass) } static void -ytsg_profile_adapter_init (YtsgProfileAdapter *self) +yts_profile_adapter_init (YtsProfileAdapter *self) { } diff --git a/ytstenut/profile/yts-profile-adapter.h b/ytstenut/profile/yts-profile-adapter.h new file mode 100644 index 0000000..f9521bf --- /dev/null +++ b/ytstenut/profile/yts-profile-adapter.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_PROFILE_ADAPTER_H +#define YTS_PROFILE_ADAPTER_H + +#include <stdbool.h> +#include <glib-object.h> +#include <ytstenut/yts-service-adapter.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_PROFILE_ADAPTER yts_profile_adapter_get_type() + +#define YTS_PROFILE_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_PROFILE_ADAPTER, YtsProfileAdapter)) + +#define YTS_PROFILE_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_PROFILE_ADAPTER, YtsProfileAdapterClass)) + +#define YTS_IS_PROFILE_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_PROFILE_ADAPTER)) + +#define YTS_IS_PROFILE_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_PROFILE_ADAPTER)) + +#define YTS_PROFILE_ADAPTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_PROFILE_ADAPTER, YtsProfileAdapterClass)) + +typedef struct { + YtsServiceAdapter parent; +} YtsProfileAdapter; + +typedef struct { + YtsServiceAdapterClass parent; +} YtsProfileAdapterClass; + +GType +yts_profile_adapter_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* YTS_PROFILE_ADAPTER_H */ + diff --git a/ytstenut/profile/ytsg-profile-impl.c b/ytstenut/profile/yts-profile-impl.c index 8c4b820..67334ce 100644 --- a/ytstenut/profile/ytsg-profile-impl.c +++ b/ytstenut/profile/yts-profile-impl.c @@ -18,60 +18,60 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-private.h" -#include "ytsg-profile.h" -#include "ytsg-profile-impl.h" -#include "ytsg-response-message.h" +#include "yts-capability.h" +#include "yts-private.h" +#include "yts-profile.h" +#include "yts-profile-impl.h" +#include "yts-response-message.h" static void -_capability_interface_init (YtsgCapability *interface); +_capability_interface_init (YtsCapability *interface); static void -_profile_interface_init (YtsgProfileInterface *interface); +_profile_interface_init (YtsProfileInterface *interface); -G_DEFINE_TYPE_WITH_CODE (YtsgProfileImpl, - ytsg_profile_impl, +G_DEFINE_TYPE_WITH_CODE (YtsProfileImpl, + yts_profile_impl, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (YTSG_TYPE_CAPABILITY, + G_IMPLEMENT_INTERFACE (YTS_TYPE_CAPABILITY, _capability_interface_init) - G_IMPLEMENT_INTERFACE (YTSG_TYPE_PROFILE, + G_IMPLEMENT_INTERFACE (YTS_TYPE_PROFILE, _profile_interface_init)) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_PROFILE_IMPL, YtsgProfileImplPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_PROFILE_IMPL, YtsProfileImplPrivate)) typedef struct { GPtrArray *capabilities; - YtsgClient *client; /* free pointer */ -} YtsgProfileImplPrivate; + YtsClient *client; /* free pointer */ +} YtsProfileImplPrivate; /* - * YtsgCapability implementation + * YtsCapability implementation */ static void -_capability_interface_init (YtsgCapability *interface) +_capability_interface_init (YtsCapability *interface) { /* Nothing to do, it's just about overriding the "fqc-id" property */ } /* - * YtsgProfile + * YtsProfile */ static void -_register_proxy (YtsgProfile *self, +_register_proxy (YtsProfile *self, char const *invocation_id, char const *capability) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (self); - YtsgContact *contact; + YtsProfileImplPrivate *priv = GET_PRIVATE (self); + YtsContact *contact; char const *proxy_id; bool found; int i; GVariant *return_value = NULL; - YtsgMetadata *message; + YtsMetadata *message; found = false; for (i = 0; i < priv->capabilities->len; i++) { @@ -83,13 +83,13 @@ _register_proxy (YtsgProfile *self, if (found) { - bool have_proxy = ytsg_client_get_invocation_proxy (priv->client, + bool have_proxy = yts_client_get_invocation_proxy (priv->client, invocation_id, &contact, &proxy_id); if (have_proxy) { - return_value = ytsg_client_register_proxy (priv->client, + return_value = yts_client_register_proxy (priv->client, capability, contact, proxy_id); @@ -97,7 +97,7 @@ _register_proxy (YtsgProfile *self, if (NULL == return_value) { g_critical ("%s : Failed to register proxy %s:%s for %s", G_STRLOC, - ytsg_contact_get_jid (contact), + yts_contact_get_jid (contact), proxy_id, capability); return_value = g_variant_new_boolean (false); @@ -119,21 +119,21 @@ _register_proxy (YtsgProfile *self, /* This is one big HACK. The request was made to org.freedesktop.Ytstenut * but the response goes to the actual capability that was registered, * so it ends up in the right place. */ - message = ytsg_response_message_new (capability, + message = yts_response_message_new (capability, invocation_id, return_value); - _ytsg_client_send_message (priv->client, contact, proxy_id, message); + _yts_client_send_message (priv->client, contact, proxy_id, message); g_object_unref (message); g_variant_unref (return_value); } static void -_unregister_proxy (YtsgProfile *self, +_unregister_proxy (YtsProfile *self, char const *invocation_id, char const *capability) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (self); - YtsgContact *contact; + YtsProfileImplPrivate *priv = GET_PRIVATE (self); + YtsContact *contact; char const *proxy_id; bool found; bool ret; @@ -151,11 +151,11 @@ _unregister_proxy (YtsgProfile *self, g_critical ("%s : Capability %s not available in profile", G_STRLOC, capability); - ytsg_profile_unregister_proxy_return (self, invocation_id, false); + yts_profile_unregister_proxy_return (self, invocation_id, false); return; } - ret = ytsg_client_get_invocation_proxy (priv->client, + ret = yts_client_get_invocation_proxy (priv->client, invocation_id, &contact, &proxy_id); @@ -163,35 +163,35 @@ _unregister_proxy (YtsgProfile *self, g_critical ("%s : Failed to get proxy info for %s", G_STRLOC, capability); - ytsg_profile_unregister_proxy_return (self, invocation_id, false); + yts_profile_unregister_proxy_return (self, invocation_id, false); return; } - ret = ytsg_client_unregister_proxy (priv->client, + ret = yts_client_unregister_proxy (priv->client, capability, proxy_id); if (!ret) { g_critical ("%s : Failed to unregister proxy %s:%s for %s", G_STRLOC, - ytsg_contact_get_jid (contact), + yts_contact_get_jid (contact), proxy_id, capability); - ytsg_profile_unregister_proxy_return (self, invocation_id, false); + yts_profile_unregister_proxy_return (self, invocation_id, false); return; } - ytsg_profile_unregister_proxy_return (self, invocation_id, true); + yts_profile_unregister_proxy_return (self, invocation_id, true); } static void -_profile_interface_init (YtsgProfileInterface *interface) +_profile_interface_init (YtsProfileInterface *interface) { interface->register_proxy = _register_proxy; interface->unregister_proxy = _unregister_proxy; } /* - * YtsgProfileImpl + * YtsProfileImpl */ enum { @@ -210,11 +210,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (object); + YtsProfileImplPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_CAPABILITY_FQC_IDS: { - char *fqc_ids[] = { YTSG_PROFILE_FQC_ID, NULL }; + char *fqc_ids[] = { YTS_PROFILE_FQC_ID, NULL }; g_value_set_boxed (value, fqc_ids); } break; case PROP_PROFILE_CAPABILITIES: @@ -231,7 +231,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (object); + YtsProfileImplPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_CLIENT: @@ -246,35 +246,35 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (object); + YtsProfileImplPrivate *priv = GET_PRIVATE (object); if (priv->capabilities) { g_ptr_array_free (priv->capabilities, TRUE); priv->capabilities = NULL; } - G_OBJECT_CLASS (ytsg_profile_impl_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_profile_impl_parent_class)->dispose (object); } static void -ytsg_profile_impl_class_init (YtsgProfileImplClass *klass) +yts_profile_impl_class_init (YtsProfileImplClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *pspec; - g_type_class_add_private (klass, sizeof (YtsgProfileImplPrivate)); + g_type_class_add_private (klass, sizeof (YtsProfileImplPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; object_class->dispose = _dispose; - /* YtsgCapability */ + /* YtsCapability */ g_object_class_override_property (object_class, PROP_CAPABILITY_FQC_IDS, "fqc-ids"); - /* YtsgProfile interface */ + /* YtsProfile interface */ g_object_class_override_property (object_class, PROP_PROFILE_CAPABILITIES, @@ -283,7 +283,7 @@ ytsg_profile_impl_class_init (YtsgProfileImplClass *klass) /* Properties */ pspec = g_param_spec_object ("client", "", "", - YTSG_TYPE_CLIENT, + YTS_TYPE_CLIENT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); @@ -293,29 +293,29 @@ ytsg_profile_impl_class_init (YtsgProfileImplClass *klass) } static void -ytsg_profile_impl_init (YtsgProfileImpl *self) +yts_profile_impl_init (YtsProfileImpl *self) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (self); + YtsProfileImplPrivate *priv = GET_PRIVATE (self); priv->capabilities = g_ptr_array_new_with_free_func (g_free); } -YtsgProfileImpl * -ytsg_profile_impl_new (YtsgClient *client) +YtsProfileImpl * +yts_profile_impl_new (YtsClient *client) { - return g_object_new (YTSG_TYPE_PROFILE_IMPL, + return g_object_new (YTS_TYPE_PROFILE_IMPL, "client", client, NULL); } bool -ytsg_profile_impl_add_capability (YtsgProfileImpl *self, +yts_profile_impl_add_capability (YtsProfileImpl *self, char const *capability) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (self); + YtsProfileImplPrivate *priv = GET_PRIVATE (self); unsigned int i; - g_return_val_if_fail (YTSG_IS_PROFILE_IMPL (self), false); + g_return_val_if_fail (YTS_IS_PROFILE_IMPL (self), false); for (i = 0; i < priv->capabilities->len; i++) { if (0 == g_strcmp0 (capability, priv->capabilities->pdata[i])) { @@ -329,13 +329,13 @@ ytsg_profile_impl_add_capability (YtsgProfileImpl *self, } bool -ytsg_profile_impl_remove_capability (YtsgProfileImpl *self, +yts_profile_impl_remove_capability (YtsProfileImpl *self, char const *capability) { - YtsgProfileImplPrivate *priv = GET_PRIVATE (self); + YtsProfileImplPrivate *priv = GET_PRIVATE (self); unsigned int i; - g_return_val_if_fail (YTSG_IS_PROFILE_IMPL (self), false); + g_return_val_if_fail (YTS_IS_PROFILE_IMPL (self), false); for (i = 0; i < priv->capabilities->len; i++) { if (0 == g_strcmp0 (capability, priv->capabilities->pdata[i])) { diff --git a/ytstenut/profile/ytsg-profile-impl.h b/ytstenut/profile/yts-profile-impl.h index 9cedab9..de46644 100644 --- a/ytstenut/profile/ytsg-profile-impl.h +++ b/ytstenut/profile/yts-profile-impl.h @@ -18,54 +18,54 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_PROFILE_IMPL_H -#define YTSG_PROFILE_IMPL_H +#ifndef YTS_PROFILE_IMPL_H +#define YTS_PROFILE_IMPL_H #include <glib-object.h> -#include <ytstenut/ytsg-client.h> +#include <ytstenut/yts-client.h> G_BEGIN_DECLS -#define YTSG_TYPE_PROFILE_IMPL ytsg_profile_impl_get_type() +#define YTS_TYPE_PROFILE_IMPL yts_profile_impl_get_type() -#define YTSG_PROFILE_IMPL(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_PROFILE_IMPL, YtsgProfileImpl)) +#define YTS_PROFILE_IMPL(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_PROFILE_IMPL, YtsProfileImpl)) -#define YTSG_PROFILE_IMPL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_PROFILE_IMPL, YtsgProfileImplClass)) +#define YTS_PROFILE_IMPL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_PROFILE_IMPL, YtsProfileImplClass)) -#define YTSG_IS_PROFILE_IMPL(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_PROFILE_IMPL)) +#define YTS_IS_PROFILE_IMPL(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_PROFILE_IMPL)) -#define YTSG_IS_PROFILE_IMPL_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_PROFILE_IMPL)) +#define YTS_IS_PROFILE_IMPL_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_PROFILE_IMPL)) -#define YTSG_PROFILE_IMPL_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_PROFILE_IMPL, YtsgProfileImplClass)) +#define YTS_PROFILE_IMPL_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_PROFILE_IMPL, YtsProfileImplClass)) typedef struct { GObject parent; -} YtsgProfileImpl; +} YtsProfileImpl; typedef struct { GObjectClass parent; -} YtsgProfileImplClass; +} YtsProfileImplClass; GType -ytsg_profile_impl_get_type (void) G_GNUC_CONST; +yts_profile_impl_get_type (void) G_GNUC_CONST; -YtsgProfileImpl * -ytsg_profile_impl_new (YtsgClient *client); +YtsProfileImpl * +yts_profile_impl_new (YtsClient *client); bool -ytsg_profile_impl_add_capability (YtsgProfileImpl *self, +yts_profile_impl_add_capability (YtsProfileImpl *self, char const *capability); bool -ytsg_profile_impl_remove_capability (YtsgProfileImpl *self, +yts_profile_impl_remove_capability (YtsProfileImpl *self, char const *capability); G_END_DECLS -#endif /* YTSG_PROFILE_IMPL_H */ +#endif /* YTS_PROFILE_IMPL_H */ diff --git a/ytstenut/profile/ytsg-profile-proxy.c b/ytstenut/profile/yts-profile-proxy.c index dc3f889..502c900 100644 --- a/ytstenut/profile/ytsg-profile-proxy.c +++ b/ytstenut/profile/yts-profile-proxy.c @@ -18,20 +18,20 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-profile.h" -#include "ytsg-profile-proxy.h" +#include "yts-profile.h" +#include "yts-profile-proxy.h" static void -_profile_interface_init (YtsgProfileInterface *interface); +_profile_interface_init (YtsProfileInterface *interface); -G_DEFINE_TYPE_WITH_CODE (YtsgProfileProxy, - ytsg_profile_proxy, - YTSG_TYPE_PROXY, - G_IMPLEMENT_INTERFACE (YTSG_TYPE_PROFILE, +G_DEFINE_TYPE_WITH_CODE (YtsProfileProxy, + yts_profile_proxy, + YTS_TYPE_PROXY, + G_IMPLEMENT_INTERFACE (YTS_TYPE_PROFILE, _profile_interface_init)) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_PROFILE_PROXY, YtsgProfileProxyPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_PROFILE_PROXY, YtsProfileProxyPrivate)) typedef struct { @@ -42,65 +42,65 @@ typedef struct { /* Data */ GHashTable *invocations; -} YtsgProfileProxyPrivate; +} YtsProfileProxyPrivate; /* - * YtsgProfile implementation + * YtsProfile implementation */ static void -_register_proxy (YtsgProfile *self, +_register_proxy (YtsProfile *self, char const *invocation_id_, char const *capability) { - YtsgProfileProxyPrivate *priv = GET_PRIVATE (self); + YtsProfileProxyPrivate *priv = GET_PRIVATE (self); char *invocation_id; invocation_id = invocation_id_ ? g_strdup (invocation_id_) : - ytsg_proxy_create_invocation_id (YTSG_PROXY (self)); + yts_proxy_create_invocation_id (YTS_PROXY (self)); /* Hash takes invocation_id. */ g_hash_table_insert (priv->invocations, invocation_id, _register_proxy); - // TODO set timeout, well, probably in ytsg-proxy-service.c + // TODO set timeout, well, probably in yts-proxy-service.c - ytsg_proxy_invoke (YTSG_PROXY (self), invocation_id, "register-proxy", + yts_proxy_invoke (YTS_PROXY (self), invocation_id, "register-proxy", g_variant_new_string (capability)); } static void -_unregister_proxy (YtsgProfile *self, +_unregister_proxy (YtsProfile *self, char const *invocation_id_, char const *capability) { - YtsgProfileProxyPrivate *priv = GET_PRIVATE (self); + YtsProfileProxyPrivate *priv = GET_PRIVATE (self); char *invocation_id; invocation_id = invocation_id_ ? g_strdup (invocation_id_) : - ytsg_proxy_create_invocation_id (YTSG_PROXY (self)); + yts_proxy_create_invocation_id (YTS_PROXY (self)); /* Hash takes invocation_id. */ g_hash_table_insert (priv->invocations, invocation_id, _unregister_proxy); - // TODO set timeout, well, probably in ytsg-proxy-service.c + // TODO set timeout, well, probably in yts-proxy-service.c - ytsg_proxy_invoke (YTSG_PROXY (self), invocation_id, "unregister-proxy", + yts_proxy_invoke (YTS_PROXY (self), invocation_id, "unregister-proxy", g_variant_new_string (capability)); } static void -_profile_interface_init (YtsgProfileInterface *interface) +_profile_interface_init (YtsProfileInterface *interface) { interface->register_proxy = _register_proxy; interface->unregister_proxy = _unregister_proxy; } /* - * YtsgProxy overrides + * YtsProxy overrides */ static void -_proxy_service_event (YtsgProxy *self, +_proxy_service_event (YtsProxy *self, char const *aspect, GVariant *arguments) { @@ -112,25 +112,25 @@ _proxy_service_event (YtsgProxy *self, } static void -_proxy_service_response (YtsgProxy *self, +_proxy_service_response (YtsProxy *self, char const *invocation_id, GVariant *response) { - YtsgProfileProxyPrivate *priv = GET_PRIVATE (self); + YtsProfileProxyPrivate *priv = GET_PRIVATE (self); void *call; call = g_hash_table_lookup (priv->invocations, invocation_id); - // TODO clear timeout, well, probably in ytsg-proxy-service.c + // TODO clear timeout, well, probably in yts-proxy-service.c if (call == _register_proxy) { - ytsg_profile_register_proxy_return (YTSG_PROFILE (self), + yts_profile_register_proxy_return (YTS_PROFILE (self), invocation_id, response); } else if (call == _unregister_proxy) { - ytsg_profile_unregister_proxy_return (YTSG_PROFILE (self), + yts_profile_unregister_proxy_return (YTS_PROFILE (self), invocation_id, g_variant_get_boolean (response)); @@ -155,7 +155,7 @@ _proxy_service_response (YtsgProxy *self, } /* - * YtsgProfileProxy + * YtsProfileProxy */ enum { @@ -172,11 +172,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgProfileProxyPrivate *priv = GET_PRIVATE (object); + YtsProfileProxyPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_CAPABILITY_FQC_IDS: { - char *fqc_ids[] = { YTSG_PROFILE_FQC_ID, NULL }; + char *fqc_ids[] = { YTS_PROFILE_FQC_ID, NULL }; g_value_set_boxed (value, fqc_ids); } break; case PROP_PROFILE_CAPABILITIES: @@ -193,7 +193,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - // YtsgProfileProxyPrivate *priv = GET_PRIVATE (object); + // YtsProfileProxyPrivate *priv = GET_PRIVATE (object); switch (property_id) { default: @@ -204,23 +204,23 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgProfileProxyPrivate *priv = GET_PRIVATE (object); + YtsProfileProxyPrivate *priv = GET_PRIVATE (object); if (priv->invocations) { g_hash_table_destroy (priv->invocations); priv->invocations = NULL; } - G_OBJECT_CLASS (ytsg_profile_proxy_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_profile_proxy_parent_class)->dispose (object); } static void -ytsg_profile_proxy_class_init (YtsgProfileProxyClass *klass) +yts_profile_proxy_class_init (YtsProfileProxyClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - YtsgProxyClass *proxy_class = YTSG_PROXY_CLASS (klass); + YtsProxyClass *proxy_class = YTS_PROXY_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgProfileProxyPrivate)); + g_type_class_add_private (klass, sizeof (YtsProfileProxyPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -229,13 +229,13 @@ ytsg_profile_proxy_class_init (YtsgProfileProxyClass *klass) proxy_class->service_event = _proxy_service_event; proxy_class->service_response = _proxy_service_response; - /* YtsgCapability */ + /* YtsCapability */ g_object_class_override_property (object_class, PROP_CAPABILITY_FQC_IDS, "fqc-ids"); - /* YtsgProfile */ + /* YtsProfile */ g_object_class_override_property (object_class, PROP_PROFILE_CAPABILITIES, @@ -243,9 +243,9 @@ ytsg_profile_proxy_class_init (YtsgProfileProxyClass *klass) } static void -ytsg_profile_proxy_init (YtsgProfileProxy *self) +yts_profile_proxy_init (YtsProfileProxy *self) { - YtsgProfileProxyPrivate *priv = GET_PRIVATE (self); + YtsProfileProxyPrivate *priv = GET_PRIVATE (self); priv->invocations = g_hash_table_new_full (g_str_hash, g_str_equal, diff --git a/ytstenut/profile/yts-profile-proxy.h b/ytstenut/profile/yts-profile-proxy.h new file mode 100644 index 0000000..591e0bf --- /dev/null +++ b/ytstenut/profile/yts-profile-proxy.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_PROFILE_PROXY_H +#define YTS_PROFILE_PROXY_H + +#include <glib-object.h> +#include <ytstenut/yts-proxy.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_PROFILE_PROXY yts_profile_proxy_get_type() + +#define YTS_PROFILE_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_PROFILE_PROXY, YtsProfileProxy)) + +#define YTS_PROFILE_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_PROFILE_PROXY, YtsProfileProxyClass)) + +#define YTS_VP_IS_PLAYER_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_PROFILE_PROXY)) + +#define YTS_VP_IS_PLAYER_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_PROFILE_PROXY)) + +#define YTS_PROFILE_PROXY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_PROFILE_PROXY, YtsProfileProxyClass)) + +typedef struct { + YtsProxy parent; +} YtsProfileProxy; + +typedef struct { + YtsProxyClass parent; +} YtsProfileProxyClass; + +GType +yts_profile_proxy_get_type (void); + +G_END_DECLS + +#endif /* YTS_PROFILE_PROXY_H */ + diff --git a/ytstenut/profile/ytsg-profile.c b/ytstenut/profile/yts-profile.c index 779ec88..bcf9072 100644 --- a/ytstenut/profile/ytsg-profile.c +++ b/ytstenut/profile/yts-profile.c @@ -18,14 +18,14 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-marshal.h" -#include "ytsg-profile.h" -#include "ytsg-proxy.h" +#include "yts-capability.h" +#include "yts-marshal.h" +#include "yts-profile.h" +#include "yts-proxy.h" -G_DEFINE_INTERFACE (YtsgProfile, - ytsg_profile, - YTSG_TYPE_CAPABILITY) +G_DEFINE_INTERFACE (YtsProfile, + yts_profile, + YTS_TYPE_CAPABILITY) enum { SIG_REGISTER_PROXY_RESPONSE, @@ -36,27 +36,27 @@ enum { static unsigned int _signals[N_SIGNALS] = { 0, }; static void -_register_proxy (YtsgProfile *self, +_register_proxy (YtsProfile *self, char const *invocation_id, char const *capability) { - g_critical ("%s : Method YtsgProfile.register_proxy() not implemented by %s", + g_critical ("%s : Method YtsProfile.register_proxy() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); } static void -_unregister_proxy (YtsgProfile *self, +_unregister_proxy (YtsProfile *self, char const *invocation_id, char const *capability) { - g_critical ("%s : Method YtsgProfile.unregister_proxy() not implemented by %s", + g_critical ("%s : Method YtsProfile.unregister_proxy() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); } static void -ytsg_profile_default_init (YtsgProfileInterface *interface) +yts_profile_default_init (YtsProfileInterface *interface) { GParamSpec *pspec; @@ -73,29 +73,29 @@ ytsg_profile_default_init (YtsgProfileInterface *interface) _signals[SIG_REGISTER_PROXY_RESPONSE] = g_signal_new ( "register-proxy-response", - YTSG_TYPE_PROFILE, + YTS_TYPE_PROFILE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__STRING_BOXED, + yts_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); _signals[SIG_UNREGISTER_PROXY_RESPONSE] = g_signal_new ( "unregister-proxy-response", - YTSG_TYPE_PROFILE, + YTS_TYPE_PROFILE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__STRING_BOOLEAN, + yts_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); } GPtrArray * -ytsg_profile_get_capabilities (YtsgProfile *self) +yts_profile_get_capabilities (YtsProfile *self) { GPtrArray *capabilities; - g_return_val_if_fail (YTSG_IS_PROFILE (self), NULL); + g_return_val_if_fail (YTS_IS_PROFILE (self), NULL); capabilities = NULL; g_object_get (self, "capabilities", &capabilities, NULL); @@ -104,35 +104,35 @@ ytsg_profile_get_capabilities (YtsgProfile *self) } void -ytsg_profile_register_proxy (YtsgProfile *self, +yts_profile_register_proxy (YtsProfile *self, char const *invocation_id, char const *capability) { - g_return_if_fail (YTSG_IS_PROFILE (self)); + g_return_if_fail (YTS_IS_PROFILE (self)); - YTSG_PROFILE_GET_INTERFACE (self)->register_proxy (self, + YTS_PROFILE_GET_INTERFACE (self)->register_proxy (self, invocation_id, capability); } void -ytsg_profile_unregister_proxy (YtsgProfile *self, +yts_profile_unregister_proxy (YtsProfile *self, char const *invocation_id, char const *capability) { - g_return_if_fail (YTSG_IS_PROFILE (self)); + g_return_if_fail (YTS_IS_PROFILE (self)); - YTSG_PROFILE_GET_INTERFACE (self)->unregister_proxy (self, + YTS_PROFILE_GET_INTERFACE (self)->unregister_proxy (self, invocation_id, capability); } void -ytsg_profile_register_proxy_return (YtsgProfile *self, +yts_profile_register_proxy_return (YtsProfile *self, char const *invocation_id, GVariant *return_value) { - g_return_if_fail (YTSG_IS_PROFILE (self)); + g_return_if_fail (YTS_IS_PROFILE (self)); g_signal_emit (self, _signals[SIG_REGISTER_PROXY_RESPONSE], 0, invocation_id, return_value); @@ -143,11 +143,11 @@ ytsg_profile_register_proxy_return (YtsgProfile *self, } void -ytsg_profile_unregister_proxy_return (YtsgProfile *self, +yts_profile_unregister_proxy_return (YtsProfile *self, char const *invocation_id, bool return_value) { - g_return_if_fail (YTSG_IS_PROFILE (self)); + g_return_if_fail (YTS_IS_PROFILE (self)); g_signal_emit (self, _signals[SIG_UNREGISTER_PROXY_RESPONSE], 0, invocation_id, return_value); diff --git a/ytstenut/profile/ytsg-profile.h b/ytstenut/profile/yts-profile.h index 0da5794..05e1701 100644 --- a/ytstenut/profile/ytsg-profile.h +++ b/ytstenut/profile/yts-profile.h @@ -18,32 +18,32 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_PROFILE_H -#define YTSG_PROFILE_H +#ifndef YTS_PROFILE_H +#define YTS_PROFILE_H #include <stdbool.h> #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_PROFILE_FQC_ID "org.freedesktop.Ytstenut" +#define YTS_PROFILE_FQC_ID "org.freedesktop.Ytstenut" -#define YTSG_TYPE_PROFILE \ - (ytsg_profile_get_type ()) +#define YTS_TYPE_PROFILE \ + (yts_profile_get_type ()) -#define YTSG_PROFILE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_PROFILE, YtsgProfile)) +#define YTS_PROFILE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_PROFILE, YtsProfile)) -#define YTSG_IS_PROFILE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_PROFILE)) +#define YTS_IS_PROFILE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_PROFILE)) -#define YTSG_PROFILE_GET_INTERFACE(obj) \ - (G_TYPE_INSTANCE_GET_INTERFACE ((obj), YTSG_TYPE_PROFILE, YtsgProfileInterface)) +#define YTS_PROFILE_GET_INTERFACE(obj) \ + (G_TYPE_INSTANCE_GET_INTERFACE ((obj), YTS_TYPE_PROFILE, YtsProfileInterface)) -typedef struct YtsgProfile YtsgProfile; -typedef struct YtsgProfileInterface YtsgProfileInterface; +typedef struct YtsProfile YtsProfile; +typedef struct YtsProfileInterface YtsProfileInterface; -struct YtsgProfileInterface { +struct YtsProfileInterface { /*< private >*/ GTypeInterface parent; @@ -51,45 +51,45 @@ struct YtsgProfileInterface { /* Methods */ void - (*register_proxy) (YtsgProfile *self, + (*register_proxy) (YtsProfile *self, char const *invocation_id, char const *capability); void - (*unregister_proxy) (YtsgProfile *self, + (*unregister_proxy) (YtsProfile *self, char const *invocation_id, char const *capability); }; GType -ytsg_profile_get_type (void) G_GNUC_CONST; +yts_profile_get_type (void) G_GNUC_CONST; GPtrArray * -ytsg_profile_get_capabilities (YtsgProfile *self); +yts_profile_get_capabilities (YtsProfile *self); void -ytsg_profile_register_proxy (YtsgProfile *self, +yts_profile_register_proxy (YtsProfile *self, char const *invocation_id, char const *capability); void -ytsg_profile_unregister_proxy (YtsgProfile *self, +yts_profile_unregister_proxy (YtsProfile *self, char const *invocation_id, char const *capability); /* Protected */ void -ytsg_profile_register_proxy_return (YtsgProfile *self, +yts_profile_register_proxy_return (YtsProfile *self, char const *invocation_id, GVariant *return_value); void -ytsg_profile_unregister_proxy_return (YtsgProfile *self, +yts_profile_unregister_proxy_return (YtsProfile *self, char const *invocation_id, bool return_value); G_END_DECLS -#endif /* YTSG_PROFILE_H */ +#endif /* YTS_PROFILE_H */ diff --git a/ytstenut/profile/ytsg-profile-adapter.h b/ytstenut/profile/ytsg-profile-adapter.h deleted file mode 100644 index b535c8d..0000000 --- a/ytstenut/profile/ytsg-profile-adapter.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_PROFILE_ADAPTER_H -#define YTSG_PROFILE_ADAPTER_H - -#include <stdbool.h> -#include <glib-object.h> -#include <ytstenut/ytsg-service-adapter.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_PROFILE_ADAPTER ytsg_profile_adapter_get_type() - -#define YTSG_PROFILE_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_PROFILE_ADAPTER, YtsgProfileAdapter)) - -#define YTSG_PROFILE_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_PROFILE_ADAPTER, YtsgProfileAdapterClass)) - -#define YTSG_IS_PROFILE_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_PROFILE_ADAPTER)) - -#define YTSG_IS_PROFILE_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_PROFILE_ADAPTER)) - -#define YTSG_PROFILE_ADAPTER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_PROFILE_ADAPTER, YtsgProfileAdapterClass)) - -typedef struct { - YtsgServiceAdapter parent; -} YtsgProfileAdapter; - -typedef struct { - YtsgServiceAdapterClass parent; -} YtsgProfileAdapterClass; - -GType -ytsg_profile_adapter_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* YTSG_PROFILE_ADAPTER_H */ - diff --git a/ytstenut/profile/ytsg-profile-proxy.h b/ytstenut/profile/ytsg-profile-proxy.h deleted file mode 100644 index 1df5ff5..0000000 --- a/ytstenut/profile/ytsg-profile-proxy.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_PROFILE_PROXY_H -#define YTSG_PROFILE_PROXY_H - -#include <glib-object.h> -#include <ytstenut/ytsg-proxy.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_PROFILE_PROXY ytsg_profile_proxy_get_type() - -#define YTSG_PROFILE_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_PROFILE_PROXY, YtsgProfileProxy)) - -#define YTSG_PROFILE_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_PROFILE_PROXY, YtsgProfileProxyClass)) - -#define YTSG_VP_IS_PLAYER_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_PROFILE_PROXY)) - -#define YTSG_VP_IS_PLAYER_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_PROFILE_PROXY)) - -#define YTSG_PROFILE_PROXY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_PROFILE_PROXY, YtsgProfileProxyClass)) - -typedef struct { - YtsgProxy parent; -} YtsgProfileProxy; - -typedef struct { - YtsgProxyClass parent; -} YtsgProfileProxyClass; - -GType -ytsg_profile_proxy_get_type (void); - -G_END_DECLS - -#endif /* YTSG_PROFILE_PROXY_H */ - diff --git a/ytstenut/video-profile/ytsg-vp-content.c b/ytstenut/video-profile/yts-vp-content.c index b094983..5dfa06f 100644 --- a/ytstenut/video-profile/ytsg-vp-content.c +++ b/ytstenut/video-profile/yts-vp-content.c @@ -18,60 +18,60 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-vp-content.h" +#include "yts-capability.h" +#include "yts-vp-content.h" -G_DEFINE_INTERFACE (YtsgVPContent, - ytsg_vp_content, - YTSG_TYPE_CAPABILITY) +G_DEFINE_INTERFACE (YtsVPContent, + yts_vp_content, + YTS_TYPE_CAPABILITY) -YtsgVPQuery * -_retrieve (YtsgVPContent *self, +YtsVPQuery * +_retrieve (YtsVPContent *self, char const *uri) { - g_critical ("%s : Method YtsgVPContent.retrieve() not implemented by %s", + g_critical ("%s : Method YtsVPContent.retrieve() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); return NULL; } -YtsgVPQuery * -_search (YtsgVPContent *self, +YtsVPQuery * +_search (YtsVPContent *self, char const **tokens, - YtsgVPQueryResultOrder order, + YtsVPQueryResultOrder order, unsigned max_results) { - g_critical ("%s : Method YtsgVPContent.search() not implemented by %s", + g_critical ("%s : Method YtsVPContent.search() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); return NULL; } static void -ytsg_vp_content_default_init (YtsgVPContentInterface *interface) +yts_vp_content_default_init (YtsVPContentInterface *interface) { interface->retrieve = _retrieve; interface->search = _search; } -YtsgVPQuery * -ytsg_vp_content_retrieve (YtsgVPContent *self, +YtsVPQuery * +yts_vp_content_retrieve (YtsVPContent *self, char const *uri) { - g_return_val_if_fail (YTSG_VP_IS_CONTENT (self), NULL); + g_return_val_if_fail (YTS_VP_IS_CONTENT (self), NULL); - return YTSG_VP_CONTENT_GET_INTERFACE (self)->retrieve (self, uri); + return YTS_VP_CONTENT_GET_INTERFACE (self)->retrieve (self, uri); } -YtsgVPQuery * -ytsg_vp_content_search (YtsgVPContent *self, +YtsVPQuery * +yts_vp_content_search (YtsVPContent *self, char const **tokens, - YtsgVPQueryResultOrder order, + YtsVPQueryResultOrder order, unsigned max_results) { - g_return_val_if_fail (YTSG_VP_IS_CONTENT (self), NULL); + g_return_val_if_fail (YTS_VP_IS_CONTENT (self), NULL); - return YTSG_VP_CONTENT_GET_INTERFACE (self)->search (self, + return YTS_VP_CONTENT_GET_INTERFACE (self)->search (self, tokens, order, max_results); diff --git a/ytstenut/video-profile/ytsg-vp-content.h b/ytstenut/video-profile/yts-vp-content.h index 5dd65d2..c33cd51 100644 --- a/ytstenut/video-profile/ytsg-vp-content.h +++ b/ytstenut/video-profile/yts-vp-content.h @@ -18,62 +18,62 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_CONTENT_H -#define YTSG_VP_CONTENT_H +#ifndef YTS_VP_CONTENT_H +#define YTS_VP_CONTENT_H #include <glib-object.h> -#include <ytstenut/video-profile/ytsg-vp-query.h> +#include <ytstenut/video-profile/yts-vp-query.h> G_BEGIN_DECLS -#define YTSG_VP_CONTENT_FQC_ID "org.freedesktop.ytstenut.VideoProfile.Content" +#define YTS_VP_CONTENT_FQC_ID "org.freedesktop.ytstenut.VideoProfile.Content" -#define YTSG_VP_TYPE_CONTENT (ytsg_vp_content_get_type ()) +#define YTS_VP_TYPE_CONTENT (yts_vp_content_get_type ()) -#define YTSG_VP_CONTENT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_VP_TYPE_CONTENT, YtsgVPContent)) +#define YTS_VP_CONTENT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_VP_TYPE_CONTENT, YtsVPContent)) -#define YTSG_VP_IS_CONTENT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_CONTENT)) +#define YTS_VP_IS_CONTENT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_CONTENT)) -#define YTSG_VP_CONTENT_GET_INTERFACE(obj) \ +#define YTS_VP_CONTENT_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_CONTENT, \ - YtsgVPContentInterface)) + YTS_VP_TYPE_CONTENT, \ + YtsVPContentInterface)) -typedef struct YtsgVPContent YtsgVPContent; +typedef struct YtsVPContent YtsVPContent; typedef struct { /*< private >*/ GTypeInterface parent; - YtsgVPQuery * - (*retrieve) (YtsgVPContent *self, + YtsVPQuery * + (*retrieve) (YtsVPContent *self, char const *uri); - YtsgVPQuery * - (*search) (YtsgVPContent *self, + YtsVPQuery * + (*search) (YtsVPContent *self, char const **tokens, - YtsgVPQueryResultOrder order, + YtsVPQueryResultOrder order, unsigned max_results); -} YtsgVPContentInterface; +} YtsVPContentInterface; GType -ytsg_vp_content_get_type (void) G_GNUC_CONST; +yts_vp_content_get_type (void) G_GNUC_CONST; -YtsgVPQuery * -ytsg_vp_content_retrieve (YtsgVPContent *self, +YtsVPQuery * +yts_vp_content_retrieve (YtsVPContent *self, char const *uri); -YtsgVPQuery * -ytsg_vp_content_search (YtsgVPContent *self, +YtsVPQuery * +yts_vp_content_search (YtsVPContent *self, char const **tokens, - YtsgVPQueryResultOrder order, + YtsVPQueryResultOrder order, unsigned max_results); G_END_DECLS -#endif /* YTSG_VP_CONTENT_H */ +#endif /* YTS_VP_CONTENT_H */ diff --git a/ytstenut/video-profile/ytsg-vp-playable-proxy.c b/ytstenut/video-profile/yts-vp-playable-proxy.c index b647113..559f7e5 100644 --- a/ytstenut/video-profile/ytsg-vp-playable-proxy.c +++ b/ytstenut/video-profile/yts-vp-playable-proxy.c @@ -18,20 +18,20 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-vp-playable.h" -#include "ytsg-vp-playable-proxy.h" +#include "yts-vp-playable.h" +#include "yts-vp-playable-proxy.h" static void -_playable_interface_init (YtsgVPPlayableInterface *interface); +_playable_interface_init (YtsVPPlayableInterface *interface); -G_DEFINE_TYPE_WITH_CODE (YtsgVPPlayableProxy, - ytsg_vp_playable_proxy, +G_DEFINE_TYPE_WITH_CODE (YtsVPPlayableProxy, + yts_vp_playable_proxy, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (YTSG_VP_TYPE_PLAYABLE, + G_IMPLEMENT_INTERFACE (YTS_VP_TYPE_PLAYABLE, _playable_interface_init)) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_VP_TYPE_PLAYABLE_PROXY, YtsgVPPlayableProxyPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_VP_TYPE_PLAYABLE_PROXY, YtsVPPlayableProxyPrivate)) typedef struct { double duration; @@ -40,19 +40,19 @@ typedef struct { char *thumbnail; char *title; char *uri; -} YtsgVPPlayableProxyPrivate; +} YtsVPPlayableProxyPrivate; /* - * YtsgVPPlayable implementation + * YtsVPPlayable implementation */ static void -_playable_interface_init (YtsgVPPlayableInterface *interface) +_playable_interface_init (YtsVPPlayableInterface *interface) { } /* - * YtsgVPPlayableProxy + * YtsVPPlayableProxy */ enum { @@ -71,7 +71,7 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgVPPlayableProxyPrivate *priv = GET_PRIVATE (object); + YtsVPPlayableProxyPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_PLAYABLE_DURATION: @@ -103,7 +103,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgVPPlayableProxyPrivate *priv = GET_PRIVATE (object); + YtsVPPlayableProxyPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_PLAYABLE_POSITION: { @@ -122,7 +122,7 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgVPPlayableProxyPrivate *priv = GET_PRIVATE (object); + YtsVPPlayableProxyPrivate *priv = GET_PRIVATE (object); if (priv->metadata) { g_hash_table_unref (priv->metadata); @@ -139,15 +139,15 @@ _dispose (GObject *object) priv->uri = NULL; } - G_OBJECT_CLASS (ytsg_vp_playable_proxy_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_vp_playable_proxy_parent_class)->dispose (object); } static void -ytsg_vp_playable_proxy_class_init (YtsgVPPlayableProxyClass *klass) +yts_vp_playable_proxy_class_init (YtsVPPlayableProxyClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgVPPlayableProxyPrivate)); + g_type_class_add_private (klass, sizeof (YtsVPPlayableProxyPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -179,19 +179,19 @@ ytsg_vp_playable_proxy_class_init (YtsgVPPlayableProxyClass *klass) } static void -ytsg_vp_playable_proxy_init (YtsgVPPlayableProxy *self) +yts_vp_playable_proxy_init (YtsVPPlayableProxy *self) { } -YtsgVPPlayableProxy * -ytsg_vp_playable_proxy_new (double duration, +YtsVPPlayableProxy * +yts_vp_playable_proxy_new (double duration, GHashTable *metadata, double position, char const *thumbnail, char const *title, char const *uri) { - return g_object_new (YTSG_VP_TYPE_PLAYABLE_PROXY, + return g_object_new (YTS_VP_TYPE_PLAYABLE_PROXY, "duration", duration, "metadata", metadata, "position", position, diff --git a/ytstenut/video-profile/ytsg-vp-playable-proxy.h b/ytstenut/video-profile/yts-vp-playable-proxy.h index 6541b5f..17cfef0 100644 --- a/ytstenut/video-profile/ytsg-vp-playable-proxy.h +++ b/ytstenut/video-profile/yts-vp-playable-proxy.h @@ -18,49 +18,49 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_PLAYABLE_PROXY_H -#define YTSG_VP_PLAYABLE_PROXY_H +#ifndef YTS_VP_PLAYABLE_PROXY_H +#define YTS_VP_PLAYABLE_PROXY_H #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_VP_TYPE_PLAYABLE_PROXY (ytsg_vp_playable_proxy_get_type ()) +#define YTS_VP_TYPE_PLAYABLE_PROXY (yts_vp_playable_proxy_get_type ()) -#define YTSG_VP_PLAYABLE_PROXY(obj) \ +#define YTS_VP_PLAYABLE_PROXY(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_PLAYABLE_PROXY, \ - YtsgVPPlayableProxy)) + YTS_VP_TYPE_PLAYABLE_PROXY, \ + YtsVPPlayableProxy)) -#define YTSG_VP_PLAYABLE_PROXY_CLASS(klass) \ +#define YTS_VP_PLAYABLE_PROXY_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_VP_TYPE_PLAYABLE_PROXY, \ - YtsgVPPlayableProxyClass)) + YTS_VP_TYPE_PLAYABLE_PROXY, \ + YtsVPPlayableProxyClass)) -#define YTSG_VP_IS_PLAYABLE_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_PLAYABLE_PROXY)) +#define YTS_VP_IS_PLAYABLE_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_PLAYABLE_PROXY)) -#define YTSG_VP_IS_PLAYABLE_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_VP_TYPE_PLAYABLE_PROXY)) +#define YTS_VP_IS_PLAYABLE_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_VP_TYPE_PLAYABLE_PROXY)) -#define YTSG_VP_PLAYABLE_PROXY_GET_CLASS(obj) \ +#define YTS_VP_PLAYABLE_PROXY_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_VP_TYPE_PLAYABLE_PROXY, \ - YtsgVPPlayableProxyClass)) + YTS_VP_TYPE_PLAYABLE_PROXY, \ + YtsVPPlayableProxyClass)) typedef struct { GObject parent; -} YtsgVPPlayableProxy; +} YtsVPPlayableProxy; typedef struct { GObjectClass parent; -} YtsgVPPlayableProxyClass; +} YtsVPPlayableProxyClass; GType -ytsg_vp_playable_proxy_get_type (void); +yts_vp_playable_proxy_get_type (void); -YtsgVPPlayableProxy * -ytsg_vp_playable_proxy_new (double duration, +YtsVPPlayableProxy * +yts_vp_playable_proxy_new (double duration, GHashTable *metadata, double position, char const *thumbnail, @@ -69,5 +69,5 @@ ytsg_vp_playable_proxy_new (double duration, G_END_DECLS -#endif /* YTSG_VP_PLAYABLE_PROXY_H */ +#endif /* YTS_VP_PLAYABLE_PROXY_H */ diff --git a/ytstenut/video-profile/ytsg-vp-playable.c b/ytstenut/video-profile/yts-vp-playable.c index 3be4c6d..2c0531f 100644 --- a/ytstenut/video-profile/ytsg-vp-playable.c +++ b/ytstenut/video-profile/yts-vp-playable.c @@ -18,14 +18,14 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-vp-playable.h" +#include "yts-vp-playable.h" -G_DEFINE_INTERFACE (YtsgVPPlayable, - ytsg_vp_playable, +G_DEFINE_INTERFACE (YtsVPPlayable, + yts_vp_playable, G_TYPE_OBJECT) static void -ytsg_vp_playable_default_init (YtsgVPPlayableInterface *interface) +yts_vp_playable_default_init (YtsVPPlayableInterface *interface) { GParamFlags param_flags; @@ -67,11 +67,11 @@ ytsg_vp_playable_default_init (YtsgVPPlayableInterface *interface) } double -ytsg_vp_playable_get_duration (YtsgVPPlayable *self) +yts_vp_playable_get_duration (YtsVPPlayable *self) { double duration; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), 0.0); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), 0.0); duration = 0.0; g_object_get (G_OBJECT (self), "duration", &duration, NULL); @@ -79,11 +79,11 @@ ytsg_vp_playable_get_duration (YtsgVPPlayable *self) } GHashTable * -ytsg_vp_playable_get_metadata (YtsgVPPlayable *self) +yts_vp_playable_get_metadata (YtsVPPlayable *self) { GHashTable *metadata; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), NULL); metadata = NULL; g_object_get (G_OBJECT (self), "metadata", &metadata, NULL); @@ -91,16 +91,16 @@ ytsg_vp_playable_get_metadata (YtsgVPPlayable *self) } char const * -ytsg_vp_playable_get_metadata_attribute (YtsgVPPlayable *self, +yts_vp_playable_get_metadata_attribute (YtsVPPlayable *self, char const *attribute) { GHashTable *metadata; char const *value; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), NULL); - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (attribute), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (attribute), NULL); - metadata = ytsg_vp_playable_get_metadata (self); + metadata = yts_vp_playable_get_metadata (self); g_return_val_if_fail (metadata, NULL); value = (char const *) g_hash_table_lookup (metadata, attribute); @@ -110,11 +110,11 @@ ytsg_vp_playable_get_metadata_attribute (YtsgVPPlayable *self, } double -ytsg_vp_playable_get_position (YtsgVPPlayable *self) +yts_vp_playable_get_position (YtsVPPlayable *self) { double position; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), 0.0); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), 0.0); position = 0.0; g_object_get (G_OBJECT (self), "position", &position, NULL); @@ -122,20 +122,20 @@ ytsg_vp_playable_get_position (YtsgVPPlayable *self) } void -ytsg_vp_playable_set_position (YtsgVPPlayable *self, +yts_vp_playable_set_position (YtsVPPlayable *self, double position) { - g_return_if_fail (YTSG_VP_IS_PLAYABLE (self)); + g_return_if_fail (YTS_VP_IS_PLAYABLE (self)); g_object_set (G_OBJECT (self), "position", position, NULL); } char * -ytsg_vp_playable_get_thumbnail (YtsgVPPlayable *self) +yts_vp_playable_get_thumbnail (YtsVPPlayable *self) { char *thumbnail; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), NULL); thumbnail = NULL; g_object_get (G_OBJECT (self), "thumbnail", &thumbnail, NULL); @@ -143,11 +143,11 @@ ytsg_vp_playable_get_thumbnail (YtsgVPPlayable *self) } char * -ytsg_vp_playable_get_title (YtsgVPPlayable *self) +yts_vp_playable_get_title (YtsVPPlayable *self) { char *title; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), NULL); title = NULL; g_object_get (G_OBJECT (self), "title", &title, NULL); @@ -155,11 +155,11 @@ ytsg_vp_playable_get_title (YtsgVPPlayable *self) } char * -ytsg_vp_playable_get_uri (YtsgVPPlayable *self) +yts_vp_playable_get_uri (YtsVPPlayable *self) { char *uri; - g_return_val_if_fail (YTSG_VP_IS_PLAYABLE (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYABLE (self), NULL); uri = NULL; g_object_get (G_OBJECT (self), "uri", &uri, NULL); diff --git a/ytstenut/video-profile/ytsg-vp-playable.h b/ytstenut/video-profile/yts-vp-playable.h index 26cc13f..b7e35a6 100644 --- a/ytstenut/video-profile/ytsg-vp-playable.h +++ b/ytstenut/video-profile/yts-vp-playable.h @@ -18,65 +18,65 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_PLAYABLE_H -#define YTSG_VP_PLAYABLE_H +#ifndef YTS_VP_PLAYABLE_H +#define YTS_VP_PLAYABLE_H #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_VP_TYPE_PLAYABLE (ytsg_vp_playable_get_type ()) +#define YTS_VP_TYPE_PLAYABLE (yts_vp_playable_get_type ()) -#define YTSG_VP_PLAYABLE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_VP_TYPE_PLAYABLE, YtsgVPPlayable)) +#define YTS_VP_PLAYABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_VP_TYPE_PLAYABLE, YtsVPPlayable)) -#define YTSG_VP_IS_PLAYABLE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_PLAYABLE)) +#define YTS_VP_IS_PLAYABLE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_PLAYABLE)) -#define YTSG_VP_PLAYABLE_GET_INTERFACE(obj) \ +#define YTS_VP_PLAYABLE_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_PLAYABLE, \ - YtsgVPPlayableInterface)) + YTS_VP_TYPE_PLAYABLE, \ + YtsVPPlayableInterface)) -typedef struct YtsgVPPlayable YtsgVPPlayable; +typedef struct YtsVPPlayable YtsVPPlayable; typedef struct { /*< private >*/ GTypeInterface parent; -} YtsgVPPlayableInterface; +} YtsVPPlayableInterface; GType -ytsg_vp_playable_get_type (void) G_GNUC_CONST; +yts_vp_playable_get_type (void) G_GNUC_CONST; double -ytsg_vp_playable_get_duration (YtsgVPPlayable *self); +yts_vp_playable_get_duration (YtsVPPlayable *self); GHashTable * -ytsg_vp_playable_get_metadata (YtsgVPPlayable *self); +yts_vp_playable_get_metadata (YtsVPPlayable *self); char const * -ytsg_vp_playable_get_metadata_attribute (YtsgVPPlayable *self, +yts_vp_playable_get_metadata_attribute (YtsVPPlayable *self, char const *attribute); double -ytsg_vp_playable_get_position (YtsgVPPlayable *self); +yts_vp_playable_get_position (YtsVPPlayable *self); void -ytsg_vp_playable_set_position (YtsgVPPlayable *self, +yts_vp_playable_set_position (YtsVPPlayable *self, double position); char * -ytsg_vp_playable_get_thumbnail (YtsgVPPlayable *self); +yts_vp_playable_get_thumbnail (YtsVPPlayable *self); char * -ytsg_vp_playable_get_title (YtsgVPPlayable *self); +yts_vp_playable_get_title (YtsVPPlayable *self); char * -ytsg_vp_playable_get_uri (YtsgVPPlayable *self); +yts_vp_playable_get_uri (YtsVPPlayable *self); G_END_DECLS -#endif /* YTSG_VP_PLAYABLE_H */ +#endif /* YTS_VP_PLAYABLE_H */ diff --git a/ytstenut/video-profile/ytsg-vp-player-adapter.c b/ytstenut/video-profile/yts-vp-player-adapter.c index 0ef5397..ae20a78 100644 --- a/ytstenut/video-profile/ytsg-vp-player-adapter.c +++ b/ytstenut/video-profile/yts-vp-player-adapter.c @@ -19,31 +19,31 @@ */ #include <stdbool.h> -#include "ytsg-service-adapter.h" -#include "ytsg-vp-player.h" -#include "ytsg-vp-player-adapter.h" +#include "yts-service-adapter.h" +#include "yts-vp-player.h" +#include "yts-vp-player-adapter.h" -G_DEFINE_TYPE (YtsgVPPlayerAdapter, - ytsg_vp_player_adapter, - YTSG_TYPE_SERVICE_ADAPTER) +G_DEFINE_TYPE (YtsVPPlayerAdapter, + yts_vp_player_adapter, + YTS_TYPE_SERVICE_ADAPTER) #define GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - YTSG_VP_TYPE_PLAYER_ADAPTER, \ - YtsgVPPlayerAdapterPrivate)) + YTS_VP_TYPE_PLAYER_ADAPTER, \ + YtsVPPlayerAdapterPrivate)) typedef struct { - YtsgVPPlayer *player; -} YtsgVPPlayerAdapterPrivate; + YtsVPPlayer *player; +} YtsVPPlayerAdapterPrivate; /* - * YtsgServiceAdapter overrides + * YtsServiceAdapter overrides */ static GVariant * -_service_adapter_collect_properties (YtsgServiceAdapter *self) +_service_adapter_collect_properties (YtsServiceAdapter *self) { - YtsgVPPlayerAdapterPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerAdapterPrivate *priv = GET_PRIVATE (self); GVariantBuilder builder; bool playing; double volume; @@ -51,16 +51,16 @@ _service_adapter_collect_properties (YtsgServiceAdapter *self) g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY); - playing = ytsg_vp_player_get_playing (priv->player); + playing = yts_vp_player_get_playing (priv->player); g_variant_builder_add (&builder, "{sv}", "playing", g_variant_new_boolean (playing)); - volume = ytsg_vp_player_get_volume (priv->player); + volume = yts_vp_player_get_volume (priv->player); g_variant_builder_add (&builder, "{sv}", "volume", g_variant_new_double (volume)); /* PONDERING should NULL properties be synched or assumed default? */ - playable_uri = ytsg_vp_player_get_playable_uri (priv->player); + playable_uri = yts_vp_player_get_playable_uri (priv->player); if (playable_uri) { g_variant_builder_add (&builder, "{sv}", "playable-uri", g_variant_new_string (playable_uri)); @@ -71,12 +71,12 @@ _service_adapter_collect_properties (YtsgServiceAdapter *self) } static bool -_service_adapter_invoke (YtsgServiceAdapter *self, +_service_adapter_invoke (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments) { - YtsgVPPlayerAdapterPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerAdapterPrivate *priv = GET_PRIVATE (self); bool keep_sae = false; /* Properties */ @@ -91,7 +91,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, g_variant_is_of_type (arguments, G_VARIANT_TYPE_BOOLEAN)) { /* PONDERING at some point we can maybe optimize out sending back the notification */ - ytsg_vp_player_set_playing (priv->player, + yts_vp_player_set_playing (priv->player, g_variant_get_boolean (arguments)); } else if (0 == g_strcmp0 ("volume", aspect) && @@ -99,7 +99,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, g_variant_is_of_type (arguments, G_VARIANT_TYPE_DOUBLE)) { /* PONDERING at some point we can maybe optimize out sending back the notification */ - ytsg_vp_player_set_volume (priv->player, + yts_vp_player_set_volume (priv->player, g_variant_get_double (arguments)); } else if (0 == g_strcmp0 ("playable-uri", aspect) && @@ -107,7 +107,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING)) { /* PONDERING at some point we can maybe optimize out sending back the notification */ - ytsg_vp_player_set_playable_uri (priv->player, + yts_vp_player_set_playable_uri (priv->player, g_variant_get_string (arguments, NULL)); } else @@ -116,22 +116,22 @@ _service_adapter_invoke (YtsgServiceAdapter *self, if (0 == g_strcmp0 ("play", aspect)) { - ytsg_vp_player_play (priv->player); + yts_vp_player_play (priv->player); } else if (0 == g_strcmp0 ("pause", aspect)) { - ytsg_vp_player_pause (priv->player); + yts_vp_player_pause (priv->player); } else if (0 == g_strcmp0 ("next", aspect)) { - ytsg_vp_player_next (priv->player, invocation_id); + yts_vp_player_next (priv->player, invocation_id); /* This method responds whether it could skip to next, * so keep the return envelope. */ keep_sae = true; } else if (0 == g_strcmp0 ("prev", aspect)) { - ytsg_vp_player_prev (priv->player, invocation_id); + yts_vp_player_prev (priv->player, invocation_id); /* This method responds whether it could skip to next, * so keep the return envelope. */ keep_sae = true; @@ -153,7 +153,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, } /* - * YtsgVPPlayerAdapter + * YtsVPPlayerAdapter */ enum { @@ -163,81 +163,81 @@ enum { }; static void -_player_notify_playable (YtsgVPPlayer *player, +_player_notify_playable (YtsVPPlayer *player, GParamSpec *pspec, - YtsgVPPlayerAdapter *self) + YtsVPPlayerAdapter *self) { /* TODO */ g_debug ("%s : %s() not implemented yet", G_STRLOC, __FUNCTION__); } static void -_player_notify_playing (YtsgVPPlayer *player, +_player_notify_playing (YtsVPPlayer *player, GParamSpec *pspec, - YtsgVPPlayerAdapter *self) + YtsVPPlayerAdapter *self) { bool playing; - playing = ytsg_vp_player_get_playing (player); - ytsg_service_adapter_send_event (YTSG_SERVICE_ADAPTER (self), + playing = yts_vp_player_get_playing (player); + yts_service_adapter_send_event (YTS_SERVICE_ADAPTER (self), "playing", g_variant_new_boolean (playing)); } static void -_player_notify_volume (YtsgVPPlayer *player, +_player_notify_volume (YtsVPPlayer *player, GParamSpec *pspec, - YtsgVPPlayerAdapter *self) + YtsVPPlayerAdapter *self) { double volume; - volume = ytsg_vp_player_get_volume (player); - ytsg_service_adapter_send_event (YTSG_SERVICE_ADAPTER (self), + volume = yts_vp_player_get_volume (player); + yts_service_adapter_send_event (YTS_SERVICE_ADAPTER (self), "volume", g_variant_new_double (volume)); } static void -_player_notify_playable_uri (YtsgVPPlayer *player, +_player_notify_playable_uri (YtsVPPlayer *player, GParamSpec *pspec, - YtsgVPPlayerAdapter *self) + YtsVPPlayerAdapter *self) { char *playable_uri; - playable_uri = ytsg_vp_player_get_playable_uri (player); - ytsg_service_adapter_send_event (YTSG_SERVICE_ADAPTER (self), + playable_uri = yts_vp_player_get_playable_uri (player); + yts_service_adapter_send_event (YTS_SERVICE_ADAPTER (self), "playable-uri", g_variant_new_string (playable_uri)); g_free (playable_uri); } static void -_player_next_response (YtsgVPPlayer *player, +_player_next_response (YtsVPPlayer *player, char const *invocation_id, bool return_value, - YtsgVPPlayerAdapter *self) + YtsVPPlayerAdapter *self) { - ytsg_service_adapter_send_response (YTSG_SERVICE_ADAPTER (self), + yts_service_adapter_send_response (YTS_SERVICE_ADAPTER (self), invocation_id, g_variant_new_boolean (return_value)); } static void -_player_prev_response (YtsgVPPlayer *player, +_player_prev_response (YtsVPPlayer *player, char const *invocation_id, bool return_value, - YtsgVPPlayerAdapter *self) + YtsVPPlayerAdapter *self) { - ytsg_service_adapter_send_response (YTSG_SERVICE_ADAPTER (self), + yts_service_adapter_send_response (YTS_SERVICE_ADAPTER (self), invocation_id, g_variant_new_boolean (return_value)); } static void -_player_destroyed (YtsgVPPlayerAdapter *self, +_player_destroyed (YtsVPPlayerAdapter *self, void *stale_player_ptr) { - YtsgVPPlayerAdapterPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerAdapterPrivate *priv = GET_PRIVATE (self); priv->player = NULL; g_object_unref (self); @@ -249,11 +249,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgVPPlayerAdapterPrivate *priv = GET_PRIVATE (object); + YtsVPPlayerAdapterPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_SERVICE_ADAPTER_FQC_ID: - g_value_set_string (value, YTSG_VP_PLAYER_FQC_ID); + g_value_set_string (value, YTS_VP_PLAYER_FQC_ID); break; case PROP_SERVICE_ADAPTER_SERVICE: g_value_set_object (value, priv->player); @@ -269,7 +269,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgVPPlayerAdapterPrivate *priv = GET_PRIVATE (object); + YtsVPPlayerAdapterPrivate *priv = GET_PRIVATE (object); switch (property_id) { @@ -278,9 +278,9 @@ _set_property (GObject *object, /* Construct-only */ g_return_if_fail (priv->player == NULL); - g_return_if_fail (YTSG_VP_IS_PLAYER (g_value_get_object (value))); + g_return_if_fail (YTS_VP_IS_PLAYER (g_value_get_object (value))); - priv->player = YTSG_VP_PLAYER (g_value_get_object (value)); + priv->player = YTS_VP_PLAYER (g_value_get_object (value)); g_object_weak_ref (G_OBJECT (priv->player), (GWeakNotify) _player_destroyed, object); @@ -307,7 +307,7 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgVPPlayerAdapterPrivate *priv = GET_PRIVATE (object); + YtsVPPlayerAdapterPrivate *priv = GET_PRIVATE (object); if (priv->player) { g_warning ("%s : Adapter disposed with adaptee still referenced.", @@ -318,16 +318,16 @@ _dispose (GObject *object) priv->player = NULL; } - G_OBJECT_CLASS (ytsg_vp_player_adapter_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_vp_player_adapter_parent_class)->dispose (object); } static void -ytsg_vp_player_adapter_class_init (YtsgVPPlayerAdapterClass *klass) +yts_vp_player_adapter_class_init (YtsVPPlayerAdapterClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - YtsgServiceAdapterClass *adapter_class = YTSG_SERVICE_ADAPTER_CLASS (klass); + YtsServiceAdapterClass *adapter_class = YTS_SERVICE_ADAPTER_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgVPPlayerAdapterPrivate)); + g_type_class_add_private (klass, sizeof (YtsVPPlayerAdapterPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -348,7 +348,7 @@ ytsg_vp_player_adapter_class_init (YtsgVPPlayerAdapterClass *klass) } static void -ytsg_vp_player_adapter_init (YtsgVPPlayerAdapter *self) +yts_vp_player_adapter_init (YtsVPPlayerAdapter *self) { } diff --git a/ytstenut/video-profile/yts-vp-player-adapter.h b/ytstenut/video-profile/yts-vp-player-adapter.h new file mode 100644 index 0000000..3bfe09f --- /dev/null +++ b/ytstenut/video-profile/yts-vp-player-adapter.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_VP_PLAYER_ADAPTER_H +#define YTS_VP_PLAYER_ADAPTER_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define YTS_VP_TYPE_PLAYER_ADAPTER (yts_vp_player_adapter_get_type ()) + +#define YTS_VP_PLAYER_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_VP_TYPE_PLAYER_ADAPTER, \ + YtsVPPlayerAdapter)) + +#define YTS_VP_PLAYER_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_VP_TYPE_PLAYER_ADAPTER, \ + YtsVPPlayerAdapterClass)) + +#define YTS_VP_IS_PLAYER_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_PLAYER_ADAPTER)) + +#define YTS_VP_IS_PLAYER_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_VP_TYPE_PLAYER_ADAPTER)) + +#define YTS_VP_PLAYER_ADAPTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_VP_TYPE_PLAYER_ADAPTER, \ + YtsVPPlayerAdapterClass)) + +typedef struct { + YtsServiceAdapter parent; +} YtsVPPlayerAdapter; + +typedef struct { + YtsServiceAdapterClass parent; +} YtsVPPlayerAdapterClass; + +GType +yts_vp_player_adapter_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* YTS_VP_PLAYER_ADAPTER_H */ + diff --git a/ytstenut/video-profile/ytsg-vp-player-proxy.c b/ytstenut/video-profile/yts-vp-player-proxy.c index c4e1bca..d464dd8 100644 --- a/ytstenut/video-profile/ytsg-vp-player-proxy.c +++ b/ytstenut/video-profile/yts-vp-player-proxy.c @@ -19,27 +19,27 @@ */ #include <stdbool.h> -#include "ytsg-vp-playable.h" -#include "ytsg-vp-playable-proxy.h" -#include "ytsg-vp-player.h" -#include "ytsg-vp-player-proxy.h" +#include "yts-vp-playable.h" +#include "yts-vp-playable-proxy.h" +#include "yts-vp-player.h" +#include "yts-vp-player-proxy.h" static void -_player_interface_init (YtsgVPPlayerInterface *interface); +_player_interface_init (YtsVPPlayerInterface *interface); -G_DEFINE_TYPE_WITH_CODE (YtsgVPPlayerProxy, - ytsg_vp_player_proxy, - YTSG_TYPE_PROXY, - G_IMPLEMENT_INTERFACE (YTSG_VP_TYPE_PLAYER, +G_DEFINE_TYPE_WITH_CODE (YtsVPPlayerProxy, + yts_vp_player_proxy, + YTS_TYPE_PROXY, + G_IMPLEMENT_INTERFACE (YTS_VP_TYPE_PLAYER, _player_interface_init)) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_VP_TYPE_PLAYER_PROXY, YtsgVPPlayerProxyPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_VP_TYPE_PLAYER_PROXY, YtsVPPlayerProxyPrivate)) typedef struct { /* Properties */ - YtsgVPPlayableProxy *playable; + YtsVPPlayableProxy *playable; bool playing; double volume; char *playable_uri; @@ -47,79 +47,79 @@ typedef struct { /* Data */ GHashTable *invocations; -} YtsgVPPlayerProxyPrivate; +} YtsVPPlayerProxyPrivate; static void -player_proxy_set_playing (YtsgVPPlayerProxy *self, +player_proxy_set_playing (YtsVPPlayerProxy *self, bool playing); static void -player_proxy_set_playable_uri (YtsgVPPlayerProxy *self, +player_proxy_set_playable_uri (YtsVPPlayerProxy *self, char const *playable_uri); static void -player_proxy_set_volume (YtsgVPPlayerProxy *self, +player_proxy_set_volume (YtsVPPlayerProxy *self, double volume); /* - * YtsgVPPlayer implementation + * YtsVPPlayer implementation */ static void -_player_play (YtsgVPPlayer *self) +_player_play (YtsVPPlayer *self) { char *invocation_id; - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (self)); - ytsg_proxy_invoke (YTSG_PROXY (self), invocation_id, "play", NULL); + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (self)); + yts_proxy_invoke (YTS_PROXY (self), invocation_id, "play", NULL); g_free (invocation_id); } static void -_player_pause (YtsgVPPlayer *self) +_player_pause (YtsVPPlayer *self) { char *invocation_id; - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (self)); - ytsg_proxy_invoke (YTSG_PROXY (self), invocation_id, "pause", NULL); + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (self)); + yts_proxy_invoke (YTS_PROXY (self), invocation_id, "pause", NULL); g_free (invocation_id); } static void -_player_next (YtsgVPPlayer *self, +_player_next (YtsVPPlayer *self, char const *invocation_id_) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); char *invocation_id; invocation_id = invocation_id_ ? g_strdup (invocation_id_) : - ytsg_proxy_create_invocation_id (YTSG_PROXY (self)); + yts_proxy_create_invocation_id (YTS_PROXY (self)); /* Hash takes invocation_id. */ g_hash_table_insert (priv->invocations, invocation_id, _player_next); - // TODO set timeout, well, probably in ytsg-proxy-service.c + // TODO set timeout, well, probably in yts-proxy-service.c - ytsg_proxy_invoke (YTSG_PROXY (self), invocation_id, "next", NULL); + yts_proxy_invoke (YTS_PROXY (self), invocation_id, "next", NULL); } static void -_player_prev (YtsgVPPlayer *self, +_player_prev (YtsVPPlayer *self, char const *invocation_id_) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); char *invocation_id; invocation_id = invocation_id_ ? g_strdup (invocation_id_) : - ytsg_proxy_create_invocation_id (YTSG_PROXY (self)); + yts_proxy_create_invocation_id (YTS_PROXY (self)); /* Hash takes invocation_id. */ g_hash_table_insert (priv->invocations, invocation_id, _player_prev); - // TODO set timeout, well, probably in ytsg-proxy-service.c + // TODO set timeout, well, probably in yts-proxy-service.c - ytsg_proxy_invoke (YTSG_PROXY (self), invocation_id, "prev", NULL); + yts_proxy_invoke (YTS_PROXY (self), invocation_id, "prev", NULL); } static void -_player_interface_init (YtsgVPPlayerInterface *interface) +_player_interface_init (YtsVPPlayerInterface *interface) { interface->play = _player_play; interface->pause = _player_pause; @@ -128,15 +128,15 @@ _player_interface_init (YtsgVPPlayerInterface *interface) } /* - * YtsgProxy overrides + * YtsProxy overrides */ static void -_proxy_service_event (YtsgProxy *self, +_proxy_service_event (YtsProxy *self, char const *aspect, GVariant *arguments) { -// YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); +// YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); if (0 == g_strcmp0 ("playable", aspect)) { @@ -147,19 +147,19 @@ _proxy_service_event (YtsgProxy *self, g_variant_is_of_type (arguments, G_VARIANT_TYPE_BOOLEAN)) { bool playing = g_variant_get_boolean (arguments); - player_proxy_set_playing (YTSG_VP_PLAYER_PROXY (self), playing); + player_proxy_set_playing (YTS_VP_PLAYER_PROXY (self), playing); } else if (0 == g_strcmp0 ("volume", aspect) && g_variant_is_of_type (arguments, G_VARIANT_TYPE_DOUBLE)) { double volume = g_variant_get_double (arguments); - player_proxy_set_volume (YTSG_VP_PLAYER_PROXY (self), volume); + player_proxy_set_volume (YTS_VP_PLAYER_PROXY (self), volume); } else if (0 == g_strcmp0 ("playable-uri", aspect) && g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING)) { char const *playable_uri = g_variant_get_string (arguments, NULL); - player_proxy_set_playable_uri (YTSG_VP_PLAYER_PROXY (self), playable_uri); + player_proxy_set_playable_uri (YTS_VP_PLAYER_PROXY (self), playable_uri); } else { @@ -173,25 +173,25 @@ _proxy_service_event (YtsgProxy *self, } static void -_proxy_service_response (YtsgProxy *self, +_proxy_service_response (YtsProxy *self, char const *invocation_id, GVariant *response) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); void *call; call = g_hash_table_lookup (priv->invocations, invocation_id); - // TODO clear timeout, well, probably in ytsg-proxy-service.c + // TODO clear timeout, well, probably in yts-proxy-service.c if (call == _player_next) { - ytsg_vp_player_next_return (YTSG_VP_PLAYER (self), + yts_vp_player_next_return (YTS_VP_PLAYER (self), invocation_id, g_variant_get_boolean (response)); } else if (call == _player_prev) { - ytsg_vp_player_prev_return (YTSG_VP_PLAYER (self), + yts_vp_player_prev_return (YTS_VP_PLAYER (self), invocation_id, g_variant_get_boolean (response)); @@ -216,7 +216,7 @@ _proxy_service_response (YtsgProxy *self, } /* - * YtsgVPPlayerProxy + * YtsVPPlayerProxy */ enum { @@ -236,11 +236,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (object); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_CAPABILITY_FQC_IDS: { - char *fqc_ids[] = { YTSG_VP_PLAYER_FQC_ID, NULL }; + char *fqc_ids[] = { YTS_VP_PLAYER_FQC_ID, NULL }; g_value_set_boxed (value, fqc_ids); } break; case PROP_PLAYER_PLAYABLE: @@ -266,7 +266,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (object); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (object); char *invocation_id; switch (property_id) { @@ -281,8 +281,8 @@ _set_property (GObject *object, case PROP_PLAYER_PLAYING: { bool playing = g_value_get_boolean (value); if (playing != priv->playing) { - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (object)); - ytsg_proxy_invoke (YTSG_PROXY (object), invocation_id, + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (object)); + yts_proxy_invoke (YTS_PROXY (object), invocation_id, "playing", g_variant_new_boolean (playing)); g_free (invocation_id); } @@ -291,8 +291,8 @@ _set_property (GObject *object, case PROP_PLAYER_VOLUME: { double volume = g_value_get_double (value); if (volume != priv->volume) { - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (object)); - ytsg_proxy_invoke (YTSG_PROXY (object), invocation_id, + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (object)); + yts_proxy_invoke (YTS_PROXY (object), invocation_id, "volume", g_variant_new_double (volume)); g_free (invocation_id); } @@ -301,8 +301,8 @@ _set_property (GObject *object, case PROP_PLAYER_PLAYABLE_URI: { char const *playable_uri = g_value_get_string (value); if (0 != g_strcmp0 (playable_uri, priv->playable_uri)) { - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (object)); - ytsg_proxy_invoke (YTSG_PROXY (object), invocation_id, + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (object)); + yts_proxy_invoke (YTS_PROXY (object), invocation_id, "playable-uri", g_variant_new_string (playable_uri)); g_free (invocation_id); } @@ -316,7 +316,7 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (object); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (object); if (priv->playable) { g_object_unref (G_OBJECT (priv->playable)); @@ -328,16 +328,16 @@ _dispose (GObject *object) priv->invocations = NULL; } - G_OBJECT_CLASS (ytsg_vp_player_proxy_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_vp_player_proxy_parent_class)->dispose (object); } static void -ytsg_vp_player_proxy_class_init (YtsgVPPlayerProxyClass *klass) +yts_vp_player_proxy_class_init (YtsVPPlayerProxyClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - YtsgProxyClass *proxy_class = YTSG_PROXY_CLASS (klass); + YtsProxyClass *proxy_class = YTS_PROXY_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgVPPlayerProxyPrivate)); + g_type_class_add_private (klass, sizeof (YtsVPPlayerProxyPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -346,13 +346,13 @@ ytsg_vp_player_proxy_class_init (YtsgVPPlayerProxyClass *klass) proxy_class->service_event = _proxy_service_event; proxy_class->service_response = _proxy_service_response; - /* YtsgCapability */ + /* YtsCapability */ g_object_class_override_property (object_class, PROP_CAPABILITY_FQC_IDS, "fqc-ids"); - /* YtsgVPPlayer */ + /* YtsVPPlayer */ g_object_class_override_property (object_class, PROP_PLAYER_PLAYABLE, @@ -372,9 +372,9 @@ ytsg_vp_player_proxy_class_init (YtsgVPPlayerProxyClass *klass) } static void -ytsg_vp_player_proxy_init (YtsgVPPlayerProxy *self) +yts_vp_player_proxy_init (YtsVPPlayerProxy *self) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); priv->invocations = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -383,10 +383,10 @@ ytsg_vp_player_proxy_init (YtsgVPPlayerProxy *self) } static void -player_proxy_set_playing (YtsgVPPlayerProxy *self, +player_proxy_set_playing (YtsVPPlayerProxy *self, bool playing) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); if (playing != priv->playing) { priv->playing = playing; @@ -395,10 +395,10 @@ player_proxy_set_playing (YtsgVPPlayerProxy *self, } static void -player_proxy_set_playable_uri (YtsgVPPlayerProxy *self, +player_proxy_set_playable_uri (YtsVPPlayerProxy *self, char const *playable_uri) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); if (0 != g_strcmp0 (playable_uri, priv->playable_uri)) { @@ -416,10 +416,10 @@ player_proxy_set_playable_uri (YtsgVPPlayerProxy *self, } static void -player_proxy_set_volume (YtsgVPPlayerProxy *self, +player_proxy_set_volume (YtsVPPlayerProxy *self, double volume) { - YtsgVPPlayerProxyPrivate *priv = GET_PRIVATE (self); + YtsVPPlayerProxyPrivate *priv = GET_PRIVATE (self); if (volume != priv->volume) { priv->volume = volume; diff --git a/ytstenut/video-profile/ytsg-vp-player-proxy.h b/ytstenut/video-profile/yts-vp-player-proxy.h index 728167e..3313370 100644 --- a/ytstenut/video-profile/ytsg-vp-player-proxy.h +++ b/ytstenut/video-profile/yts-vp-player-proxy.h @@ -18,49 +18,49 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_PLAYER_PROXY_H -#define YTSG_VP_PLAYER_PROXY_H +#ifndef YTS_VP_PLAYER_PROXY_H +#define YTS_VP_PLAYER_PROXY_H #include <glib-object.h> -#include <ytstenut/ytsg-proxy.h> +#include <ytstenut/yts-proxy.h> G_BEGIN_DECLS -#define YTSG_VP_TYPE_PLAYER_PROXY ytsg_vp_player_proxy_get_type() +#define YTS_VP_TYPE_PLAYER_PROXY yts_vp_player_proxy_get_type() -#define YTSG_VP_PLAYER_PROXY(obj) \ +#define YTS_VP_PLAYER_PROXY(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_PLAYER_PROXY, \ - YtsgVPPlayerProxy)) + YTS_VP_TYPE_PLAYER_PROXY, \ + YtsVPPlayerProxy)) -#define YTSG_VP_PLAYER_PROXY_CLASS(klass) \ +#define YTS_VP_PLAYER_PROXY_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_VP_TYPE_PLAYER_PROXY, \ - YtsgVPPlayerProxyClass)) + YTS_VP_TYPE_PLAYER_PROXY, \ + YtsVPPlayerProxyClass)) -#define YTSG_VP_IS_PLAYER_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_PLAYER_PROXY)) +#define YTS_VP_IS_PLAYER_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_PLAYER_PROXY)) -#define YTSG_VP_IS_PLAYER_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_VP_TYPE_PLAYER_PROXY)) +#define YTS_VP_IS_PLAYER_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_VP_TYPE_PLAYER_PROXY)) -#define YTSG_VP_PLAYER_PROXY_GET_CLASS(obj) \ +#define YTS_VP_PLAYER_PROXY_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_VP_TYPE_PLAYER_PROXY, \ - YtsgVPPlayerProxyClass)) + YTS_VP_TYPE_PLAYER_PROXY, \ + YtsVPPlayerProxyClass)) typedef struct { - YtsgProxy parent; -} YtsgVPPlayerProxy; + YtsProxy parent; +} YtsVPPlayerProxy; typedef struct { - YtsgProxyClass parent; -} YtsgVPPlayerProxyClass; + YtsProxyClass parent; +} YtsVPPlayerProxyClass; GType -ytsg_vp_player_proxy_get_type (void) G_GNUC_CONST; +yts_vp_player_proxy_get_type (void) G_GNUC_CONST; G_END_DECLS -#endif /* YTSG_VP_PLAYER_PROXY_H */ +#endif /* YTS_VP_PLAYER_PROXY_H */ diff --git a/ytstenut/video-profile/ytsg-vp-player.c b/ytstenut/video-profile/yts-vp-player.c index 11e66d8..fa27e98 100644 --- a/ytstenut/video-profile/ytsg-vp-player.c +++ b/ytstenut/video-profile/yts-vp-player.c @@ -18,14 +18,14 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-marshal.h" -#include "ytsg-vp-playable.h" -#include "ytsg-vp-player.h" +#include "yts-capability.h" +#include "yts-marshal.h" +#include "yts-vp-playable.h" +#include "yts-vp-player.h" -G_DEFINE_INTERFACE (YtsgVPPlayer, - ytsg_vp_player, - YTSG_TYPE_CAPABILITY) +G_DEFINE_INTERFACE (YtsVPPlayer, + yts_vp_player, + YTS_TYPE_CAPABILITY) enum { SIG_NEXT_RESPONSE, @@ -36,41 +36,41 @@ enum { static unsigned _signals[N_SIGNALS] = { 0, }; static void -_play (YtsgVPPlayer *self) +_play (YtsVPPlayer *self) { - g_critical ("%s : Method YtsgVPPlayer.play() not implemented by %s", + g_critical ("%s : Method YtsVPPlayer.play() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); } static void -_pause (YtsgVPPlayer *self) +_pause (YtsVPPlayer *self) { - g_critical ("%s : Method YtsgVPPlayer.pause() not implemented by %s", + g_critical ("%s : Method YtsVPPlayer.pause() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); } static void -_next (YtsgVPPlayer *self, +_next (YtsVPPlayer *self, char const *invocation_id) { - g_critical ("%s : Method YtsgVPPlayer.next() not implemented by %s", + g_critical ("%s : Method YtsVPPlayer.next() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); } static void -_prev (YtsgVPPlayer *self, +_prev (YtsVPPlayer *self, char const *invocation_id) { - g_critical ("%s : Method YtsgVPPlayer.prev() not implemented by %s", + g_critical ("%s : Method YtsVPPlayer.prev() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); } static void -ytsg_vp_player_default_init (YtsgVPPlayerInterface *interface) +yts_vp_player_default_init (YtsVPPlayerInterface *interface) { GParamSpec *pspec; @@ -80,7 +80,7 @@ ytsg_vp_player_default_init (YtsgVPPlayerInterface *interface) interface->prev = _prev; pspec = g_param_spec_object ("playable", "", "", - YTSG_VP_TYPE_PLAYABLE, + YTS_VP_TYPE_PLAYABLE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_interface_install_property (interface, pspec); @@ -106,28 +106,28 @@ ytsg_vp_player_default_init (YtsgVPPlayerInterface *interface) /* Signals */ _signals[SIG_NEXT_RESPONSE] = g_signal_new ("next-response", - YTSG_VP_TYPE_PLAYER, + YTS_VP_TYPE_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__STRING_BOOLEAN, + yts_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); _signals[SIG_PREV_RESPONSE] = g_signal_new ("prev-response", - YTSG_VP_TYPE_PLAYER, + YTS_VP_TYPE_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__STRING_BOOLEAN, + yts_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); } -YtsgVPPlayable * -ytsg_vp_player_get_playable (YtsgVPPlayer *self) +YtsVPPlayable * +yts_vp_player_get_playable (YtsVPPlayer *self) { - YtsgVPPlayable *playable; + YtsVPPlayable *playable; - g_return_val_if_fail (YTSG_VP_IS_PLAYER (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYER (self), NULL); playable = NULL; g_object_get (G_OBJECT (self), "playable", &playable, NULL); @@ -135,20 +135,20 @@ ytsg_vp_player_get_playable (YtsgVPPlayer *self) } void -ytsg_vp_player_set_playable (YtsgVPPlayer *self, - YtsgVPPlayable *playable) +yts_vp_player_set_playable (YtsVPPlayer *self, + YtsVPPlayable *playable) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); g_object_set (G_OBJECT (self), "playable", playable, NULL); } bool -ytsg_vp_player_get_playing (YtsgVPPlayer *self) +yts_vp_player_get_playing (YtsVPPlayer *self) { bool playing; - g_return_val_if_fail (YTSG_VP_IS_PLAYER (self), false); + g_return_val_if_fail (YTS_VP_IS_PLAYER (self), false); playing = false; g_object_get (G_OBJECT (self), "playing", &playing, NULL); @@ -156,20 +156,20 @@ ytsg_vp_player_get_playing (YtsgVPPlayer *self) } void -ytsg_vp_player_set_playing (YtsgVPPlayer *self, +yts_vp_player_set_playing (YtsVPPlayer *self, bool playing) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); g_object_set (G_OBJECT (self), "playing", playing, NULL); } double -ytsg_vp_player_get_volume (YtsgVPPlayer *self) +yts_vp_player_get_volume (YtsVPPlayer *self) { double volume; - g_return_val_if_fail (YTSG_VP_IS_PLAYER (self), 0.0); + g_return_val_if_fail (YTS_VP_IS_PLAYER (self), 0.0); volume = 0.0; g_object_get (G_OBJECT (self), "volume", &volume, NULL); @@ -177,20 +177,20 @@ ytsg_vp_player_get_volume (YtsgVPPlayer *self) } void -ytsg_vp_player_set_volume (YtsgVPPlayer *self, +yts_vp_player_set_volume (YtsVPPlayer *self, double volume) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); g_object_set (G_OBJECT (self), "volume", volume, NULL); } char * -ytsg_vp_player_get_playable_uri (YtsgVPPlayer *self) +yts_vp_player_get_playable_uri (YtsVPPlayer *self) { char *playable_uri; - g_return_val_if_fail (YTSG_VP_IS_PLAYER (self), NULL); + g_return_val_if_fail (YTS_VP_IS_PLAYER (self), NULL); playable_uri = NULL; g_object_get (G_OBJECT (self), "playable-uri", &playable_uri, NULL); @@ -198,65 +198,65 @@ ytsg_vp_player_get_playable_uri (YtsgVPPlayer *self) } void -ytsg_vp_player_set_playable_uri (YtsgVPPlayer *self, +yts_vp_player_set_playable_uri (YtsVPPlayer *self, char const *playable_uri) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); g_object_set (G_OBJECT (self), "playable-uri", playable_uri, NULL); } void -ytsg_vp_player_play (YtsgVPPlayer *self) +yts_vp_player_play (YtsVPPlayer *self) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); - YTSG_VP_PLAYER_GET_INTERFACE (self)->play (self); + YTS_VP_PLAYER_GET_INTERFACE (self)->play (self); } void -ytsg_vp_player_pause (YtsgVPPlayer *self) +yts_vp_player_pause (YtsVPPlayer *self) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); - YTSG_VP_PLAYER_GET_INTERFACE (self)->pause (self); + YTS_VP_PLAYER_GET_INTERFACE (self)->pause (self); } void -ytsg_vp_player_next (YtsgVPPlayer *self, +yts_vp_player_next (YtsVPPlayer *self, char const *invocation_id) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); - YTSG_VP_PLAYER_GET_INTERFACE (self)->next (self, invocation_id); + YTS_VP_PLAYER_GET_INTERFACE (self)->next (self, invocation_id); } void -ytsg_vp_player_next_return (YtsgVPPlayer *self, +yts_vp_player_next_return (YtsVPPlayer *self, char const *invocation_id, bool response) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); g_signal_emit (self, _signals[SIG_NEXT_RESPONSE], 0, invocation_id, response); } void -ytsg_vp_player_prev (YtsgVPPlayer *self, +yts_vp_player_prev (YtsVPPlayer *self, char const *invocation_id) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); - YTSG_VP_PLAYER_GET_INTERFACE (self)->prev (self, invocation_id); + YTS_VP_PLAYER_GET_INTERFACE (self)->prev (self, invocation_id); } void -ytsg_vp_player_prev_return (YtsgVPPlayer *self, +yts_vp_player_prev_return (YtsVPPlayer *self, char const *invocation_id, bool response) { - g_return_if_fail (YTSG_VP_IS_PLAYER (self)); + g_return_if_fail (YTS_VP_IS_PLAYER (self)); g_signal_emit (self, _signals[SIG_PREV_RESPONSE], 0, invocation_id, response); diff --git a/ytstenut/video-profile/ytsg-vp-player.h b/ytstenut/video-profile/yts-vp-player.h index b47fe6e..0c24050 100644 --- a/ytstenut/video-profile/ytsg-vp-player.h +++ b/ytstenut/video-profile/yts-vp-player.h @@ -18,31 +18,31 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_PLAYER_H -#define YTSG_VP_PLAYER_H +#ifndef YTS_VP_PLAYER_H +#define YTS_VP_PLAYER_H #include <stdbool.h> #include <glib-object.h> -#include <ytstenut/video-profile/ytsg-vp-playable.h> +#include <ytstenut/video-profile/yts-vp-playable.h> G_BEGIN_DECLS -#define YTSG_VP_PLAYER_FQC_ID "org.freedesktop.ytstenut.VideoProfile.Player" +#define YTS_VP_PLAYER_FQC_ID "org.freedesktop.ytstenut.VideoProfile.Player" -#define YTSG_VP_TYPE_PLAYER (ytsg_vp_player_get_type ()) +#define YTS_VP_TYPE_PLAYER (yts_vp_player_get_type ()) -#define YTSG_VP_PLAYER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_VP_TYPE_PLAYER, YtsgVPPlayer)) +#define YTS_VP_PLAYER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_VP_TYPE_PLAYER, YtsVPPlayer)) -#define YTSG_VP_IS_PLAYER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_PLAYER)) +#define YTS_VP_IS_PLAYER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_PLAYER)) -#define YTSG_VP_PLAYER_GET_INTERFACE(obj) \ +#define YTS_VP_PLAYER_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_PLAYER, \ - YtsgVPPlayerInterface)) + YTS_VP_TYPE_PLAYER, \ + YtsVPPlayerInterface)) -typedef struct YtsgVPPlayer YtsgVPPlayer; +typedef struct YtsVPPlayer YtsVPPlayer; typedef struct { @@ -50,80 +50,80 @@ typedef struct { GTypeInterface parent; void - (*play) (YtsgVPPlayer *self); + (*play) (YtsVPPlayer *self); void - (*pause) (YtsgVPPlayer *self); + (*pause) (YtsVPPlayer *self); void - (*next) (YtsgVPPlayer *self, + (*next) (YtsVPPlayer *self, char const *invocation_id); void - (*prev) (YtsgVPPlayer *self, + (*prev) (YtsVPPlayer *self, char const *invocation_id); -} YtsgVPPlayerInterface; +} YtsVPPlayerInterface; GType -ytsg_vp_player_get_type (void) G_GNUC_CONST; +yts_vp_player_get_type (void) G_GNUC_CONST; -YtsgVPPlayable * -ytsg_vp_player_get_playable (YtsgVPPlayer *self); +YtsVPPlayable * +yts_vp_player_get_playable (YtsVPPlayer *self); void -ytsg_vp_player_set_playable (YtsgVPPlayer *self, - YtsgVPPlayable *playable); +yts_vp_player_set_playable (YtsVPPlayer *self, + YtsVPPlayable *playable); bool -ytsg_vp_player_get_playing (YtsgVPPlayer *self); +yts_vp_player_get_playing (YtsVPPlayer *self); void -ytsg_vp_player_set_playing (YtsgVPPlayer *self, +yts_vp_player_set_playing (YtsVPPlayer *self, bool playing); char * -ytsg_vp_player_get_playable_uri (YtsgVPPlayer *self); +yts_vp_player_get_playable_uri (YtsVPPlayer *self); void -ytsg_vp_player_set_playable_uri (YtsgVPPlayer *self, +yts_vp_player_set_playable_uri (YtsVPPlayer *self, char const *playable_uri); double -ytsg_vp_player_get_volume (YtsgVPPlayer *self); +yts_vp_player_get_volume (YtsVPPlayer *self); void -ytsg_vp_player_set_volume (YtsgVPPlayer *self, +yts_vp_player_set_volume (YtsVPPlayer *self, double volume); void -ytsg_vp_player_play (YtsgVPPlayer *self); +yts_vp_player_play (YtsVPPlayer *self); void -ytsg_vp_player_pause (YtsgVPPlayer *self); +yts_vp_player_pause (YtsVPPlayer *self); void -ytsg_vp_player_next (YtsgVPPlayer *self, +yts_vp_player_next (YtsVPPlayer *self, char const *invocation_id); void -ytsg_vp_player_prev (YtsgVPPlayer *self, +yts_vp_player_prev (YtsVPPlayer *self, char const *invocation_id); /* Protected */ void -ytsg_vp_player_next_return (YtsgVPPlayer *self, +yts_vp_player_next_return (YtsVPPlayer *self, char const *invocation_id, bool response); void -ytsg_vp_player_prev_return (YtsgVPPlayer *self, +yts_vp_player_prev_return (YtsVPPlayer *self, char const *invocation_id, bool response); G_END_DECLS -#endif /* YTSG_VP_PLAYER_H */ +#endif /* YTS_VP_PLAYER_H */ diff --git a/ytstenut/video-profile/ytsg-vp-query.c b/ytstenut/video-profile/yts-vp-query.c index 02b7563..edc6238 100644 --- a/ytstenut/video-profile/ytsg-vp-query.c +++ b/ytstenut/video-profile/yts-vp-query.c @@ -18,12 +18,12 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-enum-types.h" -#include "ytsg-marshal.h" -#include "ytsg-vp-query.h" +#include "yts-enum-types.h" +#include "yts-marshal.h" +#include "yts-vp-query.h" -G_DEFINE_INTERFACE (YtsgVPQuery, - ytsg_vp_query, +G_DEFINE_INTERFACE (YtsVPQuery, + yts_vp_query, G_TYPE_OBJECT) enum { @@ -35,7 +35,7 @@ enum { static unsigned _signals[N_SIGNALS] = { 0, }; static void -ytsg_vp_query_default_init (YtsgVPQueryInterface *interface) +yts_vp_query_default_init (YtsVPQueryInterface *interface) { /* 0 means no limit */ g_object_interface_install_property (interface, @@ -48,15 +48,15 @@ ytsg_vp_query_default_init (YtsgVPQueryInterface *interface) 0, 100, 0, G_PARAM_READABLE)); - /* GList*<YtsgVPPlayable> */ + /* GList*<YtsVPPlayable> */ g_object_interface_install_property (interface, g_param_spec_pointer ("results", "", "", G_PARAM_READABLE)); g_object_interface_install_property (interface, g_param_spec_enum ("result-order", "", "", - YTSG_TYPE_VP_QUERY_RESULT_ORDER, - YTSG_VP_QUERY_NONE, + YTS_TYPE_VP_QUERY_RESULT_ORDER, + YTS_VP_QUERY_NONE, G_PARAM_READABLE)); /* GPtrArray<char const *> */ @@ -66,21 +66,21 @@ ytsg_vp_query_default_init (YtsgVPQueryInterface *interface) G_PARAM_READABLE)); _signals[RESULT_SIGNAL] = g_signal_new ("result", - YTSG_VP_TYPE_QUERY, + YTS_VP_TYPE_QUERY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgVPQueryInterface, result), + G_STRUCT_OFFSET (YtsVPQueryInterface, result), NULL, NULL, - ytsg_marshal_BOOLEAN__POINTER_UINT, + yts_marshal_BOOLEAN__POINTER_UINT, G_TYPE_BOOLEAN, 2, G_TYPE_POINTER, G_TYPE_UINT); } unsigned -ytsg_vp_get_max_results (YtsgVPQuery *self) +yts_vp_get_max_results (YtsVPQuery *self) { unsigned max_results; - g_return_val_if_fail (YTSG_VP_IS_QUERY (self), 0); + g_return_val_if_fail (YTS_VP_IS_QUERY (self), 0); max_results = 0; g_object_get (G_OBJECT (self), "max-results", &max_results, NULL); @@ -88,11 +88,11 @@ ytsg_vp_get_max_results (YtsgVPQuery *self) } unsigned -ytsg_vp_get_progress (YtsgVPQuery *self) +yts_vp_get_progress (YtsVPQuery *self) { unsigned progress; - g_return_val_if_fail (YTSG_VP_IS_QUERY (self), 0); + g_return_val_if_fail (YTS_VP_IS_QUERY (self), 0); progress = 0; g_object_get (G_OBJECT (self), "progress", &progress, NULL); @@ -100,25 +100,25 @@ ytsg_vp_get_progress (YtsgVPQuery *self) } GList * -ytsg_vp_get_results (YtsgVPQuery *self) +yts_vp_get_results (YtsVPQuery *self) { GList *results; - g_return_val_if_fail (YTSG_VP_IS_QUERY (self), NULL); + g_return_val_if_fail (YTS_VP_IS_QUERY (self), NULL); results = NULL; g_object_get (G_OBJECT (self), "results", &results, NULL); return results; } -YtsgVPQueryResultOrder -ytsg_vp_get_result_order (YtsgVPQuery *self) +YtsVPQueryResultOrder +yts_vp_get_result_order (YtsVPQuery *self) { - YtsgVPQueryResultOrder result_order; + YtsVPQueryResultOrder result_order; - g_return_val_if_fail (YTSG_VP_IS_QUERY (self), YTSG_VP_QUERY_NONE); + g_return_val_if_fail (YTS_VP_IS_QUERY (self), YTS_VP_QUERY_NONE); - result_order = YTSG_VP_QUERY_NONE; + result_order = YTS_VP_QUERY_NONE; g_object_get (G_OBJECT (self), "result-order", &result_order, NULL); return result_order; } diff --git a/ytstenut/video-profile/ytsg-vp-query.h b/ytstenut/video-profile/yts-vp-query.h index b3e9022..6d4fa25 100644 --- a/ytstenut/video-profile/ytsg-vp-query.h +++ b/ytstenut/video-profile/yts-vp-query.h @@ -18,29 +18,29 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_QUERY_H -#define YTSG_VP_QUERY_H +#ifndef YTS_VP_QUERY_H +#define YTS_VP_QUERY_H #include <stdbool.h> #include <glib-object.h> -#include <ytstenut/ytsg-types.h> +#include <ytstenut/yts-types.h> G_BEGIN_DECLS -#define YTSG_VP_TYPE_QUERY (ytsg_vp_query_get_type ()) +#define YTS_VP_TYPE_QUERY (yts_vp_query_get_type ()) -#define YTSG_VP_QUERY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_VP_TYPE_QUERY, YtsgVPQuery)) +#define YTS_VP_QUERY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_VP_TYPE_QUERY, YtsVPQuery)) -#define YTSG_VP_IS_QUERY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_QUERY)) +#define YTS_VP_IS_QUERY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_QUERY)) -#define YTSG_VP_QUERY_GET_INTERFACE(obj) \ +#define YTS_VP_QUERY_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_QUERY, \ - YtsgVPQueryInterface)) + YTS_VP_TYPE_QUERY, \ + YtsVPQueryInterface)) -typedef struct YtsgVPQuery YtsgVPQuery; +typedef struct YtsVPQuery YtsVPQuery; typedef struct { @@ -49,28 +49,28 @@ typedef struct { /* Signals */ bool - (*result) (YtsgVPQuery *self, + (*result) (YtsVPQuery *self, GList *playables, unsigned progress); -} YtsgVPQueryInterface; +} YtsVPQueryInterface; GType -ytsg_vp_query_get_type (void) G_GNUC_CONST; +yts_vp_query_get_type (void) G_GNUC_CONST; unsigned -ytsg_vp_get_max_results (YtsgVPQuery *self); +yts_vp_get_max_results (YtsVPQuery *self); unsigned -ytsg_vp_get_progress (YtsgVPQuery *self); +yts_vp_get_progress (YtsVPQuery *self); GList * -ytsg_vp_get_results (YtsgVPQuery *self); +yts_vp_get_results (YtsVPQuery *self); -YtsgVPQueryResultOrder -ytsg_vp_get_result_order (YtsgVPQuery *self); +YtsVPQueryResultOrder +yts_vp_get_result_order (YtsVPQuery *self); G_END_DECLS -#endif /* YTSG_VP_QUERY_H */ +#endif /* YTS_VP_QUERY_H */ diff --git a/ytstenut/video-profile/ytsg-vp-transcript-adapter.c b/ytstenut/video-profile/yts-vp-transcript-adapter.c index 88814e9..4c747b7 100644 --- a/ytstenut/video-profile/ytsg-vp-transcript-adapter.c +++ b/ytstenut/video-profile/yts-vp-transcript-adapter.c @@ -18,31 +18,31 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-service-adapter.h" -#include "ytsg-vp-transcript.h" -#include "ytsg-vp-transcript-adapter.h" +#include "yts-service-adapter.h" +#include "yts-vp-transcript.h" +#include "yts-vp-transcript-adapter.h" -G_DEFINE_TYPE (YtsgVPTranscriptAdapter, - ytsg_vp_transcript_adapter, - YTSG_TYPE_SERVICE_ADAPTER) +G_DEFINE_TYPE (YtsVPTranscriptAdapter, + yts_vp_transcript_adapter, + YTS_TYPE_SERVICE_ADAPTER) #define GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ - YTSG_VP_TYPE_TRANSCRIPT_ADAPTER, \ - YtsgVPTranscriptAdapterPrivate)) + YTS_VP_TYPE_TRANSCRIPT_ADAPTER, \ + YtsVPTranscriptAdapterPrivate)) typedef struct { - YtsgVPTranscript *transcript; -} YtsgVPTranscriptAdapterPrivate; + YtsVPTranscript *transcript; +} YtsVPTranscriptAdapterPrivate; /* - * YtsgServiceAdapter overrides + * YtsServiceAdapter overrides */ static GVariant * -_service_adapter_collect_properties (YtsgServiceAdapter *self) +_service_adapter_collect_properties (YtsServiceAdapter *self) { - YtsgVPTranscriptAdapterPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptAdapterPrivate *priv = GET_PRIVATE (self); GVariantBuilder builder; char **locales; char *current_text; @@ -50,7 +50,7 @@ _service_adapter_collect_properties (YtsgServiceAdapter *self) g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY); - locales = ytsg_vp_transcript_get_available_locales (priv->transcript); + locales = yts_vp_transcript_get_available_locales (priv->transcript); if (locales) { GVariant *v = g_variant_new_strv ((char const *const *) locales, -1); g_variant_builder_add (&builder, "{sv}", @@ -58,14 +58,14 @@ _service_adapter_collect_properties (YtsgServiceAdapter *self) g_strfreev (locales); } - current_text = ytsg_vp_transcript_get_current_text (priv->transcript); + current_text = yts_vp_transcript_get_current_text (priv->transcript); if (current_text) { g_variant_builder_add (&builder, "{sv}", "current-text", g_variant_new_string (current_text)); g_free (current_text); } - locale = ytsg_vp_transcript_get_locale (priv->transcript); + locale = yts_vp_transcript_get_locale (priv->transcript); if (locale) { g_variant_builder_add (&builder, "{sv}", "locale", g_variant_new_string (locale)); @@ -76,12 +76,12 @@ _service_adapter_collect_properties (YtsgServiceAdapter *self) } static bool -_service_adapter_invoke (YtsgServiceAdapter *self, +_service_adapter_invoke (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments) { - YtsgVPTranscriptAdapterPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptAdapterPrivate *priv = GET_PRIVATE (self); bool keep_sae = false; /* Properties */ @@ -90,7 +90,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, arguments && g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING)) { - ytsg_vp_transcript_set_locale (priv->transcript, + yts_vp_transcript_set_locale (priv->transcript, g_variant_get_string (arguments, NULL)); } else { @@ -110,7 +110,7 @@ _service_adapter_invoke (YtsgServiceAdapter *self, } /* - * YtsgVPTranscriptAdapter + * YtsVPTranscriptAdapter */ enum { @@ -120,54 +120,54 @@ enum { }; static void -_transcript_notify_available_locales (YtsgVPTranscript *transcript, +_transcript_notify_available_locales (YtsVPTranscript *transcript, GParamSpec *pspec, - YtsgVPTranscriptAdapter *self) + YtsVPTranscriptAdapter *self) { char **locales; GVariant *v; - locales = ytsg_vp_transcript_get_available_locales (transcript); + locales = yts_vp_transcript_get_available_locales (transcript); v = g_variant_new_strv ((char const *const *) locales, -1); - ytsg_service_adapter_send_event (YTSG_SERVICE_ADAPTER (self), + yts_service_adapter_send_event (YTS_SERVICE_ADAPTER (self), "available-locales", v); g_strfreev (locales); } static void -_transcript_notify_current_text (YtsgVPTranscript *transcript, +_transcript_notify_current_text (YtsVPTranscript *transcript, GParamSpec *pspec, - YtsgVPTranscriptAdapter *self) + YtsVPTranscriptAdapter *self) { char *current_text; - current_text = ytsg_vp_transcript_get_current_text (transcript); - ytsg_service_adapter_send_event (YTSG_SERVICE_ADAPTER (self), + current_text = yts_vp_transcript_get_current_text (transcript); + yts_service_adapter_send_event (YTS_SERVICE_ADAPTER (self), "current-text", g_variant_new_string (current_text)); g_free (current_text); } static void -_transcript_notify_locale (YtsgVPTranscript *transcript, +_transcript_notify_locale (YtsVPTranscript *transcript, GParamSpec *pspec, - YtsgVPTranscriptAdapter *self) + YtsVPTranscriptAdapter *self) { char *locale; - locale = ytsg_vp_transcript_get_locale (transcript); - ytsg_service_adapter_send_event (YTSG_SERVICE_ADAPTER (self), + locale = yts_vp_transcript_get_locale (transcript); + yts_service_adapter_send_event (YTS_SERVICE_ADAPTER (self), "locale", g_variant_new_string (locale)); g_free (locale); } static void -_transcript_destroyed (YtsgVPTranscriptAdapter *self, +_transcript_destroyed (YtsVPTranscriptAdapter *self, void *stale_transcript_ptr) { - YtsgVPTranscriptAdapterPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptAdapterPrivate *priv = GET_PRIVATE (self); priv->transcript = NULL; g_object_unref (self); @@ -179,11 +179,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgVPTranscriptAdapterPrivate *priv = GET_PRIVATE (object); + YtsVPTranscriptAdapterPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_SERVICE_ADAPTER_FQC_ID: - g_value_set_string (value, YTSG_VP_TRANSCRIPT_FQC_ID); + g_value_set_string (value, YTS_VP_TRANSCRIPT_FQC_ID); break; case PROP_SERVICE_ADAPTER_SERVICE: g_value_set_object (value, priv->transcript); @@ -199,7 +199,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgVPTranscriptAdapterPrivate *priv = GET_PRIVATE (object); + YtsVPTranscriptAdapterPrivate *priv = GET_PRIVATE (object); switch (property_id) { @@ -208,9 +208,9 @@ _set_property (GObject *object, /* Construct-only */ g_return_if_fail (priv->transcript == NULL); - g_return_if_fail (YTSG_VP_IS_TRANSCRIPT (g_value_get_object (value))); + g_return_if_fail (YTS_VP_IS_TRANSCRIPT (g_value_get_object (value))); - priv->transcript = YTSG_VP_TRANSCRIPT (g_value_get_object (value)); + priv->transcript = YTS_VP_TRANSCRIPT (g_value_get_object (value)); g_object_weak_ref (G_OBJECT (priv->transcript), (GWeakNotify) _transcript_destroyed, object); @@ -231,7 +231,7 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgVPTranscriptAdapterPrivate *priv = GET_PRIVATE (object); + YtsVPTranscriptAdapterPrivate *priv = GET_PRIVATE (object); if (priv->transcript) { g_warning ("%s : Adapter disposed with adaptee still referenced.", @@ -242,16 +242,16 @@ _dispose (GObject *object) priv->transcript = NULL; } - G_OBJECT_CLASS (ytsg_vp_transcript_adapter_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_vp_transcript_adapter_parent_class)->dispose (object); } static void -ytsg_vp_transcript_adapter_class_init (YtsgVPTranscriptAdapterClass *klass) +yts_vp_transcript_adapter_class_init (YtsVPTranscriptAdapterClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - YtsgServiceAdapterClass *adapter_class = YTSG_SERVICE_ADAPTER_CLASS (klass); + YtsServiceAdapterClass *adapter_class = YTS_SERVICE_ADAPTER_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgVPTranscriptAdapterPrivate)); + g_type_class_add_private (klass, sizeof (YtsVPTranscriptAdapterPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -272,7 +272,7 @@ ytsg_vp_transcript_adapter_class_init (YtsgVPTranscriptAdapterClass *klass) } static void -ytsg_vp_transcript_adapter_init (YtsgVPTranscriptAdapter *self) +yts_vp_transcript_adapter_init (YtsVPTranscriptAdapter *self) { } diff --git a/ytstenut/video-profile/yts-vp-transcript-adapter.h b/ytstenut/video-profile/yts-vp-transcript-adapter.h new file mode 100644 index 0000000..cf7d405 --- /dev/null +++ b/ytstenut/video-profile/yts-vp-transcript-adapter.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_VP_TRANSCRIPT_ADAPTER_H +#define YTS_VP_TRANSCRIPT_ADAPTER_H + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define YTS_VP_TYPE_TRANSCRIPT_ADAPTER \ + (yts_vp_transcript_adapter_get_type ()) + +#define YTS_VP_TRANSCRIPT_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_VP_TYPE_TRANSCRIPT_ADAPTER, \ + YtsVPTranscriptAdapter)) + +#define YTS_VP_TRANSCRIPT_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_VP_TYPE_TRANSCRIPT_ADAPTER, \ + YtsVPTranscriptAdapterClass)) + +#define YTS_VP_IS_TRANSCRIPT_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_TRANSCRIPT_ADAPTER)) + +#define YTS_VP_IS_TRANSCRIPT_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_VP_TYPE_TRANSCRIPT_ADAPTER)) + +#define YTS_VP_TRANSCRIPT_ADAPTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_VP_TYPE_TRANSCRIPT_ADAPTER, \ + YtsVPTranscriptAdapterClass)) + +typedef struct { + YtsServiceAdapter parent; +} YtsVPTranscriptAdapter; + +typedef struct { + YtsServiceAdapterClass parent; +} YtsVPTranscriptAdapterClass; + +GType +yts_vp_transcript_adapter_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* YTS_VP_TRANSCRIPT_ADAPTER_H */ + diff --git a/ytstenut/video-profile/ytsg-vp-transcript-proxy.c b/ytstenut/video-profile/yts-vp-transcript-proxy.c index c43d70a..ea731de 100644 --- a/ytstenut/video-profile/ytsg-vp-transcript-proxy.c +++ b/ytstenut/video-profile/yts-vp-transcript-proxy.c @@ -19,20 +19,20 @@ */ #include <stdbool.h> -#include "ytsg-vp-transcript.h" -#include "ytsg-vp-transcript-proxy.h" +#include "yts-vp-transcript.h" +#include "yts-vp-transcript-proxy.h" static void -_transcript_interface_init (YtsgVPTranscriptInterface *interface); +_transcript_interface_init (YtsVPTranscriptInterface *interface); -G_DEFINE_TYPE_WITH_CODE (YtsgVPTranscriptProxy, - ytsg_vp_transcript_proxy, - YTSG_TYPE_PROXY, - G_IMPLEMENT_INTERFACE (YTSG_VP_TYPE_TRANSCRIPT, +G_DEFINE_TYPE_WITH_CODE (YtsVPTranscriptProxy, + yts_vp_transcript_proxy, + YTS_TYPE_PROXY, + G_IMPLEMENT_INTERFACE (YTS_VP_TYPE_TRANSCRIPT, _transcript_interface_init)) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_VP_TYPE_TRANSCRIPT_PROXY, YtsgVPTranscriptProxyPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_VP_TYPE_TRANSCRIPT_PROXY, YtsVPTranscriptProxyPrivate)) typedef struct { @@ -44,45 +44,45 @@ typedef struct { /* Data */ GHashTable *invocations; -} YtsgVPTranscriptProxyPrivate; +} YtsVPTranscriptProxyPrivate; static void -transcript_proxy_set_available_locales (YtsgVPTranscriptProxy *self, +transcript_proxy_set_available_locales (YtsVPTranscriptProxy *self, char const *const *locales); static void -transcript_proxy_set_current_text (YtsgVPTranscriptProxy *self, +transcript_proxy_set_current_text (YtsVPTranscriptProxy *self, char const *current_text); static void -transcript_proxy_set_locale (YtsgVPTranscriptProxy *self, +transcript_proxy_set_locale (YtsVPTranscriptProxy *self, char const *locale); /* - * YtsgVPTranscript implementation + * YtsVPTranscript implementation */ static void -_transcript_interface_init (YtsgVPTranscriptInterface *interface) +_transcript_interface_init (YtsVPTranscriptInterface *interface) { /* No methods. */ } /* - * YtsgProxy overrides + * YtsProxy overrides */ static void -_proxy_service_event (YtsgProxy *self, +_proxy_service_event (YtsProxy *self, char const *aspect, GVariant *arguments) { -// YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); +// YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); if (0 == g_strcmp0 ("available-locales", aspect) && g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING_ARRAY)) { /* Read-only property, sync behind the scenes. */ char const **locales = g_variant_get_strv (arguments, NULL); - transcript_proxy_set_available_locales (YTSG_VP_TRANSCRIPT_PROXY (self), + transcript_proxy_set_available_locales (YTS_VP_TRANSCRIPT_PROXY (self), locales); g_free (locales); /* See g_variant_get_strv(). */ @@ -91,14 +91,14 @@ _proxy_service_event (YtsgProxy *self, /* Read-only property, sync behind the scenes. */ char const *current_text = g_variant_get_string (arguments, NULL); - transcript_proxy_set_current_text (YTSG_VP_TRANSCRIPT_PROXY (self), + transcript_proxy_set_current_text (YTS_VP_TRANSCRIPT_PROXY (self), current_text); } else if (0 == g_strcmp0 ("locale", aspect) && g_variant_is_of_type (arguments, G_VARIANT_TYPE_STRING)) { char const *locale = g_variant_get_string (arguments, NULL); - transcript_proxy_set_locale (YTSG_VP_TRANSCRIPT_PROXY (self), locale); + transcript_proxy_set_locale (YTS_VP_TRANSCRIPT_PROXY (self), locale); } else { @@ -112,7 +112,7 @@ _proxy_service_event (YtsgProxy *self, } static void -_proxy_service_response (YtsgProxy *self, +_proxy_service_response (YtsProxy *self, char const *invocation_id, GVariant *response) { @@ -125,7 +125,7 @@ _proxy_service_response (YtsgProxy *self, } /* - * YtsgVPTranscriptProxy + * YtsVPTranscriptProxy */ enum { @@ -144,11 +144,11 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (object); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_CAPABILITY_FQC_IDS: { - char *fqc_ids[] = { YTSG_VP_TRANSCRIPT_FQC_ID, NULL }; + char *fqc_ids[] = { YTS_VP_TRANSCRIPT_FQC_ID, NULL }; g_value_set_boxed (value, fqc_ids); } break; case PROP_TRANSCRIPT_AVAILABLE_LOCALES: @@ -171,7 +171,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (object); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (object); char *invocation_id; switch (property_id) { @@ -180,8 +180,8 @@ _set_property (GObject *object, char const *locale = g_value_get_string (value); if (0 != g_strcmp0 (locale, priv->locale)) { - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (object)); - ytsg_proxy_invoke (YTSG_PROXY (object), invocation_id, + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (object)); + yts_proxy_invoke (YTS_PROXY (object), invocation_id, "locale", g_variant_new_string (locale)); g_free (invocation_id); } @@ -195,23 +195,23 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (object); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (object); if (priv->invocations) { g_hash_table_destroy (priv->invocations); priv->invocations = NULL; } - G_OBJECT_CLASS (ytsg_vp_transcript_proxy_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_vp_transcript_proxy_parent_class)->dispose (object); } static void -ytsg_vp_transcript_proxy_class_init (YtsgVPTranscriptProxyClass *klass) +yts_vp_transcript_proxy_class_init (YtsVPTranscriptProxyClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - YtsgProxyClass *proxy_class = YTSG_PROXY_CLASS (klass); + YtsProxyClass *proxy_class = YTS_PROXY_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgVPTranscriptProxyPrivate)); + g_type_class_add_private (klass, sizeof (YtsVPTranscriptProxyPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -220,13 +220,13 @@ ytsg_vp_transcript_proxy_class_init (YtsgVPTranscriptProxyClass *klass) proxy_class->service_event = _proxy_service_event; proxy_class->service_response = _proxy_service_response; - /* YtsgCapability */ + /* YtsCapability */ g_object_class_override_property (object_class, PROP_CAPABILITY_FQC_IDS, "fqc-ids"); - /* YtsgVPTranscript */ + /* YtsVPTranscript */ g_object_class_override_property (object_class, PROP_TRANSCRIPT_AVAILABLE_LOCALES, @@ -242,9 +242,9 @@ ytsg_vp_transcript_proxy_class_init (YtsgVPTranscriptProxyClass *klass) } static void -ytsg_vp_transcript_proxy_init (YtsgVPTranscriptProxy *self) +yts_vp_transcript_proxy_init (YtsVPTranscriptProxy *self) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); priv->invocations = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -253,10 +253,10 @@ ytsg_vp_transcript_proxy_init (YtsgVPTranscriptProxy *self) } static void -transcript_proxy_set_available_locales (YtsgVPTranscriptProxy *self, +transcript_proxy_set_available_locales (YtsVPTranscriptProxy *self, char const *const *locales) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); /* Assume the value has been validated by the service. */ @@ -273,10 +273,10 @@ transcript_proxy_set_available_locales (YtsgVPTranscriptProxy *self, } static void -transcript_proxy_set_current_text (YtsgVPTranscriptProxy *self, +transcript_proxy_set_current_text (YtsVPTranscriptProxy *self, char const *current_text) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); /* Assume the value has been validated by the service. */ @@ -296,10 +296,10 @@ transcript_proxy_set_current_text (YtsgVPTranscriptProxy *self, } static void -transcript_proxy_set_locale (YtsgVPTranscriptProxy *self, +transcript_proxy_set_locale (YtsVPTranscriptProxy *self, char const *locale) { - YtsgVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); + YtsVPTranscriptProxyPrivate *priv = GET_PRIVATE (self); /* Assume the value has been validated by the service. */ diff --git a/ytstenut/video-profile/yts-vp-transcript-proxy.h b/ytstenut/video-profile/yts-vp-transcript-proxy.h new file mode 100644 index 0000000..a9abc13 --- /dev/null +++ b/ytstenut/video-profile/yts-vp-transcript-proxy.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_VP_TRANSCRIPT_PROXY_H +#define YTS_VP_TRANSCRIPT_PROXY_H + +#include <glib-object.h> +#include <ytstenut/yts-proxy.h> + +G_BEGIN_DECLS + +#define YTS_VP_TYPE_TRANSCRIPT_PROXY yts_vp_transcript_proxy_get_type() + +#define YTS_VP_TRANSCRIPT_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_VP_TYPE_TRANSCRIPT_PROXY, \ + YtsVPTranscriptProxy)) + +#define YTS_VP_TRANSCRIPT_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_VP_TYPE_TRANSCRIPT_PROXY, \ + YtsVPTranscriptProxyClass)) + +#define YTS_VP_IS_TRANSCRIPT_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_TRANSCRIPT_PROXY)) + +#define YTS_VP_IS_TRANSCRIPT_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_VP_TYPE_TRANSCRIPT_PROXY)) + +#define YTS_VP_TRANSCRIPT_PROXY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_VP_TYPE_TRANSCRIPT_PROXY, \ + YtsVPTranscriptProxyClass)) + +typedef struct { + YtsProxy parent; +} YtsVPTranscriptProxy; + +typedef struct { + YtsProxyClass parent; +} YtsVPTranscriptProxyClass; + +GType +yts_vp_transcript_proxy_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* YTS_VP_TRANSCRIPT_PROXY_H */ + diff --git a/ytstenut/video-profile/ytsg-vp-transcript.c b/ytstenut/video-profile/yts-vp-transcript.c index e1ac74e..5814657 100644 --- a/ytstenut/video-profile/ytsg-vp-transcript.c +++ b/ytstenut/video-profile/yts-vp-transcript.c @@ -18,15 +18,15 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-vp-transcript.h" +#include "yts-capability.h" +#include "yts-vp-transcript.h" -G_DEFINE_INTERFACE (YtsgVPTranscript, - ytsg_vp_transcript, - YTSG_TYPE_CAPABILITY) +G_DEFINE_INTERFACE (YtsVPTranscript, + yts_vp_transcript, + YTS_TYPE_CAPABILITY) static void -ytsg_vp_transcript_default_init (YtsgVPTranscriptInterface *interface) +yts_vp_transcript_default_init (YtsVPTranscriptInterface *interface) { GParamSpec *pspec; @@ -50,11 +50,11 @@ ytsg_vp_transcript_default_init (YtsgVPTranscriptInterface *interface) } char ** -ytsg_vp_transcript_get_available_locales (YtsgVPTranscript *self) +yts_vp_transcript_get_available_locales (YtsVPTranscript *self) { char **available_locales; - g_return_val_if_fail (YTSG_VP_IS_TRANSCRIPT (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSCRIPT (self), NULL); available_locales = NULL; g_object_get (G_OBJECT (self), "available-locales", &available_locales, NULL); @@ -62,11 +62,11 @@ ytsg_vp_transcript_get_available_locales (YtsgVPTranscript *self) } char * -ytsg_vp_transcript_get_current_text (YtsgVPTranscript *self) +yts_vp_transcript_get_current_text (YtsVPTranscript *self) { char *current_text; - g_return_val_if_fail (YTSG_VP_IS_TRANSCRIPT (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSCRIPT (self), NULL); current_text = NULL; g_object_get (G_OBJECT (self), "current-text", ¤t_text, NULL); @@ -74,11 +74,11 @@ ytsg_vp_transcript_get_current_text (YtsgVPTranscript *self) } char * -ytsg_vp_transcript_get_locale (YtsgVPTranscript *self) +yts_vp_transcript_get_locale (YtsVPTranscript *self) { char *locale; - g_return_val_if_fail (YTSG_VP_IS_TRANSCRIPT (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSCRIPT (self), NULL); locale = NULL; g_object_get (G_OBJECT (self), "locale", &locale, NULL); @@ -86,10 +86,10 @@ ytsg_vp_transcript_get_locale (YtsgVPTranscript *self) } void -ytsg_vp_transcript_set_locale (YtsgVPTranscript *self, +yts_vp_transcript_set_locale (YtsVPTranscript *self, char const *locale) { - g_return_if_fail (YTSG_VP_IS_TRANSCRIPT (self)); + g_return_if_fail (YTS_VP_IS_TRANSCRIPT (self)); g_object_set (G_OBJECT (self), "locale", locale, NULL); } diff --git a/ytstenut/video-profile/ytsg-vp-transcript.h b/ytstenut/video-profile/yts-vp-transcript.h index 0133564..c98d5d6 100644 --- a/ytstenut/video-profile/ytsg-vp-transcript.h +++ b/ytstenut/video-profile/yts-vp-transcript.h @@ -18,57 +18,57 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_TRANSCRIPT_H -#define YTSG_VP_TRANSCRIPT_H +#ifndef YTS_VP_TRANSCRIPT_H +#define YTS_VP_TRANSCRIPT_H #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_VP_TRANSCRIPT_FQC_ID \ +#define YTS_VP_TRANSCRIPT_FQC_ID \ "org.freedesktop.ytstenut.VideoProfile.Transcript" -#define YTSG_VP_TYPE_TRANSCRIPT (ytsg_vp_transcript_get_type ()) +#define YTS_VP_TYPE_TRANSCRIPT (yts_vp_transcript_get_type ()) -#define YTSG_VP_TRANSCRIPT(obj) \ +#define YTS_VP_TRANSCRIPT(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_TRANSCRIPT, \ - YtsgVPTranscript)) + YTS_VP_TYPE_TRANSCRIPT, \ + YtsVPTranscript)) -#define YTSG_VP_IS_TRANSCRIPT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_TRANSCRIPT)) +#define YTS_VP_IS_TRANSCRIPT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_TRANSCRIPT)) -#define YTSG_VP_TRANSCRIPT_GET_INTERFACE(obj) \ +#define YTS_VP_TRANSCRIPT_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_TRANSCRIPT, \ - YtsgVPTranscriptInterface)) + YTS_VP_TYPE_TRANSCRIPT, \ + YtsVPTranscriptInterface)) -typedef struct YtsgVPTranscript YtsgVPTranscript; +typedef struct YtsVPTranscript YtsVPTranscript; typedef struct { /*< private >*/ GTypeInterface parent; -} YtsgVPTranscriptInterface; +} YtsVPTranscriptInterface; GType -ytsg_vp_transcript_get_type (void) G_GNUC_CONST; +yts_vp_transcript_get_type (void) G_GNUC_CONST; char ** -ytsg_vp_transcript_get_available_locales (YtsgVPTranscript *self); +yts_vp_transcript_get_available_locales (YtsVPTranscript *self); char * -ytsg_vp_transcript_get_current_text (YtsgVPTranscript *self); +yts_vp_transcript_get_current_text (YtsVPTranscript *self); char * -ytsg_vp_transcript_get_locale (YtsgVPTranscript *self); +yts_vp_transcript_get_locale (YtsVPTranscript *self); void -ytsg_vp_transcript_set_locale (YtsgVPTranscript *self, +yts_vp_transcript_set_locale (YtsVPTranscript *self, char const *locale); G_END_DECLS -#endif /* YTSG_VP_TRANSCRIPT_H */ +#endif /* YTS_VP_TRANSCRIPT_H */ diff --git a/ytstenut/video-profile/ytsg-vp-transfer.c b/ytstenut/video-profile/yts-vp-transfer.c index 6528281..9d59822 100644 --- a/ytstenut/video-profile/ytsg-vp-transfer.c +++ b/ytstenut/video-profile/yts-vp-transfer.c @@ -18,56 +18,56 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-vp-transfer.h" +#include "yts-capability.h" +#include "yts-vp-transfer.h" -G_DEFINE_INTERFACE (YtsgVPTransfer, - ytsg_vp_transfer, - YTSG_TYPE_CAPABILITY) +G_DEFINE_INTERFACE (YtsVPTransfer, + yts_vp_transfer, + YTS_TYPE_CAPABILITY) -static YtsgVPTransmission * -_download (YtsgVPTransfer *self, +static YtsVPTransmission * +_download (YtsVPTransfer *self, char const *uri) { - g_critical ("%s : Method YtsgVPTransfer.download() not implemented by %s", + g_critical ("%s : Method YtsVPTransfer.download() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); return NULL; } -static YtsgVPTransmission * -_upload (YtsgVPTransfer *self, +static YtsVPTransmission * +_upload (YtsVPTransfer *self, char const *uri) { - g_critical ("%s : Method YtsgVPTransfer.download() not implemented by %s", + g_critical ("%s : Method YtsVPTransfer.download() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); return NULL; } static void -ytsg_vp_transfer_default_init (YtsgVPTransferInterface *interface) +yts_vp_transfer_default_init (YtsVPTransferInterface *interface) { /* Methods */ interface->download = _download; interface->upload = _upload; } -YtsgVPTransmission * -ytsg_vp_transfer_download (YtsgVPTransfer *self, +YtsVPTransmission * +yts_vp_transfer_download (YtsVPTransfer *self, char const *uri) { - g_return_val_if_fail (YTSG_VP_IS_TRANSFER (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSFER (self), NULL); - return YTSG_VP_TRANSFER_GET_INTERFACE (self)->download (self, uri); + return YTS_VP_TRANSFER_GET_INTERFACE (self)->download (self, uri); } -YtsgVPTransmission * -ytsg_vp_transfer_upload (YtsgVPTransfer *self, +YtsVPTransmission * +yts_vp_transfer_upload (YtsVPTransfer *self, char const *uri) { - g_return_val_if_fail (YTSG_VP_IS_TRANSFER (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSFER (self), NULL); - return YTSG_VP_TRANSFER_GET_INTERFACE (self)->upload (self, uri); + return YTS_VP_TRANSFER_GET_INTERFACE (self)->upload (self, uri); } diff --git a/ytstenut/video-profile/ytsg-vp-transfer.h b/ytstenut/video-profile/yts-vp-transfer.h index fea42bb..4a72a57 100644 --- a/ytstenut/video-profile/ytsg-vp-transfer.h +++ b/ytstenut/video-profile/yts-vp-transfer.h @@ -18,59 +18,59 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_TRANSFER_H -#define YTSG_VP_TRANSFER_H +#ifndef YTS_VP_TRANSFER_H +#define YTS_VP_TRANSFER_H #include <glib-object.h> -#include <ytstenut/video-profile/ytsg-vp-transmission.h> +#include <ytstenut/video-profile/yts-vp-transmission.h> G_BEGIN_DECLS -#define YTSG_VP_TRANSFER_FQC_ID \ +#define YTS_VP_TRANSFER_FQC_ID \ "org.freedesktop.ytstenut.VideoProfile.Transfer" -#define YTSG_VP_TYPE_TRANSFER (ytsg_vp_transfer_get_type ()) +#define YTS_VP_TYPE_TRANSFER (yts_vp_transfer_get_type ()) -#define YTSG_VP_TRANSFER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_VP_TYPE_TRANSFER, YtsgVPTransfer)) +#define YTS_VP_TRANSFER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_VP_TYPE_TRANSFER, YtsVPTransfer)) -#define YTSG_VP_IS_TRANSFER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_TRANSFER)) +#define YTS_VP_IS_TRANSFER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_TRANSFER)) -#define YTSG_VP_TRANSFER_GET_INTERFACE(obj) \ +#define YTS_VP_TRANSFER_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_TRANSFER, \ - YtsgVPTransferInterface)) + YTS_VP_TYPE_TRANSFER, \ + YtsVPTransferInterface)) -typedef struct YtsgVPTransfer YtsgVPTransfer; +typedef struct YtsVPTransfer YtsVPTransfer; typedef struct { /*< private >*/ GTypeInterface parent; - YtsgVPTransmission * - (*download) (YtsgVPTransfer *self, + YtsVPTransmission * + (*download) (YtsVPTransfer *self, char const *uri); - YtsgVPTransmission * - (*upload) (YtsgVPTransfer *self, + YtsVPTransmission * + (*upload) (YtsVPTransfer *self, char const *uri); -} YtsgVPTransferInterface; +} YtsVPTransferInterface; GType -ytsg_vp_transfer_get_type (void) G_GNUC_CONST; +yts_vp_transfer_get_type (void) G_GNUC_CONST; -YtsgVPTransmission * -ytsg_vp_transfer_download (YtsgVPTransfer *self, +YtsVPTransmission * +yts_vp_transfer_download (YtsVPTransfer *self, char const *uri); -YtsgVPTransmission * -ytsg_vp_transfer_upload (YtsgVPTransfer *self, +YtsVPTransmission * +yts_vp_transfer_upload (YtsVPTransfer *self, char const *uri); G_END_DECLS -#endif /* YTSG_VP_TRANSFER_H */ +#endif /* YTS_VP_TRANSFER_H */ diff --git a/ytstenut/video-profile/ytsg-vp-transmission.c b/ytstenut/video-profile/yts-vp-transmission.c index 301555f..9d1ed4b 100644 --- a/ytstenut/video-profile/ytsg-vp-transmission.c +++ b/ytstenut/video-profile/yts-vp-transmission.c @@ -18,14 +18,14 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-vp-transmission.h" +#include "yts-vp-transmission.h" -G_DEFINE_INTERFACE (YtsgVPTransmission, - ytsg_vp_transmission, +G_DEFINE_INTERFACE (YtsVPTransmission, + yts_vp_transmission, G_TYPE_OBJECT) static void -ytsg_vp_transmission_default_init (YtsgVPTransmissionInterface *interface) +yts_vp_transmission_default_init (YtsVPTransmissionInterface *interface) { g_object_interface_install_property (interface, g_param_spec_string ("local-uri", "", "", @@ -44,11 +44,11 @@ ytsg_vp_transmission_default_init (YtsgVPTransmissionInterface *interface) } char * -ytsg_vp_transmission_get_local_uri (YtsgVPTransmission *self) +yts_vp_transmission_get_local_uri (YtsVPTransmission *self) { char *local_uri; - g_return_val_if_fail (YTSG_VP_IS_TRANSMISSION (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSMISSION (self), NULL); local_uri = NULL; g_object_get (G_OBJECT (self), "local-uri", &local_uri, NULL); @@ -56,11 +56,11 @@ ytsg_vp_transmission_get_local_uri (YtsgVPTransmission *self) } unsigned -ytsg_vp_transmission_get_progress (YtsgVPTransmission *self) +yts_vp_transmission_get_progress (YtsVPTransmission *self) { unsigned progress; - g_return_val_if_fail (YTSG_VP_IS_TRANSMISSION (self), 0); + g_return_val_if_fail (YTS_VP_IS_TRANSMISSION (self), 0); progress = 0; g_object_get (G_OBJECT (self), "progress", &progress, NULL); @@ -68,11 +68,11 @@ ytsg_vp_transmission_get_progress (YtsgVPTransmission *self) } char * -ytsg_vp_transmission_get_remote_uri (YtsgVPTransmission *self) +yts_vp_transmission_get_remote_uri (YtsVPTransmission *self) { char *remote_uri; - g_return_val_if_fail (YTSG_VP_IS_TRANSMISSION (self), NULL); + g_return_val_if_fail (YTS_VP_IS_TRANSMISSION (self), NULL); remote_uri = NULL; g_object_get (G_OBJECT (self), "remote-uri", &remote_uri, NULL); diff --git a/ytstenut/video-profile/ytsg-vp-transmission.h b/ytstenut/video-profile/yts-vp-transmission.h index bec0276..3e2153e 100644 --- a/ytstenut/video-profile/ytsg-vp-transmission.h +++ b/ytstenut/video-profile/yts-vp-transmission.h @@ -18,50 +18,50 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_VP_TRANSMISSION_H -#define YTSG_VP_TRANSMISSION_H +#ifndef YTS_VP_TRANSMISSION_H +#define YTS_VP_TRANSMISSION_H #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_VP_TYPE_TRANSMISSION (ytsg_vp_transmission_get_type ()) +#define YTS_VP_TYPE_TRANSMISSION (yts_vp_transmission_get_type ()) -#define YTSG_VP_TRANSMISSION(obj) \ +#define YTS_VP_TRANSMISSION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_TRANSMISSION, \ - YtsgVPTransmission)) + YTS_VP_TYPE_TRANSMISSION, \ + YtsVPTransmission)) -#define YTSG_VP_IS_TRANSMISSION(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_TRANSMISSION)) +#define YTS_VP_IS_TRANSMISSION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_VP_TYPE_TRANSMISSION)) -#define YTSG_VP_TRANSMISSION_GET_INTERFACE(obj) \ +#define YTS_VP_TRANSMISSION_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_VP_TYPE_TRANSMISSION, \ - YtsgVPTransmissionInterface)) + YTS_VP_TYPE_TRANSMISSION, \ + YtsVPTransmissionInterface)) -typedef struct YtsgVPTransmission YtsgVPTransmission; +typedef struct YtsVPTransmission YtsVPTransmission; typedef struct { /*< private >*/ GTypeInterface parent; -} YtsgVPTransmissionInterface; +} YtsVPTransmissionInterface; GType -ytsg_vp_transmission_get_type (void) G_GNUC_CONST; +yts_vp_transmission_get_type (void) G_GNUC_CONST; char * -ytsg_vp_transmission_get_local_uri (YtsgVPTransmission *self); +yts_vp_transmission_get_local_uri (YtsVPTransmission *self); unsigned -ytsg_vp_transmission_get_progress (YtsgVPTransmission *self); +yts_vp_transmission_get_progress (YtsVPTransmission *self); char * -ytsg_vp_transmission_get_remote_uri (YtsgVPTransmission *self); +yts_vp_transmission_get_remote_uri (YtsVPTransmission *self); G_END_DECLS -#endif /* YTSG_VP_TRANSMISSION_H */ +#endif /* YTS_VP_TRANSMISSION_H */ diff --git a/ytstenut/video-profile/ytsg-vp-player-adapter.h b/ytstenut/video-profile/ytsg-vp-player-adapter.h deleted file mode 100644 index 1f99c74..0000000 --- a/ytstenut/video-profile/ytsg-vp-player-adapter.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_VP_PLAYER_ADAPTER_H -#define YTSG_VP_PLAYER_ADAPTER_H - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define YTSG_VP_TYPE_PLAYER_ADAPTER (ytsg_vp_player_adapter_get_type ()) - -#define YTSG_VP_PLAYER_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_PLAYER_ADAPTER, \ - YtsgVPPlayerAdapter)) - -#define YTSG_VP_PLAYER_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_VP_TYPE_PLAYER_ADAPTER, \ - YtsgVPPlayerAdapterClass)) - -#define YTSG_VP_IS_PLAYER_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_PLAYER_ADAPTER)) - -#define YTSG_VP_IS_PLAYER_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_VP_TYPE_PLAYER_ADAPTER)) - -#define YTSG_VP_PLAYER_ADAPTER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_VP_TYPE_PLAYER_ADAPTER, \ - YtsgVPPlayerAdapterClass)) - -typedef struct { - YtsgServiceAdapter parent; -} YtsgVPPlayerAdapter; - -typedef struct { - YtsgServiceAdapterClass parent; -} YtsgVPPlayerAdapterClass; - -GType -ytsg_vp_player_adapter_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* YTSG_VP_PLAYER_ADAPTER_H */ - diff --git a/ytstenut/video-profile/ytsg-vp-transcript-adapter.h b/ytstenut/video-profile/ytsg-vp-transcript-adapter.h deleted file mode 100644 index 09e3c10..0000000 --- a/ytstenut/video-profile/ytsg-vp-transcript-adapter.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_VP_TRANSCRIPT_ADAPTER_H -#define YTSG_VP_TRANSCRIPT_ADAPTER_H - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define YTSG_VP_TYPE_TRANSCRIPT_ADAPTER \ - (ytsg_vp_transcript_adapter_get_type ()) - -#define YTSG_VP_TRANSCRIPT_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_TRANSCRIPT_ADAPTER, \ - YtsgVPTranscriptAdapter)) - -#define YTSG_VP_TRANSCRIPT_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_VP_TYPE_TRANSCRIPT_ADAPTER, \ - YtsgVPTranscriptAdapterClass)) - -#define YTSG_VP_IS_TRANSCRIPT_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_TRANSCRIPT_ADAPTER)) - -#define YTSG_VP_IS_TRANSCRIPT_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_VP_TYPE_TRANSCRIPT_ADAPTER)) - -#define YTSG_VP_TRANSCRIPT_ADAPTER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_VP_TYPE_TRANSCRIPT_ADAPTER, \ - YtsgVPTranscriptAdapterClass)) - -typedef struct { - YtsgServiceAdapter parent; -} YtsgVPTranscriptAdapter; - -typedef struct { - YtsgServiceAdapterClass parent; -} YtsgVPTranscriptAdapterClass; - -GType -ytsg_vp_transcript_adapter_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* YTSG_VP_TRANSCRIPT_ADAPTER_H */ - diff --git a/ytstenut/video-profile/ytsg-vp-transcript-proxy.h b/ytstenut/video-profile/ytsg-vp-transcript-proxy.h deleted file mode 100644 index aeb4793..0000000 --- a/ytstenut/video-profile/ytsg-vp-transcript-proxy.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_VP_TRANSCRIPT_PROXY_H -#define YTSG_VP_TRANSCRIPT_PROXY_H - -#include <glib-object.h> -#include <ytstenut/ytsg-proxy.h> - -G_BEGIN_DECLS - -#define YTSG_VP_TYPE_TRANSCRIPT_PROXY ytsg_vp_transcript_proxy_get_type() - -#define YTSG_VP_TRANSCRIPT_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_VP_TYPE_TRANSCRIPT_PROXY, \ - YtsgVPTranscriptProxy)) - -#define YTSG_VP_TRANSCRIPT_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_VP_TYPE_TRANSCRIPT_PROXY, \ - YtsgVPTranscriptProxyClass)) - -#define YTSG_VP_IS_TRANSCRIPT_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_VP_TYPE_TRANSCRIPT_PROXY)) - -#define YTSG_VP_IS_TRANSCRIPT_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_VP_TYPE_TRANSCRIPT_PROXY)) - -#define YTSG_VP_TRANSCRIPT_PROXY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_VP_TYPE_TRANSCRIPT_PROXY, \ - YtsgVPTranscriptProxyClass)) - -typedef struct { - YtsgProxy parent; -} YtsgVPTranscriptProxy; - -typedef struct { - YtsgProxyClass parent; -} YtsgVPTranscriptProxyClass; - -GType -ytsg_vp_transcript_proxy_get_type (void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* YTSG_VP_TRANSCRIPT_PROXY_H */ - diff --git a/ytstenut/ytsg-capability-status.c b/ytstenut/yts-capability-status.c index 66130b3..daf1151 100644 --- a/ytstenut/ytsg-capability-status.c +++ b/ytstenut/yts-capability-status.c @@ -19,16 +19,16 @@ */ #include <stdbool.h> -#include "ytsg-capability-status.h" +#include "yts-capability-status.h" -G_DEFINE_TYPE (YtsgCapabilityStatus, ytsg_capability_status, YTSG_TYPE_METADATA) +G_DEFINE_TYPE (YtsCapabilityStatus, yts_capability_status, YTS_TYPE_METADATA) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_CAPABILITY_STATUS, YtsgCapabilityStatusPrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_CAPABILITY_STATUS, YtsCapabilityStatusPrivate)) typedef struct { int dummy; -} YtsgCapabilityStatusPrivate; +} YtsCapabilityStatusPrivate; static void _get_property (GObject *object, @@ -57,15 +57,15 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - G_OBJECT_CLASS (ytsg_capability_status_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_capability_status_parent_class)->dispose (object); } static void -ytsg_capability_status_class_init (YtsgCapabilityStatusClass *klass) +yts_capability_status_class_init (YtsCapabilityStatusClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgCapabilityStatusPrivate)); + g_type_class_add_private (klass, sizeof (YtsCapabilityStatusPrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -73,12 +73,12 @@ ytsg_capability_status_class_init (YtsgCapabilityStatusClass *klass) } static void -ytsg_capability_status_init (YtsgCapabilityStatus *self) +yts_capability_status_init (YtsCapabilityStatus *self) { } -YtsgMetadata * -ytsg_capability_status_new (char const *capability, +YtsMetadata * +yts_capability_status_new (char const *capability, char const *aspect, GVariant *condition) { @@ -100,7 +100,7 @@ ytsg_capability_status_new (char const *capability, g_free (args); } - return g_object_new (YTSG_TYPE_CAPABILITY_STATUS, + return g_object_new (YTS_TYPE_CAPABILITY_STATUS, "top-level-node", node, NULL); } diff --git a/ytstenut/yts-capability-status.h b/ytstenut/yts-capability-status.h new file mode 100644 index 0000000..f3809fc --- /dev/null +++ b/ytstenut/yts-capability-status.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_CAPABILITY_STATUS_H +#define YTS_CAPABILITY_STATUS_H + +#include <glib-object.h> +#include <ytstenut/yts-metadata.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_CAPABILITY_STATUS yts_capability_status_get_type() + +#define YTS_CAPABILITY_STATUS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_CAPABILITY_STATUS, YtsCapabilityStatus)) + +#define YTS_CAPABILITY_STATUS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_CAPABILITY_STATUS, YtsCapabilityStatusClass)) + +#define YTS_IS_CAPABILITY_STATUS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_CAPABILITY_STATUS)) + +#define YTS_IS_CAPABILITY_STATUS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_CAPABILITY_STATUS)) + +#define YTS_CAPABILITY_STATUS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_CAPABILITY_STATUS, YtsCapabilityStatusClass)) + +typedef struct { + YtsMetadata parent; +} YtsCapabilityStatus; + +typedef struct { + YtsMetadataClass parent; +} YtsCapabilityStatusClass; + +GType +yts_capability_status_get_type (void) G_GNUC_CONST; + +YtsMetadata * +yts_capability_status_new (char const *capability, + char const *aspect, + GVariant *condition); + +G_END_DECLS + +#endif /* YTS_CAPABILITY_STATUS_H */ diff --git a/ytstenut/ytsg-capability.c b/ytstenut/yts-capability.c index 3e0729e..d519fd3 100644 --- a/ytstenut/ytsg-capability.c +++ b/ytstenut/yts-capability.c @@ -18,14 +18,14 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" +#include "yts-capability.h" -G_DEFINE_INTERFACE (YtsgCapability, - ytsg_capability, +G_DEFINE_INTERFACE (YtsCapability, + yts_capability, G_TYPE_OBJECT) static void -ytsg_capability_default_init (YtsgCapabilityInterface *interface) +yts_capability_default_init (YtsCapabilityInterface *interface) { GParamSpec *pspec; @@ -37,11 +37,11 @@ ytsg_capability_default_init (YtsgCapabilityInterface *interface) } char ** -ytsg_capability_get_fqc_ids (YtsgCapability *self) +yts_capability_get_fqc_ids (YtsCapability *self) { char **fqc_ids; - g_return_val_if_fail (YTSG_IS_CAPABILITY (self), NULL); + g_return_val_if_fail (YTS_IS_CAPABILITY (self), NULL); fqc_ids = NULL; g_object_get (self, "fqc-ids", &fqc_ids, NULL); diff --git a/ytstenut/ytsg-capability.h b/ytstenut/yts-capability.h index b8fa1d5..31b27d9 100644 --- a/ytstenut/ytsg-capability.h +++ b/ytstenut/yts-capability.h @@ -18,42 +18,42 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_CAPABILITY_H -#define YTSG_CAPABILITY_H +#ifndef YTS_CAPABILITY_H +#define YTS_CAPABILITY_H #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_TYPE_CAPABILITY (ytsg_capability_get_type ()) +#define YTS_TYPE_CAPABILITY (yts_capability_get_type ()) -#define YTSG_CAPABILITY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_CAPABILITY, YtsgCapability)) +#define YTS_CAPABILITY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_CAPABILITY, YtsCapability)) -#define YTSG_IS_CAPABILITY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_CAPABILITY)) +#define YTS_IS_CAPABILITY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_CAPABILITY)) -#define YTSG_CAPABILITY_GET_INTERFACE(obj) \ +#define YTS_CAPABILITY_GET_INTERFACE(obj) \ (G_TYPE_INSTANCE_GET_INTERFACE ((obj), \ - YTSG_TYPE_CAPABILITY, \ - YtsgCapabilityInterface)) + YTS_TYPE_CAPABILITY, \ + YtsCapabilityInterface)) -typedef struct YtsgCapability YtsgCapability; +typedef struct YtsCapability YtsCapability; typedef struct { /*< private >*/ GTypeInterface parent; -} YtsgCapabilityInterface; +} YtsCapabilityInterface; GType -ytsg_capability_get_type (void) G_GNUC_CONST; +yts_capability_get_type (void) G_GNUC_CONST; char ** -ytsg_capability_get_fqc_ids (YtsgCapability *self); +yts_capability_get_fqc_ids (YtsCapability *self); G_END_DECLS -#endif /* YTSG_CAPABILITY_H */ +#endif /* YTS_CAPABILITY_H */ diff --git a/ytstenut/ytsg-caps.h b/ytstenut/yts-caps.h index ce7d180..37cc133 100644 --- a/ytstenut/ytsg-caps.h +++ b/ytstenut/yts-caps.h @@ -20,160 +20,160 @@ */ /** - * SECTION:ytsg-caps + * SECTION:yts-caps * @short_description: represents application capability. * - * #YtsgCaps represents application capability. + * #YtsCaps represents application capability. */ -#ifndef _YTSG_CAPS_H -#define _YTSG_CAPS_H +#ifndef _YTS_CAPS_H +#define _YTS_CAPS_H #include <glib.h> G_BEGIN_DECLS /** - * YtsgCaps: + * YtsCaps: * * Represents client capablilites. */ -typedef GQuark YtsgCaps; +typedef GQuark YtsCaps; /** - * YTSG_CAPS_S_UNDEFINED: + * YTS_CAPS_S_UNDEFINED: * * Ytstenut string representing unknown capabilities */ -#define YTSG_CAPS_S_UNDEFINED NULL +#define YTS_CAPS_S_UNDEFINED NULL /** - * YTSG_CAPS_UI_UNDEFINED: + * YTS_CAPS_UI_UNDEFINED: * * Ytstenut UI string representing unknown capabilities */ -#define YTSG_CAPS_UI_UNDEFINED "Unknown" +#define YTS_CAPS_UI_UNDEFINED "Unknown" /** - * YTSG_CAPS_UNDEFINED: + * YTS_CAPS_UNDEFINED: * * Ytstenut GQuark representing unknown capabilties */ -#define YTSG_CAPS_UNDEFINED 0 +#define YTS_CAPS_UNDEFINED 0 /** - * YTSG_CAPS_S_AUDIO: + * YTS_CAPS_S_AUDIO: * * Ytstenut string representing audio capabilities */ -#define YTSG_CAPS_S_AUDIO "ytsg-caps-audio" +#define YTS_CAPS_S_AUDIO "yts-caps-audio" /** - * YTSG_CAPS_UI_AUDIO: + * YTS_CAPS_UI_AUDIO: * * Ytstenut UI string representing audio capabilities */ -#define YTSG_CAPS_UI_AUDIO "Audio" +#define YTS_CAPS_UI_AUDIO "Audio" /** - * YTSG_CAPS_AUDIO: + * YTS_CAPS_AUDIO: * * Ytstenut GQuark representing audio capabilties */ -#define YTSG_CAPS_AUDIO g_quark_from_static_string (YTSG_CAPS_S_AUDIO) +#define YTS_CAPS_AUDIO g_quark_from_static_string (YTS_CAPS_S_AUDIO) /** - * YTSG_CAPS_S_VIDEO: + * YTS_CAPS_S_VIDEO: * * Ytstenut string representing video capabilities */ -#define YTSG_CAPS_S_VIDEO "ytsg-caps-video" +#define YTS_CAPS_S_VIDEO "yts-caps-video" /** - * YTSG_CAPS_UI_VIDEO: + * YTS_CAPS_UI_VIDEO: * * Ytstenut UI string representing video capabilities */ -#define YTSG_CAPS_UI_VIDEO "Video" +#define YTS_CAPS_UI_VIDEO "Video" /** - * YTSG_CAPS_VIDEO: + * YTS_CAPS_VIDEO: * * Ytstenut GQuark representing video capabilties */ -#define YTSG_CAPS_VIDEO g_quark_from_static_string (YTSG_CAPS_S_VIDEO) +#define YTS_CAPS_VIDEO g_quark_from_static_string (YTS_CAPS_S_VIDEO) /** - * YTSG_CAPS_S_IMAGE: + * YTS_CAPS_S_IMAGE: * * Ytstenut string representing image capabilities */ -#define YTSG_CAPS_S_IMAGE "ytsg-caps-image" +#define YTS_CAPS_S_IMAGE "yts-caps-image" /** - * YTSG_CAPS_UI_IMAGE: + * YTS_CAPS_UI_IMAGE: * * Ytstenut UI string representing unknown capabilities */ -#define YTSG_CAPS_UI_IMAGE "Image" +#define YTS_CAPS_UI_IMAGE "Image" /** - * YTSG_CAPS_IMAGE: + * YTS_CAPS_IMAGE: * * Ytstenut GQuark representing image capabilties */ -#define YTSG_CAPS_IMAGE g_quark_from_static_string (YTSG_CAPS_S_IMAGE) +#define YTS_CAPS_IMAGE g_quark_from_static_string (YTS_CAPS_S_IMAGE) /** - * YTSG_CAPS_S_HTML: + * YTS_CAPS_S_HTML: * * Ytstenut string representing html capabilities */ -#define YTSG_CAPS_S_HTML "ytsg-caps-html" +#define YTS_CAPS_S_HTML "yts-caps-html" /** - * YTSG_CAPS_UI_HTML: + * YTS_CAPS_UI_HTML: * * Ytstenut UI string representing unknown capabilities */ -#define YTSG_CAPS_UI_HTML "Web page" +#define YTS_CAPS_UI_HTML "Web page" /** - * YTSG_CAPS_HTML: + * YTS_CAPS_HTML: * * Ytstenut GQuark representing html capabilties */ -#define YTSG_CAPS_HTML g_quark_from_static_string (YTSG_CAPS_S_HTML) +#define YTS_CAPS_HTML g_quark_from_static_string (YTS_CAPS_S_HTML) /** - * YTSG_CAPS_S_CONTROL: + * YTS_CAPS_S_CONTROL: * * Ytstenut string representing control capabilities */ -#define YTSG_CAPS_S_CONTROL "ytsg-caps-control" +#define YTS_CAPS_S_CONTROL "yts-caps-control" /** - * YTSG_CAPS_UI_CONTROL: + * YTS_CAPS_UI_CONTROL: * * Ytstenut UI string representing unknown capabilities */ -#define YTSG_CAPS_UI_CONTROL "Control" +#define YTS_CAPS_UI_CONTROL "Control" /** - * YTSG_CAPS_CONTROL: + * YTS_CAPS_CONTROL: * * Ytstenut GQuark representing control capabilties. This is a special value for * applications the sole purpose of which is to be Ytstenut remote - * control. Clients that set their #YtsgClient status using this value will + * control. Clients that set their #YtsClient status using this value will * receive unfiltered roster and in turn will be added to the roster of every * other connected client. Clients that implement regular capabilities should - * fitler out clients with YTSG_CAPS_CONTROL capability from their UI (though + * fitler out clients with YTS_CAPS_CONTROL capability from their UI (though * they need to respond to commands received from them). */ -#define YTSG_CAPS_CONTROL g_quark_from_static_string (YTSG_CAPS_S_CONTROL) +#define YTS_CAPS_CONTROL g_quark_from_static_string (YTS_CAPS_S_CONTROL) G_END_DECLS -#endif /* _YTSG_CAPS_H */ +#endif /* _YTS_CAPS_H */ diff --git a/ytstenut/ytsg-client.c b/ytstenut/yts-client.c index 108547f..1e03388 100644 --- a/ytstenut/ytsg-client.c +++ b/ytstenut/yts-client.c @@ -21,12 +21,12 @@ */ /** - * SECTION:ytsg-client + * SECTION:yts-client * @short_description: Represents a connection to the Ytstenut mesh. * - * #YtsgClient is an object that mediates connection between the current + * #YtsClient is an object that mediates connection between the current * application and the Ytstenut application mesh. It provides access to roster - * of availalble services (#YtsgRoster) and means to advertises status within + * of availalble services (#YtsRoster) and means to advertises status within * the mesh. */ @@ -44,57 +44,57 @@ #include <telepathy-glib/proxy-subclass.h> #include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h> -#include "ytsg-client.h" -#include "ytsg-debug.h" -#include "ytsg-enum-types.h" -#include "ytsg-error.h" -#include "ytsg-error-message.h" -#include "ytsg-event-message.h" -#include "ytsg-invocation-message.h" -#include "ytsg-marshal.h" -#include "ytsg-metadata.h" -#include "ytsg-private.h" -#include "ytsg-response-message.h" -#include "ytsg-roster.h" -#include "ytsg-service-adapter.h" -#include "ytsg-types.h" +#include "yts-client.h" +#include "yts-debug.h" +#include "yts-enum-types.h" +#include "yts-error.h" +#include "yts-error-message.h" +#include "yts-event-message.h" +#include "yts-invocation-message.h" +#include "yts-marshal.h" +#include "yts-metadata.h" +#include "yts-private.h" +#include "yts-response-message.h" +#include "yts-roster.h" +#include "yts-service-adapter.h" +#include "yts-types.h" #include "empathy-tp-file.h" -#include "profile/ytsg-profile.h" -#include "profile/ytsg-profile-adapter.h" -#include "profile/ytsg-profile-impl.h" +#include "profile/yts-profile.h" +#include "profile/yts-profile-adapter.h" +#include "profile/yts-profile-impl.h" #define RECONNECT_DELAY 20 /* in seconds */ -static void ytsg_client_dispose (GObject *object); -static void ytsg_client_finalize (GObject *object); -static void ytsg_client_constructed (GObject *object); -static void ytsg_client_get_property (GObject *object, +static void yts_client_dispose (GObject *object); +static void yts_client_finalize (GObject *object); +static void yts_client_constructed (GObject *object); +static void yts_client_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_client_set_property (GObject *object, +static void yts_client_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void ytsg_client_make_connection (YtsgClient *client); +static void yts_client_make_connection (YtsClient *client); -G_DEFINE_TYPE (YtsgClient, ytsg_client, G_TYPE_OBJECT); +G_DEFINE_TYPE (YtsClient, yts_client, G_TYPE_OBJECT); -#define YTSG_CLIENT_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_CLIENT, YtsgClientPrivate)) +#define YTS_CLIENT_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_CLIENT, YtsClientPrivate)) -struct _YtsgClientPrivate +struct _YtsClientPrivate { - YtsgRoster *roster; /* the roster of this client */ - YtsgRoster *unwanted; /* roster of unwanted items */ + YtsRoster *roster; /* the roster of this client */ + YtsRoster *unwanted; /* roster of unwanted items */ GArray *caps; /* connection parameters */ char *uid; char *mgr_name; - YtsgProtocol protocol; + YtsProtocol protocol; char *incoming_dir; /* destination directory for incoming files */ @@ -110,7 +110,7 @@ struct _YtsgClientPrivate TpConnection *connection; TpProxy *debug_proxy; TpYtsStatus *tp_status; - YtsgStatus *status; + YtsStatus *status; TpYtsClient *tp_client; /* Implemented services */ @@ -163,17 +163,17 @@ static guint signals[N_SIGNALS] = {0}; */ typedef struct { - YtsgClient *client; + YtsClient *client; char *capability; } ServiceData; static ServiceData * -service_data_create (YtsgClient *client, +service_data_create (YtsClient *client, char const *capability) { ServiceData *self; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); g_return_val_if_fail (capability, NULL); self = g_new0 (ServiceData, 1); @@ -201,8 +201,8 @@ service_data_destroy (ServiceData *self) #define INVOCATION_RESPONSE_TIMEOUT_S 20 typedef struct { - YtsgClient *client; /* free pointer, no ref */ - YtsgContact *contact; /* free pointer, no ref */ + YtsClient *client; /* free pointer, no ref */ + YtsContact *contact; /* free pointer, no ref */ char *proxy_id; char *invocation_id; unsigned int timeout_s; @@ -225,10 +225,10 @@ invocation_data_destroy (InvocationData *self) } static bool -client_conclude_invocation (YtsgClient *self, +client_conclude_invocation (YtsClient *self, char const *invocation_id) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; bool found; found = g_hash_table_remove (priv->invocations, invocation_id); @@ -260,8 +260,8 @@ _invocation_timeout (InvocationData *self) } static InvocationData * -invocation_data_create (YtsgClient *client, - YtsgContact *contact, +invocation_data_create (YtsClient *client, + YtsContact *contact, char const *proxy_id, char const *invocation_id, unsigned int timeout_s) @@ -282,12 +282,12 @@ invocation_data_create (YtsgClient *client, } static bool -client_establish_invocation (YtsgClient *self, +client_establish_invocation (YtsClient *self, char const *invocation_id, - YtsgContact *contact, + YtsContact *contact, char const *proxy_id) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; InvocationData *invocation_data; invocation_data = g_hash_table_lookup (priv->invocations, @@ -317,12 +317,12 @@ client_establish_invocation (YtsgClient *self, */ typedef struct { - YtsgContact const *contact; /* free pointer, no ref. */ + YtsContact const *contact; /* free pointer, no ref. */ char *proxy_id; } ProxyData; static ProxyData * -proxy_data_create (YtsgContact const *contact, +proxy_data_create (YtsContact const *contact, char const *proxy_id) { ProxyData *self; @@ -350,7 +350,7 @@ typedef struct { } ProxyList; static ProxyList * -proxy_list_create_with_proxy (YtsgContact const *contact, +proxy_list_create_with_proxy (YtsContact const *contact, char const *proxy_id) { ProxyList *self; @@ -367,7 +367,7 @@ proxy_list_create_with_proxy (YtsgContact const *contact, static bool proxy_list_ensure_proxy (ProxyList *self, - YtsgContact const *contact, + YtsContact const *contact, char const *proxy_id) { GList const *iter; @@ -393,7 +393,7 @@ proxy_list_ensure_proxy (ProxyList *self, static void proxy_list_purge_contact (ProxyList *self, - YtsgContact const *contact) + YtsContact const *contact) { GList *iter; bool found; @@ -472,11 +472,11 @@ proxy_list_destroy (ProxyList *self) } /* - * YtsgClient + * YtsClient */ static gboolean -ytsg_client_channel_requested (TpChannel *proxy) +yts_client_channel_requested (TpChannel *proxy) { GHashTable *props; gboolean requested; @@ -489,7 +489,7 @@ ytsg_client_channel_requested (TpChannel *proxy) } static void -ytsg_client_ft_op_cb (EmpathyTpFile *tp_file, +yts_client_ft_op_cb (EmpathyTpFile *tp_file, const GError *error, gpointer data) { @@ -500,20 +500,20 @@ ytsg_client_ft_op_cb (EmpathyTpFile *tp_file, } static void -ytsg_client_ft_accept_cb (TpProxy *proxy, +yts_client_ft_accept_cb (TpProxy *proxy, GHashTable *props, const GError *error, gpointer data, GObject *weak_object) { - YtsgClient *client = data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = data; + YtsClientPrivate *priv = client->priv; const char *name; const char *jid; guint64 offset; guint64 size; GHashTable *iprops; - YtsgContact *item; + YtsContact *item; guint32 ihandle; iprops = tp_channel_borrow_immutable_properties ((TpChannel*)proxy); @@ -522,9 +522,9 @@ ytsg_client_ft_accept_cb (TpProxy *proxy, TP_PROP_CHANNEL_INITIATOR_HANDLE, NULL); - if ((item = _ytsg_roster_find_contact_by_handle (priv->roster, ihandle))) + if ((item = _yts_roster_find_contact_by_handle (priv->roster, ihandle))) { - jid = ytsg_contact_get_jid (item); + jid = yts_contact_get_jid (item); } else { @@ -565,57 +565,57 @@ ytsg_client_ft_accept_cb (TpProxy *proxy, } static void -ytsg_client_ft_handle_state (YtsgClient *client, TpChannel *proxy, guint state) +yts_client_ft_handle_state (YtsClient *client, TpChannel *proxy, guint state) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; GHashTable *props; gboolean requested; props = tp_channel_borrow_immutable_properties ((TpChannel*)proxy); if (!(requested = tp_asv_get_boolean (props, TP_PROP_CHANNEL_REQUESTED,NULL))) { - YtsgContact *item; + YtsContact *item; guint32 ihandle; ihandle = tp_asv_get_uint32 (props, TP_PROP_CHANNEL_INITIATOR_HANDLE, NULL); - item = _ytsg_roster_find_contact_by_handle (priv->roster, ihandle); + item = _yts_roster_find_contact_by_handle (priv->roster, ihandle); switch (state) { case 1: { if (item) - YTSG_NOTE (FILE_TRANSFER, + YTS_NOTE (FILE_TRANSFER, "Got request for FT channel from %s (%s)", - ytsg_contact_get_jid (item), + yts_contact_get_jid (item), tp_proxy_get_bus_name (proxy)); else - YTSG_NOTE (FILE_TRANSFER, + YTS_NOTE (FILE_TRANSFER, "Got request for FT channel from handle %d", ihandle); tp_cli_dbus_properties_call_get_all (proxy, -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, - ytsg_client_ft_accept_cb, + yts_client_ft_accept_cb, client, NULL, (GObject*) client); } break; case 2: - YTSG_NOTE (FILE_TRANSFER, "Incoming stream state (%s) --> 'accepted'", + YTS_NOTE (FILE_TRANSFER, "Incoming stream state (%s) --> 'accepted'", tp_proxy_get_bus_name (proxy)); break; case 3: - YTSG_NOTE (FILE_TRANSFER, "Incoming stream state (%s) --> 'open'", + YTS_NOTE (FILE_TRANSFER, "Incoming stream state (%s) --> 'open'", tp_proxy_get_bus_name (proxy)); break; case 4: case 5: - YTSG_NOTE (FILE_TRANSFER, "Incoming stream state (%s) --> '%s'", + YTS_NOTE (FILE_TRANSFER, "Incoming stream state (%s) --> '%s'", tp_proxy_get_bus_name (proxy), state == 4 ? "completed" : "cancelled"); { @@ -624,7 +624,7 @@ ytsg_client_ft_handle_state (YtsgClient *client, TpChannel *proxy, guint state) if (item) { - jid = ytsg_contact_get_jid (item); + jid = yts_contact_get_jid (item); name = tp_asv_get_string (props, "Filename"); @@ -634,52 +634,52 @@ ytsg_client_ft_handle_state (YtsgClient *client, TpChannel *proxy, guint state) } break; default: - YTSG_NOTE (FILE_TRANSFER, "Invalid value of stream state: %d", state); + YTS_NOTE (FILE_TRANSFER, "Invalid value of stream state: %d", state); } } else - YTSG_NOTE (FILE_TRANSFER, "The FT channel was requested by us ... (%s)", + YTS_NOTE (FILE_TRANSFER, "The FT channel was requested by us ... (%s)", tp_proxy_get_bus_name (proxy)); } static void -ytsg_client_ft_state_cb (TpChannel *proxy, +yts_client_ft_state_cb (TpChannel *proxy, guint state, guint reason, gpointer data, GObject *object) { - YtsgClient *client = data; + YtsClient *client = data; - YTSG_NOTE (FILE_TRANSFER, + YTS_NOTE (FILE_TRANSFER, "FT channel changed status to %d (reason %d)", state, reason); - ytsg_client_ft_handle_state (client, proxy, state); + yts_client_ft_handle_state (client, proxy, state); } static void -ytsg_client_ft_core_cb (GObject *proxy, GAsyncResult *res, gpointer data) +yts_client_ft_core_cb (GObject *proxy, GAsyncResult *res, gpointer data) { - YtsgClient *client = data; + YtsClient *client = data; TpChannel *channel = (TpChannel*) proxy; GError *error = NULL; - YTSG_NOTE (FILE_TRANSFER, "FT channel ready"); + YTS_NOTE (FILE_TRANSFER, "FT channel ready"); tp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed (channel, - ytsg_client_ft_state_cb, + yts_client_ft_state_cb, client, NULL, (GObject*)client, &error); - if (!ytsg_client_channel_requested (channel)) - ytsg_client_ft_handle_state (client, channel, 1); + if (!yts_client_channel_requested (channel)) + yts_client_ft_handle_state (client, channel, 1); } static void -ytsg_client_channel_cb (TpConnection *proxy, +yts_client_channel_cb (TpConnection *proxy, const gchar *path, const gchar *type, guint handle_type, @@ -688,8 +688,8 @@ ytsg_client_channel_cb (TpConnection *proxy, gpointer data, GObject *weak_object) { - YtsgClient *client = data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = data; + YtsClientPrivate *priv = client->priv; if (!path) { @@ -697,7 +697,7 @@ ytsg_client_channel_cb (TpConnection *proxy, return; } - YTSG_NOTE (CLIENT, "New channel: %s: %s: h type %d, h %d", + YTS_NOTE (CLIENT, "New channel: %s: %s: h type %d, h %d", path, type, handle_type, handle); switch (handle_type) @@ -709,17 +709,17 @@ ytsg_client_channel_cb (TpConnection *proxy, GError *error = NULL; TpChannel *ch; GQuark features[] = { TP_CHANNEL_FEATURE_CORE, 0}; - YtsgContact *item; + YtsContact *item; ch = tp_channel_new (proxy, path, type, handle_type, handle, &error); - if ((item = _ytsg_roster_find_contact_by_handle (priv->roster, + if ((item = _yts_roster_find_contact_by_handle (priv->roster, handle))) { - _ytsg_contact_set_ft_channel (item, ch); + _yts_contact_set_ft_channel (item, ch); tp_proxy_prepare_async (ch, features, - ytsg_client_ft_core_cb, client); + yts_client_ft_core_cb, client); } else { @@ -737,34 +737,34 @@ ytsg_client_channel_cb (TpConnection *proxy, } static void -ytsg_client_authenticated (YtsgClient *client) +yts_client_authenticated (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; priv->authenticated = TRUE; - YTSG_NOTE (CONNECTION, "Authenticated"); + YTS_NOTE (CONNECTION, "Authenticated"); } static void -ytsg_client_ready (YtsgClient *client) +yts_client_ready (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; priv->ready = TRUE; - YTSG_NOTE (CLIENT, "YtsgClient is ready"); + YTS_NOTE (CLIENT, "YtsClient is ready"); if (priv->tp_status && priv->status) { - char *xml = ytsg_metadata_to_string ((YtsgMetadata*)priv->status); + char *xml = yts_metadata_to_string ((YtsMetadata*)priv->status); int i; for (i = 0; i < priv->caps->len; ++i) { const char *c; - c = g_quark_to_string (g_array_index (priv->caps, YtsgCaps, i)); + c = g_quark_to_string (g_array_index (priv->caps, YtsCaps, i)); tp_yts_status_advertise_status_async (priv->tp_status, c, @@ -780,9 +780,9 @@ ytsg_client_ready (YtsgClient *client) } static void -ytsg_client_cleanup_connection_resources (YtsgClient *client) +yts_client_cleanup_connection_resources (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; /* * Clean up items associated with this connection. @@ -795,7 +795,7 @@ ytsg_client_cleanup_connection_resources (YtsgClient *client) * Empty roster */ if (priv->roster) - _ytsg_roster_clear (priv->roster); + _yts_roster_clear (priv->roster); if (priv->connection) { @@ -805,36 +805,36 @@ ytsg_client_cleanup_connection_resources (YtsgClient *client) } static void -ytsg_client_disconnected (YtsgClient *client) +yts_client_disconnected (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; - ytsg_client_cleanup_connection_resources (client); + yts_client_cleanup_connection_resources (client); if (priv->reconnect) - _ytsg_client_reconnect_after (client, RECONNECT_DELAY); + _yts_client_reconnect_after (client, RECONNECT_DELAY); } static void -ytsg_client_message (YtsgClient *client, YtsgMessage *msg) +yts_client_message (YtsClient *client, YtsMessage *msg) { } static gboolean -ytsg_client_incoming_file (YtsgClient *client, +yts_client_incoming_file (YtsClient *client, const char *from, const char *name, guint64 size, guint64 offset, TpChannel *proxy) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; char *path; GFile *gfile; EmpathyTpFile *tp_file; GCancellable *cancellable; - YTSG_NOTE (FILE_TRANSFER, "Incoming file from %s", from); + YTS_NOTE (FILE_TRANSFER, "Incoming file from %s", from); if (g_mkdir_with_parents (priv->incoming_dir, 0700)) { @@ -862,7 +862,7 @@ ytsg_client_incoming_file (YtsgClient *client, cancellable, NULL /*progress_callback*/, NULL /*progress_user_data*/, - ytsg_client_ft_op_cb, + yts_client_ft_op_cb, client); g_free (path); @@ -873,7 +873,7 @@ ytsg_client_incoming_file (YtsgClient *client, } static gboolean -ytsg_client_stop_accumulator (GSignalInvocationHint *ihint, +yts_client_stop_accumulator (GSignalInvocationHint *ihint, GValue *accumulated, const GValue *returned, gpointer data) @@ -886,27 +886,27 @@ ytsg_client_stop_accumulator (GSignalInvocationHint *ihint, } static void -ytsg_client_class_init (YtsgClientClass *klass) +yts_client_class_init (YtsClientClass *klass) { GParamSpec *pspec; GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgClientPrivate)); + g_type_class_add_private (klass, sizeof (YtsClientPrivate)); - object_class->dispose = ytsg_client_dispose; - object_class->finalize = ytsg_client_finalize; - object_class->constructed = ytsg_client_constructed; - object_class->get_property = ytsg_client_get_property; - object_class->set_property = ytsg_client_set_property; + object_class->dispose = yts_client_dispose; + object_class->finalize = yts_client_finalize; + object_class->constructed = yts_client_constructed; + object_class->get_property = yts_client_get_property; + object_class->set_property = yts_client_set_property; - klass->authenticated = ytsg_client_authenticated; - klass->ready = ytsg_client_ready; - klass->disconnected = ytsg_client_disconnected; - klass->message = ytsg_client_message; - klass->incoming_file = ytsg_client_incoming_file; + klass->authenticated = yts_client_authenticated; + klass->ready = yts_client_ready; + klass->disconnected = yts_client_disconnected; + klass->message = yts_client_message; + klass->incoming_file = yts_client_incoming_file; /** - * YtsgClient:uid: + * YtsClient:uid: * * The uid of this service * @@ -920,7 +920,7 @@ ytsg_client_class_init (YtsgClientClass *klass) g_object_class_install_property (object_class, PROP_UID, pspec); /** - * YtsgClient:protocol: + * YtsClient:protocol: * * XMPP protocol to use for connection. * @@ -929,13 +929,13 @@ ytsg_client_class_init (YtsgClientClass *klass) pspec = g_param_spec_enum ("protocol", "Protocol", "Protocol", - YTSG_TYPE_PROTOCOL, + YTS_TYPE_PROTOCOL, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (object_class, PROP_PROTOCOL, pspec); /** - * YtsgClient:capabilites: + * YtsClient:capabilites: * * Capabilities of this client, used to filter roster. */ @@ -948,7 +948,7 @@ ytsg_client_class_init (YtsgClientClass *klass) /** - * YtsgClient::authenticated + * YtsClient::authenticated * @client: object which emitted the signal, * * The authenticated signal is emited when connection to the nScreen server @@ -960,13 +960,13 @@ ytsg_client_class_init (YtsgClientClass *klass) g_signal_new (I_("authenticated"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (YtsgClientClass, authenticated), + G_STRUCT_OFFSET (YtsClientClass, authenticated), NULL, NULL, - ytsg_marshal_VOID__VOID, + yts_marshal_VOID__VOID, G_TYPE_NONE, 0); /** - * YtsgClient::ready + * YtsClient::ready * @client: object which emitted the signal, * * The ready signal is emited when the initial Telepathy set up is ready. @@ -978,13 +978,13 @@ ytsg_client_class_init (YtsgClientClass *klass) g_signal_new (I_("ready"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (YtsgClientClass, ready), + G_STRUCT_OFFSET (YtsClientClass, ready), NULL, NULL, - ytsg_marshal_VOID__VOID, + yts_marshal_VOID__VOID, G_TYPE_NONE, 0); /** - * YtsgClient::disconnected + * YtsClient::disconnected * @client: object which emitted the signal, * * The disconnected signal is emited when connection to the nScreen server @@ -996,15 +996,15 @@ ytsg_client_class_init (YtsgClientClass *klass) g_signal_new (I_("disconnected"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (YtsgClientClass, disconnected), + G_STRUCT_OFFSET (YtsClientClass, disconnected), NULL, NULL, - ytsg_marshal_VOID__VOID, + yts_marshal_VOID__VOID, G_TYPE_NONE, 0); /** - * YtsgClient::message + * YtsClient::message * @client: object which emitted the signal, - * @message: #YtsgMessage, the message + * @message: #YtsMessage, the message * * The message signal is emitted when message is received from one of the * contacts. @@ -1015,21 +1015,21 @@ ytsg_client_class_init (YtsgClientClass *klass) g_signal_new (I_("message"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgClientClass, message), + G_STRUCT_OFFSET (YtsClientClass, message), NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_MESSAGE); + YTS_TYPE_MESSAGE); /** - * YtsgClient::error + * YtsClient::error * @client: object which emitted the signal, - * @error: #YtsgError + * @error: #YtsError * * The error signal is emitted to indicate an error (or eventual success) * during the handling of an operation for which the nScreen API initially - * returned %YTSG_ERROR_PENDING. The original operation can be determined - * using the atom part of the #YtsgError parameter. + * returned %YTS_ERROR_PENDING. The original operation can be determined + * using the atom part of the #YtsError parameter. * * Since: 0.1 */ @@ -1039,12 +1039,12 @@ ytsg_client_class_init (YtsgClientClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__UINT, + yts_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT); /** - * YtsgClient::incoming-file + * YtsClient::incoming-file * @client: object which emitted the signal, * @from: jid of the originator * @name: name of the file @@ -1063,9 +1063,9 @@ ytsg_client_class_init (YtsgClientClass *klass) g_signal_new (I_("incoming-file"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgClientClass, incoming_file), - ytsg_client_stop_accumulator, NULL, - ytsg_marshal_BOOLEAN__STRING_STRING_UINT64_UINT64_OBJECT, + G_STRUCT_OFFSET (YtsClientClass, incoming_file), + yts_client_stop_accumulator, NULL, + yts_marshal_BOOLEAN__STRING_STRING_UINT64_UINT64_OBJECT, G_TYPE_BOOLEAN, 5, G_TYPE_STRING, G_TYPE_STRING, @@ -1074,7 +1074,7 @@ ytsg_client_class_init (YtsgClientClass *klass) TP_TYPE_CHANNEL); /** - * YtsgClient::incoming-file-finished + * YtsClient::incoming-file-finished * @client: object which emitted the signal, * @from: jid of the originator * @name: name of the file @@ -1091,7 +1091,7 @@ ytsg_client_class_init (YtsgClientClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__STRING_STRING_BOOLEAN, + yts_marshal_VOID__STRING_STRING_BOOLEAN, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, @@ -1102,7 +1102,7 @@ ytsg_client_class_init (YtsgClientClass *klass) * Handler for Mgr debug output. */ static void -ytsg_client_debug_msg_cb (TpProxy *proxy, +yts_client_debug_msg_cb (TpProxy *proxy, gdouble timestamp, const char *domain, guint level, @@ -1127,7 +1127,7 @@ ytsg_client_debug_msg_cb (TpProxy *proxy, g_message ("%s: %s", domain, msg); break; case 5: - YTSG_NOTE (MANAGER, "%s: %s", domain, msg); + YTS_NOTE (MANAGER, "%s: %s", domain, msg); } } @@ -1141,7 +1141,7 @@ ytsg_client_debug_msg_cb (TpProxy *proxy, * First, the collect function */ static void -ytsg_client_debug_msg_collect (DBusGProxy *proxy, +yts_client_debug_msg_collect (DBusGProxy *proxy, gdouble timestamp, const char *domain, guint level, @@ -1173,7 +1173,7 @@ ytsg_client_debug_msg_collect (DBusGProxy *proxy, tp_proxy_signal_connection_v0_take_results (signal, args); } -typedef void (*YtsgClientMgrNewDebugMsg)(TpProxy *, +typedef void (*YtsClientMgrNewDebugMsg)(TpProxy *, gdouble, const char *, guint, @@ -1184,14 +1184,14 @@ typedef void (*YtsgClientMgrNewDebugMsg)(TpProxy *, * The callback invoker */ static void -ytsg_client_debug_msg_invoke (TpProxy *proxy, +yts_client_debug_msg_invoke (TpProxy *proxy, GError *error, GValueArray *args, GCallback callback, gpointer data, GObject *weak_object) { - YtsgClientMgrNewDebugMsg cb = (YtsgClientMgrNewDebugMsg) callback; + YtsClientMgrNewDebugMsg cb = (YtsClientMgrNewDebugMsg) callback; if (cb) { @@ -1213,7 +1213,7 @@ ytsg_client_debug_msg_invoke (TpProxy *proxy, * Connects to the signal(s) and enable debugging output. */ static void -ytsg_client_connect_debug_signals (YtsgClient *client, TpProxy *proxy) +yts_client_connect_debug_signals (YtsClient *client, TpProxy *proxy) { GError *error = NULL; GValue v = {0}; @@ -1230,9 +1230,9 @@ ytsg_client_connect_debug_signals (YtsgClient *client, TpProxy *proxy) TP_IFACE_QUARK_DEBUG, "NewDebugMessage", &expected[0], - G_CALLBACK (ytsg_client_debug_msg_collect), - ytsg_client_debug_msg_invoke, - G_CALLBACK (ytsg_client_debug_msg_cb), + G_CALLBACK (yts_client_debug_msg_collect), + yts_client_debug_msg_invoke, + G_CALLBACK (yts_client_debug_msg_cb), client, NULL, (GObject*)client, @@ -1240,7 +1240,7 @@ ytsg_client_connect_debug_signals (YtsgClient *client, TpProxy *proxy) if (error) { - YTSG_NOTE (MANAGER, "%s", error->message); + YTS_NOTE (MANAGER, "%s", error->message); g_clear_error (&error); } @@ -1256,7 +1256,7 @@ ytsg_client_connect_debug_signals (YtsgClient *client, TpProxy *proxy) * the unsightly TP machinery ? */ static void -ytsg_client_debug_iface_added_cb (TpProxy *tproxy, +yts_client_debug_iface_added_cb (TpProxy *tproxy, guint id, DBusGProxy *proxy, gpointer data) @@ -1273,9 +1273,9 @@ ytsg_client_debug_iface_added_cb (TpProxy *tproxy, } static void -ytsg_client_setup_debug (YtsgClient *client) +yts_client_setup_debug (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; TpDBusDaemon *dbus; GError *error = NULL; TpProxy *proxy; @@ -1302,14 +1302,14 @@ ytsg_client_setup_debug (YtsgClient *client) priv->debug_proxy = proxy; g_signal_connect (proxy, "interface-added", - G_CALLBACK (ytsg_client_debug_iface_added_cb), client); + G_CALLBACK (yts_client_debug_iface_added_cb), client); tp_proxy_add_interface_by_id (proxy, TP_IFACE_QUARK_DEBUG); /* * Connecting to the signals triggers the interface-added signal */ - ytsg_client_connect_debug_signals (client, proxy); + yts_client_connect_debug_signals (client, proxy); g_object_unref (dbus); g_free (busname); @@ -1329,17 +1329,17 @@ variant_new_from_escaped_literal (char const *string) } static gboolean -dispatch_to_service (YtsgClient *self, +dispatch_to_service (YtsClient *self, char const *sender_jid, char const *xml) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; RestXmlParser *parser; RestXmlNode *node; char const *proxy_id; char const *capability; char const *type; - YtsgContact *contact; + YtsContact *contact; gboolean dispatched = FALSE; parser = rest_xml_parser_new (); @@ -1377,7 +1377,7 @@ dispatch_to_service (YtsgClient *self, return false; } - contact = ytsg_roster_find_contact_by_jid (priv->roster, sender_jid); + contact = yts_roster_find_contact_by_jid (priv->roster, sender_jid); if (NULL == contact) { // FIXME report error g_critical ("%s : Contact for '%s' not found", @@ -1389,7 +1389,7 @@ dispatch_to_service (YtsgClient *self, if (0 == g_strcmp0 ("invocation", type)) { /* Deliver to service */ - YtsgServiceAdapter *adapter = g_hash_table_lookup (priv->services, + YtsServiceAdapter *adapter = g_hash_table_lookup (priv->services, capability); if (adapter) { @@ -1404,7 +1404,7 @@ dispatch_to_service (YtsgClient *self, invocation_id, contact, proxy_id); - keep_sae = ytsg_service_adapter_invoke (adapter, + keep_sae = yts_service_adapter_invoke (adapter, invocation_id, aspect, arguments); @@ -1425,7 +1425,7 @@ dispatch_to_service (YtsgClient *self, char const *args = rest_xml_node_get_attr (node, "arguments"); GVariant *arguments = args ? variant_new_from_escaped_literal (args) : NULL; - dispatched = ytsg_contact_dispatch_event (contact, + dispatched = yts_contact_dispatch_event (contact, capability, aspect, arguments); @@ -1436,7 +1436,7 @@ dispatch_to_service (YtsgClient *self, char const *ret = rest_xml_node_get_attr (node, "response"); GVariant *response = ret ? variant_new_from_escaped_literal (ret) : NULL; - dispatched = ytsg_contact_dispatch_response (contact, + dispatched = yts_contact_dispatch_response (contact, capability, invocation_id, response); @@ -1452,8 +1452,8 @@ dispatch_to_service (YtsgClient *self, } static void -ytsg_client_yts_channels_received_cb (TpYtsClient *tp_client, - YtsgClient *client) +yts_client_yts_channels_received_cb (TpYtsClient *tp_client, + YtsClient *client) { TpYtsChannel *ch; @@ -1482,7 +1482,7 @@ ytsg_client_yts_channels_received_cb (TpYtsClient *tp_client, if (!dispatched) { - YtsgMetadata *msg = _ytsg_metadata_new_from_xml (xml); + YtsMetadata *msg = _yts_metadata_new_from_xml (xml); g_signal_emit (client, signals[MESSAGE], 0, msg); g_object_unref (msg); } @@ -1497,12 +1497,12 @@ ytsg_client_yts_channels_received_cb (TpYtsClient *tp_client, * This function is ready for the New World Order according to Ytstenut ... */ static void -ytsg_client_account_prepared_cb (GObject *acc, +yts_client_account_prepared_cb (GObject *acc, GAsyncResult *res, gpointer data) { - YtsgClient *client = data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = data; + YtsClientPrivate *priv = client->priv; GError *error = NULL; TpAccount *account = (TpAccount*)acc; @@ -1513,7 +1513,7 @@ ytsg_client_account_prepared_cb (GObject *acc, priv->account = account; - YTSG_NOTE (CONNECTION, "Account successfully opened"); + YTS_NOTE (CONNECTION, "Account successfully opened"); priv->tp_client = tp_yts_client_new (priv->uid, account); @@ -1532,14 +1532,14 @@ ytsg_client_account_prepared_cb (GObject *acc, * If connection has been requested already, make one */ if (priv->connect) - ytsg_client_make_connection (client); + yts_client_make_connection (client); } static void -ytsg_client_account_cb (GObject *object, GAsyncResult *res, gpointer data) +yts_client_account_cb (GObject *object, GAsyncResult *res, gpointer data) { - YtsgClient *client = (YtsgClient*) data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = (YtsClient*) data; + YtsClientPrivate *priv = client->priv; GError *error = NULL; const GQuark features[] = { TP_ACCOUNT_FEATURE_CORE, 0 }; @@ -1553,37 +1553,37 @@ ytsg_client_account_cb (GObject *object, GAsyncResult *res, gpointer data) if (error) g_error ("Could not access account: %s", error->message); - YTSG_NOTE (CONNECTION, "Got account"); + YTS_NOTE (CONNECTION, "Got account"); - if (ytsg_debug_flags & YTSG_DEBUG_TP) + if (yts_debug_flags & YTS_DEBUG_TP) tp_debug_set_flags ("all"); - if (ytsg_debug_flags & YTSG_DEBUG_MANAGER) - ytsg_client_setup_debug (client); + if (yts_debug_flags & YTS_DEBUG_MANAGER) + yts_client_setup_debug (client); tp_account_prepare_async (priv->account, &features[0], - ytsg_client_account_prepared_cb, + yts_client_account_prepared_cb, client); } static void -ytsg_client_constructed (GObject *object) +yts_client_constructed (GObject *object) { - YtsgClient *client = (YtsgClient*) object; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = (YtsClient*) object; + YtsClientPrivate *priv = client->priv; GError *error = NULL; - if (G_OBJECT_CLASS (ytsg_client_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_client_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_client_parent_class)->constructed) + G_OBJECT_CLASS (yts_client_parent_class)->constructed (object); - priv->roster = _ytsg_roster_new (client); - priv->unwanted = _ytsg_roster_new (client); + priv->roster = _yts_roster_new (client); + priv->unwanted = _yts_roster_new (client); if (!priv->uid || !*priv->uid) g_error ("UID must be set at construction time."); - if (priv->protocol == YTSG_PROTOCOL_LOCAL_XMPP) + if (priv->protocol == YTS_PROTOCOL_LOCAL_XMPP) priv->mgr_name = g_strdup ("salut"); else g_error ("Unknown protocol requested"); @@ -1605,18 +1605,18 @@ ytsg_client_constructed (GObject *object) tp_yts_account_manager_hold (priv->mgr); tp_yts_account_manager_get_account_async (priv->mgr, NULL, - ytsg_client_account_cb, + yts_client_account_cb, client); } static void -ytsg_client_get_property (GObject *object, +yts_client_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - YtsgClient *client = (YtsgClient*) object; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = (YtsClient*) object; + YtsClientPrivate *priv = client->priv; switch (property_id) { @@ -1639,13 +1639,13 @@ ytsg_client_get_property (GObject *object, } static void -ytsg_client_set_property (GObject *object, +yts_client_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - YtsgClient *client = (YtsgClient*) object; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = (YtsClient*) object; + YtsClientPrivate *priv = client->priv; switch (property_id) { @@ -1656,7 +1656,7 @@ ytsg_client_set_property (GObject *object, } break; case PROP_CAPABILITIES: - ytsg_client_set_capabilities (client, g_value_get_uint (value)); + yts_client_set_capabilities (client, g_value_get_uint (value)); break; case PROP_PROTOCOL: priv->protocol = g_value_get_enum (value); @@ -1668,12 +1668,12 @@ ytsg_client_set_property (GObject *object, } static void -ytsg_client_init (YtsgClient *client) +yts_client_init (YtsClient *client) { - client->priv = YTSG_CLIENT_GET_PRIVATE (client); - YtsgClientPrivate *priv = client->priv; + client->priv = YTS_CLIENT_GET_PRIVATE (client); + YtsClientPrivate *priv = client->priv; - ytsg_client_set_incoming_file_directory (client, NULL); + yts_client_set_incoming_file_directory (client, NULL); priv->services = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -1692,10 +1692,10 @@ ytsg_client_init (YtsgClient *client) } static void -ytsg_client_dispose (GObject *object) +yts_client_dispose (GObject *object) { - YtsgClient *client = (YtsgClient*) object; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = (YtsClient*) object; + YtsClientPrivate *priv = client->priv; if (priv->disposed) return; @@ -1761,14 +1761,14 @@ ytsg_client_dispose (GObject *object) priv->proxies = NULL; } - G_OBJECT_CLASS (ytsg_client_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_client_parent_class)->dispose (object); } static void -ytsg_client_finalize (GObject *object) +yts_client_finalize (GObject *object) { - YtsgClient *client = (YtsgClient*) object; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = (YtsClient*) object; + YtsClientPrivate *priv = client->priv; g_free (priv->uid); g_free (priv->icon_token); @@ -1782,21 +1782,21 @@ ytsg_client_finalize (GObject *object) if (priv->icon_data) g_array_free (priv->icon_data, TRUE); - G_OBJECT_CLASS (ytsg_client_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_client_parent_class)->finalize (object); } /** - * ytsg_client_disconnect: - * @client: #YtsgClient + * yts_client_disconnect: + * @client: #YtsClient * - * Disconnects #YtsgClient from Ytstenut mesh. + * Disconnects #YtsClient from Ytstenut mesh. */ void -ytsg_client_disconnect (YtsgClient *client) +yts_client_disconnect (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); priv = client->priv; @@ -1822,13 +1822,13 @@ ytsg_client_disconnect (YtsgClient *client) } static gboolean -ytsg_client_reconnect_cb (gpointer data) +yts_client_reconnect_cb (gpointer data) { - YtsgClient *client = data; + YtsClient *client = data; client->priv->reconnect_id = 0; - ytsg_client_connect (client); + yts_client_connect (client); /* one off */ return FALSE; @@ -1836,62 +1836,62 @@ ytsg_client_reconnect_cb (gpointer data) /* - * _ytsg_client_reconnect_after: - * @client: #YtsgClient + * _yts_client_reconnect_after: + * @client: #YtsClient * @after_seconds: #guint * * Attempst to reconnect to server after given number of seconds. */ void -_ytsg_client_reconnect_after (YtsgClient *client, guint after_seconds) +_yts_client_reconnect_after (YtsClient *client, guint after_seconds) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); priv = client->priv; priv->reconnect = TRUE; priv->reconnect_id = - g_timeout_add_seconds (after_seconds, ytsg_client_reconnect_cb, client); + g_timeout_add_seconds (after_seconds, yts_client_reconnect_cb, client); } static void -ytsg_client_connected_cb (TpConnection *proxy, +yts_client_connected_cb (TpConnection *proxy, const GError *error, gpointer data, GObject *weak_object) { - YtsgClient *client = data; + YtsClient *client = data; if (error) { g_warning (G_STRLOC ": %s: %s", __FUNCTION__, error->message); - ytsg_client_disconnect (client); - _ytsg_client_reconnect_after (client, RECONNECT_DELAY); + yts_client_disconnect (client); + _yts_client_reconnect_after (client, RECONNECT_DELAY); } } static void -ytsg_client_error_cb (TpConnection *proxy, +yts_client_error_cb (TpConnection *proxy, const gchar *arg_Error, GHashTable *arg_Details, gpointer user_data, GObject *weak_object) { - YTSG_NOTE (CLIENT, "Error: %s", arg_Error); + YTS_NOTE (CLIENT, "Error: %s", arg_Error); } static void -ytsg_client_status_cb (TpConnection *proxy, +yts_client_status_cb (TpConnection *proxy, guint arg_Status, guint arg_Reason, gpointer data, GObject *weak_object) { - YtsgClient *client = data; + YtsClient *client = data; const char *status[] = {"'connected' ", "'connecting' ", "'disconnected'"}; @@ -1916,7 +1916,7 @@ ytsg_client_status_cb (TpConnection *proxy, if (client->priv->disposed) return; - YTSG_NOTE (CONNECTION, "Connection: %s: '%s'", + YTS_NOTE (CONNECTION, "Connection: %s: '%s'", status[arg_Status], reason[arg_Reason]); if (arg_Status == TP_CONNECTION_STATUS_CONNECTED) @@ -1930,7 +1930,7 @@ yts_client_caps_overlap (GArray *mycaps, char **caps) { int i; - /* TODO -- this is not nice, maybe YtsgClient:caps should also be just a + /* TODO -- this is not nice, maybe YtsClient:caps should also be just a * char** */ for (i = 0; i < mycaps->len; ++i) @@ -1939,7 +1939,7 @@ yts_client_caps_overlap (GArray *mycaps, char **caps) for (p = caps; *p; ++p) { - if (!strcmp (g_quark_to_string (g_array_index (mycaps, YtsgCaps, i)), + if (!strcmp (g_quark_to_string (g_array_index (mycaps, YtsCaps, i)), *p)) { return TRUE; @@ -1951,16 +1951,16 @@ yts_client_caps_overlap (GArray *mycaps, char **caps) } static gboolean -ytsg_client_process_one_service (YtsgClient *client, +yts_client_process_one_service (YtsClient *client, const char *jid, const char *sid, const GValueArray *service) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; const char *type; GHashTable *names; char **caps; - YtsgRoster *roster; + YtsRoster *roster; GValueArray *sinfo = (GValueArray*) service; if (sinfo->n_values != 3) @@ -1970,7 +1970,7 @@ ytsg_client_process_one_service (YtsgClient *client, return FALSE; } - YTSG_NOTE (CLIENT, "Processing service %s:%s", jid, sid); + YTS_NOTE (CLIENT, "Processing service %s:%s", jid, sid); type = g_value_get_string (g_value_array_get_nth (sinfo, 0)); names = g_value_get_boxed (g_value_array_get_nth (sinfo, 1)); @@ -1982,40 +1982,40 @@ ytsg_client_process_one_service (YtsgClient *client, else roster = priv->unwanted; - YTSG_NOTE (CLIENT, "Using roster %s", + YTS_NOTE (CLIENT, "Using roster %s", roster == priv->roster ? "wanted" : "unwanted"); - _ytsg_roster_add_service (roster, jid, sid, type, + _yts_roster_add_service (roster, jid, sid, type, (const char**)caps, names); return TRUE; } static void -ytsg_client_service_added_cb (TpYtsStatus *self, +yts_client_service_added_cb (TpYtsStatus *self, const gchar *jid, const gchar *sid, const GValueArray *sinfo, - YtsgClient *client) + YtsClient *client) { - ytsg_client_process_one_service (client, jid, sid, sinfo); + yts_client_process_one_service (client, jid, sid, sinfo); } static void -ytsg_client_service_removed_cb (TpYtsStatus *self, +yts_client_service_removed_cb (TpYtsStatus *self, const gchar *jid, const gchar *sid, - YtsgClient *client) + YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; - _ytsg_roster_remove_service_by_id (priv->roster, jid, sid); + _yts_roster_remove_service_by_id (priv->roster, jid, sid); } static void -ytsg_client_process_status (YtsgClient *client) +yts_client_process_status (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; GHashTable *services; if ((services = tp_yts_status_get_discovered_services (priv->tp_status))) @@ -2025,7 +2025,7 @@ ytsg_client_process_status (YtsgClient *client) GHashTableIter iter; if (g_hash_table_size (services) <= 0) - YTSG_NOTE (CLIENT, "No services discovered so far"); + YTS_NOTE (CLIENT, "No services discovered so far"); g_hash_table_iter_init (&iter, services); while (g_hash_table_iter_next (&iter, (void**)&jid, (void**)&service)) @@ -2037,16 +2037,16 @@ ytsg_client_process_status (YtsgClient *client) g_hash_table_iter_init (&iter2, service); while (g_hash_table_iter_next (&iter2, (void**)&sid, (void**)&sinfo)) { - ytsg_client_process_one_service (client, jid, sid, sinfo); + yts_client_process_one_service (client, jid, sid, sinfo); } } } else - YTSG_NOTE (CLIENT, "No discovered services"); + YTS_NOTE (CLIENT, "No discovered services"); } static void -ytsg_client_advertise_status_cb (GObject *source_object, +yts_client_advertise_status_cb (GObject *source_object, GAsyncResult *result, gpointer data) { @@ -2059,42 +2059,42 @@ ytsg_client_advertise_status_cb (GObject *source_object, } else { - YTSG_NOTE (CLIENT, "Advertising of status succeeded"); + YTS_NOTE (CLIENT, "Advertising of status succeeded"); } g_clear_error (&error); } static void -ytsg_client_dispatch_status (YtsgClient *client) +yts_client_dispatch_status (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; char *xml = NULL; int i; - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); priv = client->priv; g_return_if_fail (priv->caps && priv->caps->len); if (priv->status) - xml = ytsg_metadata_to_string ((YtsgMetadata*)priv->status); + xml = yts_metadata_to_string ((YtsMetadata*)priv->status); - YTSG_NOTE (CLIENT, "Setting status to\n%s", xml); + YTS_NOTE (CLIENT, "Setting status to\n%s", xml); for (i = 0; i < priv->caps->len; ++i) { const char *c; - c = g_quark_to_string (g_array_index (priv->caps, YtsgCaps, i)); + c = g_quark_to_string (g_array_index (priv->caps, YtsCaps, i)); tp_yts_status_advertise_status_async (priv->tp_status, c, priv->uid, xml, NULL, - ytsg_client_advertise_status_cb, + yts_client_advertise_status_cb, client); } @@ -2102,13 +2102,13 @@ ytsg_client_dispatch_status (YtsgClient *client) } static void -ytsg_client_yts_status_cb (GObject *obj, +yts_client_yts_status_cb (GObject *obj, GAsyncResult *res, gpointer data) { TpAccount *acc = TP_ACCOUNT (obj); - YtsgClient *client = data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = data; + YtsClientPrivate *priv = client->priv; GError *error = NULL; TpYtsStatus *status; @@ -2117,46 +2117,46 @@ ytsg_client_yts_status_cb (GObject *obj, g_error ("Failed to obtain status: %s", error->message); } - YTSG_NOTE (CLIENT, "Processing status"); + YTS_NOTE (CLIENT, "Processing status"); priv->tp_status = status; tp_g_signal_connect_object (status, "service-added", - G_CALLBACK (ytsg_client_service_added_cb), + G_CALLBACK (yts_client_service_added_cb), client, 0); tp_g_signal_connect_object (status, "service-removed", - G_CALLBACK (ytsg_client_service_removed_cb), + G_CALLBACK (yts_client_service_removed_cb), client, 0); if (priv->status) - ytsg_client_dispatch_status (client); + yts_client_dispatch_status (client); - ytsg_client_process_status (client); + yts_client_process_status (client); if (!priv->ready) { - YTSG_NOTE (CLIENT, "Emitting 'ready' signal"); + YTS_NOTE (CLIENT, "Emitting 'ready' signal"); g_signal_emit (client, signals[READY], 0); } } static void -ytsg_client_connection_ready_cb (TpConnection *conn, +yts_client_connection_ready_cb (TpConnection *conn, GParamSpec *par, - YtsgClient *client) + YtsClient *client) { GCancellable *cancellable; - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; if (tp_connection_is_ready (conn)) { - YTSG_NOTE (CONNECTION, "TP Connection entered ready state"); + YTS_NOTE (CONNECTION, "TP Connection entered ready state"); cancellable = g_cancellable_new (); tp_yts_status_ensure_async (priv->account, cancellable, - ytsg_client_yts_status_cb, + yts_client_yts_status_cb, client); /* @@ -2170,14 +2170,14 @@ ytsg_client_connection_ready_cb (TpConnection *conn, } static void -ytsg_client_set_avatar_cb (TpConnection *proxy, +yts_client_set_avatar_cb (TpConnection *proxy, const gchar *token, const GError *error, gpointer data, GObject *weak_object) { - YtsgClient *client = data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = data; + YtsClientPrivate *priv = client->priv; if (error) { @@ -2193,11 +2193,11 @@ ytsg_client_set_avatar_cb (TpConnection *proxy, * check whether the given avatar mime type is supported. */ static gboolean -ytsg_client_is_avatar_type_supported (YtsgClient *client, +yts_client_is_avatar_type_supported (YtsClient *client, const char *mime_type, guint bytes) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; char **p; const char *alt_type = NULL; TpAvatarRequirements *req; @@ -2247,12 +2247,12 @@ ytsg_client_is_avatar_type_supported (YtsgClient *client, } static void -ytsg_client_connection_prepare_cb (GObject *connection, +yts_client_connection_prepare_cb (GObject *connection, GAsyncResult *res, gpointer data) { - YtsgClient *client = data; - YtsgClientPrivate *priv = client->priv; + YtsClient *client = data; + YtsClientPrivate *priv = client->priv; GError *error = NULL; if (!tp_proxy_prepare_finish (connection, res, &error)) @@ -2266,14 +2266,14 @@ ytsg_client_connection_prepare_cb (GObject *connection, g_error ("Failed to register account: %s", error->message); } else - YTSG_NOTE (CONNECTION, "Registered TpYtsClient"); + YTS_NOTE (CONNECTION, "Registered TpYtsClient"); tp_g_signal_connect_object (priv->tp_client, "received-channels", - G_CALLBACK (ytsg_client_yts_channels_received_cb), + G_CALLBACK (yts_client_yts_channels_received_cb), client, 0); if (priv->icon_data && - ytsg_client_is_avatar_type_supported (client, + yts_client_is_avatar_type_supported (client, priv->icon_mime_type, priv->icon_data->len)) { @@ -2281,7 +2281,7 @@ ytsg_client_connection_prepare_cb (GObject *connection, -1, priv->icon_data, priv->icon_mime_type, - ytsg_client_set_avatar_cb, + yts_client_set_avatar_cb, client, NULL, (GObject*)client); @@ -2298,8 +2298,8 @@ ytsg_client_connection_prepare_cb (GObject *connection, * local-xmpp / salut does not support the ContactCapabilities interface, * but file transfer is enabled by default, so it does not matter to us. */ - if (priv->protocol != YTSG_PROTOCOL_LOCAL_XMPP) - ytsg_client_setup_caps (client); + if (priv->protocol != YTS_PROTOCOL_LOCAL_XMPP) + yts_client_setup_caps (client); #endif } } @@ -2309,9 +2309,9 @@ ytsg_client_connection_prepare_cb (GObject *connection, * signals that we care about. */ static void -ytsg_client_setup_account_connection (YtsgClient *client) +yts_client_setup_account_connection (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; GError *error = NULL; GQuark features[] = { TP_CONNECTION_FEATURE_CONTACT_INFO, TP_CONNECTION_FEATURE_AVATAR_REQUIREMENTS, @@ -2325,15 +2325,15 @@ ytsg_client_setup_account_connection (YtsgClient *client) priv->dialing = FALSE; - YTSG_NOTE (CONNECTION, "Connection ready ?: %d", + YTS_NOTE (CONNECTION, "Connection ready ?: %d", tp_connection_is_ready (priv->connection)); tp_g_signal_connect_object (priv->connection, "notify::connection-ready", - G_CALLBACK (ytsg_client_connection_ready_cb), + G_CALLBACK (yts_client_connection_ready_cb), client, 0); tp_cli_connection_connect_to_connection_error (priv->connection, - ytsg_client_error_cb, + yts_client_error_cb, client, NULL, (GObject*)client, @@ -2348,7 +2348,7 @@ ytsg_client_setup_account_connection (YtsgClient *client) } tp_cli_connection_connect_to_status_changed (priv->connection, - ytsg_client_status_cb, + yts_client_status_cb, client, NULL, (GObject*) client, @@ -2363,7 +2363,7 @@ ytsg_client_setup_account_connection (YtsgClient *client) } tp_cli_connection_connect_to_new_channel (priv->connection, - ytsg_client_channel_cb, + yts_client_channel_cb, client, NULL, (GObject*)client, @@ -2379,7 +2379,7 @@ ytsg_client_setup_account_connection (YtsgClient *client) tp_proxy_prepare_async (priv->connection, features, - ytsg_client_connection_prepare_cb, + yts_client_connection_prepare_cb, client); } @@ -2388,7 +2388,7 @@ ytsg_client_setup_account_connection (YtsgClient *client) * do anything with it, except when it fails. */ static void -ytsg_client_account_online_cb (GObject *acc, +yts_client_account_online_cb (GObject *acc, GAsyncResult *res, gpointer data) { @@ -2405,7 +2405,7 @@ ytsg_client_account_online_cb (GObject *acc, presence = tp_account_get_current_presence (account, &stat, &msg); - YTSG_NOTE (CONNECTION, + YTS_NOTE (CONNECTION, "Request to change presence to 'online' succeeded: %d, %s:%s", presence, stat, msg); @@ -2417,23 +2417,23 @@ ytsg_client_account_online_cb (GObject *acc, * One off handler for connection coming online */ static void -ytsg_client_account_connection_notify_cb (TpAccount *account, +yts_client_account_connection_notify_cb (TpAccount *account, GParamSpec *pspec, - YtsgClient *client) + YtsClient *client) { - YTSG_NOTE (CONNECTION, "We got connection!"); + YTS_NOTE (CONNECTION, "We got connection!"); g_signal_handlers_disconnect_by_func (account, - ytsg_client_account_connection_notify_cb, + yts_client_account_connection_notify_cb, client); - ytsg_client_setup_account_connection (client); + yts_client_setup_account_connection (client); } static void -ytsg_client_make_connection (YtsgClient *client) +yts_client_make_connection (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; /* * If we don't have an account yet, we do nothing and will make call to this @@ -2441,7 +2441,7 @@ ytsg_client_make_connection (YtsgClient *client) */ if (!priv->account) { - YTSG_NOTE (CONNECTION, "Account not yet available"); + YTS_NOTE (CONNECTION, "Account not yet available"); return; } @@ -2453,41 +2453,41 @@ ytsg_client_make_connection (YtsgClient *client) */ if (!tp_account_get_connection (priv->account)) { - YTSG_NOTE (CONNECTION, "Currently off line, changing ..."); + YTS_NOTE (CONNECTION, "Currently off line, changing ..."); g_signal_connect (priv->account, "notify::connection", - G_CALLBACK (ytsg_client_account_connection_notify_cb), + G_CALLBACK (yts_client_account_connection_notify_cb), client); tp_account_request_presence_async (priv->account, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE, "online", "online", - ytsg_client_account_online_cb, + yts_client_account_online_cb, client); } else - ytsg_client_setup_account_connection (client); + yts_client_setup_account_connection (client); } /** - * ytsg_client_connect: - * @client: #YtsgClient + * yts_client_connect: + * @client: #YtsClient * * Initiates connection to the mesh. Once the connection is established, - * the YtsgClient::authenticated signal will be emitted. + * the YtsClient::authenticated signal will be emitted. * * NB: this function long name is to avoid collision with the GIR singnal * connection method. */ void -ytsg_client_connect (YtsgClient *client) +yts_client_connect (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - YTSG_NOTE (CONNECTION, "Connecting ..."); + YTS_NOTE (CONNECTION, "Connecting ..."); - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); priv = client->priv; @@ -2507,41 +2507,41 @@ ytsg_client_connect (YtsgClient *client) */ tp_cli_connection_call_connect (priv->connection, -1, - ytsg_client_connected_cb, + yts_client_connected_cb, client, NULL, (GObject*)client); } else if (!priv->dialing) - ytsg_client_make_connection (client); + yts_client_make_connection (client); } /** - * ytsg_client_new: - * @protocol: #YtsgProtocol + * yts_client_new: + * @protocol: #YtsProtocol * @uid: UID for this service; UIDs must follow the dbus convetion for unique * names. * - * Creates a new #YtsgClient object connected to the provided roster + * Creates a new #YtsClient object connected to the provided roster * - * Return value: #YtsgClient object. + * Return value: #YtsClient object. */ -YtsgClient * -ytsg_client_new (YtsgProtocol protocol, const char *uid) +YtsClient * +yts_client_new (YtsProtocol protocol, const char *uid) { if (!uid) g_error ("UID must be specified at construction time."); - return g_object_new (YTSG_TYPE_CLIENT, + return g_object_new (YTS_TYPE_CLIENT, "protocol", protocol, "uid", uid, NULL); } static gboolean -ytsg_client_has_capability (YtsgClient *client, YtsgCaps cap) +yts_client_has_capability (YtsClient *client, YtsCaps cap) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; int i; if (!priv->caps) @@ -2549,9 +2549,9 @@ ytsg_client_has_capability (YtsgClient *client, YtsgCaps cap) for (i = 0; i < priv->caps->len; ++i) { - YtsgCaps c = g_array_index (priv->caps, YtsgCaps, i); + YtsCaps c = g_array_index (priv->caps, YtsCaps, i); - if (c == cap || c == YTSG_CAPS_CONTROL) + if (c == cap || c == YTS_CAPS_CONTROL) return TRUE; } @@ -2559,25 +2559,25 @@ ytsg_client_has_capability (YtsgClient *client, YtsgCaps cap) } static void -ytsg_client_refresh_roster (YtsgClient *client) +yts_client_refresh_roster (YtsClient *client) { - YtsgClientPrivate *priv = client->priv; + YtsClientPrivate *priv = client->priv; - YTSG_NOTE (CLIENT, "Refreshing roster"); + YTS_NOTE (CLIENT, "Refreshing roster"); if (!priv->tp_status) return; - _ytsg_roster_clear (priv->roster); - _ytsg_roster_clear (priv->unwanted); + _yts_roster_clear (priv->roster); + _yts_roster_clear (priv->unwanted); - ytsg_client_process_status (client); + yts_client_process_status (client); } /** - * ytsg_client_set_capabilities: - * @client: #YtsgClient, - * @caps: #YtsgCaps + * yts_client_set_capabilities: + * @client: #YtsClient, + * @caps: #YtsCaps * * Adds a capability to the capability set of this client; multiple capabilities * can be added by making mulitiple calls to this function. @@ -2585,17 +2585,17 @@ ytsg_client_refresh_roster (YtsgClient *client) * The capability set is used to filter roster items to match. */ void -ytsg_client_set_capabilities (YtsgClient *client, YtsgCaps caps) +yts_client_set_capabilities (YtsClient *client, YtsCaps caps) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); priv = client->priv; - if (ytsg_client_has_capability (client, caps)) + if (yts_client_has_capability (client, caps)) { - YTSG_NOTE (CLIENT, "Capablity '%s' already set", + YTS_NOTE (CLIENT, "Capablity '%s' already set", g_quark_to_string (caps)); return; @@ -2605,30 +2605,30 @@ ytsg_client_set_capabilities (YtsgClient *client, YtsgCaps caps) tp_yts_client_add_capability (priv->tp_client, g_quark_to_string (caps)); if (!priv->caps) - priv->caps = g_array_sized_new (FALSE, FALSE, sizeof (YtsgCaps), 1); + priv->caps = g_array_sized_new (FALSE, FALSE, sizeof (YtsCaps), 1); g_array_append_val (priv->caps, caps); - ytsg_client_refresh_roster (client); + yts_client_refresh_roster (client); g_object_notify ((GObject*)client, "capabilities"); } /** - * ytsg_client_get_roster: - * @client: #YtsgClient + * yts_client_get_roster: + * @client: #YtsClient * - * Gets the #YtsgRoster for this client. The object is owned by the client + * Gets the #YtsRoster for this client. The object is owned by the client * and must not be freed by the caller. * - * Return value (tranfer none): #YtsgRoster. + * Return value (tranfer none): #YtsRoster. */ -YtsgRoster * -ytsg_client_get_roster (YtsgClient *client) +YtsRoster * +yts_client_get_roster (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); priv = client->priv; @@ -2636,35 +2636,35 @@ ytsg_client_get_roster (YtsgClient *client) } /** - * ytsg_client_emit_error: - * @client: #YtsgClient, - * @error: #YtsgError + * yts_client_emit_error: + * @client: #YtsClient, + * @error: #YtsError * - * Emits the #YtsgClient::error signal with the suplied error parameter. + * Emits the #YtsClient::error signal with the suplied error parameter. * * This function is intened primarily for internal use, but can be also used by * toolkit libraries that need to generate asynchronous errors. Any function - * call that returns the %YTSG_ERROR_PENDING code to the caller should + * call that returns the %YTS_ERROR_PENDING code to the caller should * eventually lead to emission of the ::error signal with either an appropriate - * error code or %YTSG_ERROR_SUCCESS to indicate the operation successfully + * error code or %YTS_ERROR_SUCCESS to indicate the operation successfully * completed. */ void -ytsg_client_emit_error (YtsgClient *client, YtsgError error) +yts_client_emit_error (YtsClient *client, YtsError error) { - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); /* * There is no point in throwing an error that has no atom specified. */ - g_return_if_fail (ytsg_error_get_atom (error)); + g_return_if_fail (yts_error_get_atom (error)); g_signal_emit (client, signals[ERROR], 0, error); } /** - * ytsg_client_set_incoming_file_directory: - * @client: #YtsgClient + * yts_client_set_incoming_file_directory: + * @client: #YtsClient * @directory: path to a directory or %NULL. * * Sets the directory where incoming files will be stored; if the provided path @@ -2674,15 +2674,15 @@ ytsg_client_emit_error (YtsgClient *client, YtsgError error) * of 0700. * * To change the directory for a specific file call this function from a - * callback to the YtsgClient::incoming-file signal. + * callback to the YtsClient::incoming-file signal. */ void -ytsg_client_set_incoming_file_directory (YtsgClient *client, +yts_client_set_incoming_file_directory (YtsClient *client, const char *directory) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_if_fail (YTSG_IS_CLIENT (client)); + g_return_if_fail (YTS_IS_CLIENT (client)); priv = client->priv; @@ -2694,8 +2694,8 @@ ytsg_client_set_incoming_file_directory (YtsgClient *client, } /** - * ytsg_client_get_incoming_file_directory: - * @client: #YtsgClient + * yts_client_get_incoming_file_directory: + * @client: #YtsClient * * Returns the directory into which any files from incoming file transfers will * be placed. @@ -2703,11 +2703,11 @@ ytsg_client_set_incoming_file_directory (YtsgClient *client, * Return value: (tranfer none): directory where incoming files are stored. */ const char * -ytsg_client_get_incoming_file_directory (YtsgClient *client) +yts_client_get_incoming_file_directory (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); priv = client->priv; @@ -2715,20 +2715,20 @@ ytsg_client_get_incoming_file_directory (YtsgClient *client) } /** - * ytsg_client_get_jid: - * @client: #YtsgClient + * yts_client_get_jid: + * @client: #YtsClient * * Returns the jabber id associated with the current client. * * Return value: the jabber id. */ const char * -ytsg_client_get_jid (const YtsgClient *client) +yts_client_get_jid (const YtsClient *client) { /* - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); priv = client->priv; */ @@ -2738,19 +2738,19 @@ ytsg_client_get_jid (const YtsgClient *client) } /** - * ytsg_client_get_uid: - * @client: #YtsgClient + * yts_client_get_uid: + * @client: #YtsClient * * Returns uid of the service this client represents. * * Return value: the service uid. */ const char * -ytsg_client_get_uid (const YtsgClient *client) +yts_client_get_uid (const YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); priv = client->priv; @@ -2758,11 +2758,11 @@ ytsg_client_get_uid (const YtsgClient *client) } TpConnection * -_ytsg_client_get_connection (YtsgClient *client) +_yts_client_get_connection (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); priv = client->priv; @@ -2770,11 +2770,11 @@ _ytsg_client_get_connection (YtsgClient *client) } TpYtsStatus * -_ytsg_client_get_tp_status (YtsgClient *client) +_yts_client_get_tp_status (YtsClient *client) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); priv = client->priv; @@ -2782,27 +2782,27 @@ _ytsg_client_get_tp_status (YtsgClient *client) } /* - * FIXME -- bad API, constructing the YtsgStatus is hard, this should be a + * FIXME -- bad API, constructing the YtsStatus is hard, this should be a * private API, with a better public API wrapping it. */ /** - * ytsg_client_set_status_by_capability: - * @client: #YtsgClient + * yts_client_set_status_by_capability: + * @client: #YtsClient * @capability: the capability to set status for * @activity: the activity to set the status to. * * Changes the status of the service represented by this client to status. */ void -ytsg_client_set_status_by_capability (YtsgClient *client, +yts_client_set_status_by_capability (YtsClient *client, const char *capability, const char *activity) { - YtsgClientPrivate *priv; - YtsgStatus *status = NULL; + YtsClientPrivate *priv; + YtsStatus *status = NULL; - g_return_if_fail (YTSG_IS_CLIENT (client) && capability); + g_return_if_fail (YTS_IS_CLIENT (client) && capability); priv = client->priv; @@ -2821,25 +2821,25 @@ ytsg_client_set_status_by_capability (YtsgClient *client, g_debug ("Constructing status for %s, %s, %s", capability, activity, priv->uid); - status = ytsg_status_new ((const char**)&attributes); + status = yts_status_new ((const char**)&attributes); } - ytsg_client_set_status (client, status); + yts_client_set_status (client, status); } /** - * ytsg_client_set_status: - * @client: #YtsgClient - * @status: new #YtsgStatus + * yts_client_set_status: + * @client: #YtsClient + * @status: new #YtsStatus * * Changes the status of the service represented by this client to status; */ void -ytsg_client_set_status (YtsgClient *client, YtsgStatus *status) +yts_client_set_status (YtsClient *client, YtsStatus *status) { - YtsgClientPrivate *priv; + YtsClientPrivate *priv; - g_return_if_fail (YTSG_IS_CLIENT (client) && YTSG_IS_STATUS (status)); + g_return_if_fail (YTS_IS_CLIENT (client) && YTS_IS_STATUS (status)); priv = client->priv; @@ -2858,24 +2858,24 @@ ytsg_client_set_status (YtsgClient *client, YtsgStatus *status) if (priv->tp_status) { - ytsg_client_dispatch_status (client); + yts_client_dispatch_status (client); } } -struct YtsgCLChannelData +struct YtsCLChannelData { - YtsgClient *client; - YtsgContact *contact; + YtsClient *client; + YtsContact *contact; GHashTable *attrs; char *xml; char *uid; - YtsgError error; + YtsError error; gboolean status_done; int ref_count; }; static void -ytsg_cl_channel_data_unref (struct YtsgCLChannelData *d) +yts_cl_channel_data_unref (struct YtsCLChannelData *d) { d->ref_count--; @@ -2888,15 +2888,15 @@ ytsg_cl_channel_data_unref (struct YtsgCLChannelData *d) } } -static struct YtsgCLChannelData * -ytsg_cl_channel_data_ref (struct YtsgCLChannelData *d) +static struct YtsCLChannelData * +yts_cl_channel_data_ref (struct YtsCLChannelData *d) { d->ref_count++; return d; } static void -ytsg_client_msg_replied_cb (TpYtsChannel *proxy, +yts_client_msg_replied_cb (TpYtsChannel *proxy, GHashTable *attributes, const gchar *body, gpointer data, @@ -2904,38 +2904,38 @@ ytsg_client_msg_replied_cb (TpYtsChannel *proxy, { GHashTableIter iter; gpointer key, value; - struct YtsgCLChannelData *d = data; + struct YtsCLChannelData *d = data; - YTSG_NOTE (MESSAGE, "Got reply with attributes:"); + YTS_NOTE (MESSAGE, "Got reply with attributes:"); g_hash_table_iter_init (&iter, attributes); while (g_hash_table_iter_next (&iter, &key, &value)) { - YTSG_NOTE (MESSAGE, " %s = %s\n", + YTS_NOTE (MESSAGE, " %s = %s\n", (const gchar *) key, (const gchar *) value); } - YTSG_NOTE (MESSAGE, " body: %s\n", body); + YTS_NOTE (MESSAGE, " body: %s\n", body); if (!d->status_done) { guint32 a; - YtsgError e; + YtsError e; - a = ytsg_error_get_atom (d->error); - e = ytsg_error_make (a, YTSG_ERROR_SUCCESS); + a = yts_error_get_atom (d->error); + e = yts_error_make (a, YTS_ERROR_SUCCESS); - ytsg_client_emit_error (d->client, e); + yts_client_emit_error (d->client, e); d->status_done = TRUE; } - ytsg_cl_channel_data_unref (d); + yts_cl_channel_data_unref (d); } static void -ytsg_client_msg_failed_cb (TpYtsChannel *proxy, +yts_client_msg_failed_cb (TpYtsChannel *proxy, guint error_type, const gchar *stanza_error_name, const gchar *ytstenut_error_name, @@ -2944,50 +2944,50 @@ ytsg_client_msg_failed_cb (TpYtsChannel *proxy, GObject *weak_object) { guint32 a; - YtsgError e; - struct YtsgCLChannelData *d = data; + YtsError e; + struct YtsCLChannelData *d = data; - a = ytsg_error_get_atom (d->error); + a = yts_error_get_atom (d->error); g_warning ("Sending of message failed: type %u, %s, %s, %s", error_type, stanza_error_name, ytstenut_error_name, text); - e = ytsg_error_make (a, YTSG_ERROR_NO_MSG_CHANNEL); + e = yts_error_make (a, YTS_ERROR_NO_MSG_CHANNEL); - ytsg_client_emit_error (d->client, e); + yts_client_emit_error (d->client, e); d->status_done = TRUE; - ytsg_cl_channel_data_unref (d); + yts_cl_channel_data_unref (d); } static void -ytsg_client_msg_closed_cb (TpChannel *channel, +yts_client_msg_closed_cb (TpChannel *channel, gpointer data, GObject *weak_object) { - struct YtsgCLChannelData *d = data; + struct YtsCLChannelData *d = data; - YTSG_NOTE (MESSAGE, "Channel closed"); + YTS_NOTE (MESSAGE, "Channel closed"); if (!d->status_done) { guint32 a; - YtsgError e; + YtsError e; - a = ytsg_error_get_atom (d->error); - e = ytsg_error_make (a, YTSG_ERROR_SUCCESS); + a = yts_error_get_atom (d->error); + e = yts_error_make (a, YTS_ERROR_SUCCESS); - ytsg_client_emit_error (d->client, e); + yts_client_emit_error (d->client, e); d->status_done = TRUE; } - ytsg_cl_channel_data_unref (d); + yts_cl_channel_data_unref (d); } static void -ytsg_client_msg_request_cb (GObject *source_object, +yts_client_msg_request_cb (GObject *source_object, GAsyncResult *result, gpointer data) { @@ -3000,66 +3000,66 @@ ytsg_client_msg_request_cb (GObject *source_object, } else { - YTSG_NOTE (MESSAGE, "Channel requested"); + YTS_NOTE (MESSAGE, "Channel requested"); } g_clear_error (&error); } static void -ytsg_client_outgoing_channel_cb (GObject *obj, +yts_client_outgoing_channel_cb (GObject *obj, GAsyncResult *res, gpointer data) { TpYtsChannel *ch; TpYtsClient *client = TP_YTS_CLIENT (obj); GError *error = NULL; - struct YtsgCLChannelData *d = data; + struct YtsCLChannelData *d = data; if (!(ch = tp_yts_client_request_channel_finish (client, res, &error))) { guint32 a; - YtsgError e; + YtsError e; - a = ytsg_error_get_atom (d->error); + a = yts_error_get_atom (d->error); g_warning ("Failed to open outgoing channel: %s", error->message); g_clear_error (&error); - e = ytsg_error_make (a, YTSG_ERROR_NO_MSG_CHANNEL); + e = yts_error_make (a, YTS_ERROR_NO_MSG_CHANNEL); - ytsg_client_emit_error (d->client, e); + yts_client_emit_error (d->client, e); } else { - YTSG_NOTE (MESSAGE, "Got message channel, sending request"); + YTS_NOTE (MESSAGE, "Got message channel, sending request"); - tp_yts_channel_connect_to_replied (ch, ytsg_client_msg_replied_cb, - ytsg_cl_channel_data_ref (d), + tp_yts_channel_connect_to_replied (ch, yts_client_msg_replied_cb, + yts_cl_channel_data_ref (d), NULL, NULL, NULL); - tp_yts_channel_connect_to_failed (ch, ytsg_client_msg_failed_cb, - ytsg_cl_channel_data_ref (d), + tp_yts_channel_connect_to_failed (ch, yts_client_msg_failed_cb, + yts_cl_channel_data_ref (d), NULL, NULL, NULL); tp_cli_channel_connect_to_closed (TP_CHANNEL (ch), - ytsg_client_msg_closed_cb, - ytsg_cl_channel_data_ref (d), + yts_client_msg_closed_cb, + yts_cl_channel_data_ref (d), NULL, NULL, NULL); - tp_yts_channel_request_async (ch, NULL, ytsg_client_msg_request_cb, NULL); + tp_yts_channel_request_async (ch, NULL, yts_client_msg_request_cb, NULL); } - ytsg_cl_channel_data_unref (d); + yts_cl_channel_data_unref (d); } -static YtsgError -ytsg_client_dispatch_message (struct YtsgCLChannelData *d) +static YtsError +yts_client_dispatch_message (struct YtsCLChannelData *d) { TpContact *tp_contact; - YtsgClientPrivate *priv = d->client->priv; + YtsClientPrivate *priv = d->client->priv; - YTSG_NOTE (CLIENT, "Dispatching delayed message to %s", d->uid); + YTS_NOTE (CLIENT, "Dispatching delayed message to %s", d->uid); - tp_contact = ytsg_contact_get_tp_contact (d->contact); + tp_contact = yts_contact_get_tp_contact (d->contact); g_assert (tp_contact); tp_yts_client_request_channel_async (priv->tp_client, @@ -3069,47 +3069,47 @@ ytsg_client_dispatch_message (struct YtsgCLChannelData *d) d->attrs, d->xml, NULL, - ytsg_client_outgoing_channel_cb, + yts_client_outgoing_channel_cb, d); return d->error; } static void -ytsg_client_notify_tp_contact_cb (YtsgContact *contact, +yts_client_notify_tp_contact_cb (YtsContact *contact, GParamSpec *pspec, - struct YtsgCLChannelData *d) + struct YtsCLChannelData *d) { - YTSG_NOTE (CLIENT, "Contact ready"); - ytsg_client_dispatch_message (d); + YTS_NOTE (CLIENT, "Contact ready"); + yts_client_dispatch_message (d); g_signal_handlers_disconnect_by_func (contact, - ytsg_client_notify_tp_contact_cb, + yts_client_notify_tp_contact_cb, d); } -YtsgError -_ytsg_client_send_message (YtsgClient *client, - YtsgContact *contact, +YtsError +_yts_client_send_message (YtsClient *client, + YtsContact *contact, const char *uid, - YtsgMetadata *message) + YtsMetadata *message) { GHashTable *attrs; - struct YtsgCLChannelData *d; - YtsgError e; + struct YtsCLChannelData *d; + YtsError e; char *xml = NULL; - if (!(attrs = _ytsg_metadata_extract (message, &xml))) + if (!(attrs = _yts_metadata_extract (message, &xml))) { - g_warning ("Failed to extract content from YtsgMessage object"); + g_warning ("Failed to extract content from YtsMessage object"); - e = ytsg_error_new (YTSG_ERROR_INVALID_PARAMETER); + e = yts_error_new (YTS_ERROR_INVALID_PARAMETER); g_free (xml); return e; } - e = ytsg_error_new (YTSG_ERROR_PENDING); + e = yts_error_new (YTS_ERROR_PENDING); - d = g_new (struct YtsgCLChannelData, 1); + d = g_new (struct YtsCLChannelData, 1); d->error = e; d->client = client; d->contact = contact; @@ -3119,16 +3119,16 @@ _ytsg_client_send_message (YtsgClient *client, d->xml = xml; d->uid = g_strdup (uid); - if (ytsg_contact_get_tp_contact (contact)) + if (yts_contact_get_tp_contact (contact)) { - ytsg_client_dispatch_message (d); + yts_client_dispatch_message (d); } else { - YTSG_NOTE (CLIENT, "Contact not ready, postponing message dispatch"); + YTS_NOTE (CLIENT, "Contact not ready, postponing message dispatch"); g_signal_connect (contact, "notify::tp-contact", - G_CALLBACK (ytsg_client_notify_tp_contact_cb), + G_CALLBACK (yts_client_notify_tp_contact_cb), d); } @@ -3136,14 +3136,14 @@ _ytsg_client_send_message (YtsgClient *client, } static void -_adapter_error (YtsgServiceAdapter *adapter, +_adapter_error (YtsServiceAdapter *adapter, char const *invocation_id, GError const *error, - YtsgClient *self) + YtsClient *self) { - YtsgMetadata *message; + YtsMetadata *message; - message = ytsg_error_message_new (g_quark_to_string (error->domain), + message = yts_error_message_new (g_quark_to_string (error->domain), error->code, error->message, invocation_id); @@ -3155,17 +3155,17 @@ _adapter_error (YtsgServiceAdapter *adapter, } static void -_adapter_event (YtsgServiceAdapter *adapter, +_adapter_event (YtsServiceAdapter *adapter, char const *aspect, GVariant *arguments, - YtsgClient *self) + YtsClient *self) { - YtsgClientPrivate *priv = self->priv; - YtsgMetadata *message; + YtsClientPrivate *priv = self->priv; + YtsMetadata *message; char *fqc_id; - fqc_id = ytsg_service_adapter_get_fqc_id (adapter); - message = ytsg_event_message_new (fqc_id, aspect, arguments); + fqc_id = yts_service_adapter_get_fqc_id (adapter); + message = yts_event_message_new (fqc_id, aspect, arguments); /* Dispatch to all registered proxies. */ ProxyList *proxy_list = g_hash_table_lookup (priv->proxies, fqc_id); @@ -3173,8 +3173,8 @@ _adapter_event (YtsgServiceAdapter *adapter, GList const *iter; for (iter = proxy_list->list; iter; iter = iter->next) { ProxyData const *proxy_data = (ProxyData const *) iter->data; - _ytsg_client_send_message (self, - YTSG_CONTACT (proxy_data->contact), + _yts_client_send_message (self, + YTS_CONTACT (proxy_data->contact), proxy_data->proxy_id, message); } @@ -3184,14 +3184,14 @@ _adapter_event (YtsgServiceAdapter *adapter, } static void -_adapter_response (YtsgServiceAdapter *adapter, +_adapter_response (YtsServiceAdapter *adapter, char const *invocation_id, GVariant *return_value, - YtsgClient *self) + YtsClient *self) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; InvocationData *invocation; - YtsgMetadata *message; + YtsMetadata *message; char *fqc_id; invocation = g_hash_table_lookup (priv->invocations, invocation_id); @@ -3202,11 +3202,11 @@ _adapter_response (YtsgServiceAdapter *adapter, invocation_id); } - fqc_id = ytsg_service_adapter_get_fqc_id (adapter); - message = ytsg_response_message_new (fqc_id, + fqc_id = yts_service_adapter_get_fqc_id (adapter); + message = yts_response_message_new (fqc_id, invocation_id, return_value); - _ytsg_client_send_message (self, + _yts_client_send_message (self, invocation->contact, invocation->proxy_id, message); @@ -3220,7 +3220,7 @@ static void _service_destroyed (ServiceData *data, void *stale_service_ptr) { - YtsgClientPrivate *priv = data->client->priv; + YtsClientPrivate *priv = data->client->priv; g_hash_table_remove (priv->services, data->capability); service_data_destroy (data); @@ -3230,36 +3230,36 @@ _service_destroyed (ServiceData *data, * A bit hacky for now, so we don't need to include video-service headers here. */ extern GType -ytsg_vp_player_get_type (void); +yts_vp_player_get_type (void); extern GType -ytsg_vp_player_adapter_get_type (void); +yts_vp_player_adapter_get_type (void); extern GType -ytsg_vp_transcript_get_type (void); +yts_vp_transcript_get_type (void); extern GType -ytsg_vp_transcript_adapter_get_type (void); +yts_vp_transcript_adapter_get_type (void); -static YtsgServiceAdapter * -create_adapter_for_service (YtsgClient *self, - YtsgCapability *service, +static YtsServiceAdapter * +create_adapter_for_service (YtsClient *self, + YtsCapability *service, char const *fqc_id) { GType service_type; service_type = G_OBJECT_TYPE (service); if (0 == g_strcmp0 (fqc_id, "org.freedesktop.ytstenut.VideoProfile.Player") && - g_type_is_a (service_type, ytsg_vp_player_get_type ())) { + g_type_is_a (service_type, yts_vp_player_get_type ())) { - return g_object_new (ytsg_vp_player_adapter_get_type (), + return g_object_new (yts_vp_player_adapter_get_type (), "service", service, NULL); } else if (0 == g_strcmp0 (fqc_id, "org.freedesktop.ytstenut.VideoProfile.Transcript") && - g_type_is_a (service_type, ytsg_vp_transcript_get_type ())) { + g_type_is_a (service_type, yts_vp_transcript_get_type ())) { - return g_object_new (ytsg_vp_transcript_adapter_get_type (), + return g_object_new (yts_vp_transcript_adapter_get_type (), "service", service, NULL); } @@ -3277,20 +3277,20 @@ create_adapter_for_service (YtsgClient *self, * unregistered upon destruction. */ gboolean -ytsg_client_register_service (YtsgClient *self, - YtsgCapability *service) +yts_client_register_service (YtsClient *self, + YtsCapability *service) { - YtsgClientPrivate *priv = self->priv; - YtsgServiceAdapter *adapter; - YtsgProfileImpl *profile_impl; + YtsClientPrivate *priv = self->priv; + YtsServiceAdapter *adapter; + YtsProfileImpl *profile_impl; ServiceData *service_data; char **fqc_ids; unsigned i; - g_return_val_if_fail (YTSG_IS_CLIENT (self), FALSE); - g_return_val_if_fail (YTSG_IS_CAPABILITY (service), FALSE); + g_return_val_if_fail (YTS_IS_CLIENT (self), FALSE); + g_return_val_if_fail (YTS_IS_CAPABILITY (service), FALSE); - fqc_ids = ytsg_capability_get_fqc_ids (service); + fqc_ids = yts_capability_get_fqc_ids (service); /* Check that capabilities are not implemented yet. */ for (i = 0; fqc_ids[i] != NULL; i++) { @@ -3328,17 +3328,17 @@ ytsg_client_register_service (YtsgClient *self, g_hash_table_insert (priv->services, g_strdup (fqc_ids[i]), adapter); - ytsg_client_set_capabilities (self, g_quark_from_string (fqc_ids[i])); + yts_client_set_capabilities (self, g_quark_from_string (fqc_ids[i])); /* Keep the proxy management service up to date. */ - adapter = g_hash_table_lookup (priv->services, YTSG_PROFILE_FQC_ID); + adapter = g_hash_table_lookup (priv->services, YTS_PROFILE_FQC_ID); if (NULL == adapter) { - profile_impl = ytsg_profile_impl_new (self); - adapter = g_object_new (YTSG_TYPE_PROFILE_ADAPTER, + profile_impl = yts_profile_impl_new (self); + adapter = g_object_new (YTS_TYPE_PROFILE_ADAPTER, "service", profile_impl, NULL); g_hash_table_insert (priv->services, - g_strdup (YTSG_PROFILE_FQC_ID), + g_strdup (YTS_PROFILE_FQC_ID), adapter); g_signal_connect (adapter, "error", @@ -3349,13 +3349,13 @@ ytsg_client_register_service (YtsgClient *self, G_CALLBACK (_adapter_response), self); } else { - profile_impl = YTSG_PROFILE_IMPL ( - ytsg_service_adapter_get_service (adapter)); + profile_impl = YTS_PROFILE_IMPL ( + yts_service_adapter_get_service (adapter)); /* Not nice, but it's still referenced by the adapter. */ g_object_unref (profile_impl); } - ytsg_profile_impl_add_capability (profile_impl, fqc_ids[i]); + yts_profile_impl_add_capability (profile_impl, fqc_ids[i]); } g_strfreev (fqc_ids); @@ -3364,10 +3364,10 @@ ytsg_client_register_service (YtsgClient *self, } void -ytsg_client_cleanup_contact (YtsgClient *self, - YtsgContact const *contact) +yts_client_cleanup_contact (YtsClient *self, + YtsContact const *contact) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; GHashTableIter iter; bool start_over; @@ -3418,15 +3418,15 @@ ytsg_client_cleanup_contact (YtsgClient *self, } void -ytsg_client_cleanup_service (YtsgClient *self, - YtsgService *service) +yts_client_cleanup_service (YtsClient *self, + YtsService *service) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; char const *service_id; GHashTableIter iter; bool start_over; - service_id = ytsg_service_get_uid (service); + service_id = yts_service_get_uid (service); /* * Clear pending responses. @@ -3475,15 +3475,15 @@ ytsg_client_cleanup_service (YtsgClient *self, } bool -ytsg_client_get_invocation_proxy (YtsgClient *self, +yts_client_get_invocation_proxy (YtsClient *self, char const *invocation_id, - YtsgContact **contact, + YtsContact **contact, char const **proxy_id) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; InvocationData const *invocation; - g_return_val_if_fail (YTSG_IS_CLIENT (self), false); + g_return_val_if_fail (YTS_IS_CLIENT (self), false); g_return_val_if_fail (contact, false); g_return_val_if_fail (proxy_id, false); @@ -3497,17 +3497,17 @@ ytsg_client_get_invocation_proxy (YtsgClient *self, } GVariant * -ytsg_client_register_proxy (YtsgClient *self, +yts_client_register_proxy (YtsClient *self, char const *capability, - YtsgContact *contact, + YtsContact *contact, char const *proxy_id) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; ProxyList *proxy_list; - YtsgServiceAdapter *adapter = NULL; + YtsServiceAdapter *adapter = NULL; GVariant *properties = NULL; - g_return_val_if_fail (YTSG_IS_CLIENT (self), false); + g_return_val_if_fail (YTS_IS_CLIENT (self), false); proxy_list = g_hash_table_lookup (priv->proxies, capability); if (NULL == proxy_list) { @@ -3524,7 +3524,7 @@ ytsg_client_register_proxy (YtsgClient *self, * object properties as response to the register-proxy invocation. */ adapter = g_hash_table_lookup (priv->services, capability); if (adapter) { - properties = ytsg_service_adapter_collect_properties (adapter); + properties = yts_service_adapter_collect_properties (adapter); } else { @@ -3537,14 +3537,14 @@ ytsg_client_register_proxy (YtsgClient *self, } bool -ytsg_client_unregister_proxy (YtsgClient *self, +yts_client_unregister_proxy (YtsClient *self, char const *capability, char const *proxy_id) { - YtsgClientPrivate *priv = self->priv; + YtsClientPrivate *priv = self->priv; ProxyList *proxy_list; - g_return_val_if_fail (YTSG_IS_CLIENT (self), false); + g_return_val_if_fail (YTS_IS_CLIENT (self), false); proxy_list = g_hash_table_lookup (priv->proxies, capability); if (NULL == proxy_list) { diff --git a/ytstenut/yts-client.h b/ytstenut/yts-client.h new file mode 100644 index 0000000..f661778 --- /dev/null +++ b/ytstenut/yts-client.h @@ -0,0 +1,158 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_CLIENT_H +#define _YTS_CLIENT_H + +#include <stdbool.h> +#include <glib-object.h> +#include <telepathy-glib/channel.h> + +#include <ytstenut/yts-capability.h> +#include <ytstenut/yts-caps.h> +#include <ytstenut/yts-error.h> +#include <ytstenut/yts-message.h> +#include <ytstenut/yts-roster.h> +#include <ytstenut/yts-types.h> +#include <ytstenut/yts-status.h> + + +G_BEGIN_DECLS + +#define YTS_TYPE_CLIENT \ + (yts_client_get_type()) +#define YTS_CLIENT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_CLIENT, \ + YtsClient)) +#define YTS_CLIENT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_CLIENT, \ + YtsClientClass)) +#define YTS_IS_CLIENT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_CLIENT)) +#define YTS_IS_CLIENT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_CLIENT)) +#define YTS_CLIENT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_CLIENT, \ + YtsClientClass)) + +typedef struct _YtsClientClass YtsClientClass; +typedef struct _YtsClientPrivate YtsClientPrivate; + +/** + * YtsClientClass: + * @authenticated: signal handler for #YtsClient::authenticated + * @ready: signal handler for #YtsClient::ready + * @disconnected: signal handler for #YtsClient::disconnected + * @message: signal handler for #YtsClient::message + * @incoming_file: signal handler for #YtsClient::incoming-file + * + * Class for #YtsClient + */ +struct _YtsClientClass +{ + /*< private >*/ + GObjectClass parent_class; + + /*< public >*/ + void (*authenticated) (YtsClient *client); + void (*ready) (YtsClient *client); + void (*disconnected) (YtsClient *client); + void (*message) (YtsClient *client, YtsMessage *msg); + gboolean (*incoming_file) (YtsClient *client, + const char *from, + const char *name, + guint64 size, + guint64 offset, + TpChannel *channel); +}; + +/** + * YtsClient: + * + * Class representing an application connection to the Ytstenut mesh. + */ +struct _YtsClient +{ + /*< private >*/ + GObject parent; + + YtsClientPrivate *priv; +}; + +GType yts_client_get_type (void) G_GNUC_CONST; + +YtsClient *yts_client_new (YtsProtocol protocol, const char *uid); + +void yts_client_disconnect (YtsClient *client); +void yts_client_connect (YtsClient *client); +void yts_client_set_capabilities (YtsClient *client, YtsCaps caps); +YtsRoster *yts_client_get_roster (YtsClient *client); +void yts_client_emit_error (YtsClient *client, YtsError error); +void yts_client_set_incoming_file_directory (YtsClient *client, + const char *directory); +const char *yts_client_get_incoming_file_directory (YtsClient *client); +const char *yts_client_get_jid (const YtsClient *client); +const char *yts_client_get_uid (const YtsClient *client); +void yts_client_set_status (YtsClient *client, YtsStatus *status); +void yts_client_set_status_by_capability (YtsClient *client, + const char *capability, + const char *activity); + +gboolean +yts_client_register_service (YtsClient *self, + YtsCapability *service); + +/* Protected */ + +void +yts_client_cleanup_contact (YtsClient *self, + YtsContact const *contact); + +void +yts_client_cleanup_service (YtsClient *self, + YtsService *service); + +bool +yts_client_get_invocation_proxy (YtsClient *self, + char const *invocation_id, + YtsContact **contact, + char const **proxy_id); + +GVariant * +yts_client_register_proxy (YtsClient *self, + char const *capability, + YtsContact *contact, + char const *proxy_id); + +bool +yts_client_unregister_proxy (YtsClient *self, + char const *capability, + char const *proxy_id); + +G_END_DECLS + +#endif /* _YTS_CLIENT_H */ + diff --git a/ytstenut/ytsg-contact.c b/ytstenut/yts-contact.c index c7ce2bb..806885a 100644 --- a/ytstenut/ytsg-contact.c +++ b/ytstenut/yts-contact.c @@ -20,11 +20,11 @@ */ /** - * SECTION:ytsg-contact + * SECTION:yts-contact * @short_description: Represents a device connected to the * Ytstenut mesh. * - * #YtsgContact represents a known device in the Ytstenut application mesh, + * #YtsContact represents a known device in the Ytstenut application mesh, * and provides access to any services (#YtsService) available on the device. */ @@ -37,51 +37,51 @@ #include <telepathy-glib/dbus.h> #include <telepathy-glib/channel.h> -#include "ytsg-client.h" -#include "ytsg-contact.h" -#include "ytsg-debug.h" -#include "ytsg-enum-types.h" -#include "ytsg-error.h" -#include "ytsg-marshal.h" -#include "ytsg-private.h" -#include "ytsg-proxy-service.h" -#include "ytsg-types.h" +#include "yts-client.h" +#include "yts-contact.h" +#include "yts-debug.h" +#include "yts-enum-types.h" +#include "yts-error.h" +#include "yts-marshal.h" +#include "yts-private.h" +#include "yts-proxy-service.h" +#include "yts-types.h" #include "empathy-tp-file.h" -static void ytsg_c_pending_file_free (gpointer file); +static void yts_c_pending_file_free (gpointer file); -static void ytsg_contact_dispose (GObject *object); -static void ytsg_contact_finalize (GObject *object); -static void ytsg_contact_constructed (GObject *object); -static void ytsg_contact_get_property (GObject *object, +static void yts_contact_dispose (GObject *object); +static void yts_contact_finalize (GObject *object); +static void yts_contact_constructed (GObject *object); +static void yts_contact_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_contact_set_property (GObject *object, +static void yts_contact_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void ytsg_contact_avatar_file_cb (TpContact *contact, +static void yts_contact_avatar_file_cb (TpContact *contact, GParamSpec *param, - YtsgContact *ycontact); + YtsContact *ycontact); -G_DEFINE_TYPE (YtsgContact, ytsg_contact, G_TYPE_OBJECT); +G_DEFINE_TYPE (YtsContact, yts_contact, G_TYPE_OBJECT); -#define YTSG_CONTACT_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_CONTACT, YtsgContactPrivate)) +#define YTS_CONTACT_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_CONTACT, YtsContactPrivate)) -struct _YtsgContactPrivate +struct _YtsContactPrivate { const char *jid; - GHashTable *services; /* hash of YtsgService instances */ - TpContact *tp_contact; /* TpContact associated with YtsgContact */ + GHashTable *services; /* hash of YtsService instances */ + TpContact *tp_contact; /* TpContact associated with YtsContact */ char *icon_token; /* token identifying this contacts avatar */ - YtsgClient *client; /* back-reference to the client that owns us */ - YtsgPresence presence; /* presence state of this client */ + YtsClient *client; /* back-reference to the client that owns us */ + YtsPresence presence; /* presence state of this client */ GQueue *pending_files; /* files dispatched before channel open */ GHashTable *ft_cancellables; @@ -113,10 +113,10 @@ static guint signals[N_SIGNALS] = {0}; static GParamSpec *properties[PROP_LAST]; static void -ytsg_contact_service_added (YtsgContact *contact, YtsgService *service) +yts_contact_service_added (YtsContact *contact, YtsService *service) { - YtsgContactPrivate *priv = contact->priv; - const char *uid = ytsg_service_get_uid (service); + YtsContactPrivate *priv = contact->priv; + const char *uid = yts_service_get_uid (service); g_return_if_fail (uid && *uid); g_return_if_fail (!g_hash_table_lookup (priv->services, uid)); @@ -127,37 +127,37 @@ ytsg_contact_service_added (YtsgContact *contact, YtsgService *service) } static void -ytsg_contact_service_removed (YtsgContact *contact, YtsgService *service) +yts_contact_service_removed (YtsContact *contact, YtsService *service) { - YtsgContactPrivate *priv = contact->priv; - const char *uid = ytsg_service_get_uid (service); + YtsContactPrivate *priv = contact->priv; + const char *uid = yts_service_get_uid (service); g_return_if_fail (uid && *uid); - ytsg_client_cleanup_service (priv->client, service); + yts_client_cleanup_service (priv->client, service); if (!g_hash_table_remove (priv->services, uid)) g_warning (G_STRLOC ": unknown service with uid %s", uid); } static void -ytsg_contact_class_init (YtsgContactClass *klass) +yts_contact_class_init (YtsContactClass *klass) { GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgContactPrivate)); + g_type_class_add_private (klass, sizeof (YtsContactPrivate)); - object_class->dispose = ytsg_contact_dispose; - object_class->finalize = ytsg_contact_finalize; - object_class->constructed = ytsg_contact_constructed; - object_class->get_property = ytsg_contact_get_property; - object_class->set_property = ytsg_contact_set_property; + object_class->dispose = yts_contact_dispose; + object_class->finalize = yts_contact_finalize; + object_class->constructed = yts_contact_constructed; + object_class->get_property = yts_contact_get_property; + object_class->set_property = yts_contact_set_property; - klass->service_added = ytsg_contact_service_added; - klass->service_removed = ytsg_contact_service_removed; + klass->service_added = yts_contact_service_added; + klass->service_removed = yts_contact_service_removed; /** - * YtsgContact:icon: + * YtsContact:icon: * * Icon for this item. * @@ -175,34 +175,34 @@ ytsg_contact_class_init (YtsgContactClass *klass) properties[PROP_ICON]); /** - * YtsgContact:client: + * YtsContact:client: * - * #YtsgClient that owns the roster + * #YtsClient that owns the roster */ properties[PROP_CLIENT] = g_param_spec_object ("client", "Client", "Client", - YTSG_TYPE_CLIENT, + YTS_TYPE_CLIENT, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (object_class, PROP_CLIENT, properties[PROP_CLIENT]); /** - * YtsgContact:presence: + * YtsContact:presence: * - * #YtsgPresence state for this contact + * #YtsPresence state for this contact */ properties[PROP_PRESENCE] = g_param_spec_enum ("presence", - "YtsgPresence", - "YtsgPresence", - YTSG_TYPE_PRESENCE, - YTSG_PRESENCE_UNAVAILABLE, + "YtsPresence", + "YtsPresence", + YTS_TYPE_PRESENCE, + YTS_PRESENCE_UNAVAILABLE, G_PARAM_READABLE); g_object_class_install_property (object_class, PROP_PRESENCE, properties[PROP_PRESENCE]); /** - * YtsgContact:jid: + * YtsContact:jid: * * The jid of this contact */ @@ -215,7 +215,7 @@ ytsg_contact_class_init (YtsgContactClass *klass) properties[PROP_JID]); /** - * YtsgContact:tp-contact: + * YtsContact:tp-contact: * * #TpContact of this item. */ @@ -229,7 +229,7 @@ ytsg_contact_class_init (YtsgContactClass *klass) /** - * YtsgContact::service-added: + * YtsContact::service-added: * @contact: the contact which received the signal * @service: the service * @@ -242,14 +242,14 @@ ytsg_contact_class_init (YtsgContactClass *klass) g_signal_new (I_("service-added"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (YtsgContactClass, service_added), + G_STRUCT_OFFSET (YtsContactClass, service_added), NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_SERVICE); + YTS_TYPE_SERVICE); /** - * YtsgContact::service-removed: + * YtsContact::service-removed: * @contact: the contact which received the signal * @service: the service * @@ -262,24 +262,24 @@ ytsg_contact_class_init (YtsgContactClass *klass) g_signal_new (I_("service-removed"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgContactClass, service_removed), + G_STRUCT_OFFSET (YtsContactClass, service_removed), NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_SERVICE); + YTS_TYPE_SERVICE); } static void -ytsg_contact_presence_cb (TpContact *tp_contact, +yts_contact_presence_cb (TpContact *tp_contact, guint type, gchar *status, gchar *message, - YtsgContact *contact) + YtsContact *contact) { - YtsgContactPrivate *priv = contact->priv; - YtsgPresence presence; + YtsContactPrivate *priv = contact->priv; + YtsPresence presence; - YTSG_NOTE (CONTACT, "Presence for %s changed: %s [%s]", + YTS_NOTE (CONTACT, "Presence for %s changed: %s [%s]", tp_contact_get_identifier (tp_contact), status, message); @@ -295,13 +295,13 @@ ytsg_contact_presence_cb (TpContact *tp_contact, case TP_CONNECTION_PRESENCE_TYPE_BUSY: case TP_CONNECTION_PRESENCE_TYPE_HIDDEN: default: - presence = YTSG_PRESENCE_AVAILABLE; + presence = YTS_PRESENCE_AVAILABLE; break; case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN: case TP_CONNECTION_PRESENCE_TYPE_OFFLINE: case TP_CONNECTION_PRESENCE_TYPE_ERROR: - presence = YTSG_PRESENCE_UNAVAILABLE; + presence = YTS_PRESENCE_UNAVAILABLE; } if (priv->presence != presence) @@ -312,7 +312,7 @@ ytsg_contact_presence_cb (TpContact *tp_contact, } static void -ytsg_contact_tp_contact_cb (TpConnection *connection, +yts_contact_tp_contact_cb (TpConnection *connection, guint n_contacts, TpContact * const *contacts, const char * const *requesed_ids, @@ -321,8 +321,8 @@ ytsg_contact_tp_contact_cb (TpConnection *connection, gpointer data, GObject *object) { - YtsgContact *contact = (YtsgContact*) object; - YtsgContactPrivate *priv = contact->priv; + YtsContact *contact = (YtsContact*) object; + YtsContactPrivate *priv = contact->priv; if (error) { @@ -330,7 +330,7 @@ ytsg_contact_tp_contact_cb (TpConnection *connection, return; } - YTSG_NOTE (CONTACT, "Got TpContact for %s", priv->jid); + YTS_NOTE (CONTACT, "Got TpContact for %s", priv->jid); priv->tp_contact = g_object_ref (contacts[0]); @@ -339,11 +339,11 @@ ytsg_contact_tp_contact_cb (TpConnection *connection, * if the contact goes off line. */ tp_g_signal_connect_object (priv->tp_contact, "presence-changed", - G_CALLBACK (ytsg_contact_presence_cb), + G_CALLBACK (yts_contact_presence_cb), contact, 0); tp_g_signal_connect_object (priv->tp_contact, "notify::avatar-file", - G_CALLBACK (ytsg_contact_avatar_file_cb), + G_CALLBACK (yts_contact_avatar_file_cb), contact, 0); g_object_notify_by_pspec ((GObject*)contact, @@ -351,44 +351,44 @@ ytsg_contact_tp_contact_cb (TpConnection *connection, } static void -ytsg_contact_constructed (GObject *object) +yts_contact_constructed (GObject *object) { TpConnection *connection; - YtsgContact *contact = (YtsgContact*) object; - YtsgContactPrivate *priv = contact->priv; + YtsContact *contact = (YtsContact*) object; + YtsContactPrivate *priv = contact->priv; TpContactFeature features[] = { TP_CONTACT_FEATURE_PRESENCE, TP_CONTACT_FEATURE_CONTACT_INFO, TP_CONTACT_FEATURE_AVATAR_DATA, TP_CONTACT_FEATURE_CAPABILITIES}; - if (G_OBJECT_CLASS (ytsg_contact_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_contact_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_contact_parent_class)->constructed) + G_OBJECT_CLASS (yts_contact_parent_class)->constructed (object); - connection = _ytsg_client_get_connection (priv->client); + connection = _yts_client_get_connection (priv->client); g_assert (connection); - YTSG_NOTE (CONTACT, "Requesting TpContact for %s", priv->jid); + YTS_NOTE (CONTACT, "Requesting TpContact for %s", priv->jid); tp_connection_get_contacts_by_id (connection, 1, &priv->jid, G_N_ELEMENTS (features), (const TpContactFeature *)&features, - ytsg_contact_tp_contact_cb, + yts_contact_tp_contact_cb, contact, NULL, (GObject*)contact); } static void -ytsg_contact_get_property (GObject *object, +yts_contact_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - YtsgContact *self = (YtsgContact*) object; - YtsgContactPrivate *priv = self->priv; + YtsContact *self = (YtsContact*) object; + YtsContactPrivate *priv = self->priv; switch (property_id) { @@ -397,7 +397,7 @@ ytsg_contact_get_property (GObject *object, break; case PROP_ICON: { - GFile *file = ytsg_contact_get_icon (self, NULL); + GFile *file = yts_contact_get_icon (self, NULL); g_value_take_object (value, file); g_warning ("Should use ytst_contact_get_icon() instead of querying " @@ -417,11 +417,11 @@ ytsg_contact_get_property (GObject *object, } static void -ytsg_contact_avatar_file_cb (TpContact *contact, +yts_contact_avatar_file_cb (TpContact *contact, GParamSpec *param, - YtsgContact *ycontact) + YtsContact *ycontact) { - YtsgContactPrivate *priv = ycontact->priv; + YtsContactPrivate *priv = ycontact->priv; const char *token = tp_contact_get_avatar_token (contact); if ((priv->icon_token && token && !strcmp (priv->icon_token, token)) || @@ -437,13 +437,13 @@ ytsg_contact_avatar_file_cb (TpContact *contact, } static void -ytsg_contact_set_property (GObject *object, +yts_contact_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - YtsgContact *self = (YtsgContact*) object; - YtsgContactPrivate *priv = self->priv; + YtsContact *self = (YtsContact*) object; + YtsContactPrivate *priv = self->priv; switch (property_id) { @@ -460,11 +460,11 @@ ytsg_contact_set_property (GObject *object, } static void -ytsg_contact_init (YtsgContact *self) +yts_contact_init (YtsContact *self) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; - priv = self->priv = YTSG_CONTACT_GET_PRIVATE (self); + priv = self->priv = YTS_CONTACT_GET_PRIVATE (self); priv->services = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -480,10 +480,10 @@ ytsg_contact_init (YtsgContact *self) } static void -ytsg_contact_dispose (GObject *object) +yts_contact_dispose (GObject *object) { - YtsgContact *self = (YtsgContact*) object; - YtsgContactPrivate *priv = self->priv; + YtsContact *self = (YtsContact*) object; + YtsContactPrivate *priv = self->priv; if (priv->disposed) return; @@ -491,7 +491,7 @@ ytsg_contact_dispose (GObject *object) priv->disposed = TRUE; if (priv->client) { - ytsg_client_cleanup_contact (priv->client, YTSG_CONTACT (object)); + yts_client_cleanup_contact (priv->client, YTS_CONTACT (object)); priv->client = NULL; } @@ -504,37 +504,37 @@ ytsg_contact_dispose (GObject *object) priv->tp_contact = NULL; } - G_OBJECT_CLASS (ytsg_contact_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_contact_parent_class)->dispose (object); } static void -ytsg_contact_finalize (GObject *object) +yts_contact_finalize (GObject *object) { - YtsgContact *self = (YtsgContact*) object; - YtsgContactPrivate *priv = self->priv; + YtsContact *self = (YtsContact*) object; + YtsContactPrivate *priv = self->priv; g_free (priv->icon_token); - g_queue_foreach (priv->pending_files, (GFunc)ytsg_c_pending_file_free, NULL); + g_queue_foreach (priv->pending_files, (GFunc)yts_c_pending_file_free, NULL); g_queue_free (priv->pending_files); - G_OBJECT_CLASS (ytsg_contact_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_contact_parent_class)->finalize (object); } /** - * ytsg_contact_get_jid: - * @contact: #YtsgContact + * yts_contact_get_jid: + * @contact: #YtsContact * * Retrieves the jabber identifier of this contact. * * Return value: (transfer none): The jid of this contact. */ const char * -ytsg_contact_get_jid (const YtsgContact *contact) +yts_contact_get_jid (const YtsContact *contact) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; - g_return_val_if_fail (YTSG_IS_CONTACT (contact), NULL); + g_return_val_if_fail (YTS_IS_CONTACT (contact), NULL); priv = contact->priv; @@ -544,15 +544,15 @@ ytsg_contact_get_jid (const YtsgContact *contact) } /** - * ytsg_contact_get_name: - * @contact: #YtsgContact + * yts_contact_get_name: + * @contact: #YtsContact * * Retrieves human readable name of this client * * Return value: (transfer none): The name of this contact. */ const char * -ytsg_contact_get_name (const YtsgContact *contact) +yts_contact_get_name (const YtsContact *contact) { /* FIXME -- */ g_warning (G_STRLOC ": %s is not implemented", __FUNCTION__); @@ -560,8 +560,8 @@ ytsg_contact_get_name (const YtsgContact *contact) } /** - * ytsg_contact_get_icon: - * @contact: #YtsgContact + * yts_contact_get_icon: + * @contact: #YtsContact * @mime: (transfer none): location to store a pointer to the icon mime type * * Retrieves icon of this contact. If the mime parameter is provided, on return @@ -573,12 +573,12 @@ ytsg_contact_get_name (const YtsgContact *contact) * it when no longer needed with g_object_unref(). */ GFile * -ytsg_contact_get_icon (const YtsgContact *contact, const char **mime) +yts_contact_get_icon (const YtsContact *contact, const char **mime) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; GFile *file; - g_return_val_if_fail (YTSG_IS_CONTACT (contact), NULL); + g_return_val_if_fail (YTS_IS_CONTACT (contact), NULL); priv = contact->priv; @@ -592,34 +592,34 @@ ytsg_contact_get_icon (const YtsgContact *contact, const char **mime) return g_object_ref (file); } -YtsgContact * -_ytsg_contact_new (YtsgClient *client, const char *jid) +YtsContact * +_yts_contact_new (YtsClient *client, const char *jid) { - g_return_val_if_fail (YTSG_IS_CLIENT (client), NULL); + g_return_val_if_fail (YTS_IS_CLIENT (client), NULL); g_return_val_if_fail (jid && *jid, NULL); - return g_object_new (YTSG_TYPE_CONTACT, + return g_object_new (YTS_TYPE_CONTACT, "client", client, "jid", jid, NULL); } /** - * ytsg_contact_get_tp_contact: - * @contact: #YtsgContact + * yts_contact_get_tp_contact: + * @contact: #YtsContact * - * Retrieves the #TpContact associated with this #YtsgContact object; can be - * %NULL. When the #TpContact is available, the YtsgContact::notify-tp-contact + * Retrieves the #TpContact associated with this #YtsContact object; can be + * %NULL. When the #TpContact is available, the YtsContact::notify-tp-contact * signal will be emitted. * * Return value (transfer none): The associated #TpContact. */ TpContact * -ytsg_contact_get_tp_contact (const YtsgContact *contact) +yts_contact_get_tp_contact (const YtsContact *contact) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; - g_return_val_if_fail (YTSG_IS_CONTACT (contact), NULL); + g_return_val_if_fail (YTS_IS_CONTACT (contact), NULL); priv = contact->priv; @@ -629,19 +629,19 @@ ytsg_contact_get_tp_contact (const YtsgContact *contact) } /** - * ytsg_contact_get_client: - * @contact: #YtsgContact + * yts_contact_get_client: + * @contact: #YtsContact * - * Retrieves the #YtsgClient associated with this #YtsgContact object. + * Retrieves the #YtsClient associated with this #YtsContact object. * - * Return value (transfer none): The associated #YtsgClient. + * Return value (transfer none): The associated #YtsClient. */ -YtsgClient * -ytsg_contact_get_client (const YtsgContact *contact) +YtsClient * +yts_contact_get_client (const YtsContact *contact) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; - g_return_val_if_fail (YTSG_IS_CONTACT (contact), NULL); + g_return_val_if_fail (YTS_IS_CONTACT (contact), NULL); priv = contact->priv; @@ -651,9 +651,9 @@ ytsg_contact_get_client (const YtsgContact *contact) } /** - * ytsg_contact_has_capability: - * @item: #YtsgContact, - * @cap: #YtsgCaps, capability to check for. + * yts_contact_has_capability: + * @item: #YtsContact, + * @cap: #YtsCaps, capability to check for. * * Checks whether the contact has the given capability. * @@ -661,7 +661,7 @@ ytsg_contact_get_client (const YtsgContact *contact) * otherwise. */ gboolean -ytsg_contact_has_capability (const YtsgContact *item, YtsgCaps cap) +yts_contact_has_capability (const YtsContact *item, YtsCaps cap) { g_critical (G_STRLOC ": NOT IMPLEMENTED!!!"); @@ -669,7 +669,7 @@ ytsg_contact_has_capability (const YtsgContact *item, YtsgCaps cap) } static gboolean -ytsg_contact_find_cancellable_cb (gpointer key, +yts_contact_find_cancellable_cb (gpointer key, gpointer value, gpointer data) { @@ -687,15 +687,15 @@ ytsg_contact_find_cancellable_cb (gpointer key, typedef struct { - YtsgContact *item; + YtsContact *item; guint32 atom; -} YtsgCFtOp; +} YtsCFtOp; -static YtsgCFtOp * -ytsg_c_ft_op_new (YtsgContact *item, guint32 atom) +static YtsCFtOp * +yts_c_ft_op_new (YtsContact *item, guint32 atom) { - YtsgCFtOp *o = g_slice_new (YtsgCFtOp); + YtsCFtOp *o = g_slice_new (YtsCFtOp); o->item = item; o->atom = atom; @@ -704,68 +704,68 @@ ytsg_c_ft_op_new (YtsgContact *item, guint32 atom) } static void -ytsg_c_ft_op_free (gpointer op) +yts_c_ft_op_free (gpointer op) { - YtsgCFtOp *o = op; + YtsCFtOp *o = op; - g_slice_free (YtsgCFtOp, o); + g_slice_free (YtsCFtOp, o); } static void -ytsg_contact_ft_op_cb (EmpathyTpFile *tp_file, +yts_contact_ft_op_cb (EmpathyTpFile *tp_file, const GError *error, gpointer data) { GCancellable *cancellable; - YtsgError e; - YtsgCFtOp *op = data; - YtsgContact *item = op->item; - YtsgContactPrivate *priv = item->priv; - YtsgClient *client = priv->client; + YtsError e; + YtsCFtOp *op = data; + YtsContact *item = op->item; + YtsContactPrivate *priv = item->priv; + YtsClient *client = priv->client; guint32 atom = op->atom; if (error) { - e = (atom | YTSG_ERROR_UNKNOWN); + e = (atom | YTS_ERROR_UNKNOWN); g_warning ("File transfer to %s failed: %s", - ytsg_contact_get_jid (item), error->message); + yts_contact_get_jid (item), error->message); } else - e = (atom | YTSG_ERROR_SUCCESS); + e = (atom | YTS_ERROR_SUCCESS); if ((cancellable = empathy_tp_file_get_cancellable (tp_file))) { gpointer the_thing = cancellable; if (g_hash_table_find (priv->ft_cancellables, - ytsg_contact_find_cancellable_cb, + yts_contact_find_cancellable_cb, &the_thing)) { g_hash_table_remove (priv->ft_cancellables, the_thing); } } - ytsg_c_ft_op_free (op); - ytsg_client_emit_error (client, e); + yts_c_ft_op_free (op); + yts_client_emit_error (client, e); } typedef struct { - const YtsgContact *item; + const YtsContact *item; TpChannel *ft_channel; GFile *file; char *name; guint32 atom; -} YtsgCPendingFile; +} YtsCPendingFile; -static YtsgCPendingFile * -ytsg_c_pending_file_new (const YtsgContact *item, +static YtsCPendingFile * +yts_c_pending_file_new (const YtsContact *item, GFile *gfile, const char *name, guint32 atom) { - YtsgCPendingFile *m = g_slice_new (YtsgCPendingFile); + YtsCPendingFile *m = g_slice_new (YtsCPendingFile); m->item = item; m->name = g_strdup (name); @@ -777,29 +777,29 @@ ytsg_c_pending_file_new (const YtsgContact *item, } static void -ytsg_c_pending_file_free (gpointer file) +yts_c_pending_file_free (gpointer file) { - YtsgCPendingFile *m = file; + YtsCPendingFile *m = file; g_object_unref (m->file); g_free (m->name); - g_slice_free (YtsgCPendingFile, m); + g_slice_free (YtsCPendingFile, m); } -static YtsgError -ytsg_c_dispatch_file (YtsgCPendingFile *file) +static YtsError +yts_c_dispatch_file (YtsCPendingFile *file) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; EmpathyTpFile *tp_file; GCancellable *cancellable; - YtsgCFtOp *op; + YtsCFtOp *op; g_return_val_if_fail (file && file->item && file->ft_channel && file->file, - YTSG_ERROR_INVALID_PARAMETER); + YTS_ERROR_INVALID_PARAMETER); priv = file->item->priv; - op = ytsg_c_ft_op_new ((YtsgContact*)file->item, file->atom); + op = yts_c_ft_op_new ((YtsContact*)file->item, file->atom); tp_file = empathy_tp_file_new (file->ft_channel, FALSE); @@ -810,20 +810,20 @@ ytsg_c_dispatch_file (YtsgCPendingFile *file) cancellable, NULL /*progress_callback*/, NULL /*progress_user_data*/, - ytsg_contact_ft_op_cb, + yts_contact_ft_op_cb, (gpointer) op); g_hash_table_insert (priv->ft_cancellables, g_file_get_path (file->file), cancellable); - return (file->atom | YTSG_ERROR_PENDING); + return (file->atom | YTS_ERROR_PENDING); } static void -ytsg_contact_ft_channel_ready_cb (TpChannel *channel, +yts_contact_ft_channel_ready_cb (TpChannel *channel, GParamSpec *pspec, - YtsgCPendingFile *file) + YtsCPendingFile *file) { /* * NB: we cannot use here tp_is_proxy_prepared(), as the proxy flag is not @@ -832,41 +832,41 @@ ytsg_contact_ft_channel_ready_cb (TpChannel *channel, if (!tp_channel_is_ready (channel)) return; - YTSG_NOTE (FILE_TRANSFER, "The FT channel is ready"); + YTS_NOTE (FILE_TRANSFER, "The FT channel is ready"); - ytsg_c_dispatch_file (file); - ytsg_c_pending_file_free (file); + yts_c_dispatch_file (file); + yts_c_pending_file_free (file); /* * This is one off. */ g_signal_handlers_disconnect_by_func (channel, - ytsg_contact_ft_channel_ready_cb, file); + yts_contact_ft_channel_ready_cb, file); } static int -ytsg_contact_find_file_cb (gconstpointer a, gconstpointer b) +yts_contact_find_file_cb (gconstpointer a, gconstpointer b) { - const YtsgCPendingFile *A = a; + const YtsCPendingFile *A = a; const char *name = b; return g_strcmp0 (A->name, name); } static void -ytsg_contact_do_set_ft_channel (YtsgContact *item, +yts_contact_do_set_ft_channel (YtsContact *item, TpChannel *channel, const char *name) { - YtsgContactPrivate *priv = item->priv; - YtsgCPendingFile *file; + YtsContactPrivate *priv = item->priv; + YtsCPendingFile *file; GList *l; g_return_if_fail (!priv->disposed); if (!(l = g_queue_find_custom (priv->pending_files, name, - ytsg_contact_find_file_cb))) + yts_contact_find_file_cb))) { return; } @@ -882,25 +882,25 @@ ytsg_contact_do_set_ft_channel (YtsgContact *item, */ if (tp_proxy_is_prepared (channel, TP_CHANNEL_FEATURE_CORE)) { - ytsg_c_dispatch_file (file); - ytsg_c_pending_file_free (file); + yts_c_dispatch_file (file); + yts_c_pending_file_free (file); } else { g_signal_connect (channel, "notify::channel-ready", - G_CALLBACK (ytsg_contact_ft_channel_ready_cb), + G_CALLBACK (yts_contact_ft_channel_ready_cb), file); } } static void -ytsg_contact_ft_filename_cb (TpProxy *proxy, +yts_contact_ft_filename_cb (TpProxy *proxy, const GValue *value, const GError *error, gpointer data, GObject *weak_object) { - YtsgContact *item = data; + YtsContact *item = data; const char *name; if (error) @@ -911,20 +911,20 @@ ytsg_contact_ft_filename_cb (TpProxy *proxy, name = g_value_get_string (value); - ytsg_contact_do_set_ft_channel (item, (TpChannel*)proxy, name); + yts_contact_do_set_ft_channel (item, (TpChannel*)proxy, name); } /* - * ytsg_contact_set_ft_channel: - * @item: #YtsgContact, + * yts_contact_set_ft_channel: + * @item: #YtsContact, * @channel: #TpChannel * * Sets the channel file transfer item for this item. */ void -_ytsg_contact_set_ft_channel (YtsgContact *item, TpChannel *channel) +_yts_contact_set_ft_channel (YtsContact *item, TpChannel *channel) { - YtsgContactPrivate *priv = item->priv; + YtsContactPrivate *priv = item->priv; g_return_if_fail (!priv->disposed); @@ -932,14 +932,14 @@ _ytsg_contact_set_ft_channel (YtsgContact *item, TpChannel *channel) -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, "Filename", - ytsg_contact_ft_filename_cb, + yts_contact_ft_filename_cb, item, NULL, (GObject*) item); } static void -ytsg_contact_create_ft_channel_cb (TpConnection *proxy, +yts_contact_create_ft_channel_cb (TpConnection *proxy, const char *channel, GHashTable *properties, const GError *error, @@ -948,37 +948,37 @@ ytsg_contact_create_ft_channel_cb (TpConnection *proxy, { if (error) { - YtsgContact *item = YTSG_CONTACT (weak_object); - YtsgCPendingFile *file = data; - YtsgError e = (YTSG_ERROR_NO_ROUTE | file->atom); + YtsContact *item = YTS_CONTACT (weak_object); + YtsCPendingFile *file = data; + YtsError e = (YTS_ERROR_NO_ROUTE | file->atom); - ytsg_client_emit_error (item->priv->client, e); + yts_client_emit_error (item->priv->client, e); g_warning ("Failed to open channel: %s", error->message); } } -static YtsgError -ytsg_contact_do_send_file (const YtsgContact *item, GFile *gfile, guint32 atom) +static YtsError +yts_contact_do_send_file (const YtsContact *item, GFile *gfile, guint32 atom) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; const char *content_type = "binary"; GFileInfo *finfo; GError *error = NULL; - YtsgCPendingFile *file; + YtsCPendingFile *file; GHashTable *request; TpConnection *conn; guint handle; - g_return_val_if_fail (YTSG_IS_CONTACT (item) && gfile, - YTSG_ERROR_INVALID_PARAMETER); + g_return_val_if_fail (YTS_IS_CONTACT (item) && gfile, + YTS_ERROR_INVALID_PARAMETER); priv = item->priv; - g_return_val_if_fail (!priv->disposed, YTSG_ERROR_OBJECT_DISPOSED); + g_return_val_if_fail (!priv->disposed, YTS_ERROR_OBJECT_DISPOSED); if (!priv->tp_contact) - return YTSG_ERROR_NO_ROUTE; + return YTS_ERROR_NO_ROUTE; finfo = g_file_query_info (gfile, "standard::*", @@ -990,10 +990,10 @@ ytsg_contact_do_send_file (const YtsgContact *item, GFile *gfile, guint32 atom) { g_warning ("Unable to query file, %s", error->message); g_clear_error (&error); - return YTSG_ERROR_INVALID_PARAMETER; + return YTS_ERROR_INVALID_PARAMETER; } - file = ytsg_c_pending_file_new (item, gfile, + file = yts_c_pending_file_new (item, gfile, g_file_info_get_display_name (finfo), atom); g_queue_push_tail (priv->pending_files, file); @@ -1029,32 +1029,32 @@ ytsg_contact_do_send_file (const YtsgContact *item, GFile *gfile, guint32 atom) tp_cli_connection_interface_requests_call_create_channel (conn, -1, request, - ytsg_contact_create_ft_channel_cb, + yts_contact_create_ft_channel_cb, file, NULL, (GObject*)item); g_object_unref (finfo); - return (atom & YTSG_ERROR_PENDING); + return (atom & YTS_ERROR_PENDING); } -struct YtsgContactFTData +struct YtsContactFTData { GFile *gfile; guint32 atom; }; static void -ytsg_contact_notify_tp_contact_cb (YtsgContact *contact, +yts_contact_notify_tp_contact_cb (YtsContact *contact, GParamSpec *pspec, - struct YtsgContactFTData *d) + struct YtsContactFTData *d) { - YTSG_NOTE (FILE_TRANSFER, "Contact ready"); - ytsg_contact_do_send_file (contact, d->gfile, d->atom); + YTS_NOTE (FILE_TRANSFER, "Contact ready"); + yts_contact_do_send_file (contact, d->gfile, d->atom); g_signal_handlers_disconnect_by_func (contact, - ytsg_contact_notify_tp_contact_cb, + yts_contact_notify_tp_contact_cb, d); g_object_unref (d->gfile); @@ -1063,35 +1063,35 @@ ytsg_contact_notify_tp_contact_cb (YtsgContact *contact, /** - * ytsg_contact_send_file: - * @item: #YtsgContact, + * yts_contact_send_file: + * @item: #YtsContact, * @gfile: #GFile to send * * Sends file to the contact represented by this item. The caller can safely * release reference on the supplied #GFile after calling this function. * - * Return value: Returns %YTSG_ERROR_SUCCESS on success, return value - * %YTSG_ERROR_NOT_ALLOWED indicates that the current client is not mutually - * approved to exchange files with the item. %YTSG_ERROR_PENDING is returned if + * Return value: Returns %YTS_ERROR_SUCCESS on success, return value + * %YTS_ERROR_NOT_ALLOWED indicates that the current client is not mutually + * approved to exchange files with the item. %YTS_ERROR_PENDING is returned if * the execution of the command has to be deferred until the communication * channel is ready; in this case the file will be automatically send at the * appropriate time, and any errors, or eventaul success, will be indicated by - * emitting the #YtsgClient::error signal at that time. + * emitting the #YtsClient::error signal at that time. */ -YtsgError -ytsg_contact_send_file (const YtsgContact *item, GFile *gfile) +YtsError +yts_contact_send_file (const YtsContact *item, GFile *gfile) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; GFileInfo *finfo; GError *error = NULL; guint32 atom; - g_return_val_if_fail (YTSG_IS_CONTACT (item) && gfile, - YTSG_ERROR_INVALID_PARAMETER); + g_return_val_if_fail (YTS_IS_CONTACT (item) && gfile, + YTS_ERROR_INVALID_PARAMETER); priv = item->priv; - g_return_val_if_fail (!priv->disposed, YTSG_ERROR_OBJECT_DISPOSED); + g_return_val_if_fail (!priv->disposed, YTS_ERROR_OBJECT_DISPOSED); finfo = g_file_query_info (gfile, "standard::*", @@ -1103,7 +1103,7 @@ ytsg_contact_send_file (const YtsgContact *item, GFile *gfile) { g_warning ("Unable to query file, %s", error->message); g_clear_error (&error); - return YTSG_ERROR_INVALID_PARAMETER; + return YTS_ERROR_INVALID_PARAMETER; } g_object_unref (finfo); @@ -1112,35 +1112,35 @@ ytsg_contact_send_file (const YtsgContact *item, GFile *gfile) * NB: the atom through this file is used in its shifted, rather than * canonical form, so it can be just ored with an error code. */ - atom = (ytsg_error_new_atom () << 16); + atom = (yts_error_new_atom () << 16); - YTSG_NOTE (FILE_TRANSFER, "Sending file with atom %d", atom); + YTS_NOTE (FILE_TRANSFER, "Sending file with atom %d", atom); if (priv->tp_contact) { - ytsg_contact_do_send_file (item, gfile, atom); + yts_contact_do_send_file (item, gfile, atom); } else { - struct YtsgContactFTData *d = g_new (struct YtsgContactFTData, 1); + struct YtsContactFTData *d = g_new (struct YtsContactFTData, 1); d->gfile = g_object_ref (gfile); d->atom = atom; - YTSG_NOTE (FILE_TRANSFER, + YTS_NOTE (FILE_TRANSFER, "Contact not ready, postponing message file transfer"); g_signal_connect ((GObject*)item, "notify::tp-contact", - G_CALLBACK (ytsg_contact_notify_tp_contact_cb), + G_CALLBACK (yts_contact_notify_tp_contact_cb), d); } - return (atom & YTSG_ERROR_PENDING); + return (atom & YTS_ERROR_PENDING); } /** - * ytsg_contact_cancel_file: - * @item: #YtsgContact, + * yts_contact_cancel_file: + * @item: #YtsContact, * @gfile: #GFile to cancel * * Cancels file transfer in progress. @@ -1149,13 +1149,13 @@ ytsg_contact_send_file (const YtsgContact *item, GFile *gfile) * the tansfer was already completed, returns %FALSE. */ gboolean -ytsg_contact_cancel_file (const YtsgContact *item, GFile *gfile) +yts_contact_cancel_file (const YtsContact *item, GFile *gfile) { - YtsgContactPrivate *priv; + YtsContactPrivate *priv; GCancellable *cancellable; char *path; - g_return_val_if_fail (YTSG_IS_CONTACT (item) && gfile, FALSE); + g_return_val_if_fail (YTS_IS_CONTACT (item) && gfile, FALSE); priv = item->priv; @@ -1180,23 +1180,23 @@ ytsg_contact_cancel_file (const YtsgContact *item, GFile *gfile) } void -_ytsg_contact_add_service (YtsgContact *contact, YtsgService *service) +_yts_contact_add_service (YtsContact *contact, YtsService *service) { /* * Emit the signal; the run-first signal closure will do the rest */ - YTSG_NOTE (CONTACT, "New service %s on %s", - ytsg_service_get_uid (service), - ytsg_service_get_jid (service)); + YTS_NOTE (CONTACT, "New service %s on %s", + yts_service_get_uid (service), + yts_service_get_jid (service)); g_signal_emit (contact, signals[SERVICE_ADDED], 0, service); } void -_ytsg_contact_remove_service_by_uid (YtsgContact *contact, const char *uid) +_yts_contact_remove_service_by_uid (YtsContact *contact, const char *uid) { - YtsgContactPrivate *priv = contact->priv; - YtsgService *service; + YtsContactPrivate *priv = contact->priv; + YtsService *service; g_return_if_fail (uid && *uid); @@ -1218,37 +1218,37 @@ _ytsg_contact_remove_service_by_uid (YtsgContact *contact, const char *uid) } gboolean -_ytsg_contact_is_empty (YtsgContact *contact) +_yts_contact_is_empty (YtsContact *contact) { - YtsgContactPrivate *priv = contact->priv; + YtsContactPrivate *priv = contact->priv; return (g_hash_table_size (priv->services) == 0); } gboolean -ytsg_contact_dispatch_event (YtsgContact *self, +yts_contact_dispatch_event (YtsContact *self, char const *capability, char const *aspect, GVariant *arguments) { - YtsgContactPrivate *priv = self->priv; + YtsContactPrivate *priv = self->priv; char const *service_uid; - YtsgService *service; + YtsService *service; GHashTableIter iter; gboolean dispatched = FALSE; - g_return_val_if_fail (YTSG_IS_CONTACT (self), FALSE); + g_return_val_if_fail (YTS_IS_CONTACT (self), FALSE); g_hash_table_iter_init (&iter, priv->services); while (g_hash_table_iter_next (&iter, (void **) &service_uid, (void **) &service)) { - if (YTSG_IS_PROXY_SERVICE (service) && - ytsg_service_has_capability (service, capability)) { + if (YTS_IS_PROXY_SERVICE (service) && + yts_service_has_capability (service, capability)) { /* Dispatch to all matching services, be happy if one of them accepts. */ dispatched = dispatched || - ytsg_proxy_service_dispatch_event (YTSG_PROXY_SERVICE (service), + yts_proxy_service_dispatch_event (YTS_PROXY_SERVICE (service), capability, aspect, arguments); @@ -1258,29 +1258,29 @@ ytsg_contact_dispatch_event (YtsgContact *self, } gboolean -ytsg_contact_dispatch_response (YtsgContact *self, +yts_contact_dispatch_response (YtsContact *self, char const *capability, char const *invocation_id, GVariant *response) { - YtsgContactPrivate *priv = self->priv; + YtsContactPrivate *priv = self->priv; char const *service_uid; - YtsgService *service; + YtsService *service; GHashTableIter iter; gboolean dispatched = FALSE; - g_return_val_if_fail (YTSG_IS_CONTACT (self), FALSE); + g_return_val_if_fail (YTS_IS_CONTACT (self), FALSE); g_hash_table_iter_init (&iter, priv->services); while (g_hash_table_iter_next (&iter, (void **) &service_uid, (void **) &service)) { - if (YTSG_IS_PROXY_SERVICE (service) && - ytsg_service_has_capability (service, capability)) { + if (YTS_IS_PROXY_SERVICE (service) && + yts_service_has_capability (service, capability)) { /* Invocations are unique, so just go home after delivery. */ dispatched = - ytsg_proxy_service_dispatch_response (YTSG_PROXY_SERVICE (service), + yts_proxy_service_dispatch_response (YTS_PROXY_SERVICE (service), capability, invocation_id, response); diff --git a/ytstenut/yts-contact.h b/ytstenut/yts-contact.h new file mode 100644 index 0000000..ee58702 --- /dev/null +++ b/ytstenut/yts-contact.h @@ -0,0 +1,122 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_CONTACT_H +#define _YTS_CONTACT_H + +#include <glib-object.h> +#include <gio/gio.h> +#include <telepathy-glib/contact.h> + +#include <ytstenut/yts-caps.h> +#include <ytstenut/yts-error.h> +#include <ytstenut/yts-types.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_CONTACT \ + (yts_contact_get_type()) +#define YTS_CONTACT(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_CONTACT, \ + YtsContact)) +#define YTS_CONTACT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_CONTACT, \ + YtsContactClass)) +#define YTS_IS_CONTACT(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_CONTACT)) +#define YTS_IS_CONTACT_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_CONTACT)) +#define YTS_CONTACT_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_CONTACT, \ + YtsContactClass)) + +typedef struct _YtsContactClass YtsContactClass; +typedef struct _YtsContactPrivate YtsContactPrivate; + +/** + * YtsContactClass: + * @service_added: signal handler for #YtsContact::service-added + * @service_removed: signal handler for #YtsContact::service-removed + * + * #YtsContact class. + */ +struct _YtsContactClass +{ + GObjectClass parent_class; + + void (*service_added) (YtsContact *contact, YtsService *service); + void (*service_removed) (YtsContact *contact, YtsService *service); +}; + +/** + * YtsContact: + * + * Represents a single XMPP connection (usually a device) in the Ytstenut + * mesh. One or more #YtsService<!-- -->s will be available throug a given + * contact. + */ +struct _YtsContact +{ + /*< private >*/ + GObject parent; + + /*< private >*/ + YtsContactPrivate *priv; +}; + +GType yts_contact_get_type (void) G_GNUC_CONST; + +YtsClient *yts_contact_get_client (const YtsContact *contact); +const char *yts_contact_get_jid (const YtsContact *contact); +const char *yts_contact_get_name (const YtsContact *contact); +TpContact *yts_contact_get_tp_contact (const YtsContact *contact); +GFile *yts_contact_get_icon (const YtsContact *contact, + const char **mime); +gboolean yts_contact_has_capability (const YtsContact *item, + YtsCaps cap); + +YtsError yts_contact_send_file (const YtsContact *item, + GFile *gfile); +gboolean yts_contact_cancel_file (const YtsContact *item, + GFile *gfile); + +/* FIXME private */ + +gboolean +yts_contact_dispatch_event (YtsContact *self, + char const *capability, + char const *aspect, + GVariant *arguments); + +gboolean +yts_contact_dispatch_response (YtsContact *self, + char const *capability, + char const *invocation_id, + GVariant *response); + +G_END_DECLS + +#endif /* _YTS_CONTACT_H */ diff --git a/ytstenut/ytsg-debug.h b/ytstenut/yts-debug.h index 879e7d0..a008f44 100644 --- a/ytstenut/ytsg-debug.h +++ b/ytstenut/yts-debug.h @@ -24,47 +24,47 @@ */ /** - * SECTION:ytsg-debug + * SECTION:yts-debug * @short_description: Debugging API * * This section list available debugging API */ -#ifndef _YTSG_DEBUG_H -#define _YTSG_DEBUG_H +#ifndef _YTS_DEBUG_H +#define _YTS_DEBUG_H #include <glib.h> G_BEGIN_DECLS /** - * YtsgProtocol: - * @YTSG_DEBUG_CLIENT: debug client - * @YTSG_DEBUG_ROSTER: debug roster - * @YTSG_DEBUG_STATUS: debug status - * @YTSG_DEBUG_TP: debug telepathy - * @YTSG_DEBUG_MANAGER: debug manager - * @YTSG_DEBUG_MESSAGE: debug messages - * @YTSG_DEBUG_FILE_TRANSFER: debug file transfer - * @YTSG_DEBUG_CONTACT: debug contact + * YtsProtocol: + * @YTS_DEBUG_CLIENT: debug client + * @YTS_DEBUG_ROSTER: debug roster + * @YTS_DEBUG_STATUS: debug status + * @YTS_DEBUG_TP: debug telepathy + * @YTS_DEBUG_MANAGER: debug manager + * @YTS_DEBUG_MESSAGE: debug messages + * @YTS_DEBUG_FILE_TRANSFER: debug file transfer + * @YTS_DEBUG_CONTACT: debug contact * */ typedef enum { - YTSG_DEBUG_CLIENT = 0x001, - YTSG_DEBUG_ROSTER = 0x002, - YTSG_DEBUG_STATUS = 0x004, - YTSG_DEBUG_TP = 0x008, - YTSG_DEBUG_MANAGER = 0x010, - YTSG_DEBUG_MESSAGE = 0x020, - YTSG_DEBUG_FILE_TRANSFER = 0x080, - YTSG_DEBUG_CONTACT = 0x100, - YTSG_DEBUG_CONNECTION = 0x200 -} YtsgDebugFlags; - -#ifdef YTSG_ENABLE_DEBUG + YTS_DEBUG_CLIENT = 0x001, + YTS_DEBUG_ROSTER = 0x002, + YTS_DEBUG_STATUS = 0x004, + YTS_DEBUG_TP = 0x008, + YTS_DEBUG_MANAGER = 0x010, + YTS_DEBUG_MESSAGE = 0x020, + YTS_DEBUG_FILE_TRANSFER = 0x080, + YTS_DEBUG_CONTACT = 0x100, + YTS_DEBUG_CONNECTION = 0x200 +} YtsDebugFlags; + +#ifdef YTS_ENABLE_DEBUG /** - * YTSG_NOTE: + * YTS_NOTE: * @type: the note type * @x: the note text, printf-like formatting allowed * @a...: parmaters, if any @@ -73,7 +73,7 @@ typedef enum { */ /** - * YTSG_TIMESTAMP: + * YTS_TIMESTAMP: * @type: the note type * @x: the note text, printf-like formatting allowed * @a...: parmaters, if any @@ -82,29 +82,29 @@ typedef enum { */ /** - * YTSG_MARK: + * YTS_MARK: * * Prints a mark to stdout. */ #ifdef __GNUC__ -#define YTSG_NOTE(type,x,a...) G_STMT_START { \ - if (ytsg_debug_flags & YTSG_DEBUG_##type) \ +#define YTS_NOTE(type,x,a...) G_STMT_START { \ + if (yts_debug_flags & YTS_DEBUG_##type) \ { g_message (#type "(" G_STRLOC "): " x, ##a); } \ } G_STMT_END -#define YTSG_TIMESTAMP(type,x,a...) G_STMT_START { \ - if (ytsg_debug_flags & YTSG_DEBUG_##type) \ +#define YTS_TIMESTAMP(type,x,a...) G_STMT_START { \ + if (yts_debug_flags & YTS_DEBUG_##type) \ { g_message ( #type " %li(" G_STRLOC "): " \ - x, ytsg_get_timestamp(), ##a); } \ + x, yts_get_timestamp(), ##a); } \ } G_STMT_END #else /* Try the C99 version; unfortunately, this does not allow us to pass * empty arguments to the macro, which means we have to * do an intemediate printf. */ -#define YTSG_NOTE(type,...) G_STMT_START { \ - if (ytsg_debug_flags & YTSG_DEBUG_##type) \ +#define YTS_NOTE(type,...) G_STMT_START { \ + if (yts_debug_flags & YTS_DEBUG_##type) \ { \ gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ g_message ( #type "(" G_STRLOC "): %s",_fmt); \ @@ -112,29 +112,29 @@ typedef enum { } \ } G_STMT_END -#define YTSG_TIMESTAMP(type,...) G_STMT_START { \ - if (ytsg_debug_flags & YTSG_DEBUG_##type) \ +#define YTS_TIMESTAMP(type,...) G_STMT_START { \ + if (yts_debug_flags & YTS_DEBUG_##type) \ { \ gchar * _fmt = g_strdup_printf (__VA_ARGS__); \ g_message ( #type " %li(" G_STRLOC "): %s", \ - ytsg_get_timestamp(), _fmt); \ + yts_get_timestamp(), _fmt); \ g_free (_fmt); \ } \ } G_STMT_END #endif -#define YTSG_MARK() YTSG_NOTE(MISC, "== mark ==") +#define YTS_MARK() YTS_NOTE(MISC, "== mark ==") -#else /* !YTSG_ENABLE_DEBUG */ +#else /* !YTS_ENABLE_DEBUG */ -#define YTSG_NOTE(type,...) G_STMT_START { } G_STMT_END -#define YTSG_MARK() G_STMT_START { } G_STMT_END -#define YTSG_TIMESTAMP(type,...) G_STMT_START { } G_STMT_END +#define YTS_NOTE(type,...) G_STMT_START { } G_STMT_END +#define YTS_MARK() G_STMT_START { } G_STMT_END +#define YTS_TIMESTAMP(type,...) G_STMT_START { } G_STMT_END -#endif /* YTSG_ENABLE_DEBUG */ +#endif /* YTS_ENABLE_DEBUG */ -extern guint ytsg_debug_flags; +extern guint yts_debug_flags; G_END_DECLS -#endif /* _YTSG_DEBUG_H */ +#endif /* _YTS_DEBUG_H */ diff --git a/ytstenut/ytsg-enum-types.c.in b/ytstenut/yts-enum-types.c.in index ac7f87e..d9305a4 100644 --- a/ytstenut/ytsg-enum-types.c.in +++ b/ytstenut/yts-enum-types.c.in @@ -1,5 +1,5 @@ /*** BEGIN file-header ***/ -#include "ytsg-enum-types.h" +#include "yts-enum-types.h" /*** END file-header ***/ /*** BEGIN file-production ***/ diff --git a/ytstenut/ytsg-enum-types.h.in b/ytstenut/yts-enum-types.h.in index ce461ee..031a8c1 100644 --- a/ytstenut/ytsg-enum-types.h.in +++ b/ytstenut/yts-enum-types.h.in @@ -1,6 +1,6 @@ /*** BEGIN file-header ***/ -#ifndef __YTSG_ENUM_TYPES_H__ -#define __YTSG_ENUM_TYPES_H__ +#ifndef __YTS_ENUM_TYPES_H__ +#define __YTS_ENUM_TYPES_H__ #include <glib-object.h> @@ -15,12 +15,12 @@ G_BEGIN_DECLS /*** BEGIN file-tail ***/ G_END_DECLS -#endif /* !__YTSG_ENUM_TYPES_H__ */ +#endif /* !__YTS_ENUM_TYPES_H__ */ /*** END file-tail ***/ /*** BEGIN value-header ***/ GType @enum_name@_get_type (void) G_GNUC_CONST; -#define YTSG_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) +#define YTS_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) /*** END value-header ***/ diff --git a/ytstenut/ytsg-error-message.c b/ytstenut/yts-error-message.c index a310976..c123624 100644 --- a/ytstenut/ytsg-error-message.c +++ b/ytstenut/yts-error-message.c @@ -19,16 +19,16 @@ */ #include <stdbool.h> -#include "ytsg-error-message.h" +#include "yts-error-message.h" -G_DEFINE_TYPE (YtsgErrorMessage, ytsg_error_message, YTSG_TYPE_METADATA) +G_DEFINE_TYPE (YtsErrorMessage, yts_error_message, YTS_TYPE_METADATA) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_ERROR_MESSAGE, YtsgErrorMessagePrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_ERROR_MESSAGE, YtsErrorMessagePrivate)) typedef struct { int dummy; -} YtsgErrorMessagePrivate; +} YtsErrorMessagePrivate; static void _get_property (GObject *object, @@ -57,15 +57,15 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - G_OBJECT_CLASS (ytsg_error_message_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_error_message_parent_class)->dispose (object); } static void -ytsg_error_message_class_init (YtsgErrorMessageClass *klass) +yts_error_message_class_init (YtsErrorMessageClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgErrorMessagePrivate)); + g_type_class_add_private (klass, sizeof (YtsErrorMessagePrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -73,12 +73,12 @@ ytsg_error_message_class_init (YtsgErrorMessageClass *klass) } static void -ytsg_error_message_init (YtsgErrorMessage *self) +yts_error_message_init (YtsErrorMessage *self) { } -YtsgMetadata * -ytsg_error_message_new (char const *domain, +YtsMetadata * +yts_error_message_new (char const *domain, int code, char const *message, char const *invocation_id) @@ -108,7 +108,7 @@ ytsg_error_message_new (char const *domain, rest_xml_node_add_attr (node, "invocation", invocation_id); } - return g_object_new (YTSG_TYPE_ERROR_MESSAGE, + return g_object_new (YTS_TYPE_ERROR_MESSAGE, "top-level-node", node, NULL); } diff --git a/ytstenut/ytsg-error-message.h b/ytstenut/yts-error-message.h index 9e2f892..3e5fe11 100644 --- a/ytstenut/ytsg-error-message.h +++ b/ytstenut/yts-error-message.h @@ -18,49 +18,49 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_ERROR_MESSAGE_H -#define YTSG_ERROR_MESSAGE_H +#ifndef YTS_ERROR_MESSAGE_H +#define YTS_ERROR_MESSAGE_H #include <glib-object.h> -#include <ytstenut/ytsg-metadata.h> +#include <ytstenut/yts-metadata.h> G_BEGIN_DECLS -#define YTSG_TYPE_ERROR_MESSAGE ytsg_error_message_get_type() +#define YTS_TYPE_ERROR_MESSAGE yts_error_message_get_type() -#define YTSG_ERROR_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_ERROR_MESSAGE, YtsgErrorMessage)) +#define YTS_ERROR_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_ERROR_MESSAGE, YtsErrorMessage)) -#define YTSG_ERROR_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_ERROR_MESSAGE, YtsgErrorMessageClass)) +#define YTS_ERROR_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_ERROR_MESSAGE, YtsErrorMessageClass)) -#define YTSG_IS_ERROR_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_ERROR_MESSAGE)) +#define YTS_IS_ERROR_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_ERROR_MESSAGE)) -#define YTSG_IS_ERROR_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_ERROR_MESSAGE)) +#define YTS_IS_ERROR_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_ERROR_MESSAGE)) -#define YTSG_ERROR_MESSAGE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_ERROR_MESSAGE, YtsgErrorMessageClass)) +#define YTS_ERROR_MESSAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_ERROR_MESSAGE, YtsErrorMessageClass)) typedef struct { - YtsgMetadata parent; -} YtsgErrorMessage; + YtsMetadata parent; +} YtsErrorMessage; typedef struct { - YtsgMetadataClass parent; -} YtsgErrorMessageClass; + YtsMetadataClass parent; +} YtsErrorMessageClass; GType -ytsg_error_message_get_type (void) G_GNUC_CONST; +yts_error_message_get_type (void) G_GNUC_CONST; -YtsgMetadata * -ytsg_error_message_new (char const *domain, +YtsMetadata * +yts_error_message_new (char const *domain, int code, char const *message, char const *invocation_id); G_END_DECLS -#endif /* YTSG_ERROR_MESSAGE_H */ +#endif /* YTS_ERROR_MESSAGE_H */ diff --git a/ytstenut/ytsg-error.c b/ytstenut/yts-error.c index c447dd6..431c8f3 100644 --- a/ytstenut/ytsg-error.c +++ b/ytstenut/yts-error.c @@ -24,12 +24,12 @@ */ /** - * SECTION:ytsg-error + * SECTION:yts-error * @short_description: An error object. - * @title: YtsgError - * @section_id: ytsg-error + * @title: YtsError + * @section_id: yts-error * - * #YtsgError represents an errror in asynchronous operations. All erros consist + * #YtsError represents an errror in asynchronous operations. All erros consist * of a unique identifier and a status code. */ @@ -37,57 +37,57 @@ #include "config.h" #endif -#include "ytsg-error.h" +#include "yts-error.h" /** - * ytsg_error_get_code: - * @error: #YtsgError + * yts_error_get_code: + * @error: #YtsError * - * Retrives error code from #YtsgError. + * Retrives error code from #YtsError. * - * Return value: the error code represented by this #YtsgError. + * Return value: the error code represented by this #YtsError. */ guint -ytsg_error_get_code (YtsgError error) +yts_error_get_code (YtsError error) { - return (error & _YTSG_ERROR_CODE_MASK); + return (error & _YTS_ERROR_CODE_MASK); } /** - * ytsg_error_get_atom: - * @error: #YtsgError + * yts_error_get_atom: + * @error: #YtsError * - * Retrieves the atom identifying the origin of this error from #YtsgError. + * Retrieves the atom identifying the origin of this error from #YtsError. * * Return value: the atom identifying the operation represented by this - * #YtsgError. + * #YtsError. */ guint -ytsg_error_get_atom (YtsgError error) +yts_error_get_atom (YtsError error) { /* g_debug ("error %d, atom %d", */ - /* (guint32)(error & _YTSG_ERROR_CODE_MASK), */ - /* ((guint32)error & _YTSG_ERROR_ATOM_MASK) >> 16); */ + /* (guint32)(error & _YTS_ERROR_CODE_MASK), */ + /* ((guint32)error & _YTS_ERROR_ATOM_MASK) >> 16); */ - return ((guint32)error & _YTSG_ERROR_ATOM_MASK) >> 16; + return ((guint32)error & _YTS_ERROR_ATOM_MASK) >> 16; } /** - * ytsg_error_new_atom: + * yts_error_new_atom: * - * Obtains a new atom for #YtsgError; this function is intended for use by code - * that generates #YtsgError<!-- -->s. NB: the atom is in its canonical shape + * Obtains a new atom for #YtsError; this function is intended for use by code + * that generates #YtsError<!-- -->s. NB: the atom is in its canonical shape * and will have to be shifted left by 16 bits before it can be ored with an * error code. * - * Return value: a new atom for use with #YtsgError. + * Return value: a new atom for use with #YtsError. */ guint32 -ytsg_error_new_atom () +yts_error_new_atom () { static guint32 atom = 0; - if (++atom > _YTSG_ERROR_CODE_MASK) + if (++atom > _YTS_ERROR_CODE_MASK) { g_warning ("Atom operation overflow, starting from beginning"); atom = 1; @@ -97,26 +97,26 @@ ytsg_error_new_atom () } /** - * ytsg_error_make: + * yts_error_make: * @atom: the error atom * @code: the error code * - * Creates #YtsgError from the provided values + * Creates #YtsError from the provided values */ -YtsgError -ytsg_error_make (guint32 atom, guint32 code) +YtsError +yts_error_make (guint32 atom, guint32 code) { return ((atom << 16) | code); } /** - * ytsg_error_new: + * yts_error_new: * @code: the error code * - * Creates #YtsgError with a new atom from the provide error code + * Creates #YtsError with a new atom from the provide error code */ -YtsgError -ytsg_error_new (guint32 code) +YtsError +yts_error_new (guint32 code) { - return ((ytsg_error_new_atom () << 16) | code); + return ((yts_error_new_atom () << 16) | code); } diff --git a/ytstenut/yts-error.h b/ytstenut/yts-error.h new file mode 100644 index 0000000..7e860c5 --- /dev/null +++ b/ytstenut/yts-error.h @@ -0,0 +1,70 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2010 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + */ + +#ifndef _YTS_ERROR_H +#define _YTS_ERROR_H + +#include <ytstenut/yts-types.h> + +G_BEGIN_DECLS + +/** + * YtsError: + * @YTS_ERROR_SUCCESS: Operation succeeded, + * @YTS_ERROR_PENDING: The operation will be completed at a later stage, + * subject to completing intermediate asynchronous operations (implies success + * up to the point the asynchronous operation began). The operation to which + * it pertains can be retrieved from the #YtsError value using + * yts_error_get_atom(). Operations that return this error code must emit + * #YtsClient::error signal at a later stage to indicate either subsequent + * errors or eventual success. + * @YTS_ERROR_OBJECT_DISPOSED: the object is in process of being destroyed + * @YTS_ERROR_INVALID_PARAMETER: Invalid parameter supplied to function + * @YTS_ERROR_NOT_ALLOWED: the operation is not allowed. + * @YTS_ERROR_NO_ROUTE: no route to complete the operation + * @YTS_ERROR_UNKNOWN: some other,unspecified, error condition. + * @YTS_ERROR_CUSTOM_START: custom error codes can start at this value + * @YTS_ERROR_CUSTOM_END: custom error code must not exceed this value + * + * YtsError represents common errors for nScreen operation; YtsError combines + * an error code defined by the above enumeration and an atom value that + * uniquely identifies the operation associated with the value. Use + * yts_error_get_code() and yts_error_get_atom() to retrieve these components. + */ + +typedef enum { /*< prefix=YTS_ERROR >*/ + YTS_ERROR_SUCCESS = 0, + YTS_ERROR_PENDING, + YTS_ERROR_OBJECT_DISPOSED, + YTS_ERROR_INVALID_PARAMETER, + YTS_ERROR_NOT_ALLOWED, + YTS_ERROR_NO_ROUTE, + YTS_ERROR_NO_MSG_CHANNEL, + + /* Last predefined error code */ + YTS_ERROR_UNKNOWN = 0x00007fff, + + YTS_ERROR_CUSTOM_START = 0x00008000, + /* Custom error code range is in between here */ + YTS_ERROR_CUSTOM_END = 0x0000ffff, + + /* <private> */ + _YTS_ERROR_CODE_MASK = 0x0000ffff, + _YTS_ERROR_ATOM_MASK = 0xffff0000, + +} YtsError; + +YtsError yts_error_new (guint32 code); +guint32 yts_error_new_atom (); +YtsError yts_error_make (guint32 atom, guint32 code); +guint yts_error_get_code (YtsError error); +guint yts_error_get_atom (YtsError error); + +G_END_DECLS + +#endif /* _YTS_ERROR_H */ diff --git a/ytstenut/ytsg-event-message.c b/ytstenut/yts-event-message.c index a5c4425..283f976 100644 --- a/ytstenut/ytsg-event-message.c +++ b/ytstenut/yts-event-message.c @@ -19,16 +19,16 @@ */ #include <stdbool.h> -#include "ytsg-event-message.h" +#include "yts-event-message.h" -G_DEFINE_TYPE (YtsgEventMessage, ytsg_event_message, YTSG_TYPE_METADATA) +G_DEFINE_TYPE (YtsEventMessage, yts_event_message, YTS_TYPE_METADATA) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_EVENT_MESSAGE, YtsgEventMessagePrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_EVENT_MESSAGE, YtsEventMessagePrivate)) typedef struct { int dummy; -} YtsgEventMessagePrivate; +} YtsEventMessagePrivate; static void _get_property (GObject *object, @@ -57,15 +57,15 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - G_OBJECT_CLASS (ytsg_event_message_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_event_message_parent_class)->dispose (object); } static void -ytsg_event_message_class_init (YtsgEventMessageClass *klass) +yts_event_message_class_init (YtsEventMessageClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgEventMessagePrivate)); + g_type_class_add_private (klass, sizeof (YtsEventMessagePrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -73,12 +73,12 @@ ytsg_event_message_class_init (YtsgEventMessageClass *klass) } static void -ytsg_event_message_init (YtsgEventMessage *self) +yts_event_message_init (YtsEventMessage *self) { } -YtsgMetadata * -ytsg_event_message_new (char const *capability, +YtsMetadata * +yts_event_message_new (char const *capability, char const *aspect, GVariant *arguments) { @@ -100,7 +100,7 @@ ytsg_event_message_new (char const *capability, g_free (args); } - return g_object_new (YTSG_TYPE_EVENT_MESSAGE, + return g_object_new (YTS_TYPE_EVENT_MESSAGE, "top-level-node", node, NULL); } diff --git a/ytstenut/ytsg-event-message.h b/ytstenut/yts-event-message.h index ec06c59..b663d07 100644 --- a/ytstenut/ytsg-event-message.h +++ b/ytstenut/yts-event-message.h @@ -18,47 +18,47 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_EVENT_MESSAGE_H -#define YTSG_EVENT_MESSAGE_H +#ifndef YTS_EVENT_MESSAGE_H +#define YTS_EVENT_MESSAGE_H #include <glib-object.h> -#include <ytstenut/ytsg-metadata.h> +#include <ytstenut/yts-metadata.h> G_BEGIN_DECLS -#define YTSG_TYPE_EVENT_MESSAGE ytsg_event_message_get_type() +#define YTS_TYPE_EVENT_MESSAGE yts_event_message_get_type() -#define YTSG_EVENT_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_EVENT_MESSAGE, YtsgEventMessage)) +#define YTS_EVENT_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_EVENT_MESSAGE, YtsEventMessage)) -#define YTSG_EVENT_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_EVENT_MESSAGE, YtsgEventMessageClass)) +#define YTS_EVENT_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_EVENT_MESSAGE, YtsEventMessageClass)) -#define YTSG_IS_EVENT_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_EVENT_MESSAGE)) +#define YTS_IS_EVENT_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_EVENT_MESSAGE)) -#define YTSG_IS_EVENT_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_EVENT_MESSAGE)) +#define YTS_IS_EVENT_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_EVENT_MESSAGE)) -#define YTSG_EVENT_MESSAGE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_EVENT_MESSAGE, YtsgEventMessageClass)) +#define YTS_EVENT_MESSAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_EVENT_MESSAGE, YtsEventMessageClass)) typedef struct { - YtsgMetadata parent; -} YtsgEventMessage; + YtsMetadata parent; +} YtsEventMessage; typedef struct { - YtsgMetadataClass parent; -} YtsgEventMessageClass; + YtsMetadataClass parent; +} YtsEventMessageClass; GType -ytsg_event_message_get_type (void) G_GNUC_CONST; +yts_event_message_get_type (void) G_GNUC_CONST; -YtsgMetadata * -ytsg_event_message_new (char const *capability, +YtsMetadata * +yts_event_message_new (char const *capability, char const *aspect, GVariant *arguments); G_END_DECLS -#endif /* YTSG_EVENT_MESSAGE_H */ +#endif /* YTS_EVENT_MESSAGE_H */ diff --git a/ytstenut/ytsg-invocation-message.c b/ytstenut/yts-invocation-message.c index d402b4f..b6df806 100644 --- a/ytstenut/ytsg-invocation-message.c +++ b/ytstenut/yts-invocation-message.c @@ -19,16 +19,16 @@ */ #include <stdbool.h> -#include "ytsg-invocation-message.h" +#include "yts-invocation-message.h" -G_DEFINE_TYPE (YtsgInvocationMessage, ytsg_invocation_message, YTSG_TYPE_METADATA) +G_DEFINE_TYPE (YtsInvocationMessage, yts_invocation_message, YTS_TYPE_METADATA) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_INVOCATION_MESSAGE, YtsgInvocationMessagePrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_INVOCATION_MESSAGE, YtsInvocationMessagePrivate)) typedef struct { int dummy; -} YtsgInvocationMessagePrivate; +} YtsInvocationMessagePrivate; static void _get_property (GObject *object, @@ -57,15 +57,15 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - G_OBJECT_CLASS (ytsg_invocation_message_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_invocation_message_parent_class)->dispose (object); } static void -ytsg_invocation_message_class_init (YtsgInvocationMessageClass *klass) +yts_invocation_message_class_init (YtsInvocationMessageClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgInvocationMessagePrivate)); + g_type_class_add_private (klass, sizeof (YtsInvocationMessagePrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -73,12 +73,12 @@ ytsg_invocation_message_class_init (YtsgInvocationMessageClass *klass) } static void -ytsg_invocation_message_init (YtsgInvocationMessage *self) +yts_invocation_message_init (YtsInvocationMessage *self) { } -YtsgMetadata * -ytsg_invocation_message_new (char const *invocation_id, +YtsMetadata * +yts_invocation_message_new (char const *invocation_id, char const *capability, char const *aspect, GVariant *arguments) @@ -102,7 +102,7 @@ ytsg_invocation_message_new (char const *invocation_id, g_free (args); } - return g_object_new (YTSG_TYPE_INVOCATION_MESSAGE, + return g_object_new (YTS_TYPE_INVOCATION_MESSAGE, "top-level-node", node, NULL); } diff --git a/ytstenut/yts-invocation-message.h b/ytstenut/yts-invocation-message.h new file mode 100644 index 0000000..5c12055 --- /dev/null +++ b/ytstenut/yts-invocation-message.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_INVOCATION_MESSAGE_H +#define YTS_INVOCATION_MESSAGE_H + +#include <glib-object.h> +#include <ytstenut/yts-metadata.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_INVOCATION_MESSAGE yts_invocation_message_get_type() + +#define YTS_INVOCATION_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_INVOCATION_MESSAGE, YtsInvocationMessage)) + +#define YTS_INVOCATION_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_INVOCATION_MESSAGE, YtsInvocationMessageClass)) + +#define YTS_IS_INVOCATION_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_INVOCATION_MESSAGE)) + +#define YTS_IS_INVOCATION_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_INVOCATION_MESSAGE)) + +#define YTS_INVOCATION_MESSAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_INVOCATION_MESSAGE, YtsInvocationMessageClass)) + +typedef struct { + YtsMetadata parent; +} YtsInvocationMessage; + +typedef struct { + YtsMetadataClass parent; +} YtsInvocationMessageClass; + +GType +yts_invocation_message_get_type (void) G_GNUC_CONST; + +YtsMetadata * +yts_invocation_message_new (char const *invocation_id, + char const *capability, + char const *aspect, + GVariant *arguments); + +G_END_DECLS + +#endif /* YTS_INVOCATION_MESSAGE_H */ diff --git a/ytstenut/ytsg-main.c b/ytstenut/yts-main.c index afb797f..f483066 100644 --- a/ytstenut/ytsg-main.c +++ b/ytstenut/yts-main.c @@ -23,7 +23,7 @@ */ /** - * SECTION:ytsg-main + * SECTION:yts-main * @short_description: Global Functions * * This section list global function in libytstenut @@ -50,66 +50,66 @@ #include <unistd.h> #include <string.h> -#include "ytsg-debug.h" -#include "ytsg-main.h" +#include "yts-debug.h" +#include "yts-main.h" -static void ytsg_base_init (void); -static int ytsg_init_real (GError **error); +static void yts_base_init (void); +static int yts_init_real (GError **error); -gboolean ytsg_is_initialized = FALSE; -static gboolean ytsg_fatal_warnings = FALSE; -static gboolean ytsg_args_parsed = FALSE; +gboolean yts_is_initialized = FALSE; +static gboolean yts_fatal_warnings = FALSE; +static gboolean yts_args_parsed = FALSE; /* * Debugging machinery; based on Clutter. */ -guint ytsg_debug_flags = 0; - -#ifdef YTSG_ENABLE_DEBUG -static const GDebugKey ytsg_debug_keys[] = { - { "connection", YTSG_DEBUG_CONNECTION }, - { "client", YTSG_DEBUG_CLIENT }, - { "roster", YTSG_DEBUG_ROSTER }, - { "contact", YTSG_DEBUG_CONTACT }, - { "status", YTSG_DEBUG_STATUS }, - { "tp", YTSG_DEBUG_TP }, - { "manager", YTSG_DEBUG_MANAGER }, - { "message", YTSG_DEBUG_MESSAGE }, - { "file-transfer", YTSG_DEBUG_FILE_TRANSFER }, +guint yts_debug_flags = 0; + +#ifdef YTS_ENABLE_DEBUG +static const GDebugKey yts_debug_keys[] = { + { "connection", YTS_DEBUG_CONNECTION }, + { "client", YTS_DEBUG_CLIENT }, + { "roster", YTS_DEBUG_ROSTER }, + { "contact", YTS_DEBUG_CONTACT }, + { "status", YTS_DEBUG_STATUS }, + { "tp", YTS_DEBUG_TP }, + { "manager", YTS_DEBUG_MANAGER }, + { "message", YTS_DEBUG_MESSAGE }, + { "file-transfer", YTS_DEBUG_FILE_TRANSFER }, }; -#endif /* YTSG_ENABLE_DEBUG */ +#endif /* YTS_ENABLE_DEBUG */ -#ifdef YTSG_ENABLE_DEBUG +#ifdef YTS_ENABLE_DEBUG static gboolean -ytsg_arg_debug_cb (const char *key, const char *value, gpointer user_data) +yts_arg_debug_cb (const char *key, const char *value, gpointer user_data) { - ytsg_debug_flags |= + yts_debug_flags |= g_parse_debug_string (value, - ytsg_debug_keys, - G_N_ELEMENTS (ytsg_debug_keys)); + yts_debug_keys, + G_N_ELEMENTS (yts_debug_keys)); return TRUE; } static gboolean -ytsg_arg_no_debug_cb (const char *key, const char *value, gpointer user_data) +yts_arg_no_debug_cb (const char *key, const char *value, gpointer user_data) { - ytsg_debug_flags &= + yts_debug_flags &= ~g_parse_debug_string (value, - ytsg_debug_keys, - G_N_ELEMENTS (ytsg_debug_keys)); + yts_debug_keys, + G_N_ELEMENTS (yts_debug_keys)); return TRUE; } #endif -static GOptionEntry ytsg_args[] = { - { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &ytsg_fatal_warnings, +static GOptionEntry yts_args[] = { + { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &yts_fatal_warnings, N_("Make all warnings fatal"), NULL }, -#ifdef YTSG_ENABLE_DEBUG - { "ytsg-debug", 0, 0, G_OPTION_ARG_CALLBACK, ytsg_arg_debug_cb, +#ifdef YTS_ENABLE_DEBUG + { "yts-debug", 0, 0, G_OPTION_ARG_CALLBACK, yts_arg_debug_cb, N_("Ytstenut-glib debugging flags to set"), "FLAGS" }, - { "ytsg-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, ytsg_arg_no_debug_cb, + { "yts-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, yts_arg_no_debug_cb, N_("Ytstenut-glib debugging flags to unset"), "FLAGS" }, -#endif /* YTSG_ENABLE_DEBUG */ +#endif /* YTS_ENABLE_DEBUG */ { NULL, }, }; @@ -125,24 +125,24 @@ pre_parse_hook (GOptionContext *context, { const char *env_string; - if (ytsg_is_initialized) + if (yts_is_initialized) return TRUE; if (setlocale (LC_ALL, "") == NULL) g_warning ("Locale not supported by C library.\n" "Using the fallback 'C' locale."); -#ifdef YTSG_ENABLE_DEBUG - env_string = g_getenv ("YTSG_DEBUG"); +#ifdef YTS_ENABLE_DEBUG + env_string = g_getenv ("YTS_DEBUG"); if (env_string != NULL) { - ytsg_debug_flags = + yts_debug_flags = g_parse_debug_string (env_string, - ytsg_debug_keys, - G_N_ELEMENTS (ytsg_debug_keys)); + yts_debug_keys, + G_N_ELEMENTS (yts_debug_keys)); env_string = NULL; } -#endif /* YTSG_ENABLE_DEBUG */ +#endif /* YTS_ENABLE_DEBUG */ return TRUE; } @@ -156,12 +156,12 @@ post_parse_hook (GOptionContext *context, gpointer data, GError **error) { - if (ytsg_is_initialized) + if (yts_is_initialized) return TRUE; - ytsg_args_parsed = TRUE; + yts_args_parsed = TRUE; - if (ytsg_fatal_warnings) + if (yts_fatal_warnings) { GLogLevelFlags fatal_mask; @@ -170,11 +170,11 @@ post_parse_hook (GOptionContext *context, g_log_set_always_fatal (fatal_mask); } - return ytsg_init_real (error); + return yts_init_real (error); } /** - * ytsg_get_option_group: + * yts_get_option_group: * * Returns a #GOptionGroup for the command line arguments recognized * by Ytstenut-Glib. You should add this group to your #GOptionContext with @@ -185,14 +185,14 @@ post_parse_hook (GOptionContext *context, * result in Ytstenut-Glib's initialization. That is, the following code: * * |[ - * g_option_context_set_main_group (context, ytsg_get_option_group ()); + * g_option_context_set_main_group (context, yts_get_option_group ()); * res = g_option_context_parse (context, &argc, &argc, NULL); * ]| * * is functionally equivalent to: * * |[ - * ytsg_init (&argc, &argv); + * yts_init (&argc, &argv); * ]| * * After g_option_context_parse() on a #GOptionContext containing the @@ -205,11 +205,11 @@ post_parse_hook (GOptionContext *context, * Since: 0.1 */ GOptionGroup * -ytsg_get_option_group (void) +yts_get_option_group (void) { GOptionGroup *group; - ytsg_base_init (); + yts_base_init (); group = g_option_group_new ("Ytstenut-glib", _("Ytstenut-glib Options"), @@ -218,7 +218,7 @@ ytsg_get_option_group (void) NULL); g_option_group_set_parse_hooks (group, pre_parse_hook, post_parse_hook); - g_option_group_add_entries (group, ytsg_args); + g_option_group_add_entries (group, yts_args); #if 0 g_option_group_set_translation_domain (group, GETTEXT_PACKAGE); #endif @@ -231,7 +231,7 @@ ytsg_get_option_group (void) * Keep it simple, send everything we log to stderr. */ static void -ytsg_loger (const gchar *domain, +yts_loger (const gchar *domain, GLogLevelFlags level, const gchar *message, gpointer data) @@ -239,15 +239,15 @@ ytsg_loger (const gchar *domain, char *s = NULL; if (level & G_LOG_LEVEL_ERROR) - s = g_strdup_printf ("Ytsg-Error: %s\n", message); + s = g_strdup_printf ("Yts-Error: %s\n", message); else if (level & G_LOG_LEVEL_CRITICAL) - s = g_strdup_printf ("Ytsg-Critical: %s\n", message); + s = g_strdup_printf ("Yts-Critical: %s\n", message); else if (level & G_LOG_LEVEL_WARNING) - s = g_strdup_printf ("Ytsg-Warning: %s\n", message); + s = g_strdup_printf ("Yts-Warning: %s\n", message); else if (level & G_LOG_LEVEL_DEBUG) - s = g_strdup_printf ("Ytsg-Debug: %s\n", message); + s = g_strdup_printf ("Yts-Debug: %s\n", message); else - s = g_strdup_printf ("Ytsg: %s\n", message); + s = g_strdup_printf ("Yts: %s\n", message); write (STDERR_FILENO, s, strlen (s)); @@ -255,7 +255,7 @@ ytsg_loger (const gchar *domain, } static void -ytsg_base_init (void) +yts_base_init (void) { static gboolean initialised = FALSE; @@ -302,35 +302,35 @@ ytsg_base_init (void) g_log_set_handler ("YtstenutGlib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL, - ytsg_loger, NULL); + yts_loger, NULL); } } static int -ytsg_init_real (GError **error) +yts_init_real (GError **error) { - ytsg_is_initialized = TRUE; + yts_is_initialized = TRUE; return 1; } static gboolean -ytsg_parse_args (int *argc, char ***argv) +yts_parse_args (int *argc, char ***argv) { GOptionContext *option_context; - GOptionGroup *ytsg_group; + GOptionGroup *yts_group; GError *error = NULL; gboolean ret = TRUE; - if (ytsg_is_initialized) + if (yts_is_initialized) return TRUE; option_context = g_option_context_new (NULL); g_option_context_set_ignore_unknown_options (option_context, TRUE); g_option_context_set_help_enabled (option_context, FALSE); - ytsg_group = ytsg_get_option_group (); - g_option_context_set_main_group (option_context, ytsg_group); + yts_group = yts_get_option_group (); + g_option_context_set_main_group (option_context, yts_group); if (!g_option_context_parse (option_context, argc, argv, &error)) { @@ -349,7 +349,7 @@ ytsg_parse_args (int *argc, char ***argv) } /** - * ytsg_init: + * yts_init: * @argc: (inout): The number of arguments in @argv * @argv: (array length=argc) (inout) (allow-none): A pointer to an array * of arguments. @@ -359,20 +359,20 @@ ytsg_parse_args (int *argc, char ***argv) * Return value: 1 on success, < 0 on failure. */ int -ytsg_init (int *argc, char ***argv) +yts_init (int *argc, char ***argv) { GError *error = NULL; - if (ytsg_is_initialized) + if (yts_is_initialized) return 1; - ytsg_base_init (); + yts_base_init (); - if (!ytsg_parse_args (argc, argv)) + if (!yts_parse_args (argc, argv)) { g_warning ("Failed to parse arguments."); return 0; } - return ytsg_init_real (&error); + return yts_init_real (&error); } diff --git a/ytstenut/ytsg-main.h b/ytstenut/yts-main.h index 3529fbd..11d99cd 100644 --- a/ytstenut/ytsg-main.h +++ b/ytstenut/yts-main.h @@ -19,16 +19,16 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _YTSG_UTIL_H -#define _YTSG_UTIL_H +#ifndef _YTS_UTIL_H +#define _YTS_UTIL_H #include <glib.h> G_BEGIN_DECLS -int ytsg_init (int *argc, char ***argv); -GOptionGroup *ytsg_get_option_group (void); +int yts_init (int *argc, char ***argv); +GOptionGroup *yts_get_option_group (void); G_END_DECLS -#endif /* _YTSG_UTIL_H */ +#endif /* _YTS_UTIL_H */ diff --git a/ytstenut/ytsg-message.c b/ytstenut/yts-message.c index 3506db3..0084258 100644 --- a/ytstenut/ytsg-message.c +++ b/ytstenut/yts-message.c @@ -20,33 +20,33 @@ */ /** - * SECTION:ytsg-message + * SECTION:yts-message * @short_description: Encapsulates a Ytstenut metadata message. * - * #YtsgMessage represents a Ytstenut metadata message. + * #YtsMessage represents a Ytstenut metadata message. */ -#include "ytsg-message.h" -#include "ytsg-private.h" +#include "yts-message.h" +#include "yts-private.h" -static void ytsg_message_dispose (GObject *object); -static void ytsg_message_finalize (GObject *object); -static void ytsg_message_constructed (GObject *object); -static void ytsg_message_get_property (GObject *object, +static void yts_message_dispose (GObject *object); +static void yts_message_finalize (GObject *object); +static void yts_message_constructed (GObject *object); +static void yts_message_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_message_set_property (GObject *object, +static void yts_message_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -G_DEFINE_TYPE (YtsgMessage, ytsg_message, YTSG_TYPE_METADATA); +G_DEFINE_TYPE (YtsMessage, yts_message, YTS_TYPE_METADATA); -#define YTSG_MESSAGE_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_MESSAGE, YtsgMessagePrivate)) +#define YTS_MESSAGE_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_MESSAGE, YtsMessagePrivate)) -struct _YtsgMessagePrivate +struct _YtsMessagePrivate { guint disposed : 1; }; @@ -64,28 +64,28 @@ enum /*static guint signals[N_SIGNALS] = {0};*/ static void -ytsg_message_class_init (YtsgMessageClass *klass) +yts_message_class_init (YtsMessageClass *klass) { GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgMessagePrivate)); + g_type_class_add_private (klass, sizeof (YtsMessagePrivate)); - object_class->dispose = ytsg_message_dispose; - object_class->finalize = ytsg_message_finalize; - object_class->constructed = ytsg_message_constructed; - object_class->get_property = ytsg_message_get_property; - object_class->set_property = ytsg_message_set_property; + object_class->dispose = yts_message_dispose; + object_class->finalize = yts_message_finalize; + object_class->constructed = yts_message_constructed; + object_class->get_property = yts_message_get_property; + object_class->set_property = yts_message_set_property; } static void -ytsg_message_constructed (GObject *object) +yts_message_constructed (GObject *object) { - if (G_OBJECT_CLASS (ytsg_message_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_message_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_message_parent_class)->constructed) + G_OBJECT_CLASS (yts_message_parent_class)->constructed (object); } static void -ytsg_message_get_property (GObject *object, +yts_message_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -98,7 +98,7 @@ ytsg_message_get_property (GObject *object, } static void -ytsg_message_set_property (GObject *object, +yts_message_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) @@ -111,51 +111,51 @@ ytsg_message_set_property (GObject *object, } static void -ytsg_message_init (YtsgMessage *self) +yts_message_init (YtsMessage *self) { - self->priv = YTSG_MESSAGE_GET_PRIVATE (self); + self->priv = YTS_MESSAGE_GET_PRIVATE (self); } static void -ytsg_message_dispose (GObject *object) +yts_message_dispose (GObject *object) { - YtsgMessage *self = (YtsgMessage*) object; - YtsgMessagePrivate *priv = self->priv; + YtsMessage *self = (YtsMessage*) object; + YtsMessagePrivate *priv = self->priv; if (priv->disposed) return; priv->disposed = TRUE; - G_OBJECT_CLASS (ytsg_message_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_message_parent_class)->dispose (object); } static void -ytsg_message_finalize (GObject *object) +yts_message_finalize (GObject *object) { - G_OBJECT_CLASS (ytsg_message_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_message_parent_class)->finalize (object); } /** - * ytsg_message_new: + * yts_message_new: * @attributes: NULL terminated array of name/value pairs; can be %NULL * - * Constructs a new #YtsgMessage object, setting the top level attributes. + * Constructs a new #YtsMessage object, setting the top level attributes. * - * Return value: (transfer full): newly allocated #YtsgMessage object. + * Return value: (transfer full): newly allocated #YtsMessage object. */ -YtsgMessage * -ytsg_message_new (const char ** attributes) +YtsMessage * +yts_message_new (const char ** attributes) { RestXmlNode *top = rest_xml_node_add_child (NULL, "message"); - YtsgMetadata *mdata; + YtsMetadata *mdata; g_return_val_if_fail (top, NULL); - mdata = _ytsg_metadata_new_from_node (top, attributes); + mdata = _yts_metadata_new_from_node (top, attributes); - g_return_val_if_fail (YTSG_IS_MESSAGE (mdata), NULL); + g_return_val_if_fail (YTS_IS_MESSAGE (mdata), NULL); - return (YtsgMessage*) mdata; + return (YtsMessage*) mdata; } diff --git a/ytstenut/yts-message.h b/ytstenut/yts-message.h new file mode 100644 index 0000000..596455b --- /dev/null +++ b/ytstenut/yts-message.h @@ -0,0 +1,86 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_MESSAGE_H +#define _YTS_MESSAGE_H + +#include <ytstenut/yts-metadata.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_MESSAGE \ + (yts_message_get_type()) +#define YTS_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_MESSAGE, \ + YtsMessage)) +#define YTS_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_MESSAGE, \ + YtsMessageClass)) +#define YTS_IS_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_MESSAGE)) +#define YTS_IS_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_MESSAGE)) +#define YTS_MESSAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_MESSAGE, \ + YtsMessageClass)) + +typedef struct _YtsMessage YtsMessage; +typedef struct _YtsMessageClass YtsMessageClass; +typedef struct _YtsMessagePrivate YtsMessagePrivate; + +/** + * YtsMessageClass: + * + * #YtsMessage class. + */ +struct _YtsMessageClass +{ + /*< private >*/ + YtsMetadataClass parent_class; +}; + +/** + * YtsMessage: + * + * Encapsulates a Ytstenut message, either being sent to a given #YtsService or + * received by #YtsClient. + */ +struct _YtsMessage +{ + /*< private >*/ + YtsMetadata parent; + + /*< private >*/ + YtsMessagePrivate *priv; +}; + +GType yts_message_get_type (void) G_GNUC_CONST; + +YtsMessage *yts_message_new (const char ** attributes); + +G_END_DECLS + +#endif /* _YTS_MESSAGE_H */ diff --git a/ytstenut/ytsg-metadata-service.c b/ytstenut/yts-metadata-service.c index 3c4f6ec..600d4af 100644 --- a/ytstenut/ytsg-metadata-service.c +++ b/ytstenut/yts-metadata-service.c @@ -20,46 +20,46 @@ */ /** - * SECTION:ytsg-metadata-service + * SECTION:yts-metadata-service * @short_description: Represents a metadata service * connected to the Ytstenut mesh. * - * #YtsgMetadataService represents a known metadata service in the Ytstenut + * #YtsMetadataService represents a known metadata service in the Ytstenut * application mesh. */ #include <string.h> #include <telepathy-glib/util.h> -#include "ytsg-metadata-service.h" +#include "yts-metadata-service.h" -#include "ytsg-client.h" -#include "ytsg-debug.h" -#include "ytsg-invocation-message.h" -#include "ytsg-marshal.h" -#include "ytsg-message.h" -#include "ytsg-private.h" -#include "ytsg-status.h" +#include "yts-client.h" +#include "yts-debug.h" +#include "yts-invocation-message.h" +#include "yts-marshal.h" +#include "yts-message.h" +#include "yts-private.h" +#include "yts-status.h" -static void ytsg_metadata_service_dispose (GObject *object); -static void ytsg_metadata_service_finalize (GObject *object); -static void ytsg_metadata_service_get_property (GObject *object, +static void yts_metadata_service_dispose (GObject *object); +static void yts_metadata_service_finalize (GObject *object); +static void yts_metadata_service_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_metadata_service_set_property (GObject *object, +static void yts_metadata_service_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -G_DEFINE_TYPE (YtsgMetadataService, ytsg_metadata_service, YTSG_TYPE_SERVICE) +G_DEFINE_TYPE (YtsMetadataService, yts_metadata_service, YTS_TYPE_SERVICE) -#define YTSG_METADATA_SERVICE_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_METADATA_SERVICE, YtsgMetadataServicePrivate)) +#define YTS_METADATA_SERVICE_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_METADATA_SERVICE, YtsMetadataServicePrivate)) -struct _YtsgMetadataServicePrivate +struct _YtsMetadataServicePrivate { - YtsgStatus *status; + YtsStatus *status; guint disposed : 1; guint test : 1; @@ -82,34 +82,34 @@ enum static guint signals[N_SIGNALS] = {0}; static void -ytsg_metadata_service_class_init (YtsgMetadataServiceClass *klass) +yts_metadata_service_class_init (YtsMetadataServiceClass *klass) { GParamSpec *pspec; GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgMetadataServicePrivate)); + g_type_class_add_private (klass, sizeof (YtsMetadataServicePrivate)); - object_class->dispose = ytsg_metadata_service_dispose; - object_class->finalize = ytsg_metadata_service_finalize; - object_class->get_property = ytsg_metadata_service_get_property; - object_class->set_property = ytsg_metadata_service_set_property; + object_class->dispose = yts_metadata_service_dispose; + object_class->finalize = yts_metadata_service_finalize; + object_class->get_property = yts_metadata_service_get_property; + object_class->set_property = yts_metadata_service_set_property; /** - * YtsgMetadataService:test: + * YtsMetadataService:test: * - * allows partial construction of YtsgMetadataService for compile time + * allows partial construction of YtsMetadataService for compile time * test purposes. */ pspec = g_param_spec_boolean ("metadata-service-test", - "YtsgMetadataService test", - "YtsgMetadataService test", + "YtsMetadataService test", + "YtsMetadataService test", FALSE, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (object_class, PROP_METADATA_SERVICE_TEST, pspec); /** - * YtsgMetadataService::status: + * YtsMetadataService::status: * @service: the service which received the signal * @status: the status * @@ -121,15 +121,15 @@ ytsg_metadata_service_class_init (YtsgMetadataServiceClass *klass) g_signal_new (I_("status"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgMetadataServiceClass, received_status), + G_STRUCT_OFFSET (YtsMetadataServiceClass, received_status), NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_STATUS); + YTS_TYPE_STATUS); /** - * YtsgMetadataService::received-message: + * YtsMetadataService::received-message: * @service: the service which received the signal * @message: the message * @@ -141,22 +141,22 @@ ytsg_metadata_service_class_init (YtsgMetadataServiceClass *klass) g_signal_new (I_("received-message"), G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgMetadataServiceClass, received_message), + G_STRUCT_OFFSET (YtsMetadataServiceClass, received_message), NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_MESSAGE); + YTS_TYPE_MESSAGE); } static void -ytsg_metadata_service_notify_status_xml_cb (YtsgMetadataService *self, +yts_metadata_service_notify_status_xml_cb (YtsMetadataService *self, GParamSpec *pspec, gpointer data) { - YtsgMetadataServicePrivate *priv = self->priv; + YtsMetadataServicePrivate *priv = self->priv; char const *xml; - xml = ytsg_service_get_status_xml (YTSG_SERVICE (self)); + xml = yts_service_get_status_xml (YTS_SERVICE (self)); if (priv->status) { @@ -164,16 +164,16 @@ ytsg_metadata_service_notify_status_xml_cb (YtsgMetadataService *self, priv->status = NULL; } - priv->status = (YtsgStatus*) _ytsg_metadata_new_from_xml (xml); + priv->status = (YtsStatus*) _yts_metadata_new_from_xml (xml); - if (!YTSG_IS_STATUS (priv->status)) - g_warning ("Failed to construct YtsgStatus object"); + if (!YTS_IS_STATUS (priv->status)) + g_warning ("Failed to construct YtsStatus object"); g_signal_emit (self, signals[RECEIVED_STATUS], 0, priv->status); } static void -ytsg_metadata_service_get_property (GObject *object, +yts_metadata_service_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -186,13 +186,13 @@ ytsg_metadata_service_get_property (GObject *object, } static void -ytsg_metadata_service_set_property (GObject *object, +yts_metadata_service_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - YtsgMetadataService *self = (YtsgMetadataService*) object; - YtsgMetadataServicePrivate *priv = self->priv; + YtsMetadataService *self = (YtsMetadataService*) object; + YtsMetadataServicePrivate *priv = self->priv; switch (property_id) { @@ -205,19 +205,19 @@ ytsg_metadata_service_set_property (GObject *object, } static void -ytsg_metadata_service_init (YtsgMetadataService *self) +yts_metadata_service_init (YtsMetadataService *self) { - self->priv = YTSG_METADATA_SERVICE_GET_PRIVATE (self); + self->priv = YTS_METADATA_SERVICE_GET_PRIVATE (self); g_signal_connect (self, "notify::status-xml", - G_CALLBACK (ytsg_metadata_service_notify_status_xml_cb), NULL); + G_CALLBACK (yts_metadata_service_notify_status_xml_cb), NULL); } static void -ytsg_metadata_service_dispose (GObject *object) +yts_metadata_service_dispose (GObject *object) { - YtsgMetadataService *self = (YtsgMetadataService*) object; - YtsgMetadataServicePrivate *priv = self->priv; + YtsMetadataService *self = (YtsMetadataService*) object; + YtsMetadataServicePrivate *priv = self->priv; if (priv->disposed) return; @@ -230,95 +230,95 @@ ytsg_metadata_service_dispose (GObject *object) priv->status = NULL; } - G_OBJECT_CLASS (ytsg_metadata_service_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_metadata_service_parent_class)->dispose (object); } static void -ytsg_metadata_service_finalize (GObject *object) +yts_metadata_service_finalize (GObject *object) { - G_OBJECT_CLASS (ytsg_metadata_service_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_metadata_service_parent_class)->finalize (object); } void -_ytsg_metadata_service_received_status (YtsgMetadataService *service, +_yts_metadata_service_received_status (YtsMetadataService *service, const char *xml) { - YtsgMetadataServicePrivate *priv = service->priv; - YtsgStatus *status; + YtsMetadataServicePrivate *priv = service->priv; + YtsStatus *status; - status = (YtsgStatus*) _ytsg_metadata_new_from_xml (xml); + status = (YtsStatus*) _yts_metadata_new_from_xml (xml); if (priv->status) g_object_unref (priv->status); priv->status = status; - g_return_if_fail (YTSG_IS_STATUS (status)); + g_return_if_fail (YTS_IS_STATUS (status)); g_signal_emit (service, signals[RECEIVED_STATUS], 0, status); } void -_ytsg_metadata_service_received_message (YtsgMetadataService *service, +_yts_metadata_service_received_message (YtsMetadataService *service, const char *xml) { - YtsgMessage *message; + YtsMessage *message; - message = (YtsgMessage*) _ytsg_metadata_new_from_xml (xml); + message = (YtsMessage*) _yts_metadata_new_from_xml (xml); - g_return_if_fail (YTSG_IS_MESSAGE (message)); + g_return_if_fail (YTS_IS_MESSAGE (message)); g_signal_emit (service, signals[RECEIVED_MESSAGE], 0, message); } -static YtsgError -ytsg_service_metadata_send_message (YtsgMetadataService *service, - YtsgMessage *message) +static YtsError +yts_service_metadata_send_message (YtsMetadataService *service, + YtsMessage *message) { - YtsgService *s = (YtsgService*) service; - YtsgContact *contact = ytsg_service_get_contact (s); - YtsgClient *client = ytsg_contact_get_client (contact); - const char *uid = ytsg_service_get_uid (s); + YtsService *s = (YtsService*) service; + YtsContact *contact = yts_service_get_contact (s); + YtsClient *client = yts_contact_get_client (contact); + const char *uid = yts_service_get_uid (s); - return _ytsg_client_send_message (client, contact, uid, YTSG_METADATA (message)); + return _yts_client_send_message (client, contact, uid, YTS_METADATA (message)); } /** - * ytsg_metadata_service_send_metadata: - * @service: #YtsgMetadataService - * @metadata: #YtsgMetadata that was received + * yts_metadata_service_send_metadata: + * @service: #YtsMetadataService + * @metadata: #YtsMetadata that was received * * Sends the provided metadata via the service. * - * Return value: #YtsgError indicating status of the operation. + * Return value: #YtsError indicating status of the operation. */ -YtsgError -ytsg_metadata_service_send_metadata (YtsgMetadataService *service, - YtsgMetadata *metadata) +YtsError +yts_metadata_service_send_metadata (YtsMetadataService *service, + YtsMetadata *metadata) { - g_return_val_if_fail (YTSG_IS_METADATA_SERVICE (service), - ytsg_error_new (YTSG_ERROR_INVALID_PARAMETER)); - g_return_val_if_fail (YTSG_IS_METADATA (metadata), - ytsg_error_new (YTSG_ERROR_INVALID_PARAMETER)); + g_return_val_if_fail (YTS_IS_METADATA_SERVICE (service), + yts_error_new (YTS_ERROR_INVALID_PARAMETER)); + g_return_val_if_fail (YTS_IS_METADATA (metadata), + yts_error_new (YTS_ERROR_INVALID_PARAMETER)); - if (YTSG_IS_MESSAGE (metadata) || - YTSG_IS_INVOCATION_MESSAGE (metadata)) + if (YTS_IS_MESSAGE (metadata) || + YTS_IS_INVOCATION_MESSAGE (metadata)) { - return ytsg_service_metadata_send_message (service, - (YtsgMessage*)metadata); + return yts_service_metadata_send_message (service, + (YtsMessage*)metadata); } - else if (YTSG_IS_STATUS (metadata)) + else if (YTS_IS_STATUS (metadata)) { - g_warning ("Cannot send YtsgStatus, only YtsgMessage !!!"); + g_warning ("Cannot send YtsStatus, only YtsMessage !!!"); } else g_warning ("Unknown metadata type %s", G_OBJECT_TYPE_NAME (metadata)); - return ytsg_error_new (YTSG_ERROR_INVALID_PARAMETER); + return yts_error_new (YTS_ERROR_INVALID_PARAMETER); } -YtsgService * -_ytsg_metadata_service_new (YtsgContact *contact, +YtsService * +_yts_metadata_service_new (YtsContact *contact, const char *uid, const char *type, const char **caps, @@ -326,7 +326,7 @@ _ytsg_metadata_service_new (YtsgContact *contact, { g_return_val_if_fail (uid && *uid, NULL); - return g_object_new (YTSG_TYPE_METADATA_SERVICE, + return g_object_new (YTS_TYPE_METADATA_SERVICE, "contact", contact, "uid", uid, "type", type, @@ -335,12 +335,12 @@ _ytsg_metadata_service_new (YtsgContact *contact, NULL); } -YtsgStatus * -ytsg_metadata_service_get_status (YtsgMetadataService *service) +YtsStatus * +yts_metadata_service_get_status (YtsMetadataService *service) { - YtsgMetadataServicePrivate *priv; + YtsMetadataServicePrivate *priv; - g_return_val_if_fail (YTSG_IS_METADATA_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_METADATA_SERVICE (service), NULL); priv = service->priv; diff --git a/ytstenut/yts-metadata-service.h b/ytstenut/yts-metadata-service.h new file mode 100644 index 0000000..8d0ccde --- /dev/null +++ b/ytstenut/yts-metadata-service.h @@ -0,0 +1,75 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +#ifndef _YTS_METADATA_SERVICE_H +#define _YTS_METADATA_SERVICE_H + +#include <ytstenut/yts-error.h> +#include <ytstenut/yts-message.h> +#include <ytstenut/yts-service.h> +#include <ytstenut/yts-status.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_METADATA_SERVICE \ + (yts_metadata_service_get_type()) + +#define YTS_METADATA_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_METADATA_SERVICE, \ + YtsMetadataService)) +#define YTS_METADATA_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_METADATA_SERVICE, \ + YtsMetadataServiceClass)) +#define YTS_IS_METADATA_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_METADATA_SERVICE)) +#define YTS_IS_METADATA_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_METADATA_SERVICE)) +#define YTS_METADATA_SERVICE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_METADATA_SERVICE, \ + YtsMetadataServiceClass)) + +typedef struct _YtsMetadataService YtsMetadataService; +typedef struct _YtsMetadataServiceClass YtsMetadataServiceClass; +typedef struct _YtsMetadataServicePrivate YtsMetadataServicePrivate; + +/** + * YtsMetadataServiceClass: + * + * #YtsMetadataService class. + */ +struct _YtsMetadataServiceClass +{ + /*< private >*/ + YtsServiceClass parent_class; + + /*< public >*/ + void (*received_status) (YtsMetadataService *service, YtsStatus *status); + void (*received_message) (YtsMetadataService *service, YtsMessage *message); +}; + +/** + * YtsMetadataService: + * + * Ytstenut service. + */ +struct _YtsMetadataService +{ + /*< private >*/ + YtsService parent; + + /*< private >*/ + YtsMetadataServicePrivate *priv; +}; + +GType yts_metadata_service_get_type (void) G_GNUC_CONST; + +YtsError yts_metadata_service_send_metadata (YtsMetadataService *service, + YtsMetadata *metadata); + +G_END_DECLS + +#endif /* _YTS_METADATA_SERVICE_H */ diff --git a/ytstenut/ytsg-metadata.c b/ytstenut/yts-metadata.c index 3b4f448..416d381 100644 --- a/ytstenut/ytsg-metadata.c +++ b/ytstenut/yts-metadata.c @@ -20,38 +20,38 @@ */ /** - * SECTION:ytsg-metadata - * @short_description: Base class for #YtsgStatus and #YtsgMessage. + * SECTION:yts-metadata + * @short_description: Base class for #YtsStatus and #YtsMessage. * - * #YtsgMetadata is a base class for Ytstenut metadata classes. + * #YtsMetadata is a base class for Ytstenut metadata classes. */ -#include "ytsg-metadata.h" -#include "ytsg-private.h" -#include "ytsg-message.h" -#include "ytsg-status.h" +#include "yts-metadata.h" +#include "yts-private.h" +#include "yts-message.h" +#include "yts-status.h" #include <rest/rest-xml-parser.h> #include <string.h> -static void ytsg_metadata_dispose (GObject *object); -static void ytsg_metadata_finalize (GObject *object); -static void ytsg_metadata_constructed (GObject *object); -static void ytsg_metadata_get_property (GObject *object, +static void yts_metadata_dispose (GObject *object); +static void yts_metadata_finalize (GObject *object); +static void yts_metadata_constructed (GObject *object); +static void yts_metadata_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_metadata_set_property (GObject *object, +static void yts_metadata_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -G_DEFINE_TYPE (YtsgMetadata, ytsg_metadata, G_TYPE_OBJECT); +G_DEFINE_TYPE (YtsMetadata, yts_metadata, G_TYPE_OBJECT); -#define YTSG_METADATA_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_METADATA, YtsgMetadataPrivate)) +#define YTS_METADATA_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_METADATA, YtsMetadataPrivate)) -struct _YtsgMetadataPrivate +struct _YtsMetadataPrivate { RestXmlNode *top_level_node; char *xml; @@ -75,23 +75,23 @@ enum }; static void -ytsg_metadata_class_init (YtsgMetadataClass *klass) +yts_metadata_class_init (YtsMetadataClass *klass) { GParamSpec *pspec; GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgMetadataPrivate)); + g_type_class_add_private (klass, sizeof (YtsMetadataPrivate)); - object_class->dispose = ytsg_metadata_dispose; - object_class->finalize = ytsg_metadata_finalize; - object_class->constructed = ytsg_metadata_constructed; - object_class->get_property = ytsg_metadata_get_property; - object_class->set_property = ytsg_metadata_set_property; + object_class->dispose = yts_metadata_dispose; + object_class->finalize = yts_metadata_finalize; + object_class->constructed = yts_metadata_constructed; + object_class->get_property = yts_metadata_get_property; + object_class->set_property = yts_metadata_set_property; /** - * YtsgMetadata:xml: + * YtsMetadata:xml: * - * The XML node this #YtsgMetadata object is to represent + * The XML node this #YtsMetadata object is to represent * * This property is only valid during construction, as no copies are made. */ @@ -103,7 +103,7 @@ ytsg_metadata_class_init (YtsgMetadataClass *klass) g_object_class_install_property (object_class, PROP_XML, pspec); /** - * YtsgMetadata:top-level-node: + * YtsMetadata:top-level-node: * * The top level node for the metadata */ @@ -115,7 +115,7 @@ ytsg_metadata_class_init (YtsgMetadataClass *klass) g_object_class_install_property (object_class, PROP_TOP_LEVEL_NODE, pspec); /** - * YtsgMetadata:attributes: + * YtsMetadata:attributes: * * Top level attributes; this property is only valid during the construction * of the object, as no copies of the supplied value are made! @@ -129,13 +129,13 @@ ytsg_metadata_class_init (YtsgMetadataClass *klass) } static void -ytsg_metadata_constructed (GObject *object) +yts_metadata_constructed (GObject *object) { - YtsgMetadata *self = (YtsgMetadata*) object; - YtsgMetadataPrivate *priv = self->priv; + YtsMetadata *self = (YtsMetadata*) object; + YtsMetadataPrivate *priv = self->priv; - if (G_OBJECT_CLASS (ytsg_metadata_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_metadata_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_metadata_parent_class)->constructed) + G_OBJECT_CLASS (yts_metadata_parent_class)->constructed (object); g_assert (priv->xml || priv->top_level_node); @@ -177,7 +177,7 @@ ytsg_metadata_constructed (GObject *object) } static void -ytsg_metadata_get_property (GObject *object, +yts_metadata_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -190,13 +190,13 @@ ytsg_metadata_get_property (GObject *object, } static void -ytsg_metadata_set_property (GObject *object, +yts_metadata_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - YtsgMetadata *self = (YtsgMetadata*) object; - YtsgMetadataPrivate *priv = self->priv; + YtsMetadata *self = (YtsMetadata*) object; + YtsMetadataPrivate *priv = self->priv; switch (property_id) { @@ -218,16 +218,16 @@ ytsg_metadata_set_property (GObject *object, } static void -ytsg_metadata_init (YtsgMetadata *self) +yts_metadata_init (YtsMetadata *self) { - self->priv = YTSG_METADATA_GET_PRIVATE (self); + self->priv = YTS_METADATA_GET_PRIVATE (self); } static void -ytsg_metadata_dispose (GObject *object) +yts_metadata_dispose (GObject *object) { - YtsgMetadata *self = (YtsgMetadata*) object; - YtsgMetadataPrivate *priv = self->priv; + YtsMetadata *self = (YtsMetadata*) object; + YtsMetadataPrivate *priv = self->priv; if (priv->disposed) return; @@ -237,18 +237,18 @@ ytsg_metadata_dispose (GObject *object) if (priv->top_level_node) rest_xml_node_unref (priv->top_level_node); - G_OBJECT_CLASS (ytsg_metadata_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_metadata_parent_class)->dispose (object); } static void -ytsg_metadata_finalize (GObject *object) +yts_metadata_finalize (GObject *object) { - G_OBJECT_CLASS (ytsg_metadata_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_metadata_parent_class)->finalize (object); } /** - * ytsg_metadata_get_root_node: - * @self: #YtsgMetadata + * yts_metadata_get_root_node: + * @self: #YtsMetadata * * Returns pointer to the top-level node of the metadata, that can be used * with the #RestXmlNode API. @@ -259,11 +259,11 @@ ytsg_metadata_finalize (GObject *object) * of the metadata xml. */ RestXmlNode * -ytsg_metadata_get_root_node (YtsgMetadata *self) +yts_metadata_get_root_node (YtsMetadata *self) { - YtsgMetadataPrivate *priv; + YtsMetadataPrivate *priv; - g_return_val_if_fail (YTSG_IS_METADATA (self), NULL); + g_return_val_if_fail (YTS_IS_METADATA (self), NULL); priv = self->priv; @@ -271,16 +271,16 @@ ytsg_metadata_get_root_node (YtsgMetadata *self) } /* - * _ytsg_metadata_new_from_xml: + * _yts_metadata_new_from_xml: * @xml: the xml the metatdata object is to represent * - * Constructs a new #YtsgMetadata object from the xml snippet; depending on the - * xml, this is either #YtsgMessage or #YtsgStatus. + * Constructs a new #YtsMetadata object from the xml snippet; depending on the + * xml, this is either #YtsMessage or #YtsStatus. */ -YtsgMetadata * -_ytsg_metadata_new_from_xml (const char *xml) +YtsMetadata * +_yts_metadata_new_from_xml (const char *xml) { - YtsgMetadata *mdata; + YtsMetadata *mdata; RestXmlParser *parser; RestXmlNode *node; @@ -294,39 +294,39 @@ _ytsg_metadata_new_from_xml (const char *xml) /* We do not unref the node, the object takes over the reference */ - mdata = _ytsg_metadata_new_from_node (node, NULL); + mdata = _yts_metadata_new_from_node (node, NULL); mdata->priv->readonly = TRUE; return mdata; } /* - * _ytsg_metadata_new_from_node: + * _yts_metadata_new_from_node: * @node: #RestXmlNode * @attributes: %NULL terminated array of name/value pairs for additional * attributes, can be %NULL * * Private constructor. * - * Return value: (transfer full): newly allocated #YtsgMetadata subclass, either - * #YtsgMessage or #YtsgStatus, depending on the top level node. + * Return value: (transfer full): newly allocated #YtsMetadata subclass, either + * #YtsMessage or #YtsStatus, depending on the top level node. */ -YtsgMetadata * -_ytsg_metadata_new_from_node (RestXmlNode *node, const char **attributes) +YtsMetadata * +_yts_metadata_new_from_node (RestXmlNode *node, const char **attributes) { - YtsgMetadata *mdata = NULL; + YtsMetadata *mdata = NULL; g_return_val_if_fail (node && node->name, NULL); if (!strcmp (node->name, "message")) { if (attributes) - mdata = g_object_new (YTSG_TYPE_MESSAGE, + mdata = g_object_new (YTS_TYPE_MESSAGE, "top-level-node", node, "attributes", attributes, NULL); else - mdata = g_object_new (YTSG_TYPE_MESSAGE, "top-level-node", node, NULL); + mdata = g_object_new (YTS_TYPE_MESSAGE, "top-level-node", node, NULL); } else if (!strcmp (node->name, "status")) { @@ -352,7 +352,7 @@ _ytsg_metadata_new_from_node (RestXmlNode *node, const char **attributes) if (!have_caps || !have_activity || !have_from) { - g_warning ("Cannot construct YtsgStatus without capability, " + g_warning ("Cannot construct YtsStatus without capability, " "activity and from-service attributes."); return NULL; } @@ -360,19 +360,19 @@ _ytsg_metadata_new_from_node (RestXmlNode *node, const char **attributes) if (have_xmlns) { g_warning ("xmlns attribute is not allowed when constructing " - "YtsgStatus"); + "YtsStatus"); return NULL; } - mdata = g_object_new (YTSG_TYPE_STATUS, + mdata = g_object_new (YTS_TYPE_STATUS, "top-level-node", node, "attributes", attributes, NULL); - ytsg_metadata_add_attribute (mdata, "xmlns", "urn:ytstenut:status"); + yts_metadata_add_attribute (mdata, "xmlns", "urn:ytstenut:status"); } else - mdata = g_object_new (YTSG_TYPE_STATUS, "top-level-node", node, NULL); + mdata = g_object_new (YTS_TYPE_STATUS, "top-level-node", node, NULL); } else g_warning ("Unknown top level node '%s'", node->name); @@ -383,24 +383,24 @@ _ytsg_metadata_new_from_node (RestXmlNode *node, const char **attributes) } /** - * ytsg_metadata_get_attribute: - * @self: #YtsgMetadata + * yts_metadata_get_attribute: + * @self: #YtsMetadata * @name: name of the attribute to look up * * Retrieves the value of an attribute of the given name on the top level node - * of the #YtsgMetadata object (to query attributes on children of the top level - * node, you need to use ytsg_metadata_get_root_node() and the librest API to + * of the #YtsMetadata object (to query attributes on children of the top level + * node, you need to use yts_metadata_get_root_node() and the librest API to * locate and query the appropriate node). * * Return value: (transfer none): the attribute value or %NULL if attribute * does not exist. */ const char * -ytsg_metadata_get_attribute (YtsgMetadata *self, const char *name) +yts_metadata_get_attribute (YtsMetadata *self, const char *name) { - YtsgMetadataPrivate *priv; + YtsMetadataPrivate *priv; - g_return_val_if_fail (YTSG_IS_METADATA (self), NULL); + g_return_val_if_fail (YTS_IS_METADATA (self), NULL); priv = self->priv; @@ -410,26 +410,26 @@ ytsg_metadata_get_attribute (YtsgMetadata *self, const char *name) } /** - * ytsg_metadata_add_attribute: - * @self: #YtsgMetadata + * yts_metadata_add_attribute: + * @self: #YtsMetadata * @name: name of the attribute to add * @value: value of the attribute to add * * Adds an attribute of the given name on the top level node - * of the #YtsgMetadata object (to add attributes to children of the top level - * node, you need to use ytsg_metadata_get_root_node() and the librest API to + * of the #YtsMetadata object (to add attributes to children of the top level + * node, you need to use yts_metadata_get_root_node() and the librest API to * construct the metadata tree). * * NB: Both attribute names and values must be in utf-8 encoding. */ void -ytsg_metadata_add_attribute (YtsgMetadata *self, +yts_metadata_add_attribute (YtsMetadata *self, const char *name, const char *value) { - YtsgMetadataPrivate *priv; + YtsMetadataPrivate *priv; - g_return_if_fail (YTSG_IS_METADATA (self) && name && *name && value); + g_return_if_fail (YTS_IS_METADATA (self) && name && *name && value); priv = self->priv; @@ -440,20 +440,20 @@ ytsg_metadata_add_attribute (YtsgMetadata *self, } /** - * ytsg_metadata_to_string: - * @self: #YtsgMetadata + * yts_metadata_to_string: + * @self: #YtsMetadata * - * Converts the #YtsgMetada object in XML representation. + * Converts the #YtsMetada object in XML representation. * * Return value: (transfer full): xml string; the caller must free the string * with g_free() when no longer needed. */ char * -ytsg_metadata_to_string (YtsgMetadata *self) +yts_metadata_to_string (YtsMetadata *self) { - YtsgMetadataPrivate *priv; + YtsMetadataPrivate *priv; - g_return_val_if_fail (YTSG_IS_METADATA (self), NULL); + g_return_val_if_fail (YTS_IS_METADATA (self), NULL); priv = self->priv; @@ -463,29 +463,29 @@ ytsg_metadata_to_string (YtsgMetadata *self) } /* - * _ytsg_metadata_extract: - * @self: #YtsgMetadata + * _yts_metadata_extract: + * @self: #YtsMetadata * @body: location to store the body of the metadata; free with g_free() when no * longer needed. * * Extracts the top level attributes into a hash table, and converts the * content of any child nodes to xml string. This is intended for use by - * #YtsgClient when sending messages. + * #YtsClient when sending messages. * * Return value: (transfer full): top level attributes, the caller holds a * reference on the returned hash table, which it needs to release with * g_hash_table_unref() when no longer needed. */ GHashTable * -_ytsg_metadata_extract (YtsgMetadata *self, char **body) +_yts_metadata_extract (YtsMetadata *self, char **body) { - YtsgMetadataPrivate *priv; + YtsMetadataPrivate *priv; RestXmlNode *n0; GHashTableIter iter; gpointer key, value; char *b; - g_return_val_if_fail (YTSG_IS_METADATA (self) && body, NULL); + g_return_val_if_fail (YTS_IS_METADATA (self) && body, NULL); priv = self->priv; n0 = priv->top_level_node; @@ -512,7 +512,7 @@ _ytsg_metadata_extract (YtsgMetadata *self, char **body) } static gboolean -ytsg_rest_xml_node_check_attrs (RestXmlNode *node0, RestXmlNode *node1) +yts_rest_xml_node_check_attrs (RestXmlNode *node0, RestXmlNode *node1) { GHashTableIter iter; gpointer key, value; @@ -535,7 +535,7 @@ ytsg_rest_xml_node_check_attrs (RestXmlNode *node0, RestXmlNode *node1) return TRUE; } -static gboolean ytsg_rest_xml_node_check_children (RestXmlNode*, RestXmlNode*); +static gboolean yts_rest_xml_node_check_children (RestXmlNode*, RestXmlNode*); /* * NB: this function is somewhat simplistic; it assumes that if two nodes have @@ -543,7 +543,7 @@ static gboolean ytsg_rest_xml_node_check_children (RestXmlNode*, RestXmlNode*); * can we define equaly in any other way? */ static gboolean -ytsg_rest_xml_node_check_siblings (RestXmlNode *node0, RestXmlNode *node1) +yts_rest_xml_node_check_siblings (RestXmlNode *node0, RestXmlNode *node1) { RestXmlNode *sib0 = node0->next; RestXmlNode *sib1 = node1->next; @@ -556,10 +556,10 @@ ytsg_rest_xml_node_check_siblings (RestXmlNode *node0, RestXmlNode *node1) if ((!sib0 && sib1) || (sib0 && !sib1)) return FALSE; - if (!ytsg_rest_xml_node_check_attrs (sib0, sib1)) + if (!yts_rest_xml_node_check_attrs (sib0, sib1)) return FALSE; - if (!ytsg_rest_xml_node_check_children (sib0, sib1)) + if (!yts_rest_xml_node_check_children (sib0, sib1)) return FALSE; sib0 = sib0->next; @@ -570,7 +570,7 @@ ytsg_rest_xml_node_check_siblings (RestXmlNode *node0, RestXmlNode *node1) } static gboolean -ytsg_rest_xml_node_check_children (RestXmlNode *node0, RestXmlNode *node1) +yts_rest_xml_node_check_children (RestXmlNode *node0, RestXmlNode *node1) { GHashTableIter iter; gpointer key, value; @@ -589,13 +589,13 @@ ytsg_rest_xml_node_check_children (RestXmlNode *node0, RestXmlNode *node1) (child0->next && !child1->next) || (!child0->next && child1->next)) return FALSE; - if (!ytsg_rest_xml_node_check_attrs (child0, child1)) + if (!yts_rest_xml_node_check_attrs (child0, child1)) return FALSE; - if (!ytsg_rest_xml_node_check_siblings (child0, child1)) + if (!yts_rest_xml_node_check_siblings (child0, child1)) return FALSE; - if (!ytsg_rest_xml_node_check_children (child0, child1)) + if (!yts_rest_xml_node_check_children (child0, child1)) return FALSE; } @@ -603,35 +603,35 @@ ytsg_rest_xml_node_check_children (RestXmlNode *node0, RestXmlNode *node1) } /** - * ytsg_metadata_is_equal: - * @self: #YtsgMetadata, - * @other: #YtsgMetadata + * yts_metadata_is_equal: + * @self: #YtsMetadata, + * @other: #YtsMetadata * * Compares two metadata instances and returns %TRUE if they are equal. - * NB: equality implies identity of type, i.e., #YtsgMessage and #YtsgStatus + * NB: equality implies identity of type, i.e., #YtsMessage and #YtsStatus * can be compared, but will always be unequal. * * Return value: %TRUE if equal, %FALSE otherwise. */ gboolean -ytsg_metadata_is_equal (YtsgMetadata *self, YtsgMetadata *other) +yts_metadata_is_equal (YtsMetadata *self, YtsMetadata *other) { RestXmlNode *node0; RestXmlNode *node1; - g_return_val_if_fail (YTSG_IS_METADATA (self) && YTSG_IS_METADATA (other), + g_return_val_if_fail (YTS_IS_METADATA (self) && YTS_IS_METADATA (other), FALSE); if (G_OBJECT_TYPE (self) != G_OBJECT_TYPE (other)) return FALSE; - node0 = ytsg_metadata_get_root_node ((YtsgMetadata*) self); - node1 = ytsg_metadata_get_root_node ((YtsgMetadata*) other); + node0 = yts_metadata_get_root_node ((YtsMetadata*) self); + node1 = yts_metadata_get_root_node ((YtsMetadata*) other); - if (!ytsg_rest_xml_node_check_attrs (node0, node1)) + if (!yts_rest_xml_node_check_attrs (node0, node1)) return FALSE; - if (!ytsg_rest_xml_node_check_children (node0, node1)) + if (!yts_rest_xml_node_check_children (node0, node1)) return FALSE; return TRUE; diff --git a/ytstenut/yts-metadata.h b/ytstenut/yts-metadata.h new file mode 100644 index 0000000..2bc29d5 --- /dev/null +++ b/ytstenut/yts-metadata.h @@ -0,0 +1,92 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_METADATA_H +#define _YTS_METADATA_H + +#include <glib-object.h> +#include <rest/rest-xml-node.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_METADATA \ + (yts_metadata_get_type()) +#define YTS_METADATA(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_METADATA, \ + YtsMetadata)) +#define YTS_METADATA_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_METADATA, \ + YtsMetadataClass)) +#define YTS_IS_METADATA(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_METADATA)) +#define YTS_IS_METADATA_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_METADATA)) +#define YTS_METADATA_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_METADATA, \ + YtsMetadataClass)) + +typedef struct _YtsMetadata YtsMetadata; +typedef struct _YtsMetadataClass YtsMetadataClass; +typedef struct _YtsMetadataPrivate YtsMetadataPrivate; + +/** + * YtsMetadataClass: + * + * #YtsMetadata class. + */ +struct _YtsMetadataClass +{ + /*< private >*/ + GObjectClass parent_class; +}; + +/** + * YtsMetadata: + * + * Base class for #YtsMessage and #YtsStatus. + */ +struct _YtsMetadata +{ + /*< private >*/ + GObject parent; + + /*< private >*/ + YtsMetadataPrivate *priv; +}; + +GType yts_metadata_get_type (void) G_GNUC_CONST; + +const char *yts_metadata_get_attribute (YtsMetadata *self, const char *name); +void yts_metadata_add_attribute (YtsMetadata *self, + const char *name, + const char *value); +char *yts_metadata_to_string (YtsMetadata *self); +gboolean yts_metadata_is_equal (YtsMetadata *self, YtsMetadata *other); +RestXmlNode *yts_metadata_get_root_node (YtsMetadata *self); + +G_END_DECLS + +#endif /* _YTS_METADATA_H */ diff --git a/ytstenut/ytsg-private.h b/ytstenut/yts-private.h index 06943e0..c1e3d3c 100644 --- a/ytstenut/ytsg-private.h +++ b/ytstenut/yts-private.h @@ -19,81 +19,81 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _YTSG_PRIVATE_H -#define _YTSG_PRIVATE_H +#ifndef _YTS_PRIVATE_H +#define _YTS_PRIVATE_H #include <rest/rest-xml-node.h> #include <telepathy-glib/contact.h> #include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h> -#include <ytstenut/ytsg-client.h> -#include <ytstenut/ytsg-contact.h> -#include <ytstenut/ytsg-error.h> -#include <ytstenut/ytsg-metadata.h> -#include <ytstenut/ytsg-metadata-service.h> -#include <ytstenut/ytsg-roster.h> -#include <ytstenut/ytsg-types.h> +#include <ytstenut/yts-client.h> +#include <ytstenut/yts-contact.h> +#include <ytstenut/yts-error.h> +#include <ytstenut/yts-metadata.h> +#include <ytstenut/yts-metadata-service.h> +#include <ytstenut/yts-roster.h> +#include <ytstenut/yts-types.h> #define I_(str) (g_intern_static_string ((str))) G_BEGIN_DECLS -YtsgContact *_ytsg_contact_new (YtsgClient *client, const char *jid); -void _ytsg_contact_add_service (YtsgContact *contact, - YtsgService *service); -void _ytsg_contact_remove_service_by_uid (YtsgContact *contact, +YtsContact *_yts_contact_new (YtsClient *client, const char *jid); +void _yts_contact_add_service (YtsContact *contact, + YtsService *service); +void _yts_contact_remove_service_by_uid (YtsContact *contact, const char *uid); -gboolean _ytsg_contact_is_empty (YtsgContact *contact); +gboolean _yts_contact_is_empty (YtsContact *contact); -YtsgMetadata *_ytsg_metadata_new_from_xml (const char *xml); -YtsgMetadata *_ytsg_metadata_new_from_node (RestXmlNode *node, +YtsMetadata *_yts_metadata_new_from_xml (const char *xml); +YtsMetadata *_yts_metadata_new_from_node (RestXmlNode *node, const char **attributes); -GHashTable *_ytsg_metadata_extract (YtsgMetadata *self, char **body); +GHashTable *_yts_metadata_extract (YtsMetadata *self, char **body); -YtsgService *_ytsg_metadata_service_new (YtsgContact *contact, +YtsService *_yts_metadata_service_new (YtsContact *contact, const char *uid, const char *type, const char **caps, GHashTable *names); -void _ytsg_metadata_service_received_status (YtsgMetadataService *service, +void _yts_metadata_service_received_status (YtsMetadataService *service, const char *xml); void -_ytsg_metadata_service_received_message (YtsgMetadataService *service, +_yts_metadata_service_received_message (YtsMetadataService *service, const char *xml); -YtsgRoster *_ytsg_roster_new (YtsgClient *client); +YtsRoster *_yts_roster_new (YtsClient *client); -void _ytsg_roster_add_contact (YtsgRoster *roster, - YtsgContact *contact); -void _ytsg_roster_remove_contact (YtsgRoster *roster, - YtsgContact *contact, +void _yts_roster_add_contact (YtsRoster *roster, + YtsContact *contact); +void _yts_roster_remove_contact (YtsRoster *roster, + YtsContact *contact, gboolean dispose); -void _ytsg_roster_add_service (YtsgRoster *roster, +void _yts_roster_add_service (YtsRoster *roster, const char *jid, const char *sid, const char *type, const char **caps, GHashTable *names); -void _ytsg_roster_remove_service_by_id (YtsgRoster *roster, +void _yts_roster_remove_service_by_id (YtsRoster *roster, const char *jid, const char *uid); -void _ytsg_roster_clear (YtsgRoster *roster); -YtsgContact *_ytsg_roster_find_contact_by_handle (YtsgRoster *roster, +void _yts_roster_clear (YtsRoster *roster); +YtsContact *_yts_roster_find_contact_by_handle (YtsRoster *roster, guint handle); -void _ytsg_contact_set_ft_channel (YtsgContact *item, +void _yts_contact_set_ft_channel (YtsContact *item, TpChannel *channel); -void _ytsg_client_reconnect_after (YtsgClient *client, +void _yts_client_reconnect_after (YtsClient *client, guint after_seconds); -TpConnection *_ytsg_client_get_connection (YtsgClient *client); -TpYtsStatus *_ytsg_client_get_tp_status (YtsgClient *client); -YtsgError _ytsg_client_send_message (YtsgClient *client, - YtsgContact *contact, +TpConnection *_yts_client_get_connection (YtsClient *client); +TpYtsStatus *_yts_client_get_tp_status (YtsClient *client); +YtsError _yts_client_send_message (YtsClient *client, + YtsContact *contact, const char *uid, - YtsgMetadata *message); + YtsMetadata *message); G_END_DECLS -#endif /* _YTSG_PRIVATE_H */ +#endif /* _YTS_PRIVATE_H */ diff --git a/ytstenut/ytsg-proxy-service.c b/ytstenut/yts-proxy-service.c index 800a647..e7fa830 100644 --- a/ytstenut/ytsg-proxy-service.c +++ b/ytstenut/yts-proxy-service.c @@ -19,19 +19,19 @@ */ #include <stdbool.h> -#include "ytsg-capability.h" -#include "ytsg-invocation-message.h" -#include "ytsg-marshal.h" -#include "ytsg-private.h" -#include "ytsg-proxy-service.h" +#include "yts-capability.h" +#include "yts-invocation-message.h" +#include "yts-marshal.h" +#include "yts-private.h" +#include "yts-proxy-service.h" -#include "profile/ytsg-profile.h" -#include "profile/ytsg-profile-proxy.h" +#include "profile/yts-profile.h" +#include "profile/yts-profile-proxy.h" -G_DEFINE_TYPE (YtsgProxyService, ytsg_proxy_service, YTSG_TYPE_SERVICE) +G_DEFINE_TYPE (YtsProxyService, yts_proxy_service, YTS_TYPE_SERVICE) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_PROXY_SERVICE, YtsgProxyServicePrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_PROXY_SERVICE, YtsProxyServicePrivate)) enum { SIG_PROXY_CREATED, @@ -39,10 +39,10 @@ enum { }; typedef struct { - YtsgProfile *profile; + YtsProfile *profile; GHashTable *invocations; GHashTable *proxies; -} YtsgProxyServicePrivate; +} YtsProxyServicePrivate; static unsigned _signals[N_SIGNALS] = { 0, }; @@ -52,7 +52,7 @@ _get_property (GObject *object, GValue *value, GParamSpec *pspec) { - // YtsgProxyServicePrivate *priv = GET_PRIVATE (object); + // YtsProxyServicePrivate *priv = GET_PRIVATE (object); switch (property_id) { default: @@ -66,7 +66,7 @@ _set_property (GObject *object, const GValue *value, GParamSpec *pspec) { - // YtsgProxyServicePrivate *priv = GET_PRIVATE (object); + // YtsProxyServicePrivate *priv = GET_PRIVATE (object); switch (property_id) { default: @@ -77,21 +77,21 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (object); + YtsProxyServicePrivate *priv = GET_PRIVATE (object); if (priv->proxies) { GHashTableIter iter; char const *capability; - YtsgProxy *proxy; + YtsProxy *proxy; g_hash_table_iter_init (&iter, priv->proxies); while (g_hash_table_iter_next (&iter, (void **) &capability, (void **) &proxy)) { - char *invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (proxy)); - ytsg_profile_unregister_proxy (priv->profile, + char *invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (proxy)); + yts_profile_unregister_proxy (priv->profile, invocation_id, capability); g_free (invocation_id); @@ -111,15 +111,15 @@ _dispose (GObject *object) priv->invocations = NULL; } - G_OBJECT_CLASS (ytsg_proxy_service_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_proxy_service_parent_class)->dispose (object); } static void -ytsg_proxy_service_class_init (YtsgProxyServiceClass *klass) +yts_proxy_service_class_init (YtsProxyServiceClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgProxyServicePrivate)); + g_type_class_add_private (klass, sizeof (YtsProxyServicePrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -128,18 +128,18 @@ ytsg_proxy_service_class_init (YtsgProxyServiceClass *klass) /* Signals */ _signals[SIG_PROXY_CREATED] = g_signal_new ("proxy-created", - YTSG_TYPE_PROXY_SERVICE, + YTS_TYPE_PROXY_SERVICE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_PROXY); + YTS_TYPE_PROXY); } static void -ytsg_proxy_service_init (YtsgProxyService *self) +yts_proxy_service_init (YtsProxyService *self) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (self); + YtsProxyServicePrivate *priv = GET_PRIVATE (self); priv->proxies = g_hash_table_new_full (g_str_hash, g_str_equal, @@ -152,14 +152,14 @@ ytsg_proxy_service_init (YtsgProxyService *self) g_object_unref); } -YtsgService * -ytsg_proxy_service_new (YtsgContact *contact, +YtsService * +yts_proxy_service_new (YtsContact *contact, char const *service_uid, char const *type, char const **capabilities, GHashTable *names) { - return g_object_new (YTSG_TYPE_PROXY_SERVICE, + return g_object_new (YTS_TYPE_PROXY_SERVICE, "contact", contact, "uid", service_uid, "type", type, @@ -169,24 +169,24 @@ ytsg_proxy_service_new (YtsgContact *contact, } static void -_profile_invoke_service (YtsgProfile *profile, +_profile_invoke_service (YtsProfile *profile, char const *invocation_id, char const *aspect, GVariant *arguments, - YtsgProxyService *self) + YtsProxyService *self) { - YtsgContact *contact; - YtsgClient *client; - YtsgMetadata *message; + YtsContact *contact; + YtsClient *client; + YtsMetadata *message; char const *uid; char *fqc_id; - fqc_id = ytsg_proxy_get_fqc_id (YTSG_PROXY (profile)); - contact = ytsg_service_get_contact (YTSG_SERVICE (self)); - client = ytsg_contact_get_client (contact); - uid = ytsg_service_get_uid (YTSG_SERVICE (self)); + fqc_id = yts_proxy_get_fqc_id (YTS_PROXY (profile)); + contact = yts_service_get_contact (YTS_SERVICE (self)); + client = yts_contact_get_client (contact); + uid = yts_service_get_uid (YTS_SERVICE (self)); - message = ytsg_invocation_message_new (invocation_id, + message = yts_invocation_message_new (invocation_id, fqc_id, aspect, arguments); @@ -194,34 +194,34 @@ _profile_invoke_service (YtsgProfile *profile, // TODO maybe we should attach the invocation-id to the contact // and handle the timeout here, so handling the response is simpler. - _ytsg_client_send_message (client, contact, uid, message); + _yts_client_send_message (client, contact, uid, message); g_object_unref (message); g_free (fqc_id); } static void -_proxy_invoke_service (YtsgProxy *proxy, +_proxy_invoke_service (YtsProxy *proxy, char const *invocation_id, char const *aspect, GVariant *arguments, - YtsgProxyService *self) + YtsProxyService *self) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (self); - YtsgContact *contact; - YtsgClient *client; - YtsgMetadata *message; + YtsProxyServicePrivate *priv = GET_PRIVATE (self); + YtsContact *contact; + YtsClient *client; + YtsMetadata *message; char const *uid; GHashTableIter iter; char const *capability; - YtsgProxy const *p; + YtsProxy const *p; - contact = ytsg_service_get_contact (YTSG_SERVICE (self)); - client = ytsg_contact_get_client (contact); - uid = ytsg_service_get_uid (YTSG_SERVICE (self)); + contact = yts_service_get_contact (YTS_SERVICE (self)); + client = yts_contact_get_client (contact); + uid = yts_service_get_uid (YTS_SERVICE (self)); /* FIXME not very nice, but a proxy doesn't know its capability, otherwise - * it conflicts with the capability property of YtsgVSPlayer et al. */ + * it conflicts with the capability property of YtsVSPlayer et al. */ // TODO get capability from proxy parameter instead. g_hash_table_iter_init (&iter, priv->proxies); while (g_hash_table_iter_next (&iter, (void **) &capability, (void **) &p)) { @@ -231,7 +231,7 @@ _proxy_invoke_service (YtsgProxy *proxy, } } - message = ytsg_invocation_message_new (invocation_id, + message = yts_invocation_message_new (invocation_id, capability, aspect, arguments); @@ -239,16 +239,16 @@ _proxy_invoke_service (YtsgProxy *proxy, // TODO maybe we should attach the invocation-id to the contact // and handle the timeout here, so handling the response is simpler. - _ytsg_client_send_message (client, contact, uid, message); + _yts_client_send_message (client, contact, uid, message); g_object_unref (message); } static void -_proxy_destroyed (YtsgProxyService *self, +_proxy_destroyed (YtsProxyService *self, void *stale_proxy_ptr) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (self); + YtsProxyServicePrivate *priv = GET_PRIVATE (self); GHashTableIter iter; char const *key; gpointer value; @@ -265,19 +265,19 @@ _proxy_destroyed (YtsgProxyService *self, // FIXME need factory foo extern GType -ytsg_vp_player_proxy_get_type (void); +yts_vp_player_proxy_get_type (void); extern GType -ytsg_vp_transcript_proxy_get_type (void); +yts_vp_transcript_proxy_get_type (void); // TODO instantiate proxy only on response // an move from invocations hash to proxies bool -ytsg_proxy_service_create_proxy (YtsgProxyService *self, +yts_proxy_service_create_proxy (YtsProxyService *self, char const *capability) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (self); - YtsgProxy *proxy; + YtsProxyServicePrivate *priv = GET_PRIVATE (self); + YtsProxy *proxy; char *invocation_id; struct { @@ -285,19 +285,19 @@ ytsg_proxy_service_create_proxy (YtsgProxyService *self, GType gtype; } proxies[] = { // { "org.freedesktop.ytstenut.VideoProfile.Content", -// ytsg_vp_content_proxy_get_type () }, +// yts_vp_content_proxy_get_type () }, { "org.freedesktop.ytstenut.VideoProfile.Player", - ytsg_vp_player_proxy_get_type () }, + yts_vp_player_proxy_get_type () }, { "org.freedesktop.ytstenut.VideoProfile.Transcript", - ytsg_vp_transcript_proxy_get_type () }, + yts_vp_transcript_proxy_get_type () }, // { "org.freedesktop.ytstenut.VideoProfile.Transfer", -// ytsg_vp_transfer_proxy_get_type () }, +// yts_vp_transfer_proxy_get_type () }, { NULL } }; unsigned int i; - g_return_val_if_fail (YTSG_IS_PROXY_SERVICE (self), NULL); + g_return_val_if_fail (YTS_IS_PROXY_SERVICE (self), NULL); proxy = NULL; for (i = 0; proxies[i].capability != NULL; i++) { @@ -323,16 +323,16 @@ ytsg_proxy_service_create_proxy (YtsgProxyService *self, if (NULL == priv->profile) { /* Lazily create the profile proxy. */ - priv->profile = g_object_new (YTSG_TYPE_PROFILE_PROXY, NULL); + priv->profile = g_object_new (YTS_TYPE_PROFILE_PROXY, NULL); g_signal_connect (priv->profile, "invoke-service", G_CALLBACK (_profile_invoke_service), self); } - invocation_id = ytsg_proxy_create_invocation_id (YTSG_PROXY (priv->profile)); + invocation_id = yts_proxy_create_invocation_id (YTS_PROXY (priv->profile)); /* Register new proxy with the service. */ // TODO timeout - ytsg_profile_register_proxy (priv->profile, + yts_profile_register_proxy (priv->profile, invocation_id, capability); @@ -344,26 +344,26 @@ ytsg_proxy_service_create_proxy (YtsgProxyService *self, // todo break here bool -ytsg_proxy_service_dispatch_event (YtsgProxyService *self, +yts_proxy_service_dispatch_event (YtsProxyService *self, char const *capability, char const *aspect, GVariant *arguments) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (self); + YtsProxyServicePrivate *priv = GET_PRIVATE (self); - if (0 == g_strcmp0 (YTSG_PROFILE_FQC_ID, capability)) { + if (0 == g_strcmp0 (YTS_PROFILE_FQC_ID, capability)) { /* This one comes from the Profile / Meta interface */ - ytsg_proxy_handle_service_event (YTSG_PROXY (priv->profile), + yts_proxy_handle_service_event (YTS_PROXY (priv->profile), aspect, arguments); return true; } else { - YtsgProxy *proxy = g_hash_table_lookup (priv->proxies, capability); + YtsProxy *proxy = g_hash_table_lookup (priv->proxies, capability); if (proxy) { - ytsg_proxy_handle_service_event (proxy, aspect, arguments); + yts_proxy_handle_service_event (proxy, aspect, arguments); return true; } } @@ -372,13 +372,13 @@ ytsg_proxy_service_dispatch_event (YtsgProxyService *self, } bool -ytsg_proxy_service_dispatch_response (YtsgProxyService *self, +yts_proxy_service_dispatch_response (YtsProxyService *self, char const *capability, char const *invocation_id, GVariant *response) { - YtsgProxyServicePrivate *priv = GET_PRIVATE (self); - YtsgProxy *proxy; + YtsProxyServicePrivate *priv = GET_PRIVATE (self); + YtsProxy *proxy; if (priv->invocations && g_hash_table_size (priv->invocations) > 0 && @@ -399,7 +399,7 @@ ytsg_proxy_service_dispatch_response (YtsgProxyService *self, g_variant_iter_init (&iter, response); while (g_variant_iter_next (&iter, "{sv}", &name, &value)) { /* Pass the properties to the proxy through the standard mechanism. */ - ytsg_proxy_handle_service_event (proxy, name, value); + yts_proxy_handle_service_event (proxy, name, value); g_free (name); g_variant_unref (value); } @@ -410,19 +410,19 @@ ytsg_proxy_service_dispatch_response (YtsgProxyService *self, return true; } - if (0 == g_strcmp0 (YTSG_PROFILE_FQC_ID, capability)) { + if (0 == g_strcmp0 (YTS_PROFILE_FQC_ID, capability)) { /* This one comes from the Profile / Meta interface */ - ytsg_proxy_handle_service_response (YTSG_PROXY (priv->profile), + yts_proxy_handle_service_response (YTS_PROXY (priv->profile), invocation_id, response); return true; } else { - YtsgProxy *proxy = g_hash_table_lookup (priv->proxies, capability); + YtsProxy *proxy = g_hash_table_lookup (priv->proxies, capability); if (proxy) { - ytsg_proxy_handle_service_response (proxy, invocation_id, response); + yts_proxy_handle_service_response (proxy, invocation_id, response); return true; } } diff --git a/ytstenut/ytsg-proxy-service.h b/ytstenut/yts-proxy-service.h index a1bbfde..65702e3 100644 --- a/ytstenut/ytsg-proxy-service.h +++ b/ytstenut/yts-proxy-service.h @@ -18,70 +18,70 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_PROXY_SERVICE_H -#define YTSG_PROXY_SERVICE_H +#ifndef YTS_PROXY_SERVICE_H +#define YTS_PROXY_SERVICE_H #include <stdbool.h> #include <glib-object.h> -#include <ytstenut/ytsg-proxy.h> -#include <ytstenut/ytsg-service.h> +#include <ytstenut/yts-proxy.h> +#include <ytstenut/yts-service.h> G_BEGIN_DECLS -#define YTSG_TYPE_PROXY_SERVICE ytsg_proxy_service_get_type() +#define YTS_TYPE_PROXY_SERVICE yts_proxy_service_get_type() -#define YTSG_PROXY_SERVICE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_PROXY_SERVICE, YtsgProxyService)) +#define YTS_PROXY_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_PROXY_SERVICE, YtsProxyService)) -#define YTSG_PROXY_SERVICE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_PROXY_SERVICE, YtsgProxyServiceClass)) +#define YTS_PROXY_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_PROXY_SERVICE, YtsProxyServiceClass)) -#define YTSG_IS_PROXY_SERVICE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_PROXY_SERVICE)) +#define YTS_IS_PROXY_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_PROXY_SERVICE)) -#define YTSG_IS_PROXY_SERVICE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_PROXY_SERVICE)) +#define YTS_IS_PROXY_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_PROXY_SERVICE)) -#define YTSG_PROXY_SERVICE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_PROXY_SERVICE, YtsgProxyServiceClass)) +#define YTS_PROXY_SERVICE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_PROXY_SERVICE, YtsProxyServiceClass)) typedef struct { - YtsgService parent; -} YtsgProxyService; + YtsService parent; +} YtsProxyService; typedef struct { - YtsgServiceClass parent; -} YtsgProxyServiceClass; + YtsServiceClass parent; +} YtsProxyServiceClass; GType -ytsg_proxy_service_get_type (void); +yts_proxy_service_get_type (void); -YtsgService * -ytsg_proxy_service_new (YtsgContact *contact, +YtsService * +yts_proxy_service_new (YtsContact *contact, char const *service_uid, char const *type, char const **capabilities, GHashTable *names); bool -ytsg_proxy_service_create_proxy (YtsgProxyService *self, +yts_proxy_service_create_proxy (YtsProxyService *self, char const *capability); /* FIXME private */ bool -ytsg_proxy_service_dispatch_event (YtsgProxyService *self, +yts_proxy_service_dispatch_event (YtsProxyService *self, char const *capability, char const *aspect, GVariant *arguments); bool -ytsg_proxy_service_dispatch_response (YtsgProxyService *self, +yts_proxy_service_dispatch_response (YtsProxyService *self, char const *capability, char const *invocation_id, GVariant *response); G_END_DECLS -#endif /* YTSG_PROXY_SERVICE_H */ +#endif /* YTS_PROXY_SERVICE_H */ diff --git a/ytstenut/ytsg-proxy.c b/ytstenut/yts-proxy.c index cc164f0..93f52ed 100644 --- a/ytstenut/ytsg-proxy.c +++ b/ytstenut/yts-proxy.c @@ -19,17 +19,17 @@ */ #include <stdbool.h> -#include "ytsg-capability.h" -#include "ytsg-marshal.h" -#include "ytsg-proxy.h" +#include "yts-capability.h" +#include "yts-marshal.h" +#include "yts-proxy.h" static void -_capability_interface_init (YtsgCapability *interface); +_capability_interface_init (YtsCapability *interface); -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (YtsgProxy, - ytsg_proxy, +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (YtsProxy, + yts_proxy, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (YTSG_TYPE_CAPABILITY, + G_IMPLEMENT_INTERFACE (YTS_TYPE_CAPABILITY, _capability_interface_init)) enum { @@ -47,18 +47,18 @@ enum { static guint _signals[N_SIGNALS] = { 0, }; /* - * YtsgCapability implementation + * YtsCapability implementation */ static void -_capability_interface_init (YtsgCapability *interface) +_capability_interface_init (YtsCapability *interface) { /* Nothing to do, it's just about overriding the "fqc-ids" property, * which has to be done in the concrete subclass of the Proxy. */ } /* - * YtsgProxy + * YtsProxy */ static void @@ -88,11 +88,11 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - G_OBJECT_CLASS (ytsg_proxy_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_proxy_parent_class)->dispose (object); } static void -ytsg_proxy_class_init (YtsgProxyClass *klass) +yts_proxy_class_init (YtsProxyClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); @@ -100,7 +100,7 @@ ytsg_proxy_class_init (YtsgProxyClass *klass) object_class->set_property = _set_property; object_class->dispose = _dispose; - /* YtsgCapability, needs to be overridden. */ + /* YtsCapability, needs to be overridden. */ g_object_class_override_property (object_class, PROP_CAPABILITY_FQC_IDS, @@ -110,52 +110,52 @@ ytsg_proxy_class_init (YtsgProxyClass *klass) _signals[INVOKE_SERVICE_SIGNAL] = g_signal_new ("invoke-service", - YTSG_TYPE_PROXY, + YTS_TYPE_PROXY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__STRING_STRING_BOXED, + yts_marshal_VOID__STRING_STRING_BOXED, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_VARIANT); _signals[SERVICE_EVENT_SIGNAL] = g_signal_new ("service-event", - YTSG_TYPE_PROXY, + YTS_TYPE_PROXY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgProxyClass, + G_STRUCT_OFFSET (YtsProxyClass, service_event), NULL, NULL, - ytsg_marshal_VOID__STRING_BOXED, + yts_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); _signals[SERVICE_RESPONSE_SIGNAL] = g_signal_new ("service-response", - YTSG_TYPE_PROXY, + YTS_TYPE_PROXY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgProxyClass, + G_STRUCT_OFFSET (YtsProxyClass, service_response), NULL, NULL, - ytsg_marshal_VOID__STRING_BOXED, + yts_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); } static void -ytsg_proxy_init (YtsgProxy *self) +yts_proxy_init (YtsProxy *self) { } char * -ytsg_proxy_get_fqc_id (YtsgProxy *self) +yts_proxy_get_fqc_id (YtsProxy *self) { char **fqc_ids; char *fqc_id; - g_return_val_if_fail (YTSG_IS_PROXY (self), NULL); + g_return_val_if_fail (YTS_IS_PROXY (self), NULL); /* Get it from the subclass. */ - fqc_ids = ytsg_capability_get_fqc_ids (YTSG_CAPABILITY (self)); + fqc_ids = yts_capability_get_fqc_ids (YTS_CAPABILITY (self)); /* A Proxy can only ever have a single fqc-id. */ g_return_val_if_fail (fqc_ids, NULL); @@ -170,7 +170,7 @@ ytsg_proxy_get_fqc_id (YtsgProxy *self) } char * -ytsg_proxy_create_invocation_id (YtsgProxy *self) +yts_proxy_create_invocation_id (YtsProxy *self) { static GRand *_rand = NULL; char *invocation_id; @@ -187,12 +187,12 @@ ytsg_proxy_create_invocation_id (YtsgProxy *self) } void -ytsg_proxy_invoke (YtsgProxy *self, +yts_proxy_invoke (YtsProxy *self, char const *invocation_id, char const *aspect, GVariant *arguments) { - g_return_if_fail (YTSG_IS_PROXY (self)); + g_return_if_fail (YTS_IS_PROXY (self)); g_return_if_fail (invocation_id); g_return_if_fail (aspect); @@ -210,11 +210,11 @@ ytsg_proxy_invoke (YtsgProxy *self, } void -ytsg_proxy_handle_service_event (YtsgProxy *self, +yts_proxy_handle_service_event (YtsProxy *self, char const *aspect, GVariant *arguments) { - g_return_if_fail (YTSG_IS_PROXY (self)); + g_return_if_fail (YTS_IS_PROXY (self)); g_return_if_fail (aspect); g_signal_emit (self, _signals[SERVICE_EVENT_SIGNAL], 0, @@ -230,11 +230,11 @@ ytsg_proxy_handle_service_event (YtsgProxy *self, } void -ytsg_proxy_handle_service_response (YtsgProxy *self, +yts_proxy_handle_service_response (YtsProxy *self, char const *invocation_id, GVariant *response) { - g_return_if_fail (YTSG_IS_PROXY (self)); + g_return_if_fail (YTS_IS_PROXY (self)); g_signal_emit (self, _signals[SERVICE_RESPONSE_SIGNAL], 0, invocation_id, diff --git a/ytstenut/ytsg-proxy.h b/ytstenut/yts-proxy.h index ca2f32c..914f4c8 100644 --- a/ytstenut/ytsg-proxy.h +++ b/ytstenut/yts-proxy.h @@ -18,33 +18,33 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_PROXY_H -#define YTSG_PROXY_H +#ifndef YTS_PROXY_H +#define YTS_PROXY_H #include <glib-object.h> G_BEGIN_DECLS -#define YTSG_TYPE_PROXY ytsg_proxy_get_type() +#define YTS_TYPE_PROXY yts_proxy_get_type() -#define YTSG_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_PROXY, YtsgProxy)) +#define YTS_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_PROXY, YtsProxy)) -#define YTSG_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_PROXY, YtsgProxyClass)) +#define YTS_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_PROXY, YtsProxyClass)) -#define YTSG_IS_PROXY(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_PROXY)) +#define YTS_IS_PROXY(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_PROXY)) -#define YTSG_IS_PROXY_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_PROXY)) +#define YTS_IS_PROXY_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_PROXY)) -#define YTSG_PROXY_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_PROXY, YtsgProxyClass)) +#define YTS_PROXY_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_PROXY, YtsProxyClass)) typedef struct { GObject parent; -} YtsgProxy; +} YtsProxy; typedef struct { GObjectClass parent; @@ -54,27 +54,27 @@ typedef struct { /* Signals */ void - (*service_event) (YtsgProxy *self, + (*service_event) (YtsProxy *self, char const *aspect, GVariant *arguments); void - (*service_response) (YtsgProxy *self, + (*service_response) (YtsProxy *self, char const *invocation_id, GVariant *response); -} YtsgProxyClass; +} YtsProxyClass; GType -ytsg_proxy_get_type (void); +yts_proxy_get_type (void); char * -ytsg_proxy_get_fqc_id (YtsgProxy *self); +yts_proxy_get_fqc_id (YtsProxy *self); char * -ytsg_proxy_create_invocation_id (YtsgProxy *self); +yts_proxy_create_invocation_id (YtsProxy *self); void -ytsg_proxy_invoke (YtsgProxy *self, +yts_proxy_invoke (YtsProxy *self, char const *invocation_id, char const *aspect, GVariant *arguments); @@ -82,16 +82,16 @@ ytsg_proxy_invoke (YtsgProxy *self, /* FIXME private */ void -ytsg_proxy_handle_service_event (YtsgProxy *self, +yts_proxy_handle_service_event (YtsProxy *self, char const *aspect, GVariant *arguments); void -ytsg_proxy_handle_service_response (YtsgProxy *self, +yts_proxy_handle_service_response (YtsProxy *self, char const *invocation_id, GVariant *response); G_END_DECLS -#endif /* YTSG_PROXY_H */ +#endif /* YTS_PROXY_H */ diff --git a/ytstenut/ytsg-response-message.c b/ytstenut/yts-response-message.c index c3d2dee..2b1bb28 100644 --- a/ytstenut/ytsg-response-message.c +++ b/ytstenut/yts-response-message.c @@ -19,16 +19,16 @@ */ #include <stdbool.h> -#include "ytsg-response-message.h" +#include "yts-response-message.h" -G_DEFINE_TYPE (YtsgResponseMessage, ytsg_response_message, YTSG_TYPE_METADATA) +G_DEFINE_TYPE (YtsResponseMessage, yts_response_message, YTS_TYPE_METADATA) #define GET_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_RESPONSE_MESSAGE, YtsgResponseMessagePrivate)) + (G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_RESPONSE_MESSAGE, YtsResponseMessagePrivate)) typedef struct { int dummy; -} YtsgResponseMessagePrivate; +} YtsResponseMessagePrivate; static void _get_property (GObject *object, @@ -57,15 +57,15 @@ _set_property (GObject *object, static void _dispose (GObject *object) { - G_OBJECT_CLASS (ytsg_response_message_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_response_message_parent_class)->dispose (object); } static void -ytsg_response_message_class_init (YtsgResponseMessageClass *klass) +yts_response_message_class_init (YtsResponseMessageClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (YtsgResponseMessagePrivate)); + g_type_class_add_private (klass, sizeof (YtsResponseMessagePrivate)); object_class->get_property = _get_property; object_class->set_property = _set_property; @@ -73,12 +73,12 @@ ytsg_response_message_class_init (YtsgResponseMessageClass *klass) } static void -ytsg_response_message_init (YtsgResponseMessage *self) +yts_response_message_init (YtsResponseMessage *self) { } -YtsgMetadata * -ytsg_response_message_new (char const *capability, +YtsMetadata * +yts_response_message_new (char const *capability, char const *invocation_id, GVariant *response) { @@ -100,7 +100,7 @@ ytsg_response_message_new (char const *capability, g_free (args); } - return g_object_new (YTSG_TYPE_RESPONSE_MESSAGE, + return g_object_new (YTS_TYPE_RESPONSE_MESSAGE, "top-level-node", node, NULL); } diff --git a/ytstenut/yts-response-message.h b/ytstenut/yts-response-message.h new file mode 100644 index 0000000..de14594 --- /dev/null +++ b/ytstenut/yts-response-message.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * <http://www.gnu.org/licenses/>. + * + * Authored by: Rob Staudinger <robsta@linux.intel.com> + */ + +#ifndef YTS_RESPONSE_MESSAGE_H +#define YTS_RESPONSE_MESSAGE_H + +#include <glib-object.h> +#include <ytstenut/yts-metadata.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_RESPONSE_MESSAGE yts_response_message_get_type() + +#define YTS_RESPONSE_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_RESPONSE_MESSAGE, YtsResponseMessage)) + +#define YTS_RESPONSE_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_RESPONSE_MESSAGE, YtsResponseMessageClass)) + +#define YTS_IS_RESPONSE_MESSAGE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_RESPONSE_MESSAGE)) + +#define YTS_IS_RESPONSE_MESSAGE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_RESPONSE_MESSAGE)) + +#define YTS_RESPONSE_MESSAGE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_RESPONSE_MESSAGE, YtsResponseMessageClass)) + +typedef struct { + YtsMetadata parent; +} YtsResponseMessage; + +typedef struct { + YtsMetadataClass parent; +} YtsResponseMessageClass; + +GType +yts_response_message_get_type (void) G_GNUC_CONST; + +YtsMetadata * +yts_response_message_new (char const *capability, + char const *invocation_id, + GVariant *response); + +G_END_DECLS + +#endif /* YTS_RESPONSE_MESSAGE_H */ diff --git a/ytstenut/ytsg-roster.c b/ytstenut/yts-roster.c index 6b1f204..35e8d85 100644 --- a/ytstenut/ytsg-roster.c +++ b/ytstenut/yts-roster.c @@ -20,46 +20,46 @@ */ /** - * SECTION:ytsg-roster + * SECTION:yts-roster * @short_description: Represents a roster of devices and services * connected to the Ytstenut application mesh. * - * #YtsgRoster represents all known devices and services in the Ytstenut + * #YtsRoster represents all known devices and services in the Ytstenut * application mesh. */ -#include "ytsg-client.h" -#include "ytsg-contact.h" -#include "ytsg-debug.h" -#include "ytsg-marshal.h" -#include "ytsg-private.h" -#include "ytsg-proxy-service.h" -#include "ytsg-roster.h" +#include "yts-client.h" +#include "yts-contact.h" +#include "yts-debug.h" +#include "yts-marshal.h" +#include "yts-private.h" +#include "yts-proxy-service.h" +#include "yts-roster.h" #include <string.h> #include <telepathy-ytstenut-glib/telepathy-ytstenut-glib.h> -static void ytsg_roster_dispose (GObject *object); -static void ytsg_roster_finalize (GObject *object); -static void ytsg_roster_constructed (GObject *object); -static void ytsg_roster_get_property (GObject *object, +static void yts_roster_dispose (GObject *object); +static void yts_roster_finalize (GObject *object); +static void yts_roster_constructed (GObject *object); +static void yts_roster_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_roster_set_property (GObject *object, +static void yts_roster_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -G_DEFINE_TYPE (YtsgRoster, ytsg_roster, G_TYPE_OBJECT); +G_DEFINE_TYPE (YtsRoster, yts_roster, G_TYPE_OBJECT); -#define YTSG_ROSTER_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_ROSTER, YtsgRosterPrivate)) +#define YTS_ROSTER_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_ROSTER, YtsRosterPrivate)) -struct _YtsgRosterPrivate +struct _YtsRosterPrivate { - GHashTable *contacts; /* hash of YtsgContact this roster holds */ - YtsgClient *client; /* back-reference to the client object that owns us */ + GHashTable *contacts; /* hash of YtsContact this roster holds */ + YtsClient *client; /* back-reference to the client object that owns us */ guint disposed : 1; }; @@ -84,35 +84,35 @@ enum static guint signals[N_SIGNALS] = {0}; static void -ytsg_roster_class_init (YtsgRosterClass *klass) +yts_roster_class_init (YtsRosterClass *klass) { GParamSpec *pspec; GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgRosterPrivate)); + g_type_class_add_private (klass, sizeof (YtsRosterPrivate)); - object_class->dispose = ytsg_roster_dispose; - object_class->finalize = ytsg_roster_finalize; - object_class->constructed = ytsg_roster_constructed; - object_class->get_property = ytsg_roster_get_property; - object_class->set_property = ytsg_roster_set_property; + object_class->dispose = yts_roster_dispose; + object_class->finalize = yts_roster_finalize; + object_class->constructed = yts_roster_constructed; + object_class->get_property = yts_roster_get_property; + object_class->set_property = yts_roster_set_property; /** - * YtsgRoster:client: + * YtsRoster:client: * - * #YtsgClient this roster represents + * #YtsClient this roster represents */ pspec = g_param_spec_object ("client", - "YtsgClient", - "YtsgClient", - YTSG_TYPE_CLIENT, + "YtsClient", + "YtsClient", + YTS_TYPE_CLIENT, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (object_class, PROP_CLIENT, pspec); /** - * YtsgRoster::contact-added - * @roster: #YtsgRoster object which emitted the signal, - * @contact: #YtsgContact that was added. + * YtsRoster::contact-added + * @roster: #YtsRoster object which emitted the signal, + * @contact: #YtsContact that was added. * * Emitted when contact is added to the roster. * @@ -124,14 +124,14 @@ ytsg_roster_class_init (YtsgRosterClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_CONTACT); + YTS_TYPE_CONTACT); /** - * YtsgRoster::contact-removed - * @roster: #YtsgRoster object which emitted the signal, - * @contact: #YtsgContact that was removed. + * YtsRoster::contact-removed + * @roster: #YtsRoster object which emitted the signal, + * @contact: #YtsContact that was removed. * * Emitted when contact is removed from the roster. Applications that * connected signal handlers to the contact, should disconnect them when this @@ -145,14 +145,14 @@ ytsg_roster_class_init (YtsgRosterClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_CONTACT); + YTS_TYPE_CONTACT); /** - * YtsgRoster::service-added - * @roster: #YtsgRoster object which emitted the signal, - * @service: #YtsgService that was added. + * YtsRoster::service-added + * @roster: #YtsRoster object which emitted the signal, + * @service: #YtsService that was added. * * Emitted when service is added to the roster. * @@ -164,14 +164,14 @@ ytsg_roster_class_init (YtsgRosterClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_SERVICE); + YTS_TYPE_SERVICE); /** - * YtsgRoster::service-removed - * @roster: #YtsgRoster object which emitted the signal, - * @service: #YtsgService that was removed. + * YtsRoster::service-removed + * @roster: #YtsRoster object which emitted the signal, + * @service: #YtsService that was removed. * * Emitted when service is removed from the roster. Applications that * connected signal handlers to the service, should disconnect them when this @@ -185,20 +185,20 @@ ytsg_roster_class_init (YtsgRosterClass *klass) G_SIGNAL_RUN_LAST, 0, NULL, NULL, - ytsg_marshal_VOID__OBJECT, + yts_marshal_VOID__OBJECT, G_TYPE_NONE, 1, - YTSG_TYPE_SERVICE); + YTS_TYPE_SERVICE); } static void -ytsg_roster_constructed (GObject *object) +yts_roster_constructed (GObject *object) { - if (G_OBJECT_CLASS (ytsg_roster_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_roster_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_roster_parent_class)->constructed) + G_OBJECT_CLASS (yts_roster_parent_class)->constructed (object); } static void -ytsg_roster_get_property (GObject *object, +yts_roster_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -211,13 +211,13 @@ ytsg_roster_get_property (GObject *object, } static void -ytsg_roster_set_property (GObject *object, +yts_roster_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - YtsgRoster *self = (YtsgRoster*) object; - YtsgRosterPrivate *priv = self->priv; + YtsRoster *self = (YtsRoster*) object; + YtsRosterPrivate *priv = self->priv; switch (property_id) { @@ -230,19 +230,19 @@ ytsg_roster_set_property (GObject *object, } static void -ytsg_roster_init (YtsgRoster *self) +yts_roster_init (YtsRoster *self) { - self->priv = YTSG_ROSTER_GET_PRIVATE (self); + self->priv = YTS_ROSTER_GET_PRIVATE (self); self->priv->contacts = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } static void -ytsg_roster_dispose (GObject *object) +yts_roster_dispose (GObject *object) { - YtsgRoster *self = (YtsgRoster*) object; - YtsgRosterPrivate *priv = self->priv; + YtsRoster *self = (YtsRoster*) object; + YtsRosterPrivate *priv = self->priv; if (priv->disposed) return; @@ -253,31 +253,31 @@ ytsg_roster_dispose (GObject *object) g_hash_table_destroy (priv->contacts); - G_OBJECT_CLASS (ytsg_roster_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_roster_parent_class)->dispose (object); } static void -ytsg_roster_finalize (GObject *object) +yts_roster_finalize (GObject *object) { - G_OBJECT_CLASS (ytsg_roster_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_roster_parent_class)->finalize (object); } /** - * ytsg_roster_get_contacts: - * @roster: #YtsgRoster + * yts_roster_get_contacts: + * @roster: #YtsRoster * - * Returns contacts in this #YtsgRoster. + * Returns contacts in this #YtsRoster. * - * Return value: (transfer none): #GHashTable of #YtsgContact; the hash table is + * Return value: (transfer none): #GHashTable of #YtsContact; the hash table is * owned by the roster and must not be modified or freed by the caller. */ GHashTable * -ytsg_roster_get_contacts (YtsgRoster *roster) +yts_roster_get_contacts (YtsRoster *roster) { - YtsgRosterPrivate *priv; + YtsRosterPrivate *priv; - g_return_val_if_fail (YTSG_IS_ROSTER (roster), NULL); + g_return_val_if_fail (YTS_IS_ROSTER (roster), NULL); priv = roster->priv; @@ -285,37 +285,37 @@ ytsg_roster_get_contacts (YtsgRoster *roster) } /* - * ytsg_roster_remove_service_by_id: - * @roster: #YtsgRoster + * yts_roster_remove_service_by_id: + * @roster: #YtsRoster * @jid: JID of the contact that the service is running on * @uid: the service UID. * - * Removes service from a roster and emits YtsgRoster::service-removed signal. + * Removes service from a roster and emits YtsRoster::service-removed signal. * - * For use by #YtsgClient. + * For use by #YtsClient. */ void -_ytsg_roster_remove_service_by_id (YtsgRoster *roster, +_yts_roster_remove_service_by_id (YtsRoster *roster, const char *jid, const char *uid) { - YtsgRosterPrivate *priv; - YtsgContact *contact; + YtsRosterPrivate *priv; + YtsContact *contact; gboolean emit = FALSE; - g_return_if_fail (YTSG_IS_ROSTER (roster)); + g_return_if_fail (YTS_IS_ROSTER (roster)); priv = roster->priv; - if (!(contact = (YtsgContact*)ytsg_roster_find_contact_by_jid (roster, jid))) + if (!(contact = (YtsContact*)yts_roster_find_contact_by_jid (roster, jid))) { g_warning ("Contact for service not found"); return; } - _ytsg_contact_remove_service_by_uid (contact, uid); + _yts_contact_remove_service_by_uid (contact, uid); - emit = _ytsg_contact_is_empty (contact); + emit = _yts_contact_is_empty (contact); if (emit) { @@ -327,30 +327,30 @@ _ytsg_roster_remove_service_by_id (YtsgRoster *roster, } /* - * ytsg_roster_find_contact_by_handle: - * @roster: #YtsgRoster + * yts_roster_find_contact_by_handle: + * @roster: #YtsRoster * @handle: handle of this contact * * Finds contact in a roster. * - * Return value: (transfer none): #YtsgContact if found, or %NULL. + * Return value: (transfer none): #YtsContact if found, or %NULL. */ -YtsgContact * -_ytsg_roster_find_contact_by_handle (YtsgRoster *roster, guint handle) +YtsContact * +_yts_roster_find_contact_by_handle (YtsRoster *roster, guint handle) { - YtsgRosterPrivate *priv; + YtsRosterPrivate *priv; GHashTableIter iter; gpointer key, value; - g_return_val_if_fail (YTSG_IS_ROSTER (roster), NULL); + g_return_val_if_fail (YTS_IS_ROSTER (roster), NULL); priv = roster->priv; g_hash_table_iter_init (&iter, priv->contacts); while (g_hash_table_iter_next (&iter, &key, &value)) { - YtsgContact *contact = value; - TpContact *tp_contact = ytsg_contact_get_tp_contact (contact); + YtsContact *contact = value; + TpContact *tp_contact = yts_contact_get_tp_contact (contact); guint h = tp_contact_get_handle (tp_contact); if (h == handle) @@ -363,29 +363,29 @@ _ytsg_roster_find_contact_by_handle (YtsgRoster *roster, guint handle) } /** - * ytsg_roster_find_contact_by_jid: - * @roster: #YtsgRoster + * yts_roster_find_contact_by_jid: + * @roster: #YtsRoster * @jid: jid of this contact * * Finds contact in a roster. * - * Return value: (transfer none): #YtsgContact if found, or %NULL. + * Return value: (transfer none): #YtsContact if found, or %NULL. */ -YtsgContact * -ytsg_roster_find_contact_by_jid (YtsgRoster *roster, const char *jid) +YtsContact * +yts_roster_find_contact_by_jid (YtsRoster *roster, const char *jid) { - YtsgRosterPrivate *priv; + YtsRosterPrivate *priv; GHashTableIter iter; gpointer key, value; - g_return_val_if_fail (YTSG_IS_ROSTER (roster) && jid, NULL); + g_return_val_if_fail (YTS_IS_ROSTER (roster) && jid, NULL); priv = roster->priv; g_hash_table_iter_init (&iter, priv->contacts); while (g_hash_table_iter_next (&iter, &key, &value)) { - YtsgContact *contact = value; + YtsContact *contact = value; const gchar *j = key; if (j && !strcmp (j, jid)) @@ -398,28 +398,28 @@ ytsg_roster_find_contact_by_jid (YtsgRoster *roster, const char *jid) } /* - * ytsg_roster_clear: - * @roster: #YtsgRoster + * yts_roster_clear: + * @roster: #YtsRoster * * Removes all contacts from the roster; for each contact removed, the * contact-removed signal is emitted and the contact's dispose method is * forecefully run. */ void -_ytsg_roster_clear (YtsgRoster *roster) +_yts_roster_clear (YtsRoster *roster) { - YtsgRosterPrivate *priv; + YtsRosterPrivate *priv; GHashTableIter iter; gpointer key, value; - g_return_if_fail (YTSG_IS_ROSTER (roster)); + g_return_if_fail (YTS_IS_ROSTER (roster)); priv = roster->priv; g_hash_table_iter_init (&iter, priv->contacts); while (g_hash_table_iter_next (&iter, &key, &value)) { - YtsgContact *contact = value; + YtsContact *contact = value; g_object_ref (contact); @@ -433,23 +433,23 @@ _ytsg_roster_clear (YtsgRoster *roster) } /** - * ytsg_roster_find_contact_by_capability: - * @roster: #YtsgRoster + * yts_roster_find_contact_by_capability: + * @roster: #YtsRoster * @capability: capability of this contact * * Finds first contact in roster that advertises the specified capablity. * - * Return value: (transfer none): #YtsgContact if found, or %NULL. + * Return value: (transfer none): #YtsContact if found, or %NULL. */ -YtsgContact * -ytsg_roster_find_contact_by_capability (YtsgRoster *roster, - YtsgCaps capability) +YtsContact * +yts_roster_find_contact_by_capability (YtsRoster *roster, + YtsCaps capability) { - YtsgRosterPrivate *priv; + YtsRosterPrivate *priv; GHashTableIter iter; gpointer key, value; - g_return_val_if_fail (YTSG_IS_ROSTER (roster), NULL); + g_return_val_if_fail (YTS_IS_ROSTER (roster), NULL); g_return_val_if_fail (capability, NULL); priv = roster->priv; @@ -457,9 +457,9 @@ ytsg_roster_find_contact_by_capability (YtsgRoster *roster, g_hash_table_iter_init (&iter, priv->contacts); while (g_hash_table_iter_next (&iter, &key, &value)) { - YtsgContact *contact = value; + YtsContact *contact = value; - if (ytsg_contact_has_capability (contact, capability)) + if (yts_contact_has_capability (contact, capability)) { return contact; } @@ -468,29 +468,29 @@ ytsg_roster_find_contact_by_capability (YtsgRoster *roster, return NULL; } -YtsgRoster* -_ytsg_roster_new (YtsgClient *client) +YtsRoster* +_yts_roster_new (YtsClient *client) { - return g_object_new (YTSG_TYPE_ROSTER, + return g_object_new (YTS_TYPE_ROSTER, "client", client, NULL); } /** - * ytsg_roster_get_client: - * @roster: #YtsgRoster + * yts_roster_get_client: + * @roster: #YtsRoster * - * Retrieves the #YtsgClient associated with this roster; the client object + * Retrieves the #YtsClient associated with this roster; the client object * must not be freed by the caller. * - * Return value (transfer none): #YtsgClient. + * Return value (transfer none): #YtsClient. */ -YtsgClient* -ytsg_roster_get_client (YtsgRoster *roster) +YtsClient* +yts_roster_get_client (YtsRoster *roster) { - YtsgRosterPrivate *priv; + YtsRosterPrivate *priv; - g_return_val_if_fail (YTSG_IS_ROSTER (roster), NULL); + g_return_val_if_fail (YTS_IS_ROSTER (roster), NULL); priv = roster->priv; @@ -498,26 +498,26 @@ ytsg_roster_get_client (YtsgRoster *roster) } static void -ytsg_roster_contact_service_removed_cb (YtsgContact *contact, - YtsgService *service, - YtsgRoster *roster) +yts_roster_contact_service_removed_cb (YtsContact *contact, + YtsService *service, + YtsRoster *roster) { g_signal_emit (roster, signals[SERVICE_REMOVED], 0, service); } static void -ytsg_roster_contact_service_added_cb (YtsgContact *contact, - YtsgService *service, - YtsgRoster *roster) +yts_roster_contact_service_added_cb (YtsContact *contact, + YtsService *service, + YtsRoster *roster) { g_signal_emit (roster, signals[SERVICE_ADDED], 0, service); } /* FIXME this should probably go into some sort of factory. * Then we'll probably also use some smarter lookup algorithm. */ -static YtsgService * -create_service (YtsgRoster *self, - YtsgContact *contact, +static YtsService * +create_service (YtsRoster *self, + YtsContact *contact, char const *sid, char const *type, char const **caps, @@ -541,54 +541,54 @@ create_service (YtsgRoster *self, { if (0 == g_strcmp0 (capability, known_caps[i])) { - return ytsg_proxy_service_new (contact, sid, type, caps, names); + return yts_proxy_service_new (contact, sid, type, caps, names); } } } - return _ytsg_metadata_service_new (contact, sid, type, caps, names); + return _yts_metadata_service_new (contact, sid, type, caps, names); } void -_ytsg_roster_add_service (YtsgRoster *roster, +_yts_roster_add_service (YtsRoster *roster, const char *jid, const char *sid, const char *type, const char **caps, GHashTable *names) { - YtsgRosterPrivate *priv; - YtsgContact *contact; - YtsgService *service; + YtsRosterPrivate *priv; + YtsContact *contact; + YtsService *service; - g_return_if_fail (YTSG_IS_ROSTER (roster)); + g_return_if_fail (YTS_IS_ROSTER (roster)); priv = roster->priv; - if (!(contact = (YtsgContact*)ytsg_roster_find_contact_by_jid (roster, jid))) + if (!(contact = (YtsContact*)yts_roster_find_contact_by_jid (roster, jid))) { - YTSG_NOTE (ROSTER, "Creating new contact for %s", jid); + YTS_NOTE (ROSTER, "Creating new contact for %s", jid); - contact = _ytsg_contact_new (priv->client, jid); + contact = _yts_contact_new (priv->client, jid); g_signal_connect (contact, "service-added", - G_CALLBACK (ytsg_roster_contact_service_added_cb), + G_CALLBACK (yts_roster_contact_service_added_cb), roster); g_signal_connect (contact, "service-removed", - G_CALLBACK (ytsg_roster_contact_service_removed_cb), + G_CALLBACK (yts_roster_contact_service_removed_cb), roster); g_hash_table_insert (priv->contacts, g_strdup (jid), contact); - YTSG_NOTE (ROSTER, "Emitting contact-added for new contact %s", jid); + YTS_NOTE (ROSTER, "Emitting contact-added for new contact %s", jid); g_signal_emit (roster, signals[CONTACT_ADDED], 0, contact); } - YTSG_NOTE (ROSTER, "Adding service %s:%s", jid, sid); + YTS_NOTE (ROSTER, "Adding service %s:%s", jid, sid); service = create_service (roster, contact, sid, type, caps, names); - _ytsg_contact_add_service (contact, service); + _yts_contact_add_service (contact, service); g_object_unref (service); } diff --git a/ytstenut/yts-roster.h b/ytstenut/yts-roster.h new file mode 100644 index 0000000..227b309 --- /dev/null +++ b/ytstenut/yts-roster.h @@ -0,0 +1,93 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_ROSTER_H +#define _YTS_ROSTER_H + +#include <glib-object.h> +#include <ytstenut/yts-caps.h> +#include <ytstenut/yts-contact.h> +#include <ytstenut/yts-types.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_ROSTER \ + (yts_roster_get_type()) +#define YTS_ROSTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_ROSTER, \ + YtsRoster)) +#define YTS_ROSTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_ROSTER, \ + YtsRosterClass)) +#define YTS_IS_ROSTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_ROSTER)) +#define YTS_IS_ROSTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_ROSTER)) +#define YTS_ROSTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_ROSTER, \ + YtsRosterClass)) + +typedef struct _YtsRoster YtsRoster; +typedef struct _YtsRosterClass YtsRosterClass; +typedef struct _YtsRosterPrivate YtsRosterPrivate; + +/** + * YtsRosterClass: + * + * #YtsRoster class. + */ +struct _YtsRosterClass +{ + /*< private >*/ + GObjectClass parent_class; +}; + +/** + * YtsRoster: + * + * Represents a roster of #YtsContact<!-- -->s known to #YtsClient. + */ +struct _YtsRoster +{ + /*< private >*/ + GObject parent; + + /*< private >*/ + YtsRosterPrivate *priv; +}; + +GType yts_roster_get_type (void) G_GNUC_CONST; + +GHashTable *yts_roster_get_contacts (YtsRoster *roster); +YtsContact *yts_roster_find_contact_by_jid (YtsRoster *roster, + const char *jid); +YtsContact *yts_roster_find_contact_by_capability (YtsRoster *roster, + YtsCaps capability); +YtsClient *yts_roster_get_client (YtsRoster *roster); + +G_END_DECLS + +#endif /* _YTS_ROSTER_H */ diff --git a/ytstenut/ytsg-service-adapter.c b/ytstenut/yts-service-adapter.c index 2fa042e..d6a7815 100644 --- a/ytstenut/ytsg-service-adapter.c +++ b/ytstenut/yts-service-adapter.c @@ -18,11 +18,11 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#include "ytsg-capability.h" -#include "ytsg-marshal.h" -#include "ytsg-service-adapter.h" +#include "yts-capability.h" +#include "yts-marshal.h" +#include "yts-service-adapter.h" -G_DEFINE_TYPE (YtsgServiceAdapter, ytsg_service_adapter, G_TYPE_OBJECT) +G_DEFINE_TYPE (YtsServiceAdapter, yts_service_adapter, G_TYPE_OBJECT) enum { PROP_0, @@ -41,9 +41,9 @@ enum { static unsigned int _signals[N_SIGNALS] = { 0, }; static GVariant * -_collect_properties (YtsgServiceAdapter *self) +_collect_properties (YtsServiceAdapter *self) { - g_critical ("%s : Method YtsgServiceAdapter.collect_properties() not implemented by %s", + g_critical ("%s : Method YtsServiceAdapter.collect_properties() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); @@ -51,12 +51,12 @@ _collect_properties (YtsgServiceAdapter *self) } static bool -_invoke (YtsgServiceAdapter *self, +_invoke (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments) { - g_critical ("%s : Method YtsgServiceAdapter.invoke() not implemented by %s", + g_critical ("%s : Method YtsServiceAdapter.invoke() not implemented by %s", G_STRLOC, G_OBJECT_TYPE_NAME (self)); @@ -66,19 +66,19 @@ _invoke (YtsgServiceAdapter *self, static void _constructed (GObject *object) { - YtsgCapability *service; + YtsCapability *service; char **fqc_ids; char *fqc_id; unsigned i; bool found = false; - fqc_id = ytsg_service_adapter_get_fqc_id (YTSG_SERVICE_ADAPTER (object)); + fqc_id = yts_service_adapter_get_fqc_id (YTS_SERVICE_ADAPTER (object)); g_return_if_fail (fqc_id); - service = ytsg_service_adapter_get_service (YTSG_SERVICE_ADAPTER (object)); + service = yts_service_adapter_get_service (YTS_SERVICE_ADAPTER (object)); g_return_if_fail (service); - fqc_ids = ytsg_capability_get_fqc_ids (service); + fqc_ids = yts_capability_get_fqc_ids (service); g_return_if_fail (fqc_ids); for (i = 0; fqc_ids[i] != NULL; i++) { @@ -109,8 +109,8 @@ _get_property (GObject *object, switch (property_id) { case PROP_FQC_ID: g_value_take_string (value, - ytsg_service_adapter_get_fqc_id ( - YTSG_SERVICE_ADAPTER (object))); + yts_service_adapter_get_fqc_id ( + YTS_SERVICE_ADAPTER (object))); break; /* Other properties need to be implemented by the subclass. */ default: @@ -132,7 +132,7 @@ _set_property (GObject *object, } static void -ytsg_service_adapter_class_init (YtsgServiceAdapterClass *klass) +yts_service_adapter_class_init (YtsServiceAdapterClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GParamSpec *pspec; @@ -162,47 +162,47 @@ ytsg_service_adapter_class_init (YtsgServiceAdapterClass *klass) /* Signals */ _signals[ERROR_SIGNAL] = g_signal_new ("error", - YTSG_TYPE_SERVICE_ADAPTER, + YTS_TYPE_SERVICE_ADAPTER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgServiceAdapterClass, + G_STRUCT_OFFSET (YtsServiceAdapterClass, error), NULL, NULL, - ytsg_marshal_VOID__STRING_BOXED, + yts_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_ERROR); _signals[EVENT_SIGNAL] = g_signal_new ("event", - YTSG_TYPE_SERVICE_ADAPTER, + YTS_TYPE_SERVICE_ADAPTER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgServiceAdapterClass, + G_STRUCT_OFFSET (YtsServiceAdapterClass, event), NULL, NULL, - ytsg_marshal_VOID__STRING_BOXED, + yts_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); _signals[RESPONSE_SIGNAL] = g_signal_new ("response", - YTSG_TYPE_SERVICE_ADAPTER, + YTS_TYPE_SERVICE_ADAPTER, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgServiceAdapterClass, + G_STRUCT_OFFSET (YtsServiceAdapterClass, response), NULL, NULL, - ytsg_marshal_VOID__STRING_BOXED, + yts_marshal_VOID__STRING_BOXED, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); } static void -ytsg_service_adapter_init (YtsgServiceAdapter *self) +yts_service_adapter_init (YtsServiceAdapter *self) { } char * -ytsg_service_adapter_get_fqc_id (YtsgServiceAdapter *self) +yts_service_adapter_get_fqc_id (YtsServiceAdapter *self) { char *fqc_id; - g_return_val_if_fail (YTSG_IS_SERVICE_ADAPTER (self), NULL); + g_return_val_if_fail (YTS_IS_SERVICE_ADAPTER (self), NULL); /* Get from subclass. */ fqc_id = NULL; @@ -211,12 +211,12 @@ ytsg_service_adapter_get_fqc_id (YtsgServiceAdapter *self) return fqc_id; } -YtsgCapability * -ytsg_service_adapter_get_service (YtsgServiceAdapter *self) +YtsCapability * +yts_service_adapter_get_service (YtsServiceAdapter *self) { - YtsgCapability *service; + YtsCapability *service; - g_return_val_if_fail (YTSG_IS_SERVICE_ADAPTER (self), NULL); + g_return_val_if_fail (YTS_IS_SERVICE_ADAPTER (self), NULL); service = NULL; g_object_get (G_OBJECT (self), "service", &service, NULL); @@ -225,24 +225,24 @@ ytsg_service_adapter_get_service (YtsgServiceAdapter *self) } GVariant * -ytsg_service_adapter_collect_properties (YtsgServiceAdapter *self) +yts_service_adapter_collect_properties (YtsServiceAdapter *self) { - g_return_val_if_fail (YTSG_IS_SERVICE_ADAPTER (self), NULL); + g_return_val_if_fail (YTS_IS_SERVICE_ADAPTER (self), NULL); - return YTSG_SERVICE_ADAPTER_GET_CLASS (self)->collect_properties (self); + return YTS_SERVICE_ADAPTER_GET_CLASS (self)->collect_properties (self); } bool -ytsg_service_adapter_invoke (YtsgServiceAdapter *self, +yts_service_adapter_invoke (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments) { bool keep_sae; - g_return_val_if_fail (YTSG_IS_SERVICE_ADAPTER (self), false); + g_return_val_if_fail (YTS_IS_SERVICE_ADAPTER (self), false); - keep_sae = YTSG_SERVICE_ADAPTER_GET_CLASS (self)->invoke (self, + keep_sae = YTS_SERVICE_ADAPTER_GET_CLASS (self)->invoke (self, invocation_id, aspect, arguments); @@ -258,22 +258,22 @@ ytsg_service_adapter_invoke (YtsgServiceAdapter *self, } void -ytsg_service_adapter_send_error (YtsgServiceAdapter *self, +yts_service_adapter_send_error (YtsServiceAdapter *self, char const *invocation_id, GError const *error) { - g_return_if_fail (YTSG_IS_SERVICE_ADAPTER (self)); + g_return_if_fail (YTS_IS_SERVICE_ADAPTER (self)); g_signal_emit (self, _signals[ERROR_SIGNAL], 0, invocation_id, error); } void -ytsg_service_adapter_send_event (YtsgServiceAdapter *self, +yts_service_adapter_send_event (YtsServiceAdapter *self, char const *aspect, GVariant *arguments) { - g_return_if_fail (YTSG_IS_SERVICE_ADAPTER (self)); + g_return_if_fail (YTS_IS_SERVICE_ADAPTER (self)); /* This is a bit hackish, ok, but it allows for creating the variant * in the invocation of this function. */ @@ -287,11 +287,11 @@ ytsg_service_adapter_send_event (YtsgServiceAdapter *self, } void -ytsg_service_adapter_send_response (YtsgServiceAdapter *self, +yts_service_adapter_send_response (YtsServiceAdapter *self, char const *invocation_id, GVariant *return_value) { - g_return_if_fail (YTSG_IS_SERVICE_ADAPTER (self)); + g_return_if_fail (YTS_IS_SERVICE_ADAPTER (self)); /* This is a bit hackish, ok, but it allows for creating the variant * in the invocation of this function. */ diff --git a/ytstenut/ytsg-service-adapter.h b/ytstenut/yts-service-adapter.h index 1655847..20aae47 100644 --- a/ytstenut/ytsg-service-adapter.h +++ b/ytstenut/yts-service-adapter.h @@ -18,35 +18,35 @@ * Authored by: Rob Staudinger <robsta@linux.intel.com> */ -#ifndef YTSG_SERVICE_ADAPTER_H -#define YTSG_SERVICE_ADAPTER_H +#ifndef YTS_SERVICE_ADAPTER_H +#define YTS_SERVICE_ADAPTER_H #include <stdbool.h> #include <glib-object.h> -#include <ytstenut/ytsg-capability.h> +#include <ytstenut/yts-capability.h> G_BEGIN_DECLS -#define YTSG_TYPE_SERVICE_ADAPTER ytsg_service_adapter_get_type() +#define YTS_TYPE_SERVICE_ADAPTER yts_service_adapter_get_type() -#define YTSG_SERVICE_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_SERVICE_ADAPTER, YtsgServiceAdapter)) +#define YTS_SERVICE_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTS_TYPE_SERVICE_ADAPTER, YtsServiceAdapter)) -#define YTSG_SERVICE_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_SERVICE_ADAPTER, YtsgServiceAdapterClass)) +#define YTS_SERVICE_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), YTS_TYPE_SERVICE_ADAPTER, YtsServiceAdapterClass)) -#define YTSG_IS_SERVICE_ADAPTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_SERVICE_ADAPTER)) +#define YTS_IS_SERVICE_ADAPTER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTS_TYPE_SERVICE_ADAPTER)) -#define YTSG_IS_SERVICE_ADAPTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_SERVICE_ADAPTER)) +#define YTS_IS_SERVICE_ADAPTER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), YTS_TYPE_SERVICE_ADAPTER)) -#define YTSG_SERVICE_ADAPTER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_SERVICE_ADAPTER, YtsgServiceAdapterClass)) +#define YTS_SERVICE_ADAPTER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_SERVICE_ADAPTER, YtsServiceAdapterClass)) typedef struct { GObject parent; -} YtsgServiceAdapter; +} YtsServiceAdapter; typedef struct { GObjectClass parent; @@ -54,10 +54,10 @@ typedef struct { /* Methods */ GVariant * - (*collect_properties) (YtsgServiceAdapter *self); + (*collect_properties) (YtsServiceAdapter *self); bool - (*invoke) (YtsgServiceAdapter *self, + (*invoke) (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments); @@ -65,56 +65,56 @@ typedef struct { /* Signals */ void - (*error) (YtsgServiceAdapter *self, + (*error) (YtsServiceAdapter *self, char const *invocation_id, GError const *error); void - (*event) (YtsgServiceAdapter *self, + (*event) (YtsServiceAdapter *self, char const *aspect, GVariant *arguments); void - (*response) (YtsgServiceAdapter *self, + (*response) (YtsServiceAdapter *self, char const *invocation_id, GVariant *return_value); -} YtsgServiceAdapterClass; +} YtsServiceAdapterClass; GType -ytsg_service_adapter_get_type (void) G_GNUC_CONST; +yts_service_adapter_get_type (void) G_GNUC_CONST; char * -ytsg_service_adapter_get_fqc_id (YtsgServiceAdapter *self); +yts_service_adapter_get_fqc_id (YtsServiceAdapter *self); -YtsgCapability * -ytsg_service_adapter_get_service (YtsgServiceAdapter *self); +YtsCapability * +yts_service_adapter_get_service (YtsServiceAdapter *self); GVariant * -ytsg_service_adapter_collect_properties (YtsgServiceAdapter *self); +yts_service_adapter_collect_properties (YtsServiceAdapter *self); bool -ytsg_service_adapter_invoke (YtsgServiceAdapter *self, +yts_service_adapter_invoke (YtsServiceAdapter *self, char const *invocation_id, char const *aspect, GVariant *arguments); void -ytsg_service_adapter_send_error (YtsgServiceAdapter *self, +yts_service_adapter_send_error (YtsServiceAdapter *self, char const *invocation_id, GError const *error); void -ytsg_service_adapter_send_event (YtsgServiceAdapter *self, +yts_service_adapter_send_event (YtsServiceAdapter *self, char const *aspect, GVariant *arguments); void -ytsg_service_adapter_send_response (YtsgServiceAdapter *self, +yts_service_adapter_send_response (YtsServiceAdapter *self, char const *invocation_id, GVariant *return_value); G_END_DECLS -#endif /* YTSG_SERVICE_ADAPTER_H */ +#endif /* YTS_SERVICE_ADAPTER_H */ diff --git a/ytstenut/ytsg-service.c b/ytstenut/yts-service.c index cabddb2..c4151ab 100644 --- a/ytstenut/ytsg-service.c +++ b/ytstenut/yts-service.c @@ -21,46 +21,46 @@ */ /** - * SECTION:ytsg-service + * SECTION:yts-service * @short_description: Represents a service connected to the Ytstenut * application mesh. * - * #YtsgService represents a known service in the Ytstenut application mesh. + * #YtsService represents a known service in the Ytstenut application mesh. */ #include <telepathy-glib/util.h> -#include "ytsg-contact.h" -#include "ytsg-debug.h" -#include "ytsg-marshal.h" -#include "ytsg-private.h" -#include "ytsg-service.h" +#include "yts-contact.h" +#include "yts-debug.h" +#include "yts-marshal.h" +#include "yts-private.h" +#include "yts-service.h" -static void ytsg_service_dispose (GObject *object); -static void ytsg_service_finalize (GObject *object); -static void ytsg_service_constructed (GObject *object); -static void ytsg_service_get_property (GObject *object, +static void yts_service_dispose (GObject *object); +static void yts_service_finalize (GObject *object); +static void yts_service_constructed (GObject *object); +static void yts_service_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_service_set_property (GObject *object, +static void yts_service_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -G_DEFINE_ABSTRACT_TYPE (YtsgService, ytsg_service, G_TYPE_OBJECT); +G_DEFINE_ABSTRACT_TYPE (YtsService, yts_service, G_TYPE_OBJECT); -#define YTSG_SERVICE_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_SERVICE, YtsgServicePrivate)) +#define YTS_SERVICE_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_SERVICE, YtsServicePrivate)) -struct _YtsgServicePrivate +struct _YtsServicePrivate { const char *type; char **caps; GHashTable *names; const char *uid; - YtsgContact *contact; /* back-reference to the contact object that owns us */ + YtsContact *contact; /* back-reference to the contact object that owns us */ char *status_xml; @@ -87,19 +87,19 @@ enum static guint _signals[N_SIGNALS] = { 0, }; static void -ytsg_service_status_changed_cb (TpYtsStatus *status, +yts_service_status_changed_cb (TpYtsStatus *status, const gchar *contact_id, const gchar *capability, const gchar *service_name, const gchar *xml, - YtsgService *self) + YtsService *self) { - YtsgServicePrivate *priv = self->priv; - const char *jid = ytsg_service_get_jid (self); + YtsServicePrivate *priv = self->priv; + const char *jid = yts_service_get_jid (self); g_return_if_fail (contact_id && service_name && jid && priv->uid); - YTSG_NOTE (STATUS, "Status changed for %s/%s:%s", + YTS_NOTE (STATUS, "Status changed for %s/%s:%s", contact_id, service_name, capability); if (0 == g_strcmp0 (contact_id, jid) && @@ -122,33 +122,33 @@ ytsg_service_status_changed_cb (TpYtsStatus *status, } static void -ytsg_service_class_init (YtsgServiceClass *klass) +yts_service_class_init (YtsServiceClass *klass) { GParamSpec *pspec; GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgServicePrivate)); + g_type_class_add_private (klass, sizeof (YtsServicePrivate)); - object_class->dispose = ytsg_service_dispose; - object_class->finalize = ytsg_service_finalize; - object_class->constructed = ytsg_service_constructed; - object_class->get_property = ytsg_service_get_property; - object_class->set_property = ytsg_service_set_property; + object_class->dispose = yts_service_dispose; + object_class->finalize = yts_service_finalize; + object_class->constructed = yts_service_constructed; + object_class->get_property = yts_service_get_property; + object_class->set_property = yts_service_set_property; /** - * YtsgService:contact: + * YtsService:contact: * - * #YtsgContact this service belongs to + * #YtsContact this service belongs to */ pspec = g_param_spec_object ("contact", - "YtsgContact", - "YtsgContact", - YTSG_TYPE_CONTACT, + "YtsContact", + "YtsContact", + YTS_TYPE_CONTACT, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (object_class, PROP_CONTACT, pspec); /** - * YtsgService:uid: + * YtsService:uid: * * The uid of this service */ @@ -160,7 +160,7 @@ ytsg_service_class_init (YtsgServiceClass *klass) g_object_class_install_property (object_class, PROP_UID, pspec); /** - * YtsgService:type: + * YtsService:type: * * The type of this service */ @@ -172,7 +172,7 @@ ytsg_service_class_init (YtsgServiceClass *klass) g_object_class_install_property (object_class, PROP_TYPE, pspec); /** - * YtsgService:names: + * YtsService:names: * * The names of this service */ @@ -184,7 +184,7 @@ ytsg_service_class_init (YtsgServiceClass *klass) g_object_class_install_property (object_class, PROP_NAMES, pspec); /** - * YtsgService:caps: + * YtsService:caps: * * The caps of this service */ @@ -196,7 +196,7 @@ ytsg_service_class_init (YtsgServiceClass *klass) g_object_class_install_property (object_class, PROP_CAPS, pspec); /** - * YtsgService:type: + * YtsService:type: * * The type of this service */ @@ -208,7 +208,7 @@ ytsg_service_class_init (YtsgServiceClass *klass) g_object_class_install_property (object_class, PROP_STATUS_XML, pspec); /** - * YtsgService::message: + * YtsService::message: * @service: the service which received the signal * @message: the message * @@ -220,41 +220,41 @@ ytsg_service_class_init (YtsgServiceClass *klass) g_signal_new ("message", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (YtsgServiceClass, message), + G_STRUCT_OFFSET (YtsServiceClass, message), NULL, NULL, - ytsg_marshal_VOID__STRING, + yts_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } static void -ytsg_service_constructed (GObject *object) +yts_service_constructed (GObject *object) { - YtsgServicePrivate *priv = YTSG_SERVICE (object)->priv; - YtsgClient *client; + YtsServicePrivate *priv = YTS_SERVICE (object)->priv; + YtsClient *client; TpYtsStatus *status; GHashTable *stats; - if (G_OBJECT_CLASS (ytsg_service_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_service_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_service_parent_class)->constructed) + G_OBJECT_CLASS (yts_service_parent_class)->constructed (object); g_return_if_fail (priv->contact); /* - * Construct the YtsgStatus object from the xml stored in + * Construct the YtsStatus object from the xml stored in * TpYtsStatus:discovered-statuses * * -- this is bit cumbersome, requiring nested hash table lookup. */ - client = ytsg_contact_get_client (priv->contact); - status = _ytsg_client_get_tp_status (client); + client = yts_contact_get_client (priv->contact); + status = _yts_client_get_tp_status (client); g_return_if_fail (status); if (priv->caps && *priv->caps && (stats = tp_yts_status_get_discovered_statuses (status))) { - const char *jid = ytsg_service_get_jid ((YtsgService*)object); - const char *uid = ytsg_service_get_uid ((YtsgService*)object); + const char *jid = yts_service_get_jid ((YtsService*)object); + const char *uid = yts_service_get_uid ((YtsService*)object); // FIXME, should we do this for every cap possibly? const char *cap = *priv->caps; /*a single capability we have*/ @@ -277,18 +277,18 @@ ytsg_service_constructed (GObject *object) } tp_g_signal_connect_object (status, "status-changed", - G_CALLBACK (ytsg_service_status_changed_cb), + G_CALLBACK (yts_service_status_changed_cb), object, 0); } static void -ytsg_service_get_property (GObject *object, +yts_service_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - YtsgService *self = (YtsgService*) object; - YtsgServicePrivate *priv = self->priv; + YtsService *self = (YtsService*) object; + YtsServicePrivate *priv = self->priv; switch (property_id) { @@ -313,13 +313,13 @@ ytsg_service_get_property (GObject *object, } static void -ytsg_service_set_property (GObject *object, +yts_service_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - YtsgService *self = (YtsgService*) object; - YtsgServicePrivate *priv = self->priv; + YtsService *self = (YtsService*) object; + YtsServicePrivate *priv = self->priv; switch (property_id) { @@ -344,16 +344,16 @@ ytsg_service_set_property (GObject *object, } static void -ytsg_service_init (YtsgService *self) +yts_service_init (YtsService *self) { - self->priv = YTSG_SERVICE_GET_PRIVATE (self); + self->priv = YTS_SERVICE_GET_PRIVATE (self); } static void -ytsg_service_dispose (GObject *object) +yts_service_dispose (GObject *object) { - YtsgService *self = (YtsgService*) object; - YtsgServicePrivate *priv = self->priv; + YtsService *self = (YtsService*) object; + YtsServicePrivate *priv = self->priv; if (priv->disposed) return; @@ -374,18 +374,18 @@ ytsg_service_dispose (GObject *object) priv->status_xml = NULL; } - G_OBJECT_CLASS (ytsg_service_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_service_parent_class)->dispose (object); } static void -ytsg_service_finalize (GObject *object) +yts_service_finalize (GObject *object) { - G_OBJECT_CLASS (ytsg_service_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_service_parent_class)->finalize (object); } /** - * ytsg_service_get_uid: - * @service: #YtsgService + * yts_service_get_uid: + * @service: #YtsService * * Returns the uid of the the given service. The returned pointer is to a * canonical representation created with g_intern_string(). @@ -393,16 +393,16 @@ ytsg_service_finalize (GObject *object) * Return value: (transfer none): the uid. */ const char * -ytsg_service_get_uid (YtsgService *service) +yts_service_get_uid (YtsService *service) { - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); return service->priv->uid; } /** - * ytsg_service_get_jid: - * @service: #YtsgService + * yts_service_get_jid: + * @service: #YtsService * * Returns the jid of the the given service. The returned pointer is to a * canonical representation created with g_intern_string(). @@ -410,28 +410,28 @@ ytsg_service_get_uid (YtsgService *service) * Return value: (transfer none): the jid. */ const char * -ytsg_service_get_jid (YtsgService *service) +yts_service_get_jid (YtsService *service) { - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); - return ytsg_contact_get_jid (service->priv->contact); + return yts_contact_get_jid (service->priv->contact); } /** - * ytsg_service_get_contact: - * @service: #YtsgService + * yts_service_get_contact: + * @service: #YtsService * - * Retrieves the #YtsgContact associated with this service; the contact object + * Retrieves the #YtsContact associated with this service; the contact object * must not be freed by the caller. * - * Return value (transfer none): #YtsgContact. + * Return value (transfer none): #YtsContact. */ -YtsgContact* -ytsg_service_get_contact (YtsgService *service) +YtsContact* +yts_service_get_contact (YtsService *service) { - YtsgServicePrivate *priv; + YtsServicePrivate *priv; - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); priv = service->priv; @@ -439,53 +439,53 @@ ytsg_service_get_contact (YtsgService *service) } const char * -ytsg_service_get_service_type (YtsgService *service) +yts_service_get_service_type (YtsService *service) { - YtsgServicePrivate *priv = service->priv; + YtsServicePrivate *priv = service->priv; - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); return priv->type; } const char ** -ytsg_service_get_caps (YtsgService *service) +yts_service_get_caps (YtsService *service) { - YtsgServicePrivate *priv = service->priv; + YtsServicePrivate *priv = service->priv; - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); return (const char **) priv->caps; } GHashTable * -ytsg_service_get_names (YtsgService *service) +yts_service_get_names (YtsService *service) { - YtsgServicePrivate *priv = service->priv; + YtsServicePrivate *priv = service->priv; - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); return priv->names; } const char * -ytsg_service_get_status_xml (YtsgService *service) +yts_service_get_status_xml (YtsService *service) { - YtsgServicePrivate *priv = service->priv; + YtsServicePrivate *priv = service->priv; - g_return_val_if_fail (YTSG_IS_SERVICE (service), NULL); + g_return_val_if_fail (YTS_IS_SERVICE (service), NULL); return priv->status_xml; } gboolean -ytsg_service_has_capability (YtsgService *self, +yts_service_has_capability (YtsService *self, char const *capability) { - YtsgServicePrivate *priv = self->priv; + YtsServicePrivate *priv = self->priv; guint i; - g_return_val_if_fail (YTSG_IS_SERVICE (self), FALSE); + g_return_val_if_fail (YTS_IS_SERVICE (self), FALSE); g_return_val_if_fail (priv->caps, FALSE); for (i = 0; priv->caps[i] != NULL; i++) { diff --git a/ytstenut/yts-service.h b/ytstenut/yts-service.h new file mode 100644 index 0000000..57d8faa --- /dev/null +++ b/ytstenut/yts-service.h @@ -0,0 +1,98 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_SERVICE_H +#define _YTS_SERVICE_H + +#include <glib-object.h> +#include <ytstenut/yts-contact.h> +#include <ytstenut/yts-types.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_SERVICE \ + (yts_service_get_type()) +#define YTS_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_SERVICE, \ + YtsService)) +#define YTS_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_SERVICE, \ + YtsServiceClass)) +#define YTS_IS_SERVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_SERVICE)) +#define YTS_IS_SERVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_SERVICE)) +#define YTS_SERVICE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_SERVICE, \ + YtsServiceClass)) + +typedef struct _YtsServiceClass YtsServiceClass; +typedef struct _YtsServicePrivate YtsServicePrivate; + +/** + * YtsServiceClass: + * + * #YtsService class. + */ +struct _YtsServiceClass +{ + /*< private >*/ + GObjectClass parent_class; + + void (*message) (YtsService *self, + char const *xml_payload); +}; + +/** + * YtsService: + * + * Abstract base class for XPMN services; see #YtsMetadataService. + */ +struct _YtsService +{ + /*< private >*/ + GObject parent; + + /*< private >*/ + YtsServicePrivate *priv; +}; + +GType yts_service_get_type (void) G_GNUC_CONST; + +const char * yts_service_get_uid (YtsService *service); +const char * yts_service_get_jid (YtsService *service); +YtsContact * yts_service_get_contact (YtsService *service); +const char * yts_service_get_service_type (YtsService *service); +const char ** yts_service_get_caps (YtsService *service); +GHashTable * yts_service_get_names (YtsService *service); +const char * yts_service_get_status_xml (YtsService *service); + +gboolean yts_service_has_capability (YtsService *self, + char const *capability); + +G_END_DECLS + +#endif /* _YTS_SERVICE_H */ diff --git a/ytstenut/ytsg-status.c b/ytstenut/yts-status.c index 030b96a..a843d0b 100644 --- a/ytstenut/ytsg-status.c +++ b/ytstenut/yts-status.c @@ -20,38 +20,38 @@ */ /** - * SECTION:ytsg-status + * SECTION:yts-status * @short_description: Represent the status of a service connected * to the Ytstenut mesh. * - * #YtsgStatus represents status of a known service in the Ytstenut application + * #YtsStatus represents status of a known service in the Ytstenut application * mesh. */ #include <string.h> #include <rest/rest-xml-node.h> -#include "ytsg-status.h" -#include "ytsg-private.h" +#include "yts-status.h" +#include "yts-private.h" -static void ytsg_status_dispose (GObject *object); -static void ytsg_status_finalize (GObject *object); -static void ytsg_status_constructed (GObject *object); -static void ytsg_status_get_property (GObject *object, +static void yts_status_dispose (GObject *object); +static void yts_status_finalize (GObject *object); +static void yts_status_constructed (GObject *object); +static void yts_status_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void ytsg_status_set_property (GObject *object, +static void yts_status_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -G_DEFINE_TYPE (YtsgStatus, ytsg_status, YTSG_TYPE_METADATA); +G_DEFINE_TYPE (YtsStatus, yts_status, YTS_TYPE_METADATA); -#define YTSG_STATUS_GET_PRIVATE(o) \ -(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTSG_TYPE_STATUS, YtsgStatusPrivate)) +#define YTS_STATUS_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), YTS_TYPE_STATUS, YtsStatusPrivate)) -struct _YtsgStatusPrivate +struct _YtsStatusPrivate { guint disposed : 1; }; @@ -69,28 +69,28 @@ enum /*static guint signals[N_SIGNALS] = {0};*/ static void -ytsg_status_class_init (YtsgStatusClass *klass) +yts_status_class_init (YtsStatusClass *klass) { GObjectClass *object_class = (GObjectClass *)klass; - g_type_class_add_private (klass, sizeof (YtsgStatusPrivate)); + g_type_class_add_private (klass, sizeof (YtsStatusPrivate)); - object_class->dispose = ytsg_status_dispose; - object_class->finalize = ytsg_status_finalize; - object_class->constructed = ytsg_status_constructed; - object_class->get_property = ytsg_status_get_property; - object_class->set_property = ytsg_status_set_property; + object_class->dispose = yts_status_dispose; + object_class->finalize = yts_status_finalize; + object_class->constructed = yts_status_constructed; + object_class->get_property = yts_status_get_property; + object_class->set_property = yts_status_set_property; } static void -ytsg_status_constructed (GObject *object) +yts_status_constructed (GObject *object) { - if (G_OBJECT_CLASS (ytsg_status_parent_class)->constructed) - G_OBJECT_CLASS (ytsg_status_parent_class)->constructed (object); + if (G_OBJECT_CLASS (yts_status_parent_class)->constructed) + G_OBJECT_CLASS (yts_status_parent_class)->constructed (object); } static void -ytsg_status_get_property (GObject *object, +yts_status_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) @@ -103,7 +103,7 @@ ytsg_status_get_property (GObject *object, } static void -ytsg_status_set_property (GObject *object, +yts_status_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) @@ -116,51 +116,51 @@ ytsg_status_set_property (GObject *object, } static void -ytsg_status_init (YtsgStatus *self) +yts_status_init (YtsStatus *self) { - self->priv = YTSG_STATUS_GET_PRIVATE (self); + self->priv = YTS_STATUS_GET_PRIVATE (self); } static void -ytsg_status_dispose (GObject *object) +yts_status_dispose (GObject *object) { - YtsgStatus *self = (YtsgStatus*) object; - YtsgStatusPrivate *priv = self->priv; + YtsStatus *self = (YtsStatus*) object; + YtsStatusPrivate *priv = self->priv; if (priv->disposed) return; priv->disposed = TRUE; - G_OBJECT_CLASS (ytsg_status_parent_class)->dispose (object); + G_OBJECT_CLASS (yts_status_parent_class)->dispose (object); } static void -ytsg_status_finalize (GObject *object) +yts_status_finalize (GObject *object) { - G_OBJECT_CLASS (ytsg_status_parent_class)->finalize (object); + G_OBJECT_CLASS (yts_status_parent_class)->finalize (object); } /** - * ytsg_status_new: + * yts_status_new: * @attributes: NULL terminated array of name/value pairs; can be %NULL * - * Constructs a new #YtsgStatus object, setting the top level attributes. + * Constructs a new #YtsStatus object, setting the top level attributes. * - * Return value: (transfer full): newly allocated #YtsgStatus object. + * Return value: (transfer full): newly allocated #YtsStatus object. */ -YtsgStatus * -ytsg_status_new (const char ** attributes) +YtsStatus * +yts_status_new (const char ** attributes) { RestXmlNode *top = rest_xml_node_add_child (NULL, "status"); - YtsgMetadata *mdata; + YtsMetadata *mdata; g_return_val_if_fail (top, NULL); - mdata = _ytsg_metadata_new_from_node (top, attributes); + mdata = _yts_metadata_new_from_node (top, attributes); - g_return_val_if_fail (YTSG_IS_STATUS (mdata), NULL); + g_return_val_if_fail (YTS_IS_STATUS (mdata), NULL); - return (YtsgStatus*) mdata; + return (YtsStatus*) mdata; } diff --git a/ytstenut/yts-status.h b/ytstenut/yts-status.h new file mode 100644 index 0000000..ebcc6df --- /dev/null +++ b/ytstenut/yts-status.h @@ -0,0 +1,85 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* + * Copyright (c) 2011 Intel Corp. + * + * Author: Tomas Frydrych <tf@linux.intel.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _YTS_STATUS_H +#define _YTS_STATUS_H + +#include <ytstenut/yts-metadata.h> + +G_BEGIN_DECLS + +#define YTS_TYPE_STATUS \ + (yts_status_get_type()) +#define YTS_STATUS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + YTS_TYPE_STATUS, \ + YtsStatus)) +#define YTS_STATUS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), \ + YTS_TYPE_STATUS, \ + YtsStatusClass)) +#define YTS_IS_STATUS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + YTS_TYPE_STATUS)) +#define YTS_IS_STATUS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), \ + YTS_TYPE_STATUS)) +#define YTS_STATUS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + YTS_TYPE_STATUS, \ + YtsStatusClass)) + +typedef struct _YtsStatus YtsStatus; +typedef struct _YtsStatusClass YtsStatusClass; +typedef struct _YtsStatusPrivate YtsStatusPrivate; + +/** + * YtsStatusClass: + * + * #YtsStatus class. + */ +struct _YtsStatusClass +{ + /*< private >*/ + YtsMetadataClass parent_class; +}; + +/** + * YtsStatus: + * + * Status of a #YtsService or #YtsClient. + */ +struct _YtsStatus +{ + /*< private >*/ + YtsMetadata parent; + + /*< private >*/ + YtsStatusPrivate *priv; +}; + +GType yts_status_get_type (void) G_GNUC_CONST; + +YtsStatus *yts_status_new (const char **attributes); + +G_END_DECLS + +#endif /* _YTS_STATUS_H */ diff --git a/ytstenut/ytsg-types.h b/ytstenut/yts-types.h index bfd64c5..646e014 100644 --- a/ytstenut/ytsg-types.h +++ b/ytstenut/yts-types.h @@ -20,16 +20,16 @@ */ /** - * SECTION:ytsg-types + * SECTION:yts-types * @short_description: Common Ytestenut-glib types * @title: Common Types - * @section_id: ytsg-types + * @section_id: yts-types * * Common Ytstenut-glib types */ -#ifndef _YTSG_TYPES_H -#define _YTSG_TYPES_H +#ifndef _YTS_TYPES_H +#define _YTS_TYPES_H #include <glib.h> @@ -38,46 +38,46 @@ G_BEGIN_DECLS /* * Forward declarations */ -typedef struct _YtsgClient YtsgClient; -typedef struct _YtsgContact YtsgContact; -typedef struct _YtsgService YtsgService; +typedef struct _YtsClient YtsClient; +typedef struct _YtsContact YtsContact; +typedef struct _YtsService YtsService; /** - * YtsgProtocol: - * @YTSG_PROTOCOL_XMPP: Jabber - * @YTSG_PROTOCOL_LOCAL_XMPP: Bonjour + * YtsProtocol: + * @YTS_PROTOCOL_XMPP: Jabber + * @YTS_PROTOCOL_LOCAL_XMPP: Bonjour * - * YtsgProtocol represents the xmpp protocol to use + * YtsProtocol represents the xmpp protocol to use */ -typedef enum { /*< prefix=YTSG_PROTOCOL >*/ - YTSG_PROTOCOL_XMPP = 0, - YTSG_PROTOCOL_LOCAL_XMPP -} YtsgProtocol; +typedef enum { /*< prefix=YTS_PROTOCOL >*/ + YTS_PROTOCOL_XMPP = 0, + YTS_PROTOCOL_LOCAL_XMPP +} YtsProtocol; /** - * YtsgPresence: - * @YTSG_PRESENCE_UNAVAILABLE: Client is not available - * @YTSG_PRESENCE_AVAILABLE: Client is available + * YtsPresence: + * @YTS_PRESENCE_UNAVAILABLE: Client is not available + * @YTS_PRESENCE_AVAILABLE: Client is available * - * YtsgPresence represents the presence status of #YtsgClient. + * YtsPresence represents the presence status of #YtsClient. */ -typedef enum { /*< prefix=YTSG_PRESENCE >*/ - YTSG_PRESENCE_UNAVAILABLE = 0, - YTSG_PRESENCE_AVAILABLE, +typedef enum { /*< prefix=YTS_PRESENCE >*/ + YTS_PRESENCE_UNAVAILABLE = 0, + YTS_PRESENCE_AVAILABLE, /* < private > */ /* Must be last */ - _YTSG_PRESENCE_LAST_ -} YtsgPresence; + _YTS_PRESENCE_LAST_ +} YtsPresence; -/* FIXME maybe create an ytsg-vs-type.h - * so YTSG_TYPE_VS_QUERY_RESULT_ORDER can become YTSG_VP_TYPE_QUERY_RESULT_ORDER */ -typedef enum { /*< prefix=YTSG_VP_QUERY >*/ - YTSG_VP_QUERY_NONE = 0, - YTSG_VP_QUERY_CHRONOLOGICAL, - YTSG_VP_QUERY_DATE, - YTSG_VP_QUERY_RELEVANCE -} YtsgVPQueryResultOrder; +/* FIXME maybe create an yts-vs-type.h + * so YTS_TYPE_VS_QUERY_RESULT_ORDER can become YTS_VP_TYPE_QUERY_RESULT_ORDER */ +typedef enum { /*< prefix=YTS_VP_QUERY >*/ + YTS_VP_QUERY_NONE = 0, + YTS_VP_QUERY_CHRONOLOGICAL, + YTS_VP_QUERY_DATE, + YTS_VP_QUERY_RELEVANCE +} YtsVPQueryResultOrder; G_END_DECLS diff --git a/ytstenut/ytsg-version.h.in b/ytstenut/yts-version.h.in index e56860c..eae2486 100644 --- a/ytstenut/ytsg-version.h.in +++ b/ytstenut/yts-version.h.in @@ -19,60 +19,60 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _YTSG_VERSION_H -#define _YTSG_VERSION_H +#ifndef _YTS_VERSION_H +#define _YTS_VERSION_H #include <glib.h> G_BEGIN_DECLS /** - * YTSG_MAJOR_VERSION: + * YTS_MAJOR_VERSION: * - * The major version of the Nscreen library (1, if %YTSG_VERSION is 1.2.3) + * The major version of the Nscreen library (1, if %YTS_VERSION is 1.2.3) */ -#define YTSG_MAJOR_VERSION (@YTSG_MAJOR_VERSION@) +#define YTS_MAJOR_VERSION (@YTS_MAJOR_VERSION@) /** - * YTSG_MINOR_VERSION: + * YTS_MINOR_VERSION: * - * The minor version of the Nscreen library (2, if %YTSG_VERSION is 1.2.3) + * The minor version of the Nscreen library (2, if %YTS_VERSION is 1.2.3) */ -#define YTSG_MINOR_VERSION (@YTSG_MINOR_VERSION@) +#define YTS_MINOR_VERSION (@YTS_MINOR_VERSION@) /** - * YTSG_MICRO_VERSION: + * YTS_MICRO_VERSION: * - * The micro version of the Nscreen library (3, if %YTSG_VERSION is 1.2.3) + * The micro version of the Nscreen library (3, if %YTS_VERSION is 1.2.3) */ -#define YTSG_MICRO_VERSION (@YTSG_MICRO_VERSION@) +#define YTS_MICRO_VERSION (@YTS_MICRO_VERSION@) /** - * YTSG_VERSION: + * YTS_VERSION: * * The full version of the Nscreen library, like 1.2.3 */ -#define YTSG_VERSION @YTSG_VERSION@ +#define YTS_VERSION @YTS_VERSION@ /** - * YTSG_VERSION_S: + * YTS_VERSION_S: * * The full version of the Nscreen library, in string form (suited for * string concatenation) */ -#define YTSG_VERSION_S "@YTSG_VERSION@" +#define YTS_VERSION_S "@YTS_VERSION@" /** - * YTSG_VERSION_HEX: + * YTS_VERSION_HEX: * * Numerically encoded version of the Nscreen library, like 0x010203 */ -#define YTSG_VERSION_HEX ((YTSG_MAJOR_VERSION << 24) | \ - (YTSG_MINOR_VERSION << 16) | \ - (YTSG_MICRO_VERSION << 8)) +#define YTS_VERSION_HEX ((YTS_MAJOR_VERSION << 24) | \ + (YTS_MINOR_VERSION << 16) | \ + (YTS_MICRO_VERSION << 8)) /** - * YTSG_CHECK_VERSION: + * YTS_CHECK_VERSION: * @major: major version, like 1 in 1.2.3 * @minor: minor version, like 2 in 1.2.3 * @micro: micro version, like 3 in 1.2.3 @@ -80,11 +80,11 @@ G_BEGIN_DECLS * Evaluates to %TRUE if the version of the Nscreen library is greater * than @major, @minor and @micro */ -#define YTSG_CHECK_VERSION(major,minor,micro) \ - (YTSG_MAJOR_VERSION > (major) || \ - (YTSG_MAJOR_VERSION == (major) && YTSG_MINOR_VERSION > (minor)) || \ - (YTSG_MAJOR_VERSION == (major) && YTSG_MINOR_VERSION == (minor) && YTSG_MICRO_VERSION >= (micro))) +#define YTS_CHECK_VERSION(major,minor,micro) \ + (YTS_MAJOR_VERSION > (major) || \ + (YTS_MAJOR_VERSION == (major) && YTS_MINOR_VERSION > (minor)) || \ + (YTS_MAJOR_VERSION == (major) && YTS_MINOR_VERSION == (minor) && YTS_MICRO_VERSION >= (micro))) G_END_DECLS -#endif /* _YTSG_VERSION_H */ +#endif /* _YTS_VERSION_H */ diff --git a/ytstenut/ytsg-capability-status.h b/ytstenut/ytsg-capability-status.h deleted file mode 100644 index 4b6e9a4..0000000 --- a/ytstenut/ytsg-capability-status.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_CAPABILITY_STATUS_H -#define YTSG_CAPABILITY_STATUS_H - -#include <glib-object.h> -#include <ytstenut/ytsg-metadata.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_CAPABILITY_STATUS ytsg_capability_status_get_type() - -#define YTSG_CAPABILITY_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_CAPABILITY_STATUS, YtsgCapabilityStatus)) - -#define YTSG_CAPABILITY_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_CAPABILITY_STATUS, YtsgCapabilityStatusClass)) - -#define YTSG_IS_CAPABILITY_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_CAPABILITY_STATUS)) - -#define YTSG_IS_CAPABILITY_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_CAPABILITY_STATUS)) - -#define YTSG_CAPABILITY_STATUS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_CAPABILITY_STATUS, YtsgCapabilityStatusClass)) - -typedef struct { - YtsgMetadata parent; -} YtsgCapabilityStatus; - -typedef struct { - YtsgMetadataClass parent; -} YtsgCapabilityStatusClass; - -GType -ytsg_capability_status_get_type (void) G_GNUC_CONST; - -YtsgMetadata * -ytsg_capability_status_new (char const *capability, - char const *aspect, - GVariant *condition); - -G_END_DECLS - -#endif /* YTSG_CAPABILITY_STATUS_H */ diff --git a/ytstenut/ytsg-client.h b/ytstenut/ytsg-client.h deleted file mode 100644 index 780349b..0000000 --- a/ytstenut/ytsg-client.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_CLIENT_H -#define _YTSG_CLIENT_H - -#include <stdbool.h> -#include <glib-object.h> -#include <telepathy-glib/channel.h> - -#include <ytstenut/ytsg-capability.h> -#include <ytstenut/ytsg-caps.h> -#include <ytstenut/ytsg-error.h> -#include <ytstenut/ytsg-message.h> -#include <ytstenut/ytsg-roster.h> -#include <ytstenut/ytsg-types.h> -#include <ytstenut/ytsg-status.h> - - -G_BEGIN_DECLS - -#define YTSG_TYPE_CLIENT \ - (ytsg_client_get_type()) -#define YTSG_CLIENT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_CLIENT, \ - YtsgClient)) -#define YTSG_CLIENT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_CLIENT, \ - YtsgClientClass)) -#define YTSG_IS_CLIENT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_CLIENT)) -#define YTSG_IS_CLIENT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_CLIENT)) -#define YTSG_CLIENT_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_CLIENT, \ - YtsgClientClass)) - -typedef struct _YtsgClientClass YtsgClientClass; -typedef struct _YtsgClientPrivate YtsgClientPrivate; - -/** - * YtsgClientClass: - * @authenticated: signal handler for #YtsgClient::authenticated - * @ready: signal handler for #YtsgClient::ready - * @disconnected: signal handler for #YtsgClient::disconnected - * @message: signal handler for #YtsgClient::message - * @incoming_file: signal handler for #YtsgClient::incoming-file - * - * Class for #YtsgClient - */ -struct _YtsgClientClass -{ - /*< private >*/ - GObjectClass parent_class; - - /*< public >*/ - void (*authenticated) (YtsgClient *client); - void (*ready) (YtsgClient *client); - void (*disconnected) (YtsgClient *client); - void (*message) (YtsgClient *client, YtsgMessage *msg); - gboolean (*incoming_file) (YtsgClient *client, - const char *from, - const char *name, - guint64 size, - guint64 offset, - TpChannel *channel); -}; - -/** - * YtsgClient: - * - * Class representing an application connection to the Ytstenut mesh. - */ -struct _YtsgClient -{ - /*< private >*/ - GObject parent; - - YtsgClientPrivate *priv; -}; - -GType ytsg_client_get_type (void) G_GNUC_CONST; - -YtsgClient *ytsg_client_new (YtsgProtocol protocol, const char *uid); - -void ytsg_client_disconnect (YtsgClient *client); -void ytsg_client_connect (YtsgClient *client); -void ytsg_client_set_capabilities (YtsgClient *client, YtsgCaps caps); -YtsgRoster *ytsg_client_get_roster (YtsgClient *client); -void ytsg_client_emit_error (YtsgClient *client, YtsgError error); -void ytsg_client_set_incoming_file_directory (YtsgClient *client, - const char *directory); -const char *ytsg_client_get_incoming_file_directory (YtsgClient *client); -const char *ytsg_client_get_jid (const YtsgClient *client); -const char *ytsg_client_get_uid (const YtsgClient *client); -void ytsg_client_set_status (YtsgClient *client, YtsgStatus *status); -void ytsg_client_set_status_by_capability (YtsgClient *client, - const char *capability, - const char *activity); - -gboolean -ytsg_client_register_service (YtsgClient *self, - YtsgCapability *service); - -/* Protected */ - -void -ytsg_client_cleanup_contact (YtsgClient *self, - YtsgContact const *contact); - -void -ytsg_client_cleanup_service (YtsgClient *self, - YtsgService *service); - -bool -ytsg_client_get_invocation_proxy (YtsgClient *self, - char const *invocation_id, - YtsgContact **contact, - char const **proxy_id); - -GVariant * -ytsg_client_register_proxy (YtsgClient *self, - char const *capability, - YtsgContact *contact, - char const *proxy_id); - -bool -ytsg_client_unregister_proxy (YtsgClient *self, - char const *capability, - char const *proxy_id); - -G_END_DECLS - -#endif /* _YTSG_CLIENT_H */ - diff --git a/ytstenut/ytsg-contact.h b/ytstenut/ytsg-contact.h deleted file mode 100644 index d9a929d..0000000 --- a/ytstenut/ytsg-contact.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_CONTACT_H -#define _YTSG_CONTACT_H - -#include <glib-object.h> -#include <gio/gio.h> -#include <telepathy-glib/contact.h> - -#include <ytstenut/ytsg-caps.h> -#include <ytstenut/ytsg-error.h> -#include <ytstenut/ytsg-types.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_CONTACT \ - (ytsg_contact_get_type()) -#define YTSG_CONTACT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_CONTACT, \ - YtsgContact)) -#define YTSG_CONTACT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_CONTACT, \ - YtsgContactClass)) -#define YTSG_IS_CONTACT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_CONTACT)) -#define YTSG_IS_CONTACT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_CONTACT)) -#define YTSG_CONTACT_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_CONTACT, \ - YtsgContactClass)) - -typedef struct _YtsgContactClass YtsgContactClass; -typedef struct _YtsgContactPrivate YtsgContactPrivate; - -/** - * YtsgContactClass: - * @service_added: signal handler for #YtsgContact::service-added - * @service_removed: signal handler for #YtsgContact::service-removed - * - * #YtsgContact class. - */ -struct _YtsgContactClass -{ - GObjectClass parent_class; - - void (*service_added) (YtsgContact *contact, YtsgService *service); - void (*service_removed) (YtsgContact *contact, YtsgService *service); -}; - -/** - * YtsgContact: - * - * Represents a single XMPP connection (usually a device) in the Ytstenut - * mesh. One or more #YtsgService<!-- -->s will be available throug a given - * contact. - */ -struct _YtsgContact -{ - /*< private >*/ - GObject parent; - - /*< private >*/ - YtsgContactPrivate *priv; -}; - -GType ytsg_contact_get_type (void) G_GNUC_CONST; - -YtsgClient *ytsg_contact_get_client (const YtsgContact *contact); -const char *ytsg_contact_get_jid (const YtsgContact *contact); -const char *ytsg_contact_get_name (const YtsgContact *contact); -TpContact *ytsg_contact_get_tp_contact (const YtsgContact *contact); -GFile *ytsg_contact_get_icon (const YtsgContact *contact, - const char **mime); -gboolean ytsg_contact_has_capability (const YtsgContact *item, - YtsgCaps cap); - -YtsgError ytsg_contact_send_file (const YtsgContact *item, - GFile *gfile); -gboolean ytsg_contact_cancel_file (const YtsgContact *item, - GFile *gfile); - -/* FIXME private */ - -gboolean -ytsg_contact_dispatch_event (YtsgContact *self, - char const *capability, - char const *aspect, - GVariant *arguments); - -gboolean -ytsg_contact_dispatch_response (YtsgContact *self, - char const *capability, - char const *invocation_id, - GVariant *response); - -G_END_DECLS - -#endif /* _YTSG_CONTACT_H */ diff --git a/ytstenut/ytsg-error.h b/ytstenut/ytsg-error.h deleted file mode 100644 index 3257098..0000000 --- a/ytstenut/ytsg-error.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2010 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - */ - -#ifndef _YTSG_ERROR_H -#define _YTSG_ERROR_H - -#include <ytstenut/ytsg-types.h> - -G_BEGIN_DECLS - -/** - * YtsgError: - * @YTSG_ERROR_SUCCESS: Operation succeeded, - * @YTSG_ERROR_PENDING: The operation will be completed at a later stage, - * subject to completing intermediate asynchronous operations (implies success - * up to the point the asynchronous operation began). The operation to which - * it pertains can be retrieved from the #YtsgError value using - * ytsg_error_get_atom(). Operations that return this error code must emit - * #YtsgClient::error signal at a later stage to indicate either subsequent - * errors or eventual success. - * @YTSG_ERROR_OBJECT_DISPOSED: the object is in process of being destroyed - * @YTSG_ERROR_INVALID_PARAMETER: Invalid parameter supplied to function - * @YTSG_ERROR_NOT_ALLOWED: the operation is not allowed. - * @YTSG_ERROR_NO_ROUTE: no route to complete the operation - * @YTSG_ERROR_UNKNOWN: some other,unspecified, error condition. - * @YTSG_ERROR_CUSTOM_START: custom error codes can start at this value - * @YTSG_ERROR_CUSTOM_END: custom error code must not exceed this value - * - * YtsgError represents common errors for nScreen operation; YtsgError combines - * an error code defined by the above enumeration and an atom value that - * uniquely identifies the operation associated with the value. Use - * ytsg_error_get_code() and ytsg_error_get_atom() to retrieve these components. - */ - -typedef enum { /*< prefix=YTSG_ERROR >*/ - YTSG_ERROR_SUCCESS = 0, - YTSG_ERROR_PENDING, - YTSG_ERROR_OBJECT_DISPOSED, - YTSG_ERROR_INVALID_PARAMETER, - YTSG_ERROR_NOT_ALLOWED, - YTSG_ERROR_NO_ROUTE, - YTSG_ERROR_NO_MSG_CHANNEL, - - /* Last predefined error code */ - YTSG_ERROR_UNKNOWN = 0x00007fff, - - YTSG_ERROR_CUSTOM_START = 0x00008000, - /* Custom error code range is in between here */ - YTSG_ERROR_CUSTOM_END = 0x0000ffff, - - /* <private> */ - _YTSG_ERROR_CODE_MASK = 0x0000ffff, - _YTSG_ERROR_ATOM_MASK = 0xffff0000, - -} YtsgError; - -YtsgError ytsg_error_new (guint32 code); -guint32 ytsg_error_new_atom (); -YtsgError ytsg_error_make (guint32 atom, guint32 code); -guint ytsg_error_get_code (YtsgError error); -guint ytsg_error_get_atom (YtsgError error); - -G_END_DECLS - -#endif /* _YTSG_ERROR_H */ diff --git a/ytstenut/ytsg-invocation-message.h b/ytstenut/ytsg-invocation-message.h deleted file mode 100644 index d05bb5e..0000000 --- a/ytstenut/ytsg-invocation-message.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_INVOCATION_MESSAGE_H -#define YTSG_INVOCATION_MESSAGE_H - -#include <glib-object.h> -#include <ytstenut/ytsg-metadata.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_INVOCATION_MESSAGE ytsg_invocation_message_get_type() - -#define YTSG_INVOCATION_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_INVOCATION_MESSAGE, YtsgInvocationMessage)) - -#define YTSG_INVOCATION_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_INVOCATION_MESSAGE, YtsgInvocationMessageClass)) - -#define YTSG_IS_INVOCATION_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_INVOCATION_MESSAGE)) - -#define YTSG_IS_INVOCATION_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_INVOCATION_MESSAGE)) - -#define YTSG_INVOCATION_MESSAGE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_INVOCATION_MESSAGE, YtsgInvocationMessageClass)) - -typedef struct { - YtsgMetadata parent; -} YtsgInvocationMessage; - -typedef struct { - YtsgMetadataClass parent; -} YtsgInvocationMessageClass; - -GType -ytsg_invocation_message_get_type (void) G_GNUC_CONST; - -YtsgMetadata * -ytsg_invocation_message_new (char const *invocation_id, - char const *capability, - char const *aspect, - GVariant *arguments); - -G_END_DECLS - -#endif /* YTSG_INVOCATION_MESSAGE_H */ diff --git a/ytstenut/ytsg-message.h b/ytstenut/ytsg-message.h deleted file mode 100644 index b4029c7..0000000 --- a/ytstenut/ytsg-message.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_MESSAGE_H -#define _YTSG_MESSAGE_H - -#include <ytstenut/ytsg-metadata.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_MESSAGE \ - (ytsg_message_get_type()) -#define YTSG_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_MESSAGE, \ - YtsgMessage)) -#define YTSG_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_MESSAGE, \ - YtsgMessageClass)) -#define YTSG_IS_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_MESSAGE)) -#define YTSG_IS_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_MESSAGE)) -#define YTSG_MESSAGE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_MESSAGE, \ - YtsgMessageClass)) - -typedef struct _YtsgMessage YtsgMessage; -typedef struct _YtsgMessageClass YtsgMessageClass; -typedef struct _YtsgMessagePrivate YtsgMessagePrivate; - -/** - * YtsgMessageClass: - * - * #YtsgMessage class. - */ -struct _YtsgMessageClass -{ - /*< private >*/ - YtsgMetadataClass parent_class; -}; - -/** - * YtsgMessage: - * - * Encapsulates a Ytstenut message, either being sent to a given #YtsgService or - * received by #YtsgClient. - */ -struct _YtsgMessage -{ - /*< private >*/ - YtsgMetadata parent; - - /*< private >*/ - YtsgMessagePrivate *priv; -}; - -GType ytsg_message_get_type (void) G_GNUC_CONST; - -YtsgMessage *ytsg_message_new (const char ** attributes); - -G_END_DECLS - -#endif /* _YTSG_MESSAGE_H */ diff --git a/ytstenut/ytsg-metadata-service.h b/ytstenut/ytsg-metadata-service.h deleted file mode 100644 index 426b6e4..0000000 --- a/ytstenut/ytsg-metadata-service.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -#ifndef _YTSG_METADATA_SERVICE_H -#define _YTSG_METADATA_SERVICE_H - -#include <ytstenut/ytsg-error.h> -#include <ytstenut/ytsg-message.h> -#include <ytstenut/ytsg-service.h> -#include <ytstenut/ytsg-status.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_METADATA_SERVICE \ - (ytsg_metadata_service_get_type()) - -#define YTSG_METADATA_SERVICE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_METADATA_SERVICE, \ - YtsgMetadataService)) -#define YTSG_METADATA_SERVICE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_METADATA_SERVICE, \ - YtsgMetadataServiceClass)) -#define YTSG_IS_METADATA_SERVICE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_METADATA_SERVICE)) -#define YTSG_IS_METADATA_SERVICE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_METADATA_SERVICE)) -#define YTSG_METADATA_SERVICE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_METADATA_SERVICE, \ - YtsgMetadataServiceClass)) - -typedef struct _YtsgMetadataService YtsgMetadataService; -typedef struct _YtsgMetadataServiceClass YtsgMetadataServiceClass; -typedef struct _YtsgMetadataServicePrivate YtsgMetadataServicePrivate; - -/** - * YtsgMetadataServiceClass: - * - * #YtsgMetadataService class. - */ -struct _YtsgMetadataServiceClass -{ - /*< private >*/ - YtsgServiceClass parent_class; - - /*< public >*/ - void (*received_status) (YtsgMetadataService *service, YtsgStatus *status); - void (*received_message) (YtsgMetadataService *service, YtsgMessage *message); -}; - -/** - * YtsgMetadataService: - * - * Ytstenut service. - */ -struct _YtsgMetadataService -{ - /*< private >*/ - YtsgService parent; - - /*< private >*/ - YtsgMetadataServicePrivate *priv; -}; - -GType ytsg_metadata_service_get_type (void) G_GNUC_CONST; - -YtsgError ytsg_metadata_service_send_metadata (YtsgMetadataService *service, - YtsgMetadata *metadata); - -G_END_DECLS - -#endif /* _YTSG_METADATA_SERVICE_H */ diff --git a/ytstenut/ytsg-metadata.h b/ytstenut/ytsg-metadata.h deleted file mode 100644 index d891663..0000000 --- a/ytstenut/ytsg-metadata.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_METADATA_H -#define _YTSG_METADATA_H - -#include <glib-object.h> -#include <rest/rest-xml-node.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_METADATA \ - (ytsg_metadata_get_type()) -#define YTSG_METADATA(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_METADATA, \ - YtsgMetadata)) -#define YTSG_METADATA_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_METADATA, \ - YtsgMetadataClass)) -#define YTSG_IS_METADATA(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_METADATA)) -#define YTSG_IS_METADATA_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_METADATA)) -#define YTSG_METADATA_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_METADATA, \ - YtsgMetadataClass)) - -typedef struct _YtsgMetadata YtsgMetadata; -typedef struct _YtsgMetadataClass YtsgMetadataClass; -typedef struct _YtsgMetadataPrivate YtsgMetadataPrivate; - -/** - * YtsgMetadataClass: - * - * #YtsgMetadata class. - */ -struct _YtsgMetadataClass -{ - /*< private >*/ - GObjectClass parent_class; -}; - -/** - * YtsgMetadata: - * - * Base class for #YtsgMessage and #YtsgStatus. - */ -struct _YtsgMetadata -{ - /*< private >*/ - GObject parent; - - /*< private >*/ - YtsgMetadataPrivate *priv; -}; - -GType ytsg_metadata_get_type (void) G_GNUC_CONST; - -const char *ytsg_metadata_get_attribute (YtsgMetadata *self, const char *name); -void ytsg_metadata_add_attribute (YtsgMetadata *self, - const char *name, - const char *value); -char *ytsg_metadata_to_string (YtsgMetadata *self); -gboolean ytsg_metadata_is_equal (YtsgMetadata *self, YtsgMetadata *other); -RestXmlNode *ytsg_metadata_get_root_node (YtsgMetadata *self); - -G_END_DECLS - -#endif /* _YTSG_METADATA_H */ diff --git a/ytstenut/ytsg-response-message.h b/ytstenut/ytsg-response-message.h deleted file mode 100644 index b4c1607..0000000 --- a/ytstenut/ytsg-response-message.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2011 Intel Corp. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see - * <http://www.gnu.org/licenses/>. - * - * Authored by: Rob Staudinger <robsta@linux.intel.com> - */ - -#ifndef YTSG_RESPONSE_MESSAGE_H -#define YTSG_RESPONSE_MESSAGE_H - -#include <glib-object.h> -#include <ytstenut/ytsg-metadata.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_RESPONSE_MESSAGE ytsg_response_message_get_type() - -#define YTSG_RESPONSE_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), YTSG_TYPE_RESPONSE_MESSAGE, YtsgResponseMessage)) - -#define YTSG_RESPONSE_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), YTSG_TYPE_RESPONSE_MESSAGE, YtsgResponseMessageClass)) - -#define YTSG_IS_RESPONSE_MESSAGE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YTSG_TYPE_RESPONSE_MESSAGE)) - -#define YTSG_IS_RESPONSE_MESSAGE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), YTSG_TYPE_RESPONSE_MESSAGE)) - -#define YTSG_RESPONSE_MESSAGE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), YTSG_TYPE_RESPONSE_MESSAGE, YtsgResponseMessageClass)) - -typedef struct { - YtsgMetadata parent; -} YtsgResponseMessage; - -typedef struct { - YtsgMetadataClass parent; -} YtsgResponseMessageClass; - -GType -ytsg_response_message_get_type (void) G_GNUC_CONST; - -YtsgMetadata * -ytsg_response_message_new (char const *capability, - char const *invocation_id, - GVariant *response); - -G_END_DECLS - -#endif /* YTSG_RESPONSE_MESSAGE_H */ diff --git a/ytstenut/ytsg-roster.h b/ytstenut/ytsg-roster.h deleted file mode 100644 index 0fe4c3f..0000000 --- a/ytstenut/ytsg-roster.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_ROSTER_H -#define _YTSG_ROSTER_H - -#include <glib-object.h> -#include <ytstenut/ytsg-caps.h> -#include <ytstenut/ytsg-contact.h> -#include <ytstenut/ytsg-types.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_ROSTER \ - (ytsg_roster_get_type()) -#define YTSG_ROSTER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_ROSTER, \ - YtsgRoster)) -#define YTSG_ROSTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_ROSTER, \ - YtsgRosterClass)) -#define YTSG_IS_ROSTER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_ROSTER)) -#define YTSG_IS_ROSTER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_ROSTER)) -#define YTSG_ROSTER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_ROSTER, \ - YtsgRosterClass)) - -typedef struct _YtsgRoster YtsgRoster; -typedef struct _YtsgRosterClass YtsgRosterClass; -typedef struct _YtsgRosterPrivate YtsgRosterPrivate; - -/** - * YtsgRosterClass: - * - * #YtsgRoster class. - */ -struct _YtsgRosterClass -{ - /*< private >*/ - GObjectClass parent_class; -}; - -/** - * YtsgRoster: - * - * Represents a roster of #YtsgContact<!-- -->s known to #YtsgClient. - */ -struct _YtsgRoster -{ - /*< private >*/ - GObject parent; - - /*< private >*/ - YtsgRosterPrivate *priv; -}; - -GType ytsg_roster_get_type (void) G_GNUC_CONST; - -GHashTable *ytsg_roster_get_contacts (YtsgRoster *roster); -YtsgContact *ytsg_roster_find_contact_by_jid (YtsgRoster *roster, - const char *jid); -YtsgContact *ytsg_roster_find_contact_by_capability (YtsgRoster *roster, - YtsgCaps capability); -YtsgClient *ytsg_roster_get_client (YtsgRoster *roster); - -G_END_DECLS - -#endif /* _YTSG_ROSTER_H */ diff --git a/ytstenut/ytsg-service.h b/ytstenut/ytsg-service.h deleted file mode 100644 index a9a827e..0000000 --- a/ytstenut/ytsg-service.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_SERVICE_H -#define _YTSG_SERVICE_H - -#include <glib-object.h> -#include <ytstenut/ytsg-contact.h> -#include <ytstenut/ytsg-types.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_SERVICE \ - (ytsg_service_get_type()) -#define YTSG_SERVICE(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_SERVICE, \ - YtsgService)) -#define YTSG_SERVICE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_SERVICE, \ - YtsgServiceClass)) -#define YTSG_IS_SERVICE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_SERVICE)) -#define YTSG_IS_SERVICE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_SERVICE)) -#define YTSG_SERVICE_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_SERVICE, \ - YtsgServiceClass)) - -typedef struct _YtsgServiceClass YtsgServiceClass; -typedef struct _YtsgServicePrivate YtsgServicePrivate; - -/** - * YtsgServiceClass: - * - * #YtsgService class. - */ -struct _YtsgServiceClass -{ - /*< private >*/ - GObjectClass parent_class; - - void (*message) (YtsgService *self, - char const *xml_payload); -}; - -/** - * YtsgService: - * - * Abstract base class for XPMN services; see #YtsgMetadataService. - */ -struct _YtsgService -{ - /*< private >*/ - GObject parent; - - /*< private >*/ - YtsgServicePrivate *priv; -}; - -GType ytsg_service_get_type (void) G_GNUC_CONST; - -const char * ytsg_service_get_uid (YtsgService *service); -const char * ytsg_service_get_jid (YtsgService *service); -YtsgContact * ytsg_service_get_contact (YtsgService *service); -const char * ytsg_service_get_service_type (YtsgService *service); -const char ** ytsg_service_get_caps (YtsgService *service); -GHashTable * ytsg_service_get_names (YtsgService *service); -const char * ytsg_service_get_status_xml (YtsgService *service); - -gboolean ytsg_service_has_capability (YtsgService *self, - char const *capability); - -G_END_DECLS - -#endif /* _YTSG_SERVICE_H */ diff --git a/ytstenut/ytsg-status.h b/ytstenut/ytsg-status.h deleted file mode 100644 index 9bb3f67..0000000 --- a/ytstenut/ytsg-status.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ - -/* - * Copyright (c) 2011 Intel Corp. - * - * Author: Tomas Frydrych <tf@linux.intel.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _YTSG_STATUS_H -#define _YTSG_STATUS_H - -#include <ytstenut/ytsg-metadata.h> - -G_BEGIN_DECLS - -#define YTSG_TYPE_STATUS \ - (ytsg_status_get_type()) -#define YTSG_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - YTSG_TYPE_STATUS, \ - YtsgStatus)) -#define YTSG_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - YTSG_TYPE_STATUS, \ - YtsgStatusClass)) -#define YTSG_IS_STATUS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - YTSG_TYPE_STATUS)) -#define YTSG_IS_STATUS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - YTSG_TYPE_STATUS)) -#define YTSG_STATUS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - YTSG_TYPE_STATUS, \ - YtsgStatusClass)) - -typedef struct _YtsgStatus YtsgStatus; -typedef struct _YtsgStatusClass YtsgStatusClass; -typedef struct _YtsgStatusPrivate YtsgStatusPrivate; - -/** - * YtsgStatusClass: - * - * #YtsgStatus class. - */ -struct _YtsgStatusClass -{ - /*< private >*/ - YtsgMetadataClass parent_class; -}; - -/** - * YtsgStatus: - * - * Status of a #YtsgService or #YtsgClient. - */ -struct _YtsgStatus -{ - /*< private >*/ - YtsgMetadata parent; - - /*< private >*/ - YtsgStatusPrivate *priv; -}; - -GType ytsg_status_get_type (void) G_GNUC_CONST; - -YtsgStatus *ytsg_status_new (const char **attributes); - -G_END_DECLS - -#endif /* _YTSG_STATUS_H */ diff --git a/ytstenut/ytstenut.h b/ytstenut/ytstenut.h index dfe3dfb..3dae831 100644 --- a/ytstenut/ytstenut.h +++ b/ytstenut/ytstenut.h @@ -21,41 +21,41 @@ #ifndef YTSTENUT_H #define YTSTENUT_H -#include <ytstenut/ytsg-capability.h> -#include <ytstenut/ytsg-caps.h> -#include <ytstenut/ytsg-client.h> -#include <ytstenut/ytsg-contact.h> -#include <ytstenut/ytsg-debug.h> -#include <ytstenut/ytsg-error.h> -#include <ytstenut/ytsg-main.h> -#include <ytstenut/ytsg-message.h> -#include <ytstenut/ytsg-metadata.h> -#include <ytstenut/ytsg-metadata-service.h> -#include <ytstenut/ytsg-roster.h> -#include <ytstenut/ytsg-service.h> -#include <ytstenut/ytsg-status.h> -#include <ytstenut/ytsg-types.h> -#include <ytstenut/ytsg-version.h> +#include <ytstenut/yts-capability.h> +#include <ytstenut/yts-caps.h> +#include <ytstenut/yts-client.h> +#include <ytstenut/yts-contact.h> +#include <ytstenut/yts-debug.h> +#include <ytstenut/yts-error.h> +#include <ytstenut/yts-main.h> +#include <ytstenut/yts-message.h> +#include <ytstenut/yts-metadata.h> +#include <ytstenut/yts-metadata-service.h> +#include <ytstenut/yts-roster.h> +#include <ytstenut/yts-service.h> +#include <ytstenut/yts-status.h> +#include <ytstenut/yts-types.h> +#include <ytstenut/yts-version.h> -#include <ytstenut/ytsg-marshal.h> -#include <ytstenut/ytsg-enum-types.h> +#include <ytstenut/yts-marshal.h> +#include <ytstenut/yts-enum-types.h> -#include <ytstenut/ytsg-capability-status.h> -#include <ytstenut/ytsg-error-message.h> -#include <ytstenut/ytsg-event-message.h> -#include <ytstenut/ytsg-invocation-message.h> -#include <ytstenut/ytsg-proxy.h> -#include <ytstenut/ytsg-proxy-service.h> -#include <ytstenut/ytsg-response-message.h> -#include <ytstenut/ytsg-service-adapter.h> +#include <ytstenut/yts-capability-status.h> +#include <ytstenut/yts-error-message.h> +#include <ytstenut/yts-event-message.h> +#include <ytstenut/yts-invocation-message.h> +#include <ytstenut/yts-proxy.h> +#include <ytstenut/yts-proxy-service.h> +#include <ytstenut/yts-response-message.h> +#include <ytstenut/yts-service-adapter.h> -#include <ytstenut/video-profile/ytsg-vp-content.h> -#include <ytstenut/video-profile/ytsg-vp-playable.h> -#include <ytstenut/video-profile/ytsg-vp-player.h> -#include <ytstenut/video-profile/ytsg-vp-query.h> -#include <ytstenut/video-profile/ytsg-vp-transcript.h> -#include <ytstenut/video-profile/ytsg-vp-transfer.h> -#include <ytstenut/video-profile/ytsg-vp-transmission.h> +#include <ytstenut/video-profile/yts-vp-content.h> +#include <ytstenut/video-profile/yts-vp-playable.h> +#include <ytstenut/video-profile/yts-vp-player.h> +#include <ytstenut/video-profile/yts-vp-query.h> +#include <ytstenut/video-profile/yts-vp-transcript.h> +#include <ytstenut/video-profile/yts-vp-transfer.h> +#include <ytstenut/video-profile/yts-vp-transmission.h> #endif /* YTSTENUT_H */ |