diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-05-11 01:18:28 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-05-11 01:18:28 +0800 |
commit | 5eb12906c4242a576ad6fac4d229f096d3aab17a (patch) | |
tree | 7c09011257167be9c0f456a7c19c21298469ea82 /shell | |
parent | 92e942499bffca812dcbc229f6c88ebb640e403a (diff) | |
download | gsoc2013-evolution-5eb12906c4242a576ad6fac4d229f096d3aab17a.tar.gz gsoc2013-evolution-5eb12906c4242a576ad6fac4d229f096d3aab17a.tar.zst gsoc2013-evolution-5eb12906c4242a576ad6fac4d229f096d3aab17a.zip |
Use the proper idiom for loading types in a GTypeModule.
Also, combine calendar, memo, and task backends into a single module,
similar to how it worked under Bonobo.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/test/Makefile.am | 9 | ||||
-rw-r--r-- | shell/test/e-test-shell-backend.c | 61 | ||||
-rw-r--r-- | shell/test/e-test-shell-backend.h | 10 | ||||
-rw-r--r-- | shell/test/e-test-shell-view.c | 49 | ||||
-rw-r--r-- | shell/test/e-test-shell-view.h | 9 | ||||
-rw-r--r-- | shell/test/evolution-module-test.c | 41 |
6 files changed, 103 insertions, 76 deletions
diff --git a/shell/test/Makefile.am b/shell/test/Makefile.am index 3b98d1b9ce..7982e29f17 100644 --- a/shell/test/Makefile.am +++ b/shell/test/Makefile.am @@ -1,4 +1,4 @@ -module_LTLIBRARIES = libevolution-test.la +module_LTLIBRARIES = libevolution-module-test.la INCLUDES = \ -I$(top_srcdir)/shell \ @@ -9,17 +9,18 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"evolution-test\" \ $(EVOLUTION_TEST_CFLAGS) -libevolution_test_la_SOURCES = \ +libevolution_module_test_la_SOURCES = \ + evolution-module-test.c \ e-test-shell-backend.c \ e-test-shell-backend.h \ e-test-shell-view.c \ e-test-shell-view.h -libevolution_test_la_LIBADD = \ +libevolution_module_test_la_LIBADD = \ $(top_builddir)/shell/libeshell.la \ $(EVOLUTION_TEST_LIBS) -libevolution_test_la_LDFLAGS = \ +libevolution_module_test_la_LDFLAGS = \ -avoid-version -module $(NO_UNDEFINED) -include $(top_srcdir)/git.mk diff --git a/shell/test/e-test-shell-backend.c b/shell/test/e-test-shell-backend.c index cdceb603d1..0fc6c203aa 100644 --- a/shell/test/e-test-shell-backend.c +++ b/shell/test/e-test-shell-backend.c @@ -23,8 +23,8 @@ #include <glib/gi18n.h> -#include <e-shell.h> -#include <e-shell-window.h> +#include "shell/e-shell.h" +#include "shell/e-shell-window.h" #include "e-test-shell-view.h" @@ -36,12 +36,8 @@ struct _ETestShellBackendPrivate { gint placeholder; }; -/* Module Entry Point */ -void e_module_load (GTypeModule *type_module); -void e_module_unload (GTypeModule *type_module); - -GType e_test_shell_backend_type = 0; static gpointer parent_class; +static GType test_shell_backend_type; static void action_test_item_new_cb (GtkAction *action, @@ -217,39 +213,28 @@ test_shell_backend_init (ETestShellBackend *test_shell_backend) } GType -e_test_shell_backend_get_type (GTypeModule *type_module) -{ - if (e_test_shell_backend_type == 0) { - const GTypeInfo type_info = { - sizeof (ETestShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) test_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (ETestShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) test_shell_backend_init, - NULL /* value_table */ - }; - - e_test_shell_backend_type = - g_type_module_register_type ( - type_module, E_TYPE_SHELL_BACKEND, - "ETestShellBackend", &type_info, 0); - } - - return e_test_shell_backend_type; -} - -void -e_module_load (GTypeModule *type_module) +e_test_shell_backend_get_type (void) { - e_test_shell_backend_get_type (type_module); - e_test_shell_view_get_type (type_module); + return test_shell_backend_type; } void -e_module_unload (GTypeModule *type_module) -{ +e_test_shell_backend_register_type (GTypeModule *type_module) +{ + const GTypeInfo type_info = { + sizeof (ETestShellBackendClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) test_shell_backend_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (ETestShellBackend), + 0, /* n_preallocs */ + (GInstanceInitFunc) test_shell_backend_init, + NULL /* value_table */ + }; + + test_shell_backend_type = g_type_module_register_type ( + type_module, E_TYPE_SHELL_BACKEND, + "ETestShellBackend", &type_info, 0); } diff --git a/shell/test/e-test-shell-backend.h b/shell/test/e-test-shell-backend.h index ccb04be7c2..0768e48a8f 100644 --- a/shell/test/e-test-shell-backend.h +++ b/shell/test/e-test-shell-backend.h @@ -1,5 +1,5 @@ /* - * e-test-shell-backend.c + * e-test-shell-backend.h * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,7 +26,7 @@ /* Standard GObject macros */ #define E_TYPE_TEST_SHELL_BACKEND \ - (e_test_shell_backend_type) + (e_test_shell_backend_get_type ()) #define E_TEST_SHELL_BACKEND(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_TEST_SHELL_BACKEND, ETestShellBackend)) @@ -45,8 +45,6 @@ G_BEGIN_DECLS -extern GType e_test_shell_backend_type; - typedef struct _ETestShellBackend ETestShellBackend; typedef struct _ETestShellBackendClass ETestShellBackendClass; typedef struct _ETestShellBackendPrivate ETestShellBackendPrivate; @@ -60,7 +58,9 @@ struct _ETestShellBackendClass { EShellBackendClass parent_class; }; -GType e_test_shell_backend_get_type (GTypeModule *type_module); +GType e_test_shell_backend_get_type (void); +void e_test_shell_backend_register_type + (GTypeModule *type_module); G_END_DECLS diff --git a/shell/test/e-test-shell-view.c b/shell/test/e-test-shell-view.c index a7326af687..f05abfff06 100644 --- a/shell/test/e-test-shell-view.c +++ b/shell/test/e-test-shell-view.c @@ -21,8 +21,8 @@ #include "e-test-shell-view.h" -#include <e-shell-content.h> -#include <e-shell-sidebar.h> +#include "shell/e-shell-content.h" +#include "shell/e-shell-sidebar.h" #define E_TEST_SHELL_VIEW_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -32,8 +32,8 @@ struct _ETestShellViewPrivate { EActivity *activity; }; -GType e_test_shell_view_type = 0; static gpointer parent_class; +static GType test_shell_view_type; static void test_shell_view_toggled (EShellView *shell_view) @@ -128,27 +128,28 @@ test_shell_view_init (ETestShellView *test_shell_view) } GType -e_test_shell_view_get_type (GTypeModule *type_module) +e_test_shell_view_get_type (void) { - if (e_test_shell_view_type == 0) { - const GTypeInfo type_info = { - sizeof (ETestShellViewClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) test_shell_view_class_init, - (GClassFinalizeFunc) NULL, - type_module, - sizeof (ETestShellView), - 0, /* n_preallocs */ - (GInstanceInitFunc) test_shell_view_init, - NULL /* value_table */ - }; - - e_test_shell_view_type = - g_type_module_register_type ( - type_module, E_TYPE_SHELL_VIEW, - "ETestShellView", &type_info, 0); - } + return test_shell_view_type; +} - return e_test_shell_view_type; +void +e_test_shell_view_register_type (GTypeModule *type_module) +{ + const GTypeInfo type_info = { + sizeof (ETestShellViewClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) test_shell_view_class_init, + (GClassFinalizeFunc) NULL, + type_module, + sizeof (ETestShellView), + 0, /* n_preallocs */ + (GInstanceInitFunc) test_shell_view_init, + NULL /* value_table */ + }; + + test_shell_view_type = g_type_module_register_type ( + type_module, E_TYPE_SHELL_VIEW, + "ETestShellView", &type_info, 0); } diff --git a/shell/test/e-test-shell-view.h b/shell/test/e-test-shell-view.h index df1098ae56..b84fba9c44 100644 --- a/shell/test/e-test-shell-view.h +++ b/shell/test/e-test-shell-view.h @@ -22,11 +22,11 @@ #ifndef E_TEST_SHELL_VIEW_H #define E_TEST_SHELL_VIEW_H -#include <e-shell-view.h> +#include <shell/e-shell-view.h> /* Standard GObject macros */ #define E_TYPE_TEST_SHELL_VIEW \ - (e_test_shell_view_type) + (e_test_shell_view_get_type ()) #define E_TEST_SHELL_VIEW(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_TEST_SHELL_VIEW, ETestShellView)) @@ -45,8 +45,6 @@ G_BEGIN_DECLS -extern GType e_test_shell_view_type; - typedef struct _ETestShellView ETestShellView; typedef struct _ETestShellViewClass ETestShellViewClass; typedef struct _ETestShellViewPrivate ETestShellViewPrivate; @@ -60,7 +58,8 @@ struct _ETestShellViewClass { EShellViewClass parent_class; }; -GType e_test_shell_view_get_type (GTypeModule *type_module); +GType e_test_shell_view_get_type (void); +void e_test_shell_view_register_type (GTypeModule *type_module); G_END_DECLS diff --git a/shell/test/evolution-module-test.c b/shell/test/evolution-module-test.c new file mode 100644 index 0000000000..5f3bb26997 --- /dev/null +++ b/shell/test/evolution-module-test.c @@ -0,0 +1,41 @@ +/* + * evolution-module-test.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-test-shell-backend.h" +#include "e-test-shell-view.h" + +/* Module Entry Points */ +void e_module_load (GTypeModule *type_module); +void e_module_unload (GTypeModule *type_module); + +void +e_module_load (GTypeModule *type_module) +{ + /* Register dynamically loaded types. */ + + e_test_shell_backend_register_type (type_module); + e_test_shell_view_register_type (type_module); +} + +void +e_module_unload (GTypeModule *type_module) +{ +} |