From 0a5803a8c00339a909a2709770288eeba5007ee7 Mon Sep 17 00:00:00 2001 From: mbari Date: Tue, 7 Aug 2007 19:03:19 +0000 Subject: 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. git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@234 4ee84921-47dd-4033-b63a-18d7a039a3e4 --- 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 + 5 files changed, 58 insertions(+), 28 deletions(-) (limited to 'libempathy-gtk') 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; -- cgit v1.2.3