From 2d366a83ee60c3c10395900498499e9ff081f3a2 Mon Sep 17 00:00:00 2001 From: Marco Barisione Date: Tue, 7 Aug 2007 19:03:19 +0000 Subject: Remove empathy-marshal-main.c and include empathy-marshal.h from 2007-08-07 Marco Barisione * libempathy/Makefile.am: * libempathy/empathy-marshal-main.c: Remove empathy-marshal-main.c and include empathy-marshal.h from empathy-marshal.c. * libempathy/Makefile.am: * libempathy-gtk/Makefile.am: Generate files for enum types with glib-mkenums. * libempathy/empathy-contact.c: * libempathy/empathy-idle.c: * libempathy/empathy-message.c: * libempathy/empathy-presence.c: * libempathy-gtk/empathy-main-window.c: * libempathy-gtk/empathy-preferences.c: * doc/libempathy-gtk/libempathy-gtk.types: * doc/libempathy-gtk/tmpl/empathy-contact-list-store.sgml: Use g_param_spec_enum() and g_param_spec_flags() instead of g_param_spec_(u)int. Fixes bug #462465. * libempathy-gtk/empathy-contact-list-store.c: * libempathy-gtk/empathy-contact-list-store.h: Remove empathy_contact_list_store_sort_get_type() as it's now auto-generated by glib-mkenums. svn path=/trunk/; revision=234 --- ChangeLog | 27 ++++++++++ doc/libempathy-gtk/libempathy-gtk.types | 1 - .../tmpl/empathy-contact-list-store.sgml | 36 +------------ libempathy-gtk/Makefile.am | 57 +++++++++++++++++++- libempathy-gtk/empathy-contact-list-store.c | 23 +------- libempathy-gtk/empathy-contact-list-store.h | 4 -- libempathy-gtk/empathy-main-window.c | 1 + libempathy-gtk/empathy-preferences.c | 1 + libempathy/Makefile.am | 62 +++++++++++++++++++--- libempathy/empathy-contact.c | 18 +++---- libempathy/empathy-idle.c | 26 +++++---- libempathy/empathy-marshal-main.c | 2 - libempathy/empathy-message.c | 18 +++---- libempathy/empathy-presence.c | 25 +++++---- 14 files changed, 192 insertions(+), 109 deletions(-) delete mode 100644 libempathy/empathy-marshal-main.c diff --git a/ChangeLog b/ChangeLog index 77595f7f6..0ffac8829 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +2007-08-07 Marco Barisione + + * libempathy/Makefile.am: + * libempathy/empathy-marshal-main.c: Remove empathy-marshal-main.c and + include empathy-marshal.h from empathy-marshal.c. + + * libempathy/Makefile.am: + * libempathy-gtk/Makefile.am: Generate files for enum types with + glib-mkenums. + + * libempathy/empathy-contact.c: + * libempathy/empathy-idle.c: + * libempathy/empathy-message.c: + * libempathy/empathy-presence.c: + * libempathy-gtk/empathy-main-window.c: + * libempathy-gtk/empathy-preferences.c: + * doc/libempathy-gtk/libempathy-gtk.types: + * doc/libempathy-gtk/tmpl/empathy-contact-list-store.sgml: Use + g_param_spec_enum() and g_param_spec_flags() instead of + g_param_spec_(u)int. + Fixes bug #462465. + + * libempathy-gtk/empathy-contact-list-store.c: + * libempathy-gtk/empathy-contact-list-store.h: Remove + empathy_contact_list_store_sort_get_type() as it's now auto-generated + by glib-mkenums. + 2007-08-06 Xavier Claessens * libempathy-gtk/empathy-main-window.glade: Change main window's title diff --git a/doc/libempathy-gtk/libempathy-gtk.types b/doc/libempathy-gtk/libempathy-gtk.types index 50c8f0896..64bfe5c01 100644 --- a/doc/libempathy-gtk/libempathy-gtk.types +++ b/doc/libempathy-gtk/libempathy-gtk.types @@ -14,7 +14,6 @@ #include empathy_cell_renderer_text_get_type -empathy_contact_list_store_get_type empathy_account_chooser_get_type empathy_chat_get_type empathy_chat_window_get_type diff --git a/doc/libempathy-gtk/tmpl/empathy-contact-list-store.sgml b/doc/libempathy-gtk/tmpl/empathy-contact-list-store.sgml index 3e764ffea..a4430da49 100644 --- a/doc/libempathy-gtk/tmpl/empathy-contact-list-store.sgml +++ b/doc/libempathy-gtk/tmpl/empathy-contact-list-store.sgml @@ -17,13 +17,6 @@ EmpathyContactListStore - - - - - - - @@ -43,26 +36,7 @@ EmpathyContactListStore - - - - - - - - - - - - - - - - - - - - +@parent: @@ -74,14 +48,6 @@ EmpathyContactListStore @Returns: - - - - - -@Returns: - - diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index 9da681a1e..7b0a9db29 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -5,6 +5,10 @@ AM_CPPFLAGS = \ $(EMPATHY_CFLAGS) \ $(WARN_CFLAGS) +BUILT_SOURCES = \ + empathy-gtk-enum-types.h \ + empathy-gtk-enum-types.c + lib_LTLIBRARIES = libempathy-gtk.la libempathy_gtk_la_SOURCES = \ @@ -42,6 +46,10 @@ libempathy_gtk_la_SOURCES = \ empathy-ui-utils.c \ empathy-account-widget-msn.c +# do not distribute generated files +nodist_libempathy_gtk_la_SOURCES =\ + $(BUILT_SOURCES) + libempathy_gtk_la_LIBADD = \ $(EMPATHY_LIBS) \ $(top_builddir)/libempathy/libempathy.la @@ -49,8 +57,7 @@ libempathy_gtk_la_LIBADD = \ libempathy_gtk_la_LDFLAGS = \ -version-info ${LIBEMPATHY_GTK_CURRENT}:${LIBEMPATHY_GTK_REVISION}:${LIBEMPATHY_GTK_AGE} -libempathy_gtkdir = $(includedir)/libempathy-gtk/ -libempathy_gtk_HEADERS = \ +libempathy_gtk_headers = \ empathy-images.h \ empathy-main-window.h \ empathy-status-icon.h \ @@ -85,6 +92,11 @@ libempathy_gtk_HEADERS = \ empathy-ui-utils.h \ empathy-account-widget-msn.h +libempathy_gtk_includedir = $(includedir)/libempathy-gtk/ +libempathy_gtk_include_HEADERS = \ + $(libempathy_gtk_headers) \ + empathy-gtk-enum-types.h + gladedir = $(datadir)/empathy glade_DATA = \ empathy-main-window.glade \ @@ -103,6 +115,44 @@ glade_DATA = \ empathy-chat.glade \ empathy-account-widget-msn.glade +empathy-gtk-enum-types.h: stamp-empathy-gtk-enum-types.h + @true +stamp-empathy-gtk-enum-types.h: Makefile $(libempathy_gtk_headers) + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#ifndef __LIBEMPATHY_GTK_ENUM_TYPES_H__\n" \ + --fhead "#define __LIBEMPATHY_GTK_ENUM_TYPES_H__ 1\n\n" \ + --fhead "#include \n\n" \ + --fhead "G_BEGIN_DECLS\n\n" \ + --ftail "G_END_DECLS\n\n" \ + --ftail "#endif /* __LIBEMPATHY_GTK_ENUM_TYPES_H__ */\n" \ + --fprod "#include \n" \ + --eprod "#define EMPATHY_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \ + --eprod "GType @enum_name@_get_type (void);\n" \ + $(libempathy_gtk_headers) ) > xgen-gth \ + && (cmp -s xgen-gth empathy-gtk-enum-type.h || cp xgen-gth empathy-gtk-enum-types.h) \ + && rm -f xgen-gth \ + && echo timestamp > $(@F) + +empathy-gtk-enum-types.c: Makefile $(libempathy_gtk_headers) + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#include \n" \ + --fhead "#include \n" \ + --fhead "#include \"empathy-gtk-enum-types.h\"\n\n" \ + --fprod "\n/* enumerations from \"@filename@\" */" \ + --vhead "static const G@Type@Value _@enum_name@_values[] = {" \ + --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ + --vtail " { 0, NULL, NULL }\n};\n\n" \ + --vtail "GType\n@enum_name@_get_type (void)\n{\n" \ + --vtail " static GType type = 0;\n\n" \ + --vtail " if (!type)\n" \ + --vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \ + --vtail " return type;\n}\n\n" \ + $(libempathy_gtk_headers) ) > xgen-gtc \ + && cp xgen-gtc $(@F) \ + && rm -f xgen-gtc + dtddir = $(datadir)/empathy dtd_DATA = \ empathy-status-presets.dtd \ @@ -115,3 +165,6 @@ EXTRA_DIST = \ $(glade_DATA) \ $(dtd_DATA) +CLEANFILES = \ + $(BUILT_SOURCES) \ + stamp-empathy-gtk-enum-types.h diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index 3b4892e3c..ac2fa62cd 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -35,6 +35,7 @@ #include "empathy-contact-list-store.h" #include "empathy-contact-groups.h" #include "empathy-ui-utils.h" +#include "empathy-gtk-enum-types.h" #define DEBUG_DOMAIN "ContactListStore" @@ -157,28 +158,6 @@ enum { PROP_SORT_CRITERIUM }; -GType -empathy_contact_list_store_sort_get_type (void) -{ - static GType etype = 0; - - if (etype == 0) { - static const GEnumValue values[] = { - { EMPATHY_CONTACT_LIST_STORE_SORT_NAME, - "EMPATHY_CONTACT_LIST_STORE_SORT_NAME", - "name" }, - { EMPATHY_CONTACT_LIST_STORE_SORT_STATE, - "EMPATHY_CONTACT_LIST_STORE_SORT_STATE", - "state" }, - { 0, NULL, NULL } - }; - - etype = g_enum_register_static ("EmpathyContactListStoreSort", values); - } - - return etype; -} - G_DEFINE_TYPE (EmpathyContactListStore, empathy_contact_list_store, GTK_TYPE_TREE_STORE); static void diff --git a/libempathy-gtk/empathy-contact-list-store.h b/libempathy-gtk/empathy-contact-list-store.h index 2e40e8c72..d7c9635f5 100644 --- a/libempathy-gtk/empathy-contact-list-store.h +++ b/libempathy-gtk/empathy-contact-list-store.h @@ -36,15 +36,11 @@ G_BEGIN_DECLS /* * EmpathyContactListStoreSort */ -#define EMPATHY_TYPE_CONTACT_LIST_STORE_SORT (empathy_contact_list_store_sort_get_type ()) - typedef enum { EMPATHY_CONTACT_LIST_STORE_SORT_STATE, EMPATHY_CONTACT_LIST_STORE_SORT_NAME } EmpathyContactListStoreSort; -GType empathy_contact_list_store_sort_get_type (void) G_GNUC_CONST; - /* * EmpathyContactListStore */ diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c index 7f61afcdb..13c578d89 100644 --- a/libempathy-gtk/empathy-main-window.c +++ b/libempathy-gtk/empathy-main-window.c @@ -51,6 +51,7 @@ #include "empathy-new-chatroom-dialog.h" #include "empathy-chatrooms-window.h" #include "empathy-log-window.h" +#include "empathy-gtk-enum-types.h" #define DEBUG_DOMAIN "MainWindow" diff --git a/libempathy-gtk/empathy-preferences.c b/libempathy-gtk/empathy-preferences.c index 7c9a27b6d..024d5137d 100644 --- a/libempathy-gtk/empathy-preferences.c +++ b/libempathy-gtk/empathy-preferences.c @@ -37,6 +37,7 @@ #include "empathy-theme-manager.h" #include "empathy-spell.h" #include "empathy-contact-list-store.h" +#include "empathy-gtk-enum-types.h" typedef struct { GtkWidget *dialog; diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 6f5758325..39dfa9b62 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -8,6 +8,8 @@ AM_CPPFLAGS = \ BUILT_SOURCES = \ empathy-marshal.h \ empathy-marshal.c \ + empathy-enum-types.h \ + empathy-enum-types.c \ empathy-filter-glue.h \ empathy-chandler-glue.h @@ -34,8 +36,11 @@ libempathy_la_SOURCES = \ empathy-chandler.c \ empathy-filter.c \ empathy-idle.c \ - empathy-log-manager.c \ - empathy-marshal-main.c + empathy-log-manager.c + +# do not distribute generated files +nodist_libempathy_la_SOURCES =\ + $(BUILT_SOURCES) libempathy_la_LIBADD = \ $(LIBEMPATHY_LIBS) @@ -43,8 +48,7 @@ libempathy_la_LIBADD = \ libempathy_la_LDFLAGS = \ -version-info ${LIBEMPATHY_CURRENT}:${LIBEMPATHY_REVISION}:${LIBEMPATHY_AGE} -libempathydir = $(includedir)/libempathy/ -libempathy_HEADERS = \ +libempathy_headers = \ empathy-conf.h \ empathy-contact.h \ empathy-avatar.h \ @@ -67,11 +71,17 @@ libempathy_HEADERS = \ empathy-idle.h \ empathy-log-manager.h +libempathy_includedir = $(includedir)/libempathy/ +libempathy_include_HEADERS = \ + $(libempathy_headers) \ + empathy-enum-types.h + %-marshal.h: %-marshal.list Makefile.am $(GLIB_GENMARSHAL) --header --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.h %-marshal.c: %-marshal.list Makefile.am - $(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< > $*-marshal.c + echo "#include \"empathy-marshal.h\"" > $@ && \ + $(GLIB_GENMARSHAL) --body --prefix=$(subst -,_,$*)_marshal $< >> $*-marshal.c %-marshal-main.c: %-marshal.c %-marshal.h @@ -80,6 +90,44 @@ empathy-chandler-glue.h: empathy-chandler.xml empathy-filter-glue.h: empathy-filter.xml $(LIBTOOL) --mode=execute $(DBUS_BINDING_TOOL) --prefix=empathy_filter --mode=glib-server --output=$@ $< +empathy-enum-types.h: stamp-empathy-enum-types.h + @true +stamp-empathy-enum-types.h: Makefile $(libempathy_headers) + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#ifndef __LIBEMPATHY_ENUM_TYPES_H__\n" \ + --fhead "#define __LIBEMPATHY_ENUM_TYPES_H__ 1\n\n" \ + --fhead "#include \n\n" \ + --fhead "G_BEGIN_DECLS\n\n" \ + --ftail "G_END_DECLS\n\n" \ + --ftail "#endif /* __LIBEMPATHY_ENUM_TYPES_H__ */\n" \ + --fprod "#include \n" \ + --eprod "#define EMPATHY_TYPE_@ENUMSHORT@ @enum_name@_get_type()\n" \ + --eprod "GType @enum_name@_get_type (void);\n" \ + $(libempathy_headers) ) > xgen-gth \ + && (cmp -s xgen-gth empathy-enum-type.h || cp xgen-gth empathy-enum-types.h) \ + && rm -f xgen-gth \ + && echo timestamp > $(@F) + +empathy-enum-types.c: Makefile $(libempathy_headers) + (cd $(srcdir) \ + && glib-mkenums \ + --fhead "#include \n" \ + --fhead "#include \n" \ + --fhead "#include \"empathy-enum-types.h\"\n\n" \ + --fprod "\n/* enumerations from \"@filename@\" */" \ + --vhead "static const G@Type@Value _@enum_name@_values[] = {" \ + --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \ + --vtail " { 0, NULL, NULL }\n};\n\n" \ + --vtail "GType\n@enum_name@_get_type (void)\n{\n" \ + --vtail " static GType type = 0;\n\n" \ + --vtail " if (!type)\n" \ + --vtail " type = g_@type@_register_static (\"@EnumName@\", _@enum_name@_values);\n\n" \ + --vtail " return type;\n}\n\n" \ + $(libempathy_headers) ) > xgen-gtc \ + && cp xgen-gtc $(@F) \ + && rm -f xgen-gtc + dtddir = $(datadir)/empathy dtd_DATA = \ empathy-chatroom-manager.dtd @@ -98,4 +146,6 @@ EXTRA_DIST = \ $(stylesheet_DATA) \ $(dtd_DATA) -CLEANFILES = $(BUILT_SOURCES) +CLEANFILES = \ + $(BUILT_SOURCES) \ + stamp-empathy-enum-types.h diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 774a18f77..d3935ad6c 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -30,6 +30,7 @@ #include "empathy-contact.h" #include "empathy-utils.h" #include "empathy-debug.h" +#include "empathy-enum-types.h" #define DEBUG_DOMAIN "Contact" @@ -163,13 +164,12 @@ contact_class_init (EmpathyContactClass *class) g_object_class_install_property (object_class, PROP_SUBSCRIPTION, - g_param_spec_int ("subscription", - "Contact Subscription", - "The subscription status of the contact", - EMPATHY_SUBSCRIPTION_NONE, - EMPATHY_SUBSCRIPTION_BOTH, - EMPATHY_SUBSCRIPTION_NONE, - G_PARAM_READWRITE)); + g_param_spec_flags ("subscription", + "Contact Subscription", + "The subscription status of the contact", + EMPATHY_TYPE_SUBSCRIPTION, + EMPATHY_SUBSCRIPTION_NONE, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, @@ -261,7 +261,7 @@ contact_get_property (GObject *object, g_value_set_pointer (value, priv->groups); break; case PROP_SUBSCRIPTION: - g_value_set_int (value, priv->subscription); + g_value_set_flags (value, priv->subscription); break; case PROP_HANDLE: g_value_set_uint (value, priv->handle); @@ -312,7 +312,7 @@ contact_set_property (GObject *object, break; case PROP_SUBSCRIPTION: empathy_contact_set_subscription (EMPATHY_CONTACT (object), - g_value_get_int (value)); + g_value_get_flags (value)); break; case PROP_HANDLE: empathy_contact_set_handle (EMPATHY_CONTACT (object), diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index f3af7c4f9..efe67ddd8 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -33,6 +33,14 @@ #include "empathy-utils.h" #include "empathy-debug.h" +/* FIXME mission-control does not install libmissioncontrol/mc-enum-types.h so + * we have to define MC_TYPE_PRESENCE here. See sf.net bug #1768235, + * https://sf.net/tracker/?func=detail&atid=932444&aid=1768235&group_id=190214 */ +#ifndef MC_TYPE_PRESENCE +GType mc_presence_get_type (void) G_GNUC_CONST; +#define MC_TYPE_PRESENCE (mc_presence_get_type()) +#endif + #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ EMPATHY_TYPE_IDLE, EmpathyIdlePriv)) @@ -107,11 +115,10 @@ empathy_idle_class_init (EmpathyIdleClass *klass) g_object_class_install_property (object_class, PROP_STATE, - g_param_spec_uint ("state", + g_param_spec_enum ("state", "state", "state", - MC_PRESENCE_UNSET, - LAST_MC_PRESENCE, + MC_TYPE_PRESENCE, MC_PRESENCE_AVAILABLE, G_PARAM_READWRITE)); g_object_class_install_property (object_class, @@ -123,11 +130,10 @@ empathy_idle_class_init (EmpathyIdleClass *klass) G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_FLASH_STATE, - g_param_spec_uint ("flash-state", + g_param_spec_enum ("flash-state", "flash-state", "flash-state", - MC_PRESENCE_UNSET, - LAST_MC_PRESENCE, + MC_TYPE_PRESENCE, MC_PRESENCE_UNSET, G_PARAM_READWRITE)); @@ -251,13 +257,13 @@ idle_get_property (GObject *object, switch (param_id) { case PROP_STATE: - g_value_set_uint (value, empathy_idle_get_state (idle)); + g_value_set_enum (value, empathy_idle_get_state (idle)); break; case PROP_STATUS: g_value_set_string (value, empathy_idle_get_status (idle)); break; case PROP_FLASH_STATE: - g_value_set_uint (value, empathy_idle_get_flash_state (idle)); + g_value_set_enum (value, empathy_idle_get_flash_state (idle)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -279,13 +285,13 @@ idle_set_property (GObject *object, switch (param_id) { case PROP_STATE: - empathy_idle_set_state (idle, g_value_get_uint (value)); + empathy_idle_set_state (idle, g_value_get_enum (value)); break; case PROP_STATUS: empathy_idle_set_status (idle, g_value_get_string (value)); break; case PROP_FLASH_STATE: - empathy_idle_set_flash_state (idle, g_value_get_uint (value)); + empathy_idle_set_flash_state (idle, g_value_get_enum (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); diff --git a/libempathy/empathy-marshal-main.c b/libempathy/empathy-marshal-main.c deleted file mode 100644 index f3ab95f54..000000000 --- a/libempathy/empathy-marshal-main.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "empathy-marshal.h" -#include "empathy-marshal.c" diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c index 02103f6ba..ceecd5d55 100644 --- a/libempathy/empathy-message.c +++ b/libempathy/empathy-message.c @@ -27,6 +27,7 @@ #include #include "empathy-message.h" +#include "empathy-enum-types.h" #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_MESSAGE, EmpathyMessagePriv)) @@ -103,13 +104,12 @@ empathy_message_class_init (EmpathyMessageClass *class) g_object_class_install_property (object_class, PROP_TYPE, - g_param_spec_int ("type", - "Message Type", - "The type of message", - EMPATHY_MESSAGE_TYPE_NORMAL, - EMPATHY_MESSAGE_TYPE_LAST, - EMPATHY_MESSAGE_TYPE_NORMAL, - G_PARAM_READWRITE)); + g_param_spec_enum ("type", + "Message Type", + "The type of message", + EMPATHY_TYPE_MESSAGE_TYPE, + EMPATHY_MESSAGE_TYPE_NORMAL, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_SENDER, g_param_spec_object ("sender", @@ -187,7 +187,7 @@ message_get_property (GObject *object, switch (param_id) { case PROP_TYPE: - g_value_set_int (value, priv->type); + g_value_set_enum (value, priv->type); break; case PROP_SENDER: g_value_set_object (value, priv->sender); @@ -217,7 +217,7 @@ message_set_property (GObject *object, switch (param_id) { case PROP_TYPE: empathy_message_set_type (EMPATHY_MESSAGE (object), - g_value_get_int (value)); + g_value_get_enum (value)); break; case PROP_SENDER: empathy_message_set_sender (EMPATHY_MESSAGE (object), diff --git a/libempathy/empathy-presence.c b/libempathy/empathy-presence.c index 158707a8b..136dce36a 100644 --- a/libempathy/empathy-presence.c +++ b/libempathy/empathy-presence.c @@ -29,6 +29,14 @@ #include "empathy-presence.h" #include "empathy-time.h" +/* FIXME mission-control does not install libmissioncontrol/mc-enum-types.h so + * we have to define MC_TYPE_PRESENCE here. See sf.net bug #1768235, + * https://sf.net/tracker/?func=detail&atid=932444&aid=1768235&group_id=190214 */ +#ifndef MC_TYPE_PRESENCE +GType mc_presence_get_type (void) G_GNUC_CONST; +#define MC_TYPE_PRESENCE (mc_presence_get_type()) +#endif + #define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EMPATHY_TYPE_PRESENCE, EmpathyPresencePriv)) typedef struct _EmpathyPresencePriv EmpathyPresencePriv; @@ -70,13 +78,12 @@ empathy_presence_class_init (EmpathyPresenceClass *class) g_object_class_install_property (object_class, PROP_STATE, - g_param_spec_int ("state", - "Presence State", - "The current state of the presence", - MC_PRESENCE_UNSET, - LAST_MC_PRESENCE, - MC_PRESENCE_AVAILABLE, - G_PARAM_READWRITE)); + g_param_spec_enum ("state", + "Presence State", + "The current state of the presence", + MC_TYPE_PRESENCE, + MC_PRESENCE_AVAILABLE, + G_PARAM_READWRITE)); g_object_class_install_property (object_class, PROP_STATUS, g_param_spec_string ("status", @@ -124,7 +131,7 @@ presence_get_property (GObject *object, switch (param_id) { case PROP_STATE: - g_value_set_int (value, priv->state); + g_value_set_enum (value, priv->state); break; case PROP_STATUS: g_value_set_string (value, @@ -147,7 +154,7 @@ presence_set_property (GObject *object, switch (param_id) { case PROP_STATE: - priv->state = g_value_get_int (value); + priv->state = g_value_get_enum (value); break; case PROP_STATUS: empathy_presence_set_status (EMPATHY_PRESENCE (object), -- cgit v1.2.3