aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorMarco Barisione <marco@barisione.org>2007-08-08 03:03:19 +0800
committerMarco Barisione <mbari@src.gnome.org>2007-08-08 03:03:19 +0800
commit2d366a83ee60c3c10395900498499e9ff081f3a2 (patch)
treeb402c16c3a9643cd05acf33802750d1accdb7930 /libempathy
parent57acf434c3ac37946f2a2d249eafd02a0130d75d (diff)
downloadgsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.tar
gsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.tar.gz
gsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.tar.bz2
gsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.tar.lz
gsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.tar.xz
gsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.tar.zst
gsoc2013-empathy-2d366a83ee60c3c10395900498499e9ff081f3a2.zip
Remove empathy-marshal-main.c and include empathy-marshal.h from
2007-08-07 Marco Barisione <marco@barisione.org> * 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
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/Makefile.am62
-rw-r--r--libempathy/empathy-contact.c18
-rw-r--r--libempathy/empathy-idle.c26
-rw-r--r--libempathy/empathy-marshal-main.c2
-rw-r--r--libempathy/empathy-message.c18
-rw-r--r--libempathy/empathy-presence.c25
6 files changed, 106 insertions, 45 deletions
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 <glib-object.h>\n\n" \
+ --fhead "G_BEGIN_DECLS\n\n" \
+ --ftail "G_END_DECLS\n\n" \
+ --ftail "#endif /* __LIBEMPATHY_ENUM_TYPES_H__ */\n" \
+ --fprod "#include <libempathy/@filename@>\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 <config.h>\n" \
+ --fhead "#include <glib-object.h>\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 <string.h>
#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),