libmbca r17 - trunk/src
- From: kaijanma svn gnome org
- To: svn-commits-list gnome org
- Subject: libmbca r17 - trunk/src
- Date: Fri, 15 Aug 2008 09:32:32 +0000 (UTC)
Author: kaijanma
Date: Fri Aug 15 09:32:32 2008
New Revision: 17
URL: http://svn.gnome.org/viewvc/libmbca?rev=17&view=rev
Log:
* use glib-mkenums to generate GType for MBCAAssistantState
* public API: enum Foo { ... }; -> typedef enum { ... } Foo;
Modified:
trunk/src/Makefile.am
trunk/src/common.h
trunk/src/mbca_assistant.c
trunk/src/mbca_assistant.h
trunk/src/mbca_serviceprovider.h
trunk/src/test_mbca.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Fri Aug 15 09:32:32 2008
@@ -57,6 +57,13 @@
gnome-panel/system-timezone.c \
gnome-panel/system-timezone.h
+nodist_libmbca_la_SOURCES = \
+ mbca_type_builtins.c \
+ mbca_type_builtins.h
+
+BUILT_SOURCES = mbca_type_builtins.c mbca_type_builtins.h
+CLEANFILES = mbca_type_builtins.c mbca_type_builtins.h
+
libmbca_la_LIBADD = \
$(LIBMBCA_LIBS)
@@ -76,3 +83,26 @@
test_mbca_DEPENDENCIES = \
libmbca.la
+mbca_assistant.c: mbca_type_builtins.h
+
+mbca_type_builtins.h: mbca_assistant.h
+ echo \#ifndef MBCA_TYPE_BUILTINS_H > mbca_type_builtins.h
+ echo \#define MBCA_TYPE_BUILTINS_H >> mbca_type_builtins.h
+ echo \#include \<glib-object.h\> >> mbca_type_builtins.h
+ echo G_BEGIN_DECLS >> mbca_type_builtins.h
+ glib-mkenums \
+ --fhead "#include <glib.h>" \
+ --fprod "/* enumerations from \"@filename \" */\n" \
+ --vhead "GType @enum_name _get_type (void);\n#define MBCA_TYPE_ ENUMSHORT@ (@enum_name _get_type ())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* MBCA_TYPE_BUILTINS_H */" \
+ $(srcdir)/mbca_assistant.h >> mbca_type_builtins.h
+
+mbca_type_builtins.c: mbca_assistant.h
+ glib-mkenums \
+ --fhead "#include \"mbca_type_builtins.h\"\n#include \"mbca_assistant.h\"" \
+ --fprod "\n/* enumerations from \"@filename \" */" \
+ --vhead "GType\n enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G Type@Value values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
+ $(srcdir)/mbca_assistant.h > xgen-gtbc
+ mv xgen-gtbc mbca_type_builtins.c
Modified: trunk/src/common.h
==============================================================================
--- trunk/src/common.h (original)
+++ trunk/src/common.h Fri Aug 15 09:32:32 2008
@@ -190,7 +190,7 @@
{
gboolean dispose_has_run;
- enum MBCAAssistantState state;
+ MBCAAssistantState state;
/* Generic */
GtkBuilder* builder; /**< GtkBuilder instance containing the GUI that
Modified: trunk/src/mbca_assistant.c
==============================================================================
--- trunk/src/mbca_assistant.c (original)
+++ trunk/src/mbca_assistant.c Fri Aug 15 09:32:32 2008
@@ -32,6 +32,8 @@
#include "mbca_assistant.h"
#include "callbacks.h"
+#include "mbca_type_builtins.h"
+
#include <stdlib.h>
static GObjectClass *parent_class = NULL;
@@ -1016,7 +1018,7 @@
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, /* return_type */
1, /* n_params */
- G_TYPE_INT); /* param_types */
+ MBCA_TYPE_ASSISTANT_STATE); /* param_types */
}
static void
@@ -1182,7 +1184,7 @@
gint
mbca_assistant_run_for_device (MBCAAssistant* assistant,
- enum MBCADeviceType type,
+ MBCADeviceType type,
const gchar* device,
const gchar* nice_device_name)
{
@@ -1248,7 +1250,7 @@
return 0;
}
-enum MBCAAssistantState
+MBCAAssistantState
mbca_assistant_get_state (MBCAAssistant* assistant)
{
if (assistant->priv->dispose_has_run)
Modified: trunk/src/mbca_assistant.h
==============================================================================
--- trunk/src/mbca_assistant.h (original)
+++ trunk/src/mbca_assistant.h Fri Aug 15 09:32:32 2008
@@ -116,14 +116,14 @@
*
* Type of the device (and connection).
*/
-enum MBCADeviceType
+typedef enum /*< skip >*/
{
MBCA_DEVICE_NONE, /**< no device selected, for initialization */
MBCA_DEVICE_BLUETOOTH, /**< Bluetooth device */
MBCA_DEVICE_HAL, /**< devices discovered using HAL */
MBCA_DEVICE_SERIAL, /**< Serial device */
MBCA_DEVICE_PSEUDO /**< pseudo device, not shown on summary page */
-};
+} MBCADeviceType;
/**
* @brief connection information
@@ -132,13 +132,13 @@
*/
struct _MBCAConfiguration
{
- gchar* name; /**< name of the connection */
- enum MBCADeviceType type; /**< type of the connection */
- gchar* device; /**< device to use, format depends on type
- * @see mbca_assistant_run_for_device() */
- gchar* baud; /**< baud rate to use with the device */
+ gchar* name; /**< name of the connection */
+ MBCADeviceType type; /**< type of the connection */
+ gchar* device; /**< device to use, format depends on type
+ * @see mbca_assistant_run_for_device() */
+ gchar* baud; /**< baud rate to use with the device */
- MBCAServiceProvider* provider; /**< service provider specific settings */
+ MBCAServiceProvider* provider; /**< service provider specific settings */
};
/** standard typedef */
typedef struct _MBCAConfiguration MBCAConfiguration;
@@ -161,13 +161,13 @@
/**
* @brief states of MBCAAssistant
*/
-enum MBCAAssistantState
+typedef enum /*< prefix=MBCA,underscore_name=mbca_assistant_state >*/
{
MBCA_STATE_READY, /**< Assistant is ready to be run */
MBCA_STATE_RUNNING, /**< Assistant is running */
MBCA_STATE_ABORTED, /**< Assistant was aborted */
MBCA_STATE_DONE /**< Assistant has finished */
-};
+} MBCAAssistantState;
/**
* @brief create new instance
@@ -257,7 +257,7 @@
*/
gint
mbca_assistant_run_for_device (MBCAAssistant* assistant,
- enum MBCADeviceType type,
+ MBCADeviceType type,
const gchar* device,
const gchar* nice_device_name);
@@ -268,7 +268,7 @@
*
* @returns assistants state
*/
-enum MBCAAssistantState
+MBCAAssistantState
mbca_assistant_get_state (MBCAAssistant* assistant);
/**
Modified: trunk/src/mbca_serviceprovider.h
==============================================================================
--- trunk/src/mbca_serviceprovider.h (original)
+++ trunk/src/mbca_serviceprovider.h Fri Aug 15 09:32:32 2008
@@ -43,7 +43,7 @@
* Cellural network a provider is using. Network type helps to choose the right
* dial sequence as data modems are standardised.
*/
- enum MBCANetwork
+enum MBCANetwork
{
MBCA_NETWORK_GSM, /**< GSM network, means GPRS, UMTS, etc */
MBCA_NETWORK_CDMA /**< CDMA network */
Modified: trunk/src/test_mbca.c
==============================================================================
--- trunk/src/test_mbca.c (original)
+++ trunk/src/test_mbca.c Fri Aug 15 09:32:32 2008
@@ -116,7 +116,7 @@
void
run_gui_state_changed (MBCAAssistant* assistant,
- enum MBCAAssistantState state,
+ MBCAAssistantState state,
gpointer user_data)
{
GSList** assistants = user_data;
@@ -288,7 +288,7 @@
void
run_once_state_changed (MBCAAssistant* assistant,
- enum MBCAAssistantState state,
+ MBCAAssistantState state,
gpointer user_data)
{
switch (state)
@@ -315,7 +315,7 @@
}
static void
-run_once (enum MBCADeviceType type, gchar** device, gchar** nicename)
+run_once (MBCADeviceType type, gchar** device, gchar** nicename)
{
MBCAAssistant* assistant;
gint ret;
@@ -407,7 +407,7 @@
int c = 0;
int option_index = 0;
- enum MBCADeviceType type = MBCA_DEVICE_NONE;
+ MBCADeviceType type = MBCA_DEVICE_NONE;
gchar* device = NULL;
gchar* nicename = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]