diff options
author | Dan Winship <danw@gnome.org> | 2012-02-08 12:56:52 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-02-15 11:42:15 -0500 |
commit | 839eab556419b6af5046e44361bdcf14fe028d27 (patch) | |
tree | b9183f7d2cc207e7741960a2120756043a95f847 /libnm-glib/nm-secret-agent.c | |
parent | 0b57cc68fd4a146c9fe255f14c667ab306266c0c (diff) | |
download | NetworkManager-839eab556419b6af5046e44361bdcf14fe028d27.tar.gz |
Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.
Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.
Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.
To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.
Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
Diffstat (limited to 'libnm-glib/nm-secret-agent.c')
-rw-r--r-- | libnm-glib/nm-secret-agent.c | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c index 4d0a825a53..d6a15f9b0b 100644 --- a/libnm-glib/nm-secret-agent.c +++ b/libnm-glib/nm-secret-agent.c @@ -25,7 +25,8 @@ #include <dbus/dbus-glib-lowlevel.h> #include "nm-secret-agent.h" -#include "nm-marshal.h" +#include "nm-glib-enum-types.h" +#include "nm-glib-marshal.h" #include "NetworkManager.h" static void impl_secret_agent_get_secrets (NMSecretAgent *self, @@ -111,34 +112,6 @@ nm_secret_agent_error_quark (void) return ret; } -#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } - -GType -nm_secret_agent_error_get_type (void) -{ - static GType etype = 0; - - if (etype == 0) { - static const GEnumValue values[] = { - /* Sender is not authorized to make this request */ - ENUM_ENTRY (NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED, "NotAuthorized"), - /* Given connection details do not make a valid connection */ - ENUM_ENTRY (NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, "InvalidConnection"), - /* The request was canceled explicitly by the user */ - ENUM_ENTRY (NM_SECRET_AGENT_ERROR_USER_CANCELED, "UserCanceled"), - /* The request was canceled, but not by the user */ - ENUM_ENTRY (NM_SECRET_AGENT_ERROR_AGENT_CANCELED, "AgentCanceled"), - /* Some internal error prevented returning secrets */ - ENUM_ENTRY (NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, "InternalError"), - /* No secrets could be found to fulfill the request */ - ENUM_ENTRY (NM_SECRET_AGENT_ERROR_NO_SECRETS, "NoSecrets"), - { 0, 0, 0 } - }; - etype = g_enum_register_static ("NMSecretAgentError", values); - } - return etype; -} - /*************************************************************/ static const char * @@ -806,7 +779,7 @@ nm_secret_agent_init (NMSecretAgent *self) return; } - dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_STRING_STRING, + dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); |