gobjectification: f6cb9087: Moved enums to use glib-mkenums. It has...

grim at pidgin.im grim at pidgin.im
Mon Mar 21 22:35:46 EDT 2011


----------------------------------------------------------------------
Revision: f6cb908701a3f952badc929344232c148d3451fe
Parent:   cec646e9141d381ba2b967c2b43e01fd83c3e031
Author:   grim at pidgin.im
Date:     03/21/11 22:32:38
Branch:   im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/f6cb908701a3f952badc929344232c148d3451fe

Changelog: 

Moved enums to use glib-mkenums.  It has some caveats but it works.
Removed the manual registration of PurpleConnectionState, PurpleConnectionFlags, PurpleConnectionError, and PurpleMediaElementType
Ignored libpurple/enums.[ch]$ in .mtn-ignore
Added configure check for glib-mkenums

Changes against parent cec646e9141d381ba2b967c2b43e01fd83c3e031

  added    libpurple/enums.c.template
  added    libpurple/enums.h.template
  patched  .mtn-ignore
  patched  configure.ac
  patched  libpurple/Makefile.am
  patched  libpurple/connection.c
  patched  libpurple/connection.h
  patched  libpurple/media-gst.h
  patched  libpurple/mediamanager.c

-------------- next part --------------
============================================================
--- configure.ac	4cab5f0570775ccf76b605326871a89761367dcd
+++ configure.ac	527a5947b4681cf85ad98a5637d7cbb3f6626ea0
@@ -346,6 +346,9 @@ AC_SUBST(GLIB_GENMARSHAL)
 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
 AC_SUBST(GLIB_GENMARSHAL)
 
+GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
+AC_SUBST(GLIB_MKENUMS)
+
 AC_ARG_WITH([extraversion],
 			AC_HELP_STRING([--with-extraversion=STRING],
 						   [extra version number to be displayed in Help->About and --help (for packagers)]),
============================================================
--- libpurple/connection.c	76f3474a4e6bb785c61f5c53feac1ed0eb725d14
+++ libpurple/connection.c	970515e8dcfd61b68d419cfc8460e4202baea804
@@ -31,6 +31,7 @@
 #include "connection.h"
 #include "dbus-maybe.h"
 #include "debug.h"
+#include "enums.h"
 #include "log.h"
 #include "marshallers.h"
 #include "notify.h"
@@ -1095,101 +1096,6 @@ purple_connection_get_gtype(void)
 	return type;
 }
 
-/******************************************************************************
- * PurpleConnectionFlags API
- *****************************************************************************/
-GType
-purple_connection_flags_get_gtype(void)
-{
-	static GType type = 0;
-
-	if(type == 0) {
-		static const GFlagsValue values[] = {
-			{ PURPLE_CONNECTION_FLAGS_HTML, "HTML", "HTML" },
-			{ PURPLE_CONNECTION_FLAGS_NO_BGCOLOR, "NO BG", "NO BG" },
-			{ PURPLE_CONNECTION_FLAGS_AUTO_RESP, "Autoresponse",
-			  "Autoresponse"
-			},
-			{ PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO, "WBFO", "WBFO" },
-			{ PURPLE_CONNECTION_FLAGS_NO_NEWLINES, "No newlines",
-			  "No newlines"
-			},
-			{ PURPLE_CONNECTION_FLAGS_NO_FONTSIZE, "No fontsize",
-			  "No fontsize"
-			},
-			{ PURPLE_CONNECTION_FLAGS_NO_URLDESC, "No url desc",
-			  "No url desc"
-			},
-			{ PURPLE_CONNECTION_FLAGS_NO_IMAGES, "No images", "No images", },
-			{ PURPLE_CONNECTION_FLAGS_ALLOW_CUSTOM_SMILEY,
-			    "Allow custom smileys", "Allow custom smileys", },
-			{ 0, NULL, NULL },
-		};
-
-		type = g_flags_register_static("PurpleConnectionFlags", values);
-	}
-
-	return type;
-}
-
-/******************************************************************************
- * PurpleConnectionState API
- *****************************************************************************/
-GType
-purple_connection_state_get_gtype(void)
-{
-	static GType type = 0;
-
-	if(type == 0) {
-		static const GEnumValue values[] = {
-			{ PURPLE_CONNECTION_STATE_DISCONNECTED, "Disconnected", "Disconnected"},
-			{ PURPLE_CONNECTION_STATE_CONNECTING, "Connecting", "Connecting"},
-			{ PURPLE_CONNECTION_STATE_CONNECTED, "Connected", "Connected"},
-			{ 0, NULL, NULL },
-		};
-
-		type = g_enum_register_static("PurpleConnectionState", values);
-	}
-
-	return type;
-}
-
-/******************************************************************************
- * PurpleConnectionError API
- *****************************************************************************/
-GType
-purple_connection_error_get_gtype(void)
-{
-	static GType type = 0;
-
-	if(type == 0) {
-		static const GEnumValue values[] = {
-			{PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Network error", ""},
-			{PURPLE_CONNECTION_ERROR_INVALID_USERNAME, "Invalid username", ""},
-			{PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, "Authentication failed", ""},
-			{PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, "Authentication impossible", ""},
-			{PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, "No SSL support", ""},
-			{PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, "Encryption error", ""},
-			{PURPLE_CONNECTION_ERROR_NAME_IN_USE, "Name already in use", ""},
-			{PURPLE_CONNECTION_ERROR_INVALID_SETTINGS, "Invalid settings", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED, "SSL certificate unavailable", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED, "SSL certificate could not be trusted", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_EXPIRED, "SSL certificate expired", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED, "SSL certificate is not yet valid", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH, "SSL certificate did not match its hostname", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH, "SSL certificate fingerprint mismatch", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED, "SSL certificate is self-signed", ""},
-			{PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR, "Other SSL error", ""},
-			{PURPLE_CONNECTION_ERROR_OTHER_ERROR, "Unknown error", ""},
-			{ 0, NULL, NULL },
-		};
-
-		type = g_enum_register_static("PurpleConnectionError", values);
-	}
-
-	return type;
-}
-
 /***
  * These should move to PurpleConnectionManager
  */
============================================================
--- libpurple/connection.h	525e25e5c9926e93c5d64d27411fecfe6cb30c3a
+++ libpurple/connection.h	f049ca4fedb7134b17964d3c4364aa42b82771d8
@@ -39,118 +39,141 @@ typedef struct _PurpleConnectionClass		P
 typedef struct _PurpleConnection			PurpleConnection;
 typedef struct _PurpleConnectionClass		PurpleConnectionClass;
 
-#define PURPLE_TYPE_CONNECTION_FLAGS		(purple_connection_flags_get_gtype())
-
 /**
+ * PurpleConnectionFlags:
+ * @PURPLE_CONNECTION_FLAGS_HTML: Connection sends/receives in 'HTML'.
+ * @PURPLE_CONNECTION_FLAGS_NO_BGCOLOR: Connection does not send/receive
+ *                                      background colors.
+ * @PURPLE_CONNECTION_FLAGS_AUTO_RESP: Send auto responses when away.
+ * @PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO: The text buffer must be
+ *                                           formatted as a whole.
+ * @PURPLE_CONNECTION_FLAGS_NO_NEWLINES: No new lines are allowed in
+ *                                       outgoing messages.
+ * @PURPLE_CONNECTION_FLAGS_NO_FONTSIZE: Connection does not send/receive font
+ *                                       sizes.
+ * @PURPLE_CONNECTION_FLAGS_NO_URLDESC: Connection does not support
+ *                                      descriptions with links.
+ * @PURPLE_CONNECTION_FLAGS_NO_IMAGES: Connection does not support sending of
+ *                                     images.
+ * @PURPLE_CONNECTION_FLAGS_ALLOW_CUSTOM_SMILEY: Connection supports sending
+ *                                               and receiving custom smileys.
+ * @PURPLE_CONNECTION_FLAGS_SUPPORT_MOODS: Connection supports setting moods.
+ * @PURPLE_CONNECTION_FLAGS_SUPPORT_MOOD_MESSAGES: Connection supports setting
+ *                                                 a message on moods.
+ *
  * Flags to change behavior of the client for a given connection.
  */
+/* had to switch this to using a bit shift otherwise glib-mkenums won't turn it
+ * into a GFlag type, even though it's supposed to honnor the flags trigraph
+ * but it doesn't...
+ */
 typedef enum
 {
-	PURPLE_CONNECTION_FLAGS_HTML       = 0x0001, /**< Connection sends/receives in 'HTML'. */
-	PURPLE_CONNECTION_FLAGS_NO_BGCOLOR = 0x0002, /**< Connection does not send/receive
-					           background colors.                  */
-	PURPLE_CONNECTION_FLAGS_AUTO_RESP  = 0x0004,  /**< Send auto responses when away.       */
-	PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO = 0x0008, /**< The text buffer must be formatted as a whole */
-	PURPLE_CONNECTION_FLAGS_NO_NEWLINES = 0x0010, /**< No new lines are allowed in outgoing messages */
-	PURPLE_CONNECTION_FLAGS_NO_FONTSIZE = 0x0020, /**< Connection does not send/receive font sizes */
-	PURPLE_CONNECTION_FLAGS_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */
-	PURPLE_CONNECTION_FLAGS_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
-	PURPLE_CONNECTION_FLAGS_ALLOW_CUSTOM_SMILEY = 0x0100, /**< Connection supports sending and receiving custom smileys */
-	PURPLE_CONNECTION_FLAGS_SUPPORT_MOODS = 0x0200, /**< Connection supports setting moods */
-	PURPLE_CONNECTION_FLAGS_SUPPORT_MOOD_MESSAGES = 0x0400 /**< Connection supports setting a message on moods */
-
+	PURPLE_CONNECTION_FLAGS_HTML       = 1 << 1, /*< nick=HTML >*/
+	PURPLE_CONNECTION_FLAGS_NO_BGCOLOR = 1 << 2, /*< nick=No BG >*/
+	PURPLE_CONNECTION_FLAGS_AUTO_RESP  = 1 << 3,  /*< nick=Autoresponse >*/
+	PURPLE_CONNECTION_FLAGS_FORMATTING_WBFO = 1 << 4, /*< nick=WBFO >*/
+	PURPLE_CONNECTION_FLAGS_NO_NEWLINES = 1 << 5, /*< nick=No New Lines >*/
+	PURPLE_CONNECTION_FLAGS_NO_FONTSIZE = 1 << 6, /*< nick=No Font Sizes >*/
+	PURPLE_CONNECTION_FLAGS_NO_URLDESC = 1 << 7,  /*< nick=No URL Desc >*/
+	PURPLE_CONNECTION_FLAGS_NO_IMAGES = 1 << 8,  /*< nick=No Images >*/
+	PURPLE_CONNECTION_FLAGS_ALLOW_CUSTOM_SMILEY = 1 << 9, /*< nick=Allow Custom Smileys >*/
+	PURPLE_CONNECTION_FLAGS_SUPPORT_MOODS = 1 << 10, /*< nick= Supports Moods >*/
+	PURPLE_CONNECTION_FLAGS_SUPPORT_MOOD_MESSAGES = 1 << 11 /*< nick= Supports Mood Messages >*/
 } PurpleConnectionFlags;
 
-#define PURPLE_TYPE_CONNECTION_STATE		(purple_connection_state_get_gtype())
-
+/**
+ * PurpleConnectionState:
+ * @PURPLE_CONNECTION_STATE_DISCONNECTED: Disconnected.
+ * @PURPLE_CONNECTION_STATE_CONNECTED: Connected.
+ * @PURPLE_CONNECTION_STATE_CONNECTING: Connecting.
+ *
+ * The possible states of a #PurpleConnection.
+ */
 typedef enum
 {
-	PURPLE_CONNECTION_STATE_DISCONNECTED = 0, /**< Disconnected. */
-	PURPLE_CONNECTION_STATE_CONNECTED,        /**< Connected.    */
-	PURPLE_CONNECTION_STATE_CONNECTING        /**< Connecting.   */
-
+	PURPLE_CONNECTION_STATE_DISCONNECTED = 0, /*< nick=Disconnected >*/
+	PURPLE_CONNECTION_STATE_CONNECTED,        /*< nick=Connected >*/
+	PURPLE_CONNECTION_STATE_CONNECTING        /*< nick=Connecting >*/
 } PurpleConnectionState;
 
 /**
+ * PurpleConnectionError:
+ * @PURPLE_CONNECTION_ERROR_NETWORK_ERROR: There was an error sending or
+ *   receiving on the network socket, or there was some protocol error (such as
+ *   the server sending malformed data).
+ * @PURPLE_CONNECTION_ERROR_INVALID_USERNAME: The username supplied was not
+ *   valid.
+ * @PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED: The username, password or
+ *   some other credential wsa incorrect.  Use
+ *   #PURPLE_CONNECTION_ERROR_INVALID_USERNAME instead if the username is known
+ *   to be invalid.
+ * @PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE: libpurple doesn't speak
+ *   any of the authentication methods the server offered.
+ * @PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT: libpurple was built without SSL
+ *   support, and the connection needs SSL.
+ * @PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR: There was an error negotiating
+ *   SSL on this connection, or the server does not support encryption but an
+ *   account option was set to require it.
+ * @PURPLE_CONNECTION_ERROR_NAME_IN_USE: Someone is already connected to the
+ *   server using the name your are trying to connect with.
+ * @PURPLE_CONNECTION_ERROR_INVALID_SETTINGS: The username/server/other
+ *   preferencefor the account isn't valid.  For instance, on IRC the username
+ *   cannot contain white space.  This reason should not be used for incorrect
+ *   passwords etc: use #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED for
+ *   that.
+ *
+ *   @TODO This reason really shouldn't be necessary.  Usernames and other
+ *   account preference should be validated when the account is created.
+ * @PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED: The server did not provide a
+ *   SSL certificate.
+ * @PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED: The server's SSL certificate could
+ *   not be trusted.
+ * @PURPLE_CONNECTION_ERROR_CERT_EXPIRED: The server's SSL certificate has
+ *   expired.
+ * @PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED: The server's SSL certificate
+ *   is not yet valid.
+ * @PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH: The server's SSL
+ *   certificate did not match its hostname.
+ * @PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH: The server's SSL
+ *   certificate does not have the expected fingerprint.
+ * @PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED: The server's SSL certificate is
+ *   self-signed.
+ * @PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR: There was some other error
+ *   validating the server's SSL certificate.
+ * @PURPLE_CONNECTION_ERROR_OTHER_ERROR: Some other error occured which fits
+ *   into none of the other categories.
+ *
  * Possible errors that can cause a connection to be closed.
  *
- *  @since 2.3.0
+ * @since 2.3.0
  */
 typedef enum
 {
-	/** There was an error sending or receiving on the network socket, or
-	 *  there was some protocol error (such as the server sending malformed
-	 *  data).
-	 */
-	PURPLE_CONNECTION_ERROR_NETWORK_ERROR = 0,
-	/** The username supplied was not valid. */
-	PURPLE_CONNECTION_ERROR_INVALID_USERNAME = 1,
-	/** The username, password or some other credential was incorrect.  Use
-	 *  #PURPLE_CONNECTION_ERROR_INVALID_USERNAME instead if the username
-	 *  is known to be invalid.
-	 */
-	PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 2,
-	/** libpurple doesn't speak any of the authentication methods the
-	 *  server offered.
-	 */
-	PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE = 3,
-	/** libpurple was built without SSL support, and the connection needs
-	 *  SSL.
-	 */
-	PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT = 4,
-	/** There was an error negotiating SSL on this connection, or the
-	 *  server does not support encryption but an account option was set to
-	 *  require it.
-	 */
-	PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR = 5,
-	/** Someone is already connected to the server using the name you are
-	 *  trying to connect with.
-	 */
-	PURPLE_CONNECTION_ERROR_NAME_IN_USE = 6,
+	PURPLE_CONNECTION_ERROR_NETWORK_ERROR = 0, /*< nick=Network Error >*/
+	PURPLE_CONNECTION_ERROR_INVALID_USERNAME = 1, /*< nick=Invalid Username >*/
+	PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED = 2, /*< nick=Authentication Failed >*/
+	PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE = 3, /*< nick=Authentication Impossible >*/
+	PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT = 4, /*< nick=No SSL Support >*/
+	PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR = 5, /*< nick=Encryption Error >*/
+	PURPLE_CONNECTION_ERROR_NAME_IN_USE = 6, /*< nick=Name Already in Use >*/
+	PURPLE_CONNECTION_ERROR_INVALID_SETTINGS = 7, /*< nick=Invalid Settings >*/
+	PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED = 8, /*< nick=SSL Certificate Unavailable >*/
+	PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED = 9, /*< nick=SSL Certificate Could Not Be Trusted >*/
+	PURPLE_CONNECTION_ERROR_CERT_EXPIRED = 10, /*< nick=SSL Certificate Expired >*/
+	PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED = 11, /*< nick=SSL Certificate is not yet valid >*/
+	PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH = 12, /*< nick=SSL certificate did not match its hostname >*/
+	PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH = 13, /*< nick=SSL certificate fingerprint mismatch >*/
+	PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED = 14, /*< nick=SSL certificate is self-signed >*/
+	PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR = 15, /*< nick=Other SSL error >*/
 
-	/** The username/server/other preference for the account isn't valid.
-	 *  For instance, on IRC the username cannot contain white space.
-	 *  This reason should not be used for incorrect passwords etc: use
-	 *  #PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED for that.
-	 *
-	 *  @todo This reason really shouldn't be necessary.  Usernames and
-	 *        other account preferences should be validated when the
-	 *        account is created.
-	 */
-	PURPLE_CONNECTION_ERROR_INVALID_SETTINGS = 7,
-
-	/** The server did not provide a SSL certificate. */
-	PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED = 8,
-	/** The server's SSL certificate could not be trusted. */
-	PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED = 9,
-	/** The server's SSL certificate has expired. */
-	PURPLE_CONNECTION_ERROR_CERT_EXPIRED = 10,
-	/** The server's SSL certificate is not yet valid. */
-	PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED = 11,
-	/** The server's SSL certificate did not match its hostname. */
-	PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH = 12,
-	/** The server's SSL certificate does not have the expected
-	 *  fingerprint.
-	 */
-	PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH = 13,
-	/** The server's SSL certificate is self-signed.  */
-	PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED = 14,
-	/** There was some other error validating the server's SSL certificate.
-	 */
-	PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR = 15,
-
-	/** Some other error occurred which fits into none of the other
-	 *  categories.
-	 */
 	/* purple_connection_error_reason() in connection.c uses the fact that
 	 * this is the last member of the enum when sanity-checking; if other
 	 * reasons are added after it, the check must be updated.
 	 */
-	PURPLE_CONNECTION_ERROR_OTHER_ERROR = 16
+	PURPLE_CONNECTION_ERROR_OTHER_ERROR = 16 /*< Unknown Error >*/
 } PurpleConnectionError;
 
-#define PURPLE_TYPE_CONNECTION_ERROR		(purple_connection_error_get_gtype())
-
 /** Holds the type of an error along with its description. */
 typedef struct
 {
============================================================
--- libpurple/Makefile.am	b6f991489de4c83047d86f1984a17cd98d1a1e10
+++ libpurple/Makefile.am	51271552dd97754f72cedf52e8dc40e3e8cf5f4a
@@ -116,6 +116,7 @@ purple_builtsources = \
 	whiteboard.c
 
 purple_builtsources = \
+	enums.c \
 	marshallers.c
 
 purple_coreheaders = \
@@ -202,8 +203,40 @@ purple_mediaheaders = \
 	codec.h \
 	enum-types.h
 
-purple_builtheaders = purple.h version.h marshallers.h
+purple_builtheaders = purple.h version.h marshallers.h enums.h
 
+purple_enumheaders = \
+	account.h \
+	blist-node.h \
+	certificate.h \
+	cmds.h \
+	connection.h \
+	conversation.h \
+	debug.h \
+	desktopitem.h \
+	eventloop.h \
+	ft.h \
+	log.h \
+	media-gst.h \
+	nat-pmp.h \
+	notify.h \
+	plugin.h \
+	pluginpref.h \
+	pounce.h \
+	prefs.h \
+	privacy.h \
+	proxy.h \
+	prpl.h \
+	request.h \
+	roomlist.h \
+	sound.h \
+	sslconn.h \
+	status.h \
+	stun.h \
+	value.h \
+	xmlnode.h
+
+
 marshallers.h: marshallers.list
 	$(AM_V_GEN)$(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --header > marshallers.h
 
@@ -211,6 +244,12 @@ marshallers.c: marshallers.list marshall
 	$(AM_V_GEN)echo "#include \"marshallers.h\"" > marshallers.c
 	$(AM_V_at)$(GLIB_GENMARSHAL) --prefix=purple_smarshal $(srcdir)/marshallers.list --body >> marshallers.c
 
+enums.h: enums.h.template $(purple_enumheaders)
+	$(AM_V_GEN)$(GLIB_MKENUMS) --template enums.h.template $(purple_enumheaders) > $@
+
+enums.c: enums.c.template $(purple_enumheaders)
+	$(AM_V_GEN)$(GLIB_MKENUMS) --template enums.c.template $(purple_enumheaders) > $@
+
 if ENABLE_DBUS
 
 CLEANFILES = \
============================================================
--- .mtn-ignore	6eb34ec4088ea6a574b45933ae8a63cc5793a2be
+++ .mtn-ignore	040f75da559268d618a40579a183f392589661ae
@@ -38,6 +38,7 @@ libpurple/dbus-types.h
 libpurple/dbus-signals.c
 libpurple/dbus-types.c
 libpurple/dbus-types.h
+libpurple/enums.[ch]$
 libpurple/example/nullclient
 libpurple/gconf/purple.schemas$
 libpurple/marshallers.[ch]
============================================================
--- libpurple/mediamanager.c	1e55c322fe59eb10d19628c4c44757ea404ba23b
+++ libpurple/mediamanager.c	d28ad3a09985669054f744a1ffff4f9dc318ab22
@@ -998,59 +998,6 @@ purple_media_manager_get_backend_type(Pu
 #ifdef USE_GSTREAMER
 
 /*
- * PurpleMediaElementType
- */
-
-GType
-purple_media_element_type_get_type()
-{
-	static GType type = 0;
-	if (type == 0) {
-		static const GFlagsValue values[] = {
-			{ PURPLE_MEDIA_ELEMENT_NONE,
-				"PURPLE_MEDIA_ELEMENT_NONE", "none" },
-			{ PURPLE_MEDIA_ELEMENT_AUDIO,
-				"PURPLE_MEDIA_ELEMENT_AUDIO", "audio" },
-			{ PURPLE_MEDIA_ELEMENT_VIDEO,
-				"PURPLE_MEDIA_ELEMENT_VIDEO", "video" },
-			{ PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO,
-				"PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO",
-				"audio-video" },
-			{ PURPLE_MEDIA_ELEMENT_NO_SRCS,
-				"PURPLE_MEDIA_ELEMENT_NO_SRCS", "no-srcs" },
-			{ PURPLE_MEDIA_ELEMENT_ONE_SRC,
-				"PURPLE_MEDIA_ELEMENT_ONE_SRC", "one-src" },
-			{ PURPLE_MEDIA_ELEMENT_MULTI_SRC,
-				"PURPLE_MEDIA_ELEMENT_MULTI_SRC",
-				"multi-src" },
-			{ PURPLE_MEDIA_ELEMENT_REQUEST_SRC,
-				"PURPLE_MEDIA_ELEMENT_REQUEST_SRC",
-				"request-src" },
-			{ PURPLE_MEDIA_ELEMENT_NO_SINKS,
-				"PURPLE_MEDIA_ELEMENT_NO_SINKS", "no-sinks" },
-			{ PURPLE_MEDIA_ELEMENT_ONE_SINK,
-				"PURPLE_MEDIA_ELEMENT_ONE_SINK", "one-sink" },
-			{ PURPLE_MEDIA_ELEMENT_MULTI_SINK,
-				"PURPLE_MEDIA_ELEMENT_MULTI_SINK",
-				"multi-sink" },
-			{ PURPLE_MEDIA_ELEMENT_REQUEST_SINK,
-				"PURPLE_MEDIA_ELEMENT_REQUEST_SINK",
-				"request-sink" },
-			{ PURPLE_MEDIA_ELEMENT_UNIQUE,
-				"PURPLE_MEDIA_ELEMENT_UNIQUE", "unique" },
-			{ PURPLE_MEDIA_ELEMENT_SRC,
-				"PURPLE_MEDIA_ELEMENT_SRC", "src" },
-			{ PURPLE_MEDIA_ELEMENT_SINK,
-				"PURPLE_MEDIA_ELEMENT_SINK", "sink" },
-			{ 0, NULL, NULL }
-		};
-		type = g_flags_register_static(
-				"PurpleMediaElementType", values);
-	}
-	return type;
-}
-
-/*
  * PurpleMediaElementInfo
  */
 
============================================================
--- libpurple/media-gst.h	4b2ed89f2709e7a9b4a4852f8a6cbdb878eabf35
+++ libpurple/media-gst.h	059519df29efef45cb5884360ee2e063a87a203f
@@ -34,7 +34,6 @@ G_BEGIN_DECLS
 
 G_BEGIN_DECLS
 
-#define PURPLE_TYPE_MEDIA_ELEMENT_TYPE           (purple_media_element_type_get_type())
 #define PURPLE_TYPE_MEDIA_ELEMENT_INFO           (purple_media_element_info_get_type())
 #define PURPLE_MEDIA_ELEMENT_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
 #define PURPLE_MEDIA_ELEMENT_INFO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_MEDIA_ELEMENT_INFO, PurpleMediaElementInfo))
@@ -48,29 +47,50 @@ typedef GstElement *(*PurpleMediaElement
 typedef GstElement *(*PurpleMediaElementCreateCallback)(PurpleMedia *media,
 			const gchar *session_id, const gchar *participant);
 
+/**
+ * PurpleMediaElementType:
+ * @PURPLE_MEDIA_ELEMENT_NONE: An empty element.
+ * @PURPLE_MEDIA_ELEMENT_AUDIO: The element supports audio.
+ * @PURPLE_MEDIA_ELEMENT_VIDEO: The element supports video.
+ * @PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO: The element support audio and video.
+ * @PURPLE_MEDIA_ELEMENT_NO_SRCS: The element has no source pads.
+ * @PURPLE_MEDIA_ELEMENT_ONE_SRC: The element has one source pad.
+ * @PURPLE_MEDIA_ELEMENT_MULTI_SRC: The element has multiple source pads.
+ * @PURPLE_MEDIA_ELEMENT_REQUEST_SRC: The element's source pads must be
+ *                                    requested.
+ * @PURPLE_MEDIA_ELEMENT_NO_SINKS: The element has no sinks.
+ * @PURPLE_MEDIA_ELEMENT_ONE_SINK: The element has one sink.
+ * @PURPLE_MEDIA_ELEMENT_MULTI_SINK: The element has multiple sinks.
+ * @PURPLE_MEDIA_ELEMENT_REQUEST_SINK: The element's sinks must be requested.
+ * @PURPLE_MEDIA_ELEMENT_UNIQUE: The element is unique and only one instance of
+ *                               it should be created at a time.
+ * @PURPLE_MEDIA_ELEMENT_SRC: The element can be set as an active source.
+ * @PURPLE_MEDIA_ELEMENT_SINK: The element can be set as an active sink.
+ *
+ * The different possible media element types
+ */
 typedef enum {
-	PURPLE_MEDIA_ELEMENT_NONE = 0,			/** empty element */
-	PURPLE_MEDIA_ELEMENT_AUDIO = 1,			/** supports audio */
-	PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1,		/** supports video */
-	PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO
-			| PURPLE_MEDIA_ELEMENT_VIDEO, 	/** supports audio and video */
+	PURPLE_MEDIA_ELEMENT_NONE = 0, /*< nick=Empty Element >*/
+	PURPLE_MEDIA_ELEMENT_AUDIO = 1 << 0, /*< nick=Audio Supported >*/
+	PURPLE_MEDIA_ELEMENT_VIDEO = 1 << 1, /*< nick=Video Supported >*/
 
-	PURPLE_MEDIA_ELEMENT_NO_SRCS = 0,		/** has no src pads */
-	PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2,		/** has one src pad */
-	PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, 	/** has multiple src pads */
-	PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, 	/** src pads must be requested */
+	/* glib-mkenums blows up if this isn't on one line... */
+	PURPLE_MEDIA_ELEMENT_AUDIO_VIDEO = PURPLE_MEDIA_ELEMENT_AUDIO | PURPLE_MEDIA_ELEMENT_VIDEO, /*< nick=Audio and Video Supported >*/
 
-	PURPLE_MEDIA_ELEMENT_NO_SINKS = 0,		/** has no sink pads */
-	PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, 	/** has one sink pad */
-	PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, 	/** has multiple sink pads */
-	PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, 	/** sink pads must be requested */
+	PURPLE_MEDIA_ELEMENT_NO_SRCS = 0, /*< nick=No Source Pads >*/
+	PURPLE_MEDIA_ELEMENT_ONE_SRC = 1 << 2, /*< nick=One Source Pad >*/
+	PURPLE_MEDIA_ELEMENT_MULTI_SRC = 1 << 3, /*< nick=Multiple Source Pads >*/
+	PURPLE_MEDIA_ELEMENT_REQUEST_SRC = 1 << 4, /*< nick=Source Pads Must be Requested >*/
 
-	PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8,		/** This element is unique and
-							 only one instance of it should
-							 be created at a time */
+	PURPLE_MEDIA_ELEMENT_NO_SINKS = 0, /*< nick=No Sinks >*/
+	PURPLE_MEDIA_ELEMENT_ONE_SINK = 1 << 5, /*< nick=One Sink >*/
+	PURPLE_MEDIA_ELEMENT_MULTI_SINK = 1 << 6, /*< nick=Multiple Sinks >*/
+	PURPLE_MEDIA_ELEMENT_REQUEST_SINK = 1 << 7, /*< nick=Sink Must be Requested >*/
 
-	PURPLE_MEDIA_ELEMENT_SRC = 1 << 9,		/** can be set as an active src */
-	PURPLE_MEDIA_ELEMENT_SINK = 1 << 10,		/** can be set as an active sink */
+	PURPLE_MEDIA_ELEMENT_UNIQUE = 1 << 8, /*< nick=Unique >*/
+
+	PURPLE_MEDIA_ELEMENT_SRC = 1 << 9, /*< nick=Source Pad >*/
+	PURPLE_MEDIA_ELEMENT_SINK = 1 << 10, /*< nick=Sink >*/
 } PurpleMediaElementType;
 
 #ifdef __cplusplus
============================================================
--- /dev/null	
+++ libpurple/enums.c.template	6e8dfa342d89cc99ba3c671fba70ea0830b2647e
@@ -0,0 +1,65 @@
+/*** BEGIN file-header ***/
+/* -*- mode: c -*-
+ * vi:syntax=c
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <enums.h>
+
+/*** END file-header ***/
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+#include "@filename@"
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+ at enum_name@_get_type(void) {
+    static volatile gsize g_define_type_id__volatile = 0;
+
+    if(g_once_init_enter(&g_define_type_id__volatile)) {
+        static const G at Type@Value values [] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+            { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+            { 0, NULL, NULL }
+        };
+
+        GType g_define_type_id =
+            g_ at type@_register_static(g_intern_static_string("@EnumName@"), values);
+        g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
+    }
+
+    return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/*** END file-tail ***/
============================================================
--- /dev/null	
+++ libpurple/enums.h.template	db64fc6f66f4193244064fb4b1ad2000f487c729
@@ -0,0 +1,46 @@
+/*** BEGIN file-header ***/
+/* -*- mode: c -*-
+ * vi:syntax=c
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+#ifndef PURPLE_ENUM_H
+#define PURPLE_ENUM_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type(void) G_GNUC_CONST;
+#define @ENUMPREFIX at _TYPE_@ENUMSHORT@ (@enum_name at _get_type())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* PURPLE_ENUM_H */
+
+/*** END file-tail ***/
+


More information about the Commits mailing list