aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-20 12:00:28 +0800
committerMichael Meeks <michael.meeks@novell.com>2010-04-07 19:12:57 +0800
commita718e57b258d993e8427bff2ee8a4eccf89a582f (patch)
tree943b2550447cb3d9afa9f145f0bb8a525cf2904d
parent260032a9ff49e78d4081b40e5f7102d2928fc572 (diff)
downloadgsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.tar
gsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.tar.gz
gsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.tar.bz2
gsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.tar.lz
gsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.tar.xz
gsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.tar.zst
gsoc2013-evolution-a718e57b258d993e8427bff2ee8a4eccf89a582f.zip
Make EShell and related classes extensible.
-rw-r--r--shell/e-shell-content.c44
-rw-r--r--shell/e-shell-searchbar.c42
-rw-r--r--shell/e-shell-sidebar.c46
-rw-r--r--shell/e-shell-switcher.c60
-rw-r--r--shell/e-shell-taskbar.c46
-rw-r--r--shell/e-shell-view.c16
-rw-r--r--shell/e-shell-window.c43
-rw-r--r--shell/e-shell.c47
8 files changed, 101 insertions, 243 deletions
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index e0102908de..af799ae8e2 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -24,6 +24,7 @@
#include <glib/gi18n.h>
#include "e-util/e-binding.h"
+#include "e-util/e-extensible.h"
#include "e-util/e-util.h"
#include "e-util/e-alert-dialog.h"
#include "filter/e-rule-editor.h"
@@ -54,7 +55,9 @@ enum {
PROP_SHELL_VIEW
};
-static gpointer parent_class;
+G_DEFINE_TYPE_WITH_CODE (
+ EShellContent, e_shell_content, GTK_TYPE_BIN,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL));
static void
shell_content_dialog_rule_changed (GtkWidget *dialog,
@@ -131,7 +134,7 @@ shell_content_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_content_parent_class)->dispose (object);
}
static void
@@ -166,6 +169,8 @@ shell_content_constructed (GObject *object)
shell_content->priv->searchbar = g_object_ref (widget);
gtk_widget_show (widget);
}
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static void
@@ -186,7 +191,7 @@ shell_content_destroy (GtkObject *gtk_object)
}
/* Chain up to parent's destroy() method. */
- GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
+ GTK_OBJECT_CLASS (e_shell_content_parent_class)->destroy (gtk_object);
}
static void
@@ -265,7 +270,7 @@ shell_content_forall (GtkContainer *container,
callback (priv->searchbar, callback_data);
/* Chain up to parent's forall() method. */
- GTK_CONTAINER_CLASS (parent_class)->forall (
+ GTK_CONTAINER_CLASS (e_shell_content_parent_class)->forall (
container, include_internals, callback, callback_data);
}
@@ -302,14 +307,13 @@ shell_content_construct_searchbar (EShellContent *shell_content)
}
static void
-shell_content_class_init (EShellContentClass *class)
+e_shell_content_class_init (EShellContentClass *class)
{
GObjectClass *object_class;
GtkObjectClass *gtk_object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellContentPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -349,39 +353,13 @@ shell_content_class_init (EShellContentClass *class)
}
static void
-shell_content_init (EShellContent *shell_content)
+e_shell_content_init (EShellContent *shell_content)
{
shell_content->priv = E_SHELL_CONTENT_GET_PRIVATE (shell_content);
GTK_WIDGET_SET_FLAGS (shell_content, GTK_NO_WINDOW);
}
-GType
-e_shell_content_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EShellContentClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_content_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellContent),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_content_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_BIN, "EShellContent", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_shell_content_new:
* @shell_view: an #EShellView
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 272ba0e906..4b2c2c8f76 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -26,6 +26,7 @@
#include "e-util/e-util.h"
#include "e-util/e-binding.h"
+#include "e-util/e-extensible.h"
#include "widgets/misc/e-action-combo-box.h"
#include "widgets/misc/e-hinted-entry.h"
@@ -82,7 +83,9 @@ enum {
PROP_STATE_GROUP
};
-static gpointer parent_class;
+G_DEFINE_TYPE_WITH_CODE (
+ EShellSearchbar, e_shell_searchbar, GTK_TYPE_BOX,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
static void
shell_searchbar_save_search_filter (EShellSearchbar *searchbar)
@@ -620,7 +623,7 @@ shell_searchbar_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_searchbar_parent_class)->dispose (object);
}
static void
@@ -693,13 +696,15 @@ shell_searchbar_constructed (GObject *object)
widget = GTK_WIDGET (searchbar);
gtk_size_group_add_widget (size_group, widget);
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static void
shell_searchbar_map (GtkWidget *widget)
{
/* Chain up to parent's map() method. */
- GTK_WIDGET_CLASS (parent_class)->map (widget);
+ GTK_WIDGET_CLASS (e_shell_searchbar_parent_class)->map (widget);
/* Load state after constructed() so we don't derail
* subclass initialization. We wait until map() so we
@@ -708,12 +713,11 @@ shell_searchbar_map (GtkWidget *widget)
}
static void
-shell_searchbar_class_init (EShellSearchbarClass *class)
+e_shell_searchbar_class_init (EShellSearchbarClass *class)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellSearchbarPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -853,7 +857,7 @@ shell_searchbar_class_init (EShellSearchbarClass *class)
}
static void
-shell_searchbar_init (EShellSearchbar *searchbar)
+e_shell_searchbar_init (EShellSearchbar *searchbar)
{
GtkBox *box;
GtkLabel *label;
@@ -989,32 +993,6 @@ shell_searchbar_init (EShellSearchbar *searchbar)
G_CONNECT_AFTER | G_CONNECT_SWAPPED);
}
-GType
-e_shell_searchbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EShellSearchbarClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_searchbar_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellSearchbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_searchbar_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_BOX, "EShellSearchbar", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_shell_searchbar_new:
* @shell_view: an #EShellView
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index 5701321f24..d293f08aca 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -22,6 +22,7 @@
#include "e-shell-sidebar.h"
#include <e-util/e-binding.h>
+#include <e-util/e-extensible.h>
#include <e-util/e-unicode.h>
#include <shell/e-shell-view.h>
@@ -48,7 +49,9 @@ enum {
PROP_SHELL_VIEW
};
-static gpointer parent_class;
+G_DEFINE_TYPE_WITH_CODE (
+ EShellSidebar, e_shell_sidebar, GTK_TYPE_BIN,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
static void
shell_sidebar_set_shell_view (EShellSidebar *shell_sidebar,
@@ -147,7 +150,7 @@ shell_sidebar_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_sidebar_parent_class)->dispose (object);
}
static void
@@ -162,7 +165,7 @@ shell_sidebar_finalize (GObject *object)
g_free (priv->secondary_text);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_shell_sidebar_parent_class)->finalize (object);
}
static void
@@ -191,6 +194,8 @@ shell_sidebar_constructed (GObject *object)
g_object_get (action, "label", &label, NULL);
e_shell_sidebar_set_primary_text (shell_sidebar, label);
g_free (label);
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static void
@@ -211,7 +216,7 @@ shell_sidebar_destroy (GtkObject *gtk_object)
}
/* Chain up to parent's destroy() method. */
- GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
+ GTK_OBJECT_CLASS (e_shell_sidebar_parent_class)->destroy (gtk_object);
}
static void
@@ -282,19 +287,18 @@ shell_sidebar_forall (GtkContainer *container,
callback (priv->event_box, callback_data);
/* Chain up to parent's forall() method. */
- GTK_CONTAINER_CLASS (parent_class)->forall (
+ GTK_CONTAINER_CLASS (e_shell_sidebar_parent_class)->forall (
container, include_internals, callback, callback_data);
}
static void
-shell_sidebar_class_init (EShellSidebarClass *class)
+e_shell_sidebar_class_init (EShellSidebarClass *class)
{
GObjectClass *object_class;
GtkObjectClass *gtk_object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellSidebarPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -378,7 +382,7 @@ shell_sidebar_class_init (EShellSidebarClass *class)
}
static void
-shell_sidebar_init (EShellSidebar *shell_sidebar)
+e_shell_sidebar_init (EShellSidebar *shell_sidebar)
{
GtkStyle *style;
GtkWidget *widget;
@@ -446,32 +450,6 @@ shell_sidebar_init (EShellSidebar *shell_sidebar)
e_binding_new (shell_sidebar, "secondary-text", widget, "label");
}
-GType
-e_shell_sidebar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EShellSidebarClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_sidebar_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellSidebar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_sidebar_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_BIN, "EShellSidebar", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_shell_sidebar_new:
* @shell_view: an #EShellView
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index 7e82e556bc..ad9a3c776a 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -22,6 +22,7 @@
#include "e-shell-switcher.h"
#include <glib/gi18n.h>
+#include <e-util/e-extensible.h>
#define E_SHELL_SWITCHER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -50,9 +51,17 @@ enum {
LAST_SIGNAL
};
-static gpointer parent_class;
static guint signals[LAST_SIGNAL];
+/* Forward Declarations */
+static void shell_switcher_tool_shell_iface_init (GtkToolShellIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ EShellSwitcher, e_shell_switcher, GTK_TYPE_BIN,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL)
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TOOL_SHELL,
+ shell_switcher_tool_shell_iface_init))
+
static gint
shell_switcher_layout_actions (EShellSwitcher *switcher)
{
@@ -223,7 +232,7 @@ shell_switcher_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_switcher_parent_class)->dispose (object);
}
static void
@@ -346,7 +355,8 @@ shell_switcher_remove (GtkContainer *container,
}
/* Chain up to parent's remove() method. */
- GTK_CONTAINER_CLASS (parent_class)->remove (container, widget);
+ GTK_CONTAINER_CLASS (e_shell_switcher_parent_class)->remove (
+ container, widget);
}
static void
@@ -364,7 +374,7 @@ shell_switcher_forall (GtkContainer *container,
priv->proxies, (GFunc) callback, callback_data);
/* Chain up to parent's forall() method. */
- GTK_CONTAINER_CLASS (parent_class)->forall (
+ GTK_CONTAINER_CLASS (e_shell_switcher_parent_class)->forall (
container, include_internals, callback, callback_data);
}
@@ -410,13 +420,12 @@ shell_switcher_get_relief_style (GtkToolShell *shell)
}
static void
-shell_switcher_class_init (EShellSwitcherClass *class)
+e_shell_switcher_class_init (EShellSwitcherClass *class)
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellSwitcherPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -487,11 +496,13 @@ shell_switcher_class_init (EShellSwitcherClass *class)
}
static void
-shell_switcher_init (EShellSwitcher *switcher)
+e_shell_switcher_init (EShellSwitcher *switcher)
{
switcher->priv = E_SHELL_SWITCHER_GET_PRIVATE (switcher);
GTK_WIDGET_SET_FLAGS (switcher, GTK_NO_WINDOW);
+
+ e_extensible_load_extensions (E_EXTENSIBLE (switcher));
}
static void
@@ -503,41 +514,6 @@ shell_switcher_tool_shell_iface_init (GtkToolShellIface *iface)
iface->get_relief_style = shell_switcher_get_relief_style;
}
-GType
-e_shell_switcher_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EShellSwitcherClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_switcher_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellSwitcher),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_switcher_init,
- NULL /* value_table */
- };
-
- static const GInterfaceInfo tool_shell_info = {
- (GInterfaceInitFunc) shell_switcher_tool_shell_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL /* interface_data */
- };
-
- type = g_type_register_static (
- GTK_TYPE_BIN, "EShellSwitcher", &type_info, 0);
-
- g_type_add_interface_static (
- type, GTK_TYPE_TOOL_SHELL, &tool_shell_info);
- }
-
- return type;
-}
-
/**
* e_shell_switcher_new:
*
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c
index 7e8a34ac7c..2129d518be 100644
--- a/shell/e-shell-taskbar.c
+++ b/shell/e-shell-taskbar.c
@@ -23,7 +23,8 @@
#include <e-shell-view.h>
-#include <widgets/misc/e-activity-proxy.h>
+#include <e-util/e-extensible.h>
+#include <misc/e-activity-proxy.h>
#define E_SHELL_TASKBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -49,7 +50,9 @@ enum {
PROP_SHELL_VIEW
};
-static gpointer parent_class;
+G_DEFINE_TYPE_WITH_CODE (
+ EShellTaskbar, e_shell_taskbar, GTK_TYPE_HBOX,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
static void
shell_taskbar_activity_remove (EShellTaskbar *shell_taskbar,
@@ -204,7 +207,7 @@ shell_taskbar_dispose (GObject *object)
object);
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_taskbar_parent_class)->dispose (object);
}
static void
@@ -217,7 +220,7 @@ shell_taskbar_finalize (GObject *object)
g_hash_table_destroy (priv->proxy_table);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_shell_taskbar_parent_class)->finalize (object);
}
static void
@@ -239,16 +242,17 @@ shell_taskbar_constructed (GObject *object)
shell_backend, "activity-added",
G_CALLBACK (shell_taskbar_activity_add), shell_taskbar);
- /* to not enlarge window width on new activities */
+ /* Do not enlarge window width on new activities. */
gtk_widget_set_size_request (GTK_WIDGET (shell_taskbar), 0, -1);
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static void
-shell_taskbar_class_init (EShellTaskbarClass *class)
+e_shell_taskbar_class_init (EShellTaskbarClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellTaskbarPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -292,7 +296,7 @@ shell_taskbar_class_init (EShellTaskbarClass *class)
}
static void
-shell_taskbar_init (EShellTaskbar *shell_taskbar)
+e_shell_taskbar_init (EShellTaskbar *shell_taskbar)
{
GtkWidget *widget;
GHashTable *proxy_table;
@@ -328,32 +332,6 @@ shell_taskbar_init (EShellTaskbar *shell_taskbar)
GTK_WIDGET (shell_taskbar), -1, (height * 2));
}
-GType
-e_shell_taskbar_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EShellTaskbarClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_taskbar_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellTaskbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_taskbar_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_HBOX, "EShellTaskbar", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_shell_taskbar_new:
* @shell_view: an #EShellView
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 3a5c6e219d..cd898532fe 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -24,11 +24,12 @@
#include <string.h>
#include <glib/gi18n.h>
-#include "e-util/e-util-private.h"
-#include "e-util/e-util.h"
+#include "e-util/e-extensible.h"
#include "e-util/e-file-utils.h"
#include "e-util/e-plugin-ui.h"
#include "e-util/e-ui-manager.h"
+#include "e-util/e-util-private.h"
+#include "e-util/e-util.h"
#include "filter/e-rule-context.h"
#include "e-shell-window-actions.h"
@@ -578,6 +579,8 @@ shell_view_constructed (GObject *object)
/* Size group should be safe to unreference now. */
g_object_unref (shell_view->priv->size_group);
shell_view->priv->size_group = NULL;
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static void
@@ -976,9 +979,18 @@ e_shell_view_get_type (void)
NULL /* value_table */
};
+ const GInterfaceInfo extensible_info = {
+ (GInterfaceInitFunc) NULL,
+ (GInterfaceFinalizeFunc) NULL,
+ NULL /* interface_data */
+ };
+
type = g_type_register_static (
G_TYPE_OBJECT, "EShellView",
&type_info, G_TYPE_FLAG_ABSTRACT);
+
+ g_type_add_interface_static (
+ type, E_TYPE_EXTENSIBLE, &extensible_info);
}
return type;
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 5513efbe95..04ecc0ea98 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -23,6 +23,7 @@
#include <gconf/gconf-client.h>
+#include <e-util/e-extensible.h>
#include <e-util/e-plugin-ui.h>
#include <e-util/e-util-private.h>
@@ -45,9 +46,12 @@ enum {
LAST_SIGNAL
};
-static gpointer parent_class;
static gulong signals[LAST_SIGNAL];
+G_DEFINE_TYPE_WITH_CODE (
+ EShellWindow, e_shell_window, GTK_TYPE_WINDOW,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
+
static void
shell_window_menubar_update_new_menu (EShellWindow *shell_window)
{
@@ -299,7 +303,7 @@ shell_window_dispose (GObject *object)
e_shell_window_private_dispose (E_SHELL_WINDOW (object));
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_window_parent_class)->dispose (object);
}
static void
@@ -308,13 +312,15 @@ shell_window_finalize (GObject *object)
e_shell_window_private_finalize (E_SHELL_WINDOW (object));
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_shell_window_parent_class)->finalize (object);
}
static void
shell_window_constructed (GObject *object)
{
e_shell_window_private_constructed (E_SHELL_WINDOW (object));
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static GtkWidget *
@@ -582,11 +588,10 @@ shell_window_create_shell_view (EShellWindow *shell_window,
}
static void
-shell_window_class_init (EShellWindowClass *class)
+e_shell_window_class_init (EShellWindowClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellWindowPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -779,39 +784,13 @@ shell_window_class_init (EShellWindowClass *class)
}
static void
-shell_window_init (EShellWindow *shell_window)
+e_shell_window_init (EShellWindow *shell_window)
{
shell_window->priv = E_SHELL_WINDOW_GET_PRIVATE (shell_window);
e_shell_window_private_init (shell_window);
}
-GType
-e_shell_window_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (EShellWindowClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_window_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellWindow),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_window_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- GTK_TYPE_WINDOW, "EShellWindow", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_shell_window_new:
* @shell: an #EShell
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 00c1e4a7a7..8bbcde784d 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -24,9 +24,10 @@
#include <glib/gi18n.h>
#include <libedataserverui/e-passwords.h>
+#include "e-util/e-module.h"
+#include "e-util/e-extensible.h"
#include "e-util/e-util-private.h"
#include "e-util/e-util.h"
-#include "e-util/e-module.h"
#include "smclient/eggsmclient.h"
#include "widgets/misc/e-preferences-window.h"
@@ -94,7 +95,6 @@ static GDebugKey debug_keys[] = {
{ "settings", DEBUG_KEY_SETTINGS }
};
-static gpointer parent_class;
static gpointer default_shell;
static guint signals[LAST_SIGNAL];
@@ -102,6 +102,10 @@ static guint signals[LAST_SIGNAL];
gboolean e_shell_dbus_initialize (EShell *shell);
#endif
+G_DEFINE_TYPE_WITH_CODE (
+ EShell, e_shell, UNIQUE_TYPE_APP,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
+
static void
shell_parse_debug_string (EShell *shell)
{
@@ -606,7 +610,7 @@ shell_dispose (GObject *object)
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_parent_class)->dispose (object);
}
static void
@@ -627,7 +631,7 @@ shell_finalize (GObject *object)
g_free (priv->module_directory);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_shell_parent_class)->finalize (object);
}
static void
@@ -656,6 +660,8 @@ shell_constructed (GObject *object)
e_type_traverse (
E_TYPE_SHELL_BACKEND, (ETypeFunc)
shell_add_backend, object);
+
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static UniqueResponse
@@ -740,7 +746,7 @@ shell_message_received (UniqueApp *app,
}
/* Chain up to parent's message_received() method. */
- return UNIQUE_APP_CLASS (parent_class)->
+ return UNIQUE_APP_CLASS (e_shell_parent_class)->
message_received (app, command, data, time_);
}
@@ -752,12 +758,11 @@ shell_window_destroyed (EShell *shell)
}
static void
-shell_class_init (EShellClass *class)
+e_shell_class_init (EShellClass *class)
{
GObjectClass *object_class;
UniqueAppClass *unique_app_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellPrivate));
object_class = G_OBJECT_CLASS (class);
@@ -1061,7 +1066,7 @@ shell_class_init (EShellClass *class)
}
static void
-shell_init (EShell *shell)
+e_shell_init (EShell *shell)
{
GHashTable *backends_by_name;
GHashTable *backends_by_scheme;
@@ -1150,32 +1155,6 @@ shell_init (EShell *shell)
G_CALLBACK (shell_sm_quit_cb), shell);
}
-GType
-e_shell_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (EShellClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShell),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- UNIQUE_TYPE_APP, "EShell", &type_info, 0);
- }
-
- return type;
-}
-
/**
* e_shell_get_default:
*