aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/Makefile.am2
-rw-r--r--shell/e-shell-backend.c154
-rw-r--r--shell/e-shell-backend.h11
-rw-r--r--shell/e-shell-content.c202
-rw-r--r--shell/e-shell-content.h14
-rw-r--r--shell/e-shell-meego.c152
-rw-r--r--shell/e-shell-meego.h24
-rw-r--r--shell/e-shell-searchbar.c154
-rw-r--r--shell/e-shell-searchbar.h17
-rw-r--r--shell/e-shell-settings.c6
-rw-r--r--shell/e-shell-settings.h6
-rw-r--r--shell/e-shell-sidebar.c52
-rw-r--r--shell/e-shell-sidebar.h6
-rw-r--r--shell/e-shell-switcher.c66
-rw-r--r--shell/e-shell-switcher.h6
-rw-r--r--shell/e-shell-taskbar.c52
-rw-r--r--shell/e-shell-taskbar.h6
-rw-r--r--shell/e-shell-utils.c6
-rw-r--r--shell/e-shell-utils.h6
-rw-r--r--shell/e-shell-view.c156
-rw-r--r--shell/e-shell-view.h12
-rw-r--r--shell/e-shell-window-private.c12
-rw-r--r--shell/e-shell-window.c74
-rw-r--r--shell/e-shell-window.h6
-rw-r--r--shell/e-shell.c40
-rw-r--r--shell/e-shell.h6
26 files changed, 690 insertions, 558 deletions
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 0a93912680..3e073d2e96 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -58,6 +58,8 @@ libeshell_la_SOURCES = \
e-shell.c \
e-shell-backend.c \
e-shell-content.c \
+ e-shell-meego.c \
+ e-shell-meego.h \
e-shell-searchbar.c \
e-shell-settings.c \
e-shell-sidebar.c \
diff --git a/shell/e-shell-backend.c b/shell/e-shell-backend.c
index 18ebe0f8d8..570e58db95 100644
--- a/shell/e-shell-backend.c
+++ b/shell/e-shell-backend.c
@@ -21,6 +21,12 @@
* Copyright (C) 2009 Intel Corporation
*/
+/**
+ * SECTION: e-shell-backend
+ * @short_description: dynamically loaded capabilities
+ * @include: shell/e-shell-backend.h
+ **/
+
#include "e-shell-backend.h"
#include <errno.h>
@@ -37,8 +43,6 @@
struct _EShellBackendPrivate {
- gpointer shell; /* weak pointer */
-
/* We keep a reference to corresponding EShellView subclass
* since it keeps a reference back to us. This ensures the
* subclass is not finalized before we are, otherwise it
@@ -52,63 +56,38 @@ struct _EShellBackendPrivate {
};
enum {
- PROP_0,
- PROP_SHELL
-};
-
-enum {
ACTIVITY_ADDED,
LAST_SIGNAL
};
-static gpointer parent_class;
static guint signals[LAST_SIGNAL];
-static void
-shell_backend_set_shell (EShellBackend *shell_backend,
- EShell *shell)
-{
- g_return_if_fail (shell_backend->priv->shell == NULL);
+G_DEFINE_ABSTRACT_TYPE (EShellBackend, e_shell_backend, E_TYPE_EXTENSION)
- shell_backend->priv->shell = shell;
-
- g_object_add_weak_pointer (
- G_OBJECT (shell_backend),
- &shell_backend->priv->shell);
-}
-
-static void
-shell_backend_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+static GObject *
+shell_backend_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
- switch (property_id) {
- case PROP_SHELL:
- shell_backend_set_shell (
- E_SHELL_BACKEND (object),
- g_value_get_object (value));
- return;
- }
+ EShellBackendPrivate *priv;
+ EShellBackendClass *class;
+ EShellViewClass *shell_view_class;
+ GObject *object;
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
+ /* Chain up to parent's construct() method. */
+ object = G_OBJECT_CLASS (e_shell_backend_parent_class)->constructor (
+ type, n_construct_properties, construct_properties);
-static void
-shell_backend_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id) {
- case PROP_SHELL:
- g_value_set_object (
- value, e_shell_backend_get_shell (
- E_SHELL_BACKEND (object)));
- return;
- }
+ class = E_SHELL_BACKEND_GET_CLASS (object);
+ priv = E_SHELL_BACKEND_GET_PRIVATE (object);
+
+ /* Install a reference to ourselves in the
+ * corresponding EShellViewClass structure. */
+ shell_view_class = g_type_class_ref (class->shell_view_type);
+ shell_view_class->shell_backend = g_object_ref (object);
+ priv->shell_view_class = shell_view_class;
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ return object;
}
static void
@@ -118,19 +97,13 @@ shell_backend_dispose (GObject *object)
priv = E_SHELL_BACKEND_GET_PRIVATE (object);
- if (priv->shell != NULL) {
- g_object_remove_weak_pointer (
- G_OBJECT (priv->shell), &priv->shell);
- priv->shell = NULL;
- }
-
if (priv->shell_view_class != NULL) {
g_type_class_unref (priv->shell_view_class);
priv->shell_view_class = NULL;
}
/* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ G_OBJECT_CLASS (e_shell_backend_parent_class)->dispose (object);
}
static void
@@ -144,7 +117,7 @@ shell_backend_finalize (GObject *object)
g_free (priv->data_dir);
/* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_shell_backend_parent_class)->finalize (object);
}
static const gchar *
@@ -189,39 +162,25 @@ shell_backend_get_data_dir (EShellBackend *shell_backend)
}
static void
-shell_backend_class_init (EShellBackendClass *class)
+e_shell_backend_class_init (EShellBackendClass *class)
{
GObjectClass *object_class;
+ EExtensionClass *extension_class;
- parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EShellBackendPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->set_property = shell_backend_set_property;
- object_class->get_property = shell_backend_get_property;
+ object_class->constructor = shell_backend_constructor;
object_class->dispose = shell_backend_dispose;
object_class->finalize = shell_backend_finalize;
+ extension_class = E_EXTENSION_CLASS (class);
+ extension_class->extensible_type = E_TYPE_SHELL;
+
class->get_config_dir = shell_backend_get_config_dir;
class->get_data_dir = shell_backend_get_data_dir;
/**
- * EShellBackend:shell
- *
- * The #EShell singleton.
- **/
- g_object_class_install_property (
- object_class,
- PROP_SHELL,
- g_param_spec_object (
- "shell",
- _("Shell"),
- _("The EShell singleton"),
- E_TYPE_SHELL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- /**
* EShellBackend::activity-added
* @shell_backend: the #EShellBackend that emitted the signal
* @activity: an #EActivity
@@ -239,44 +198,9 @@ shell_backend_class_init (EShellBackendClass *class)
}
static void
-shell_backend_init (EShellBackend *shell_backend,
- EShellBackendClass *class)
+e_shell_backend_init (EShellBackend *shell_backend)
{
- EShellViewClass *shell_view_class;
-
shell_backend->priv = E_SHELL_BACKEND_GET_PRIVATE (shell_backend);
-
- /* Install a reference to ourselves in the corresponding
- * EShellViewClass structure, */
- shell_view_class = g_type_class_ref (class->shell_view_type);
- shell_view_class->shell_backend = g_object_ref (shell_backend);
- shell_backend->priv->shell_view_class = shell_view_class;
-}
-
-GType
-e_shell_backend_get_type (void)
-{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- const GTypeInfo type_info = {
- sizeof (EShellBackendClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) shell_backend_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EShellBackend),
- 0, /* n_preallocs */
- (GInstanceInitFunc) shell_backend_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EShellBackend", &type_info, 0);
- }
-
- return type;
}
/**
@@ -358,9 +282,13 @@ e_shell_backend_get_data_dir (EShellBackend *shell_backend)
EShell *
e_shell_backend_get_shell (EShellBackend *shell_backend)
{
+ EExtensible *extensible;
+
g_return_val_if_fail (E_IS_SHELL_BACKEND (shell_backend), NULL);
- return E_SHELL (shell_backend->priv->shell);
+ extensible = e_extension_get_extensible (E_EXTENSION (shell_backend));
+
+ return E_SHELL (extensible);
}
/**
diff --git a/shell/e-shell-backend.h b/shell/e-shell-backend.h
index cda014e5a9..055a2a3322 100644
--- a/shell/e-shell-backend.h
+++ b/shell/e-shell-backend.h
@@ -19,17 +19,12 @@
*
*/
-/**
- * SECTION: e-shell-backend
- * @short_description: dynamically loaded capabilities
- * @include: shell/e-shell-backend.h
- **/
-
#ifndef E_SHELL_BACKEND_H
#define E_SHELL_BACKEND_H
#include <shell/e-shell-common.h>
#include <e-util/e-activity.h>
+#include <e-util/e-extension.h>
/* Standard GObject macros */
#define E_TYPE_SHELL_BACKEND \
@@ -66,7 +61,7 @@ typedef struct _EShellBackendPrivate EShellBackendPrivate;
* functions below.
**/
struct _EShellBackend {
- GObject parent;
+ EExtension parent;
EShellBackendPrivate *priv;
};
@@ -100,7 +95,7 @@ struct _EShellBackend {
* #EShellBackendClass contains a number of important settings for subclasses.
**/
struct _EShellBackendClass {
- GObjectClass parent_class;
+ EExtensionClass parent_class;
GType shell_view_type;
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index e0102908de..5d5857cfc2 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -19,11 +19,18 @@
*
*/
+/**
+ * SECTION: e-shell-content
+ * @short_description: the right side of the main window
+ * @include: shell/e-shell-content.h
+ **/
+
#include "e-shell-content.h"
#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"
@@ -41,9 +48,9 @@
struct _EShellContentPrivate {
- gpointer shell_view; /* weak pointer */
+ gpointer shell_view; /* weak pointer */
- GtkWidget *searchbar;
+ GtkWidget *searchbar; /* not referenced */
/* Custom search rules. */
gchar *user_filename;
@@ -54,7 +61,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,17 +140,15 @@ 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
shell_content_constructed (GObject *object)
{
- EShellContentClass *class;
EShellContent *shell_content;
EShellBackend *shell_backend;
EShellView *shell_view;
- GtkWidget *widget;
const gchar *data_dir;
shell_content = E_SHELL_CONTENT (object);
@@ -156,37 +163,7 @@ shell_content_constructed (GObject *object)
shell_content->priv->user_filename =
g_build_filename (data_dir, "searches.xml", NULL);
- class = E_SHELL_CONTENT_GET_CLASS (shell_content);
- if (class->construct_searchbar != NULL)
- widget = class->construct_searchbar (shell_content);
- else
- widget = NULL;
- if (widget != NULL) {
- gtk_widget_set_parent (widget, GTK_WIDGET (shell_content));
- shell_content->priv->searchbar = g_object_ref (widget);
- gtk_widget_show (widget);
- }
-}
-
-static void
-shell_content_destroy (GtkObject *gtk_object)
-{
- EShellContentPrivate *priv;
-
- priv = E_SHELL_CONTENT_GET_PRIVATE (gtk_object);
-
- /* Unparent the widget before destroying it to avoid
- * writing a custom GtkContainer::remove() method. */
-
- if (priv->searchbar != NULL) {
- gtk_widget_unparent (priv->searchbar);
- gtk_widget_destroy (priv->searchbar);
- g_object_unref (priv->searchbar);
- priv->searchbar = NULL;
- }
-
- /* Chain up to parent's destroy() method. */
- GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
}
static void
@@ -251,6 +228,26 @@ shell_content_size_allocate (GtkWidget *widget,
}
static void
+shell_content_remove (GtkContainer *container,
+ GtkWidget *widget)
+{
+ GtkContainerClass *container_class;
+ EShellContentPrivate *priv;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (container);
+
+ if (widget == priv->searchbar) {
+ gtk_widget_unparent (priv->searchbar);
+ priv->searchbar = NULL;
+ return;
+ }
+
+ /* Chain up to parent's remove() method. */
+ container_class = GTK_CONTAINER_CLASS (e_shell_content_parent_class);
+ container_class->remove (container, widget);
+}
+
+static void
shell_content_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
@@ -265,51 +262,17 @@ 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);
}
-static gchar *
-shell_content_get_search_name (EShellContent *shell_content)
-{
- EShellSearchbar *searchbar;
- EShellView *shell_view;
- EFilterRule *rule;
- const gchar *search_text;
-
- shell_view = e_shell_content_get_shell_view (shell_content);
-
- rule = e_shell_view_get_search_rule (shell_view);
- g_return_val_if_fail (E_IS_FILTER_RULE (rule), NULL);
-
- searchbar = E_SHELL_SEARCHBAR (shell_content->priv->searchbar);
- search_text = e_shell_searchbar_get_search_text (searchbar);
-
- if (search_text == NULL || *search_text == '\0')
- search_text = "''";
-
- return g_strdup_printf ("%s %s", rule->name, search_text);
-}
-
-static GtkWidget *
-shell_content_construct_searchbar (EShellContent *shell_content)
-{
- EShellView *shell_view;
-
- shell_view = e_shell_content_get_shell_view (shell_content);
-
- return e_shell_searchbar_new (shell_view);
-}
-
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);
@@ -318,19 +281,14 @@ shell_content_class_init (EShellContentClass *class)
object_class->dispose = shell_content_dispose;
object_class->constructed = shell_content_constructed;
- gtk_object_class = GTK_OBJECT_CLASS (class);
- gtk_object_class->destroy = shell_content_destroy;
-
widget_class = GTK_WIDGET_CLASS (class);
widget_class->size_request = shell_content_size_request;
widget_class->size_allocate = shell_content_size_allocate;
container_class = GTK_CONTAINER_CLASS (class);
+ container_class->remove = shell_content_remove;
container_class->forall = shell_content_forall;
- class->get_search_name = shell_content_get_search_name;
- class->construct_searchbar = shell_content_construct_searchbar;
-
/**
* EShellContent:shell-view
*
@@ -349,39 +307,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
@@ -400,21 +332,34 @@ e_shell_content_new (EShellView *shell_view)
}
/**
- * e_shell_content_get_searchbar:
+ * e_shell_content_set_searchbar:
* @shell_content: an #EShellContent
+ * @searchbar: a #GtkWidget, or %NULL
*
- * Returns the search bar widget returned by the
- * <structfield>construct_searchbar</structfield> method in
- * #EShellContentClass.
- *
- * Returns: the search bar widget
+ * Packs @searchbar at the top of @shell_content.
**/
-GtkWidget *
-e_shell_content_get_searchbar (EShellContent *shell_content)
+void
+e_shell_content_set_searchbar (EShellContent *shell_content,
+ GtkWidget *searchbar)
{
- g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ if (searchbar != NULL) {
+ g_return_if_fail (GTK_IS_WIDGET (searchbar));
+ g_object_ref_sink (searchbar);
+ }
- return shell_content->priv->searchbar;
+ if (shell_content->priv->searchbar != NULL)
+ gtk_container_remove (
+ GTK_CONTAINER (shell_content),
+ shell_content->priv->searchbar);
+
+ shell_content->priv->searchbar = searchbar;
+
+ if (searchbar != NULL)
+ gtk_widget_set_parent (searchbar, GTK_WIDGET (shell_content));
+
+ gtk_widget_queue_resize (GTK_WIDGET (shell_content));
}
/**
@@ -459,29 +404,6 @@ e_shell_content_get_shell_view (EShellContent *shell_content)
return E_SHELL_VIEW (shell_content->priv->shell_view);
}
-/**
- * e_shell_content_get_search_name:
- * @shell_content: an #EShellContent
- *
- * Returns a newly-allocated string containing a suitable name for the
- * current search criteria. This is used as the suggested name in the
- * Save Search dialog. Free the returned string with g_free().
- *
- * Returns: a name for the current search criteria
- **/
-gchar *
-e_shell_content_get_search_name (EShellContent *shell_content)
-{
- EShellContentClass *class;
-
- g_return_val_if_fail (E_IS_SHELL_CONTENT (shell_content), NULL);
-
- class = E_SHELL_CONTENT_GET_CLASS (shell_content);
- g_return_val_if_fail (class->get_search_name != NULL, NULL);
-
- return class->get_search_name (shell_content);
-}
-
void
e_shell_content_run_advanced_search_dialog (EShellContent *shell_content)
{
@@ -607,7 +529,7 @@ e_shell_content_run_save_search_dialog (EShellContent *shell_content)
g_return_if_fail (E_IS_FILTER_RULE (rule));
rule = e_filter_rule_clone (rule);
- search_name = e_shell_content_get_search_name (shell_content);
+ search_name = e_shell_view_get_search_name (shell_view);
e_filter_rule_set_name (rule, search_name);
g_free (search_name);
diff --git a/shell/e-shell-content.h b/shell/e-shell-content.h
index 3c3332b17b..e6a11291a7 100644
--- a/shell/e-shell-content.h
+++ b/shell/e-shell-content.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-content
- * @short_description: the right side of the main window
- * @include: shell/e-shell-content.h
- **/
-
#ifndef E_SHELL_CONTENT_H
#define E_SHELL_CONTENT_H
@@ -74,22 +68,18 @@ struct _EShellContentClass {
/* Methods */
guint32 (*check_state) (EShellContent *shell_content);
- gchar * (*get_search_name) (EShellContent *shell_content);
-
- /* This is a protected method. Not for public use. */
- GtkWidget * (*construct_searchbar) (EShellContent *shell_content);
};
GType e_shell_content_get_type (void);
GtkWidget * e_shell_content_new (struct _EShellView *shell_view);
-GtkWidget * e_shell_content_get_searchbar (EShellContent *shell_content);
+void e_shell_content_set_searchbar (EShellContent *shell_content,
+ GtkWidget *searchbar);
guint32 e_shell_content_check_state (EShellContent *shell_content);
struct _EShellView *
e_shell_content_get_shell_view (EShellContent *shell_content);
const gchar * e_shell_content_get_view_id (EShellContent *shell_content);
void e_shell_content_set_view_id (EShellContent *shell_content,
const gchar *view_id);
-gchar * e_shell_content_get_search_name (EShellContent *shell_content);
void e_shell_content_run_advanced_search_dialog
(EShellContent *shell_content);
void e_shell_content_run_edit_searches_dialog
diff --git a/shell/e-shell-meego.c b/shell/e-shell-meego.c
new file mode 100644
index 0000000000..70401c1e62
--- /dev/null
+++ b/shell/e-shell-meego.c
@@ -0,0 +1,152 @@
+/*
+ * e-shell-meego.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)
+ *
+ * Inspired by mx's mx-application.c by
+ * Thomas Wood <thomas.wood@intel.com>,
+ * Chris Lord <chris@linux.intel.com>
+ */
+
+#include <glib.h>
+#include <e-shell-meego.h>
+
+#ifndef G_OS_WIN32
+#include <gdk/gdkx.h>
+#include <X11/Xatom.h>
+#endif
+
+#ifdef G_OS_WIN32
+void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen)
+{
+ *is_meego = *small_screen = FALSE;
+}
+#else
+void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen)
+{
+ GdkAtom wm_win, mob_atom;
+ Atom dummy_t;
+ unsigned long dummy_l;
+ int dummy_i;
+ GdkScreen *screen;
+ GdkDisplay *display;
+ Window *wm_window_v = NULL;
+ unsigned char *moblin_string = NULL;
+ GModule *module;
+ /*
+ * Wow - this is unpleasant, but it is hard to link directly
+ * to the X libraries, and we have to use XGetWindowProperty
+ * to get to the (mind-mashed) 'supporting' window.
+ */
+ struct {
+ int (*XFree) (void *);
+ int (*XGetWindowProperty) (Display*, XID, Atom, long, long, Bool,
+ Atom, Atom *, int *, unsigned long*,
+ unsigned long*, unsigned char**);
+ } fns = { 0, 0 };
+
+ *is_meego = *small_screen = FALSE;
+
+ if (!gdk_display_get_default ())
+ return;
+
+ wm_win = gdk_atom_intern ("_NET_SUPPORTING_WM_CHECK", TRUE);
+ mob_atom = gdk_atom_intern ("_MOBLIN", TRUE);
+ if (!wm_win || !mob_atom)
+ return;
+
+ module = g_module_open (NULL, 0);
+ if (!module)
+ return;
+ g_module_symbol (module, "XFree", (gpointer) &fns.XFree);
+ g_module_symbol (module, "XGetWindowProperty",
+ (gpointer) &fns.XGetWindowProperty);
+ if (!fns.XFree || !fns.XGetWindowProperty) {
+ fprintf (stderr, "defective X server\n");
+ goto exit;
+ }
+
+ display = gdk_display_get_default ();
+ screen = gdk_display_get_default_screen (gdk_display_get_default());
+
+ gdk_error_trap_push ();
+
+ /* get the window manager's supporting window */
+ fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display),
+ GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
+ gdk_x11_atom_to_xatom_for_display (display, wm_win),
+ 0, 1, False, XA_WINDOW, &dummy_t, &dummy_i,
+ &dummy_l, &dummy_l, (unsigned char **)(&wm_window_v));
+
+ /* get the '_Moblin' setting */
+ if (wm_window_v && (*wm_window_v != None))
+ fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), *wm_window_v,
+ gdk_x11_atom_to_xatom_for_display (display, mob_atom),
+ 0, 8192, False, XA_STRING,
+ &dummy_t, &dummy_i, &dummy_l, &dummy_l,
+ &moblin_string);
+
+ gdk_error_trap_pop ();
+
+ if (moblin_string) {
+ int i;
+ char **props;
+
+ g_warning ("prop '%s'", moblin_string);
+
+ /* use meego theming tweaks */
+ *is_meego = TRUE;
+
+ props = g_strsplit ((gchar *)moblin_string, ":", -1);
+ for (i = 0; props && props[i]; i++) {
+ char **pair = g_strsplit (props[i], "=", 2);
+
+ g_warning ("pair '%s'='%s'", pair ? pair[0] : "<null>",
+ pair && pair[0] ? pair[1] : "<null>");
+
+ /* Hunt for session-type=small-screen */
+ if (pair && pair[0] && !g_ascii_strcasecmp (pair[0], "session-type"))
+ *small_screen = !g_ascii_strcasecmp (pair[1], "small-screen");
+ g_strfreev (pair);
+ }
+ g_strfreev (props);
+ fns.XFree (moblin_string);
+ }
+
+ exit:
+ if (wm_window_v)
+ fns.XFree (wm_window_v);
+
+ g_module_close (module);
+}
+#endif
+
+#ifdef TEST_APP
+/* gcc -g -O0 -Wall -I. -DTEST_APP `pkg-config --cflags --libs gtk+-2.0` e-shell-meego.c && ./a.out */
+#include <gtk/gtk.h>
+
+int main (int argc, char **argv)
+{
+ gboolean is_meego, small_screen;
+
+ gtk_init (&argc, &argv);
+
+ e_shell_detect_meego (&is_meego, &small_screen);
+ fprintf (stderr, "Meego ? %d small ? %d\n", is_meego, small_screen);
+
+ return 0;
+}
+#endif
diff --git a/shell/e-shell-meego.h b/shell/e-shell-meego.h
new file mode 100644
index 0000000000..54a7d528b4
--- /dev/null
+++ b/shell/e-shell-meego.h
@@ -0,0 +1,24 @@
+/*
+ * e-shell-meego.h
+ *
+ * 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)
+ */
+#ifndef E_SHELL_MEEGO_H
+#define E_SHELL_MEEGO_H
+
+extern void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen);
+
+#endif /* E_SHELL_MEEGO_H */
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 272ba0e906..940bd9fd6b 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -19,6 +19,12 @@
*
*/
+/**
+ * SECTION: e-shell-searchbar
+ * @short_description: quick search interface
+ * @include: shell/e-shell-searchbar.h
+ **/
+
#include "e-shell-searchbar.h"
#include <config.h>
@@ -26,6 +32,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"
@@ -60,8 +67,9 @@ struct _EShellSearchbarPrivate {
/* State Key File */
gchar *state_group;
+ guint express_mode : 1;
guint filter_visible : 1;
- guint label_visible : 1;
+ guint labels_visible : 1;
guint search_visible : 1;
guint scope_visible : 1;
guint state_dirty : 1;
@@ -69,9 +77,10 @@ struct _EShellSearchbarPrivate {
enum {
PROP_0,
+ PROP_EXPRESS_MODE,
PROP_FILTER_COMBO_BOX,
PROP_FILTER_VISIBLE,
- PROP_LABEL_VISIBLE,
+ PROP_LABELS_VISIBLE,
PROP_SEARCH_HINT,
PROP_SEARCH_OPTION,
PROP_SEARCH_TEXT,
@@ -82,7 +91,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)
@@ -463,14 +474,20 @@ shell_searchbar_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EXPRESS_MODE:
+ e_shell_searchbar_set_express_mode (
+ E_SHELL_SEARCHBAR (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_FILTER_VISIBLE:
e_shell_searchbar_set_filter_visible (
E_SHELL_SEARCHBAR (object),
g_value_get_boolean (value));
return;
- case PROP_LABEL_VISIBLE:
- e_shell_searchbar_set_label_visible (
+ case PROP_LABELS_VISIBLE:
+ e_shell_searchbar_set_labels_visible (
E_SHELL_SEARCHBAR (object),
g_value_get_boolean (value));
return;
@@ -528,15 +545,21 @@ shell_searchbar_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EXPRESS_MODE:
+ g_value_set_boolean (
+ value, e_shell_searchbar_get_express_mode (
+ E_SHELL_SEARCHBAR (object)));
+ return;
+
case PROP_FILTER_COMBO_BOX:
g_value_set_object (
value, e_shell_searchbar_get_filter_combo_box (
E_SHELL_SEARCHBAR (object)));
return;
- case PROP_LABEL_VISIBLE:
+ case PROP_LABELS_VISIBLE:
g_value_set_boolean (
- value, e_shell_searchbar_get_label_visible (
+ value, e_shell_searchbar_get_labels_visible (
E_SHELL_SEARCHBAR (object)));
return;
@@ -620,7 +643,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 +716,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 +733,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);
@@ -727,6 +751,17 @@ shell_searchbar_class_init (EShellSearchbarClass *class)
g_object_class_install_property (
object_class,
+ PROP_EXPRESS_MODE,
+ g_param_spec_boolean (
+ "express-mode",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
PROP_FILTER_COMBO_BOX,
g_param_spec_object (
"filter-combo-box",
@@ -737,9 +772,9 @@ shell_searchbar_class_init (EShellSearchbarClass *class)
g_object_class_install_property (
object_class,
- PROP_LABEL_VISIBLE,
+ PROP_LABELS_VISIBLE,
g_param_spec_boolean (
- "label-visible",
+ "labels-visible",
NULL,
NULL,
TRUE,
@@ -853,7 +888,7 @@ shell_searchbar_class_init (EShellSearchbarClass *class)
}
static void
-shell_searchbar_init (EShellSearchbar *searchbar)
+e_shell_searchbar_init (EShellSearchbar *searchbar)
{
GtkBox *box;
GtkLabel *label;
@@ -884,6 +919,10 @@ shell_searchbar_init (EShellSearchbar *searchbar)
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
+ e_binding_new (
+ searchbar, "labels-visible",
+ widget, "visible");
+
label = GTK_LABEL (widget);
widget = e_action_combo_box_new ();
@@ -911,11 +950,12 @@ shell_searchbar_init (EShellSearchbar *searchbar)
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
- label = GTK_LABEL (widget);
e_binding_new (
- searchbar, "label-visible",
+ searchbar, "labels-visible",
widget, "visible");
+ label = GTK_LABEL (widget);
+
widget = e_hinted_entry_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
@@ -989,32 +1029,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
@@ -1048,6 +1062,31 @@ e_shell_searchbar_get_shell_view (EShellSearchbar *searchbar)
return E_SHELL_VIEW (searchbar->priv->shell_view);
}
+gboolean
+e_shell_searchbar_get_express_mode (EShellSearchbar *searchbar)
+{
+ g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
+
+ return searchbar->priv->express_mode;
+}
+
+void
+e_shell_searchbar_set_express_mode (EShellSearchbar *searchbar,
+ gboolean express_mode)
+{
+ g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+
+ searchbar->priv->express_mode = express_mode;
+
+ /* Emit "notify" on all the properties we override. */
+ g_object_freeze_notify (G_OBJECT (searchbar));
+ g_object_notify (G_OBJECT (searchbar), "express-mode");
+ g_object_notify (G_OBJECT (searchbar), "labels-visible");
+ g_object_notify (G_OBJECT (searchbar), "filter-visible");
+ g_object_notify (G_OBJECT (searchbar), "scope-visible");
+ g_object_thaw_notify (G_OBJECT (searchbar));
+}
+
EActionComboBox *
e_shell_searchbar_get_filter_combo_box (EShellSearchbar *searchbar)
{
@@ -1057,22 +1096,26 @@ e_shell_searchbar_get_filter_combo_box (EShellSearchbar *searchbar)
}
gboolean
-e_shell_searchbar_get_label_visible (EShellSearchbar *searchbar)
+e_shell_searchbar_get_labels_visible (EShellSearchbar *searchbar)
{
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
- return searchbar->priv->label_visible;
+ /* Express mode overrides this. */
+ if (e_shell_searchbar_get_express_mode (searchbar))
+ return FALSE;
+
+ return searchbar->priv->labels_visible;
}
void
-e_shell_searchbar_set_label_visible (EShellSearchbar *searchbar,
- gboolean label_visible)
+e_shell_searchbar_set_labels_visible (EShellSearchbar *searchbar,
+ gboolean labels_visible)
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
- searchbar->priv->label_visible = label_visible;
+ searchbar->priv->labels_visible = labels_visible;
- g_object_notify (G_OBJECT (searchbar), "label-visible");
+ g_object_notify (G_OBJECT (searchbar), "labels-visible");
}
gboolean
@@ -1080,6 +1123,10 @@ e_shell_searchbar_get_filter_visible (EShellSearchbar *searchbar)
{
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
+ /* Express mode overrides this. */
+ if (e_shell_searchbar_get_express_mode (searchbar))
+ return FALSE;
+
return searchbar->priv->filter_visible;
}
@@ -1220,6 +1267,10 @@ e_shell_searchbar_get_scope_visible (EShellSearchbar *searchbar)
{
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
+ /* Express mode overrides this. */
+ if (e_shell_searchbar_get_express_mode (searchbar))
+ return FALSE;
+
return searchbar->priv->scope_visible;
}
@@ -1273,6 +1324,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
GKeyFile *key_file;
GtkAction *action;
GtkWidget *widget;
+ gboolean express_mode;
const gchar *search_text;
const gchar *state_group;
const gchar *key;
@@ -1288,6 +1340,8 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
key_file = e_shell_view_get_state_key_file (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ express_mode = e_shell_searchbar_get_express_mode (searchbar);
+
/* Changing the combo boxes triggers searches, so block
* the search action until the state is fully restored. */
action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
@@ -1299,7 +1353,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
key = STATE_KEY_SEARCH_FILTER;
string = g_key_file_get_string (key_file, state_group, key, NULL);
- if (string != NULL && *string != '\0')
+ if (string != NULL && *string != '\0' && !express_mode)
action = e_shell_window_get_action (shell_window, string);
else
action = NULL;
@@ -1344,7 +1398,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
key = STATE_KEY_SEARCH_SCOPE;
string = g_key_file_get_string (key_file, state_group, key, NULL);
- if (string != NULL && *string != '\0')
+ if (string != NULL && *string != '\0' && !express_mode)
action = e_shell_window_get_action (shell_window, string);
else
action = NULL;
diff --git a/shell/e-shell-searchbar.h b/shell/e-shell-searchbar.h
index 23fa480a86..84049e99e0 100644
--- a/shell/e-shell-searchbar.h
+++ b/shell/e-shell-searchbar.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-searchbar
- * @short_description: quick search interface
- * @include: shell/e-shell-searchbar.h
- **/
-
#ifndef E_SHELL_SEARCHBAR_H
#define E_SHELL_SEARCHBAR_H
@@ -75,6 +69,11 @@ struct _EShellSearchbarClass {
GType e_shell_searchbar_get_type (void);
GtkWidget * e_shell_searchbar_new (EShellView *shell_view);
EShellView * e_shell_searchbar_get_shell_view(EShellSearchbar *searchbar);
+gboolean e_shell_searchbar_get_express_mode
+ (EShellSearchbar *searchbar);
+void e_shell_searchbar_set_express_mode
+ (EShellSearchbar *searchbar,
+ gboolean express_mode);
EActionComboBox *
e_shell_searchbar_get_filter_combo_box
(EShellSearchbar *searchbar);
@@ -83,11 +82,11 @@ gboolean e_shell_searchbar_get_filter_visible
void e_shell_searchbar_set_filter_visible
(EShellSearchbar *searchbar,
gboolean filter_visible);
-gboolean e_shell_searchbar_get_label_visible
+gboolean e_shell_searchbar_get_labels_visible
(EShellSearchbar *searchbar);
-void e_shell_searchbar_set_label_visible
+void e_shell_searchbar_set_labels_visible
(EShellSearchbar *searchbar,
- gboolean label_visible);
+ gboolean labels_visible);
const gchar * e_shell_searchbar_get_search_hint
(EShellSearchbar *searchbar);
void e_shell_searchbar_set_search_hint
diff --git a/shell/e-shell-settings.c b/shell/e-shell-settings.c
index 99e1822e68..7c5cac4e53 100644
--- a/shell/e-shell-settings.c
+++ b/shell/e-shell-settings.c
@@ -19,6 +19,12 @@
*
*/
+/**
+ * SECTION: e-shell-settings
+ * @short_description: settings management
+ * @include: shell/e-shell-settings.h
+ **/
+
#include "e-shell-settings.h"
#include "e-util/gconf-bridge.h"
diff --git a/shell/e-shell-settings.h b/shell/e-shell-settings.h
index c1ac497dec..15aaff2071 100644
--- a/shell/e-shell-settings.h
+++ b/shell/e-shell-settings.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-settings
- * @short_description: settings management
- * @include: shell/e-shell-settings.h
- **/
-
#ifndef E_SHELL_SETTINGS_H
#define E_SHELL_SETTINGS_H
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index 5701321f24..edb8ba5299 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -19,9 +19,16 @@
*
*/
+/**
+ * SECTION: e-shell-sidebar
+ * @short_description: the left side of the main window
+ * @include: shell/e-shell-sidebar.h
+ **/
+
#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 +55,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 +156,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 +171,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 +200,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 +222,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 +293,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 +388,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 +456,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-sidebar.h b/shell/e-shell-sidebar.h
index 5999aa9de2..95f2e97dad 100644
--- a/shell/e-shell-sidebar.h
+++ b/shell/e-shell-sidebar.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-sidebar
- * @short_description: the left side of the main window
- * @include: shell/e-shell-sidebar.h
- **/
-
#ifndef E_SHELL_SIDEBAR_H
#define E_SHELL_SIDEBAR_H
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index 7e82e556bc..c12423de99 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -19,9 +19,16 @@
*
*/
+/**
+ * SECTION: e-shell-switcher
+ * @short_description: buttons for switching views
+ * @include: shell/e-shell-switcher.h
+ **/
+
#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 +57,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 +238,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 +361,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 +380,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 +426,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 +502,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 +520,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-switcher.h b/shell/e-shell-switcher.h
index dd3eddf970..b18546d58f 100644
--- a/shell/e-shell-switcher.h
+++ b/shell/e-shell-switcher.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-switcher
- * @short_description: buttons for switching views
- * @include: shell/e-shell-switcher.h
- **/
-
#ifndef E_SHELL_SWITCHER_H
#define E_SHELL_SWITCHER_H
diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c
index 7e8a34ac7c..bf8dfa7e2a 100644
--- a/shell/e-shell-taskbar.c
+++ b/shell/e-shell-taskbar.c
@@ -19,11 +19,18 @@
*
*/
+/**
+ * SECTION: e-shell-taskbar
+ * @short_description: the bottom of the main window
+ * @include: shell/e-shell-taskbar.h
+ **/
+
#include "e-shell-taskbar.h"
#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 +56,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 +213,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 +226,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 +248,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 +302,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 +338,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-taskbar.h b/shell/e-shell-taskbar.h
index d2ebfbb0c4..e01ec40989 100644
--- a/shell/e-shell-taskbar.h
+++ b/shell/e-shell-taskbar.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-taskbar
- * @short_description: the bottom of the main window
- * @include: shell/e-shell-taskbar.h
- **/
-
#ifndef E_SHELL_TASKBAR_H
#define E_SHELL_TASKBAR_H
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index c7b296931c..4bc9c480cb 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -19,6 +19,12 @@
*
*/
+/**
+ * SECTION: e-shell-utils
+ * @short_description: high-level utilities with shell integration
+ * @include: shell/e-shell-utils.h
+ **/
+
#include "e-shell-utils.h"
#include <glib/gi18n-lib.h>
diff --git a/shell/e-shell-utils.h b/shell/e-shell-utils.h
index e705ded2e5..428d49a836 100644
--- a/shell/e-shell-utils.h
+++ b/shell/e-shell-utils.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-utils
- * @short_description: high-level utilities with shell integration
- * @include: shell/e-shell-utils.h
- **/
-
#ifndef E_SHELL_UTILS_H
#define E_SHELL_UTILS_H
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 3a5c6e219d..6cae11cb03 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -19,24 +19,34 @@
*
*/
+/**
+ * SECTION: e-shell-view
+ * @short_description: views within the main window
+ * @include: shell/e-shell-view.h
+ **/
+
#include "e-shell-view.h"
#include <string.h>
#include <glib/gi18n.h>
-#include "e-util/e-util-private.h"
-#include "e-util/e-util.h"
+#include "e-util/e-binding.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-searchbar.h"
#include "e-shell-window-actions.h"
#define E_SHELL_VIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL_VIEW, EShellViewPrivate))
+#define SIMPLE_SEARCHBAR_WIDTH 300
#define STATE_SAVE_TIMEOUT_SECONDS 3
struct _EShellViewPrivate {
@@ -57,6 +67,7 @@ struct _EShellViewPrivate {
GtkWidget *shell_content;
GtkWidget *shell_sidebar;
GtkWidget *shell_taskbar;
+ GtkWidget *searchbar;
EFilterRule *search_rule;
guint execute_search_blocked;
@@ -69,6 +80,7 @@ enum {
PROP_0,
PROP_ACTION,
PROP_PAGE_NUM,
+ PROP_SEARCHBAR,
PROP_SEARCH_RULE,
PROP_SHELL_BACKEND,
PROP_SHELL_CONTENT,
@@ -345,8 +357,9 @@ shell_view_set_action (EShellView *shell_view,
static void
shell_view_set_shell_window (EShellView *shell_view,
- GtkWidget *shell_window)
+ EShellWindow *shell_window)
{
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
g_return_if_fail (shell_view->priv->shell_window == NULL);
shell_view->priv->shell_window = shell_window;
@@ -422,6 +435,12 @@ shell_view_get_property (GObject *object,
E_SHELL_VIEW (object)));
return;
+ case PROP_SEARCHBAR:
+ g_value_set_object (
+ value, e_shell_view_get_searchbar (
+ E_SHELL_VIEW (object)));
+ return;
+
case PROP_SEARCH_RULE:
g_value_set_object (
value, e_shell_view_get_search_rule (
@@ -522,6 +541,11 @@ shell_view_dispose (GObject *object)
priv->shell_taskbar = NULL;
}
+ if (priv->searchbar != NULL) {
+ g_object_unref (priv->searchbar);
+ priv->searchbar = NULL;
+ }
+
if (priv->search_rule != NULL) {
g_object_unref (priv->search_rule);
priv->search_rule = NULL;
@@ -575,9 +599,86 @@ shell_view_constructed (GObject *object)
shell_view->priv->shell_sidebar = g_object_ref_sink (widget);
gtk_widget_show (widget);
+ if (shell_view_class->construct_searchbar != NULL) {
+ widget = shell_view_class->construct_searchbar (shell_view);
+ shell_view->priv->searchbar = g_object_ref_sink (widget);
+ }
+
/* 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 GtkWidget *
+shell_view_construct_searchbar (EShellView *shell_view)
+{
+ EShell *shell;
+ EShellWindow *shell_window;
+ EShellContent *shell_content;
+ EShellSearchbar *shell_searchbar;
+ GtkToolItem *item;
+ GtkAction *action;
+ GtkWidget *main_toolbar;
+ GtkWidget *widget;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ shell_window = e_shell_view_get_shell_window (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
+
+ widget = e_shell_searchbar_new (shell_view);
+
+ /* In normal mode, we hand the searchbar off to EShellContent. */
+ if (!e_shell_get_express_mode (shell)) {
+ e_shell_content_set_searchbar (shell_content, widget);
+ gtk_widget_show (widget);
+ return widget;
+ }
+
+ /* Express mode is more complicated. We append a heavily simplified
+ * version of it to the main toolbar, but only show it when this shell
+ * view is active. So each view still gets its own searchbar. */
+
+ shell_searchbar = E_SHELL_SEARCHBAR (widget);
+ e_shell_searchbar_set_express_mode (shell_searchbar, TRUE);
+
+ /* XXX Hardcoded sizes are evil, but what should the width be
+ * relative to. Window width? The other toolbar width? */
+ gtk_widget_set_size_request (widget, SIMPLE_SEARCHBAR_WIDTH, -1);
+
+ main_toolbar = e_shell_window_get_managed_widget (
+ shell_window, "/search-toolbar");
+
+ item = gtk_tool_item_new ();
+ gtk_container_add (GTK_CONTAINER (item), widget);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ action = e_shell_view_get_action (shell_view);
+ e_binding_new (action, "active", widget, "visible");
+
+ gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, -1);
+
+ return widget;
+}
+
+static gchar *
+shell_view_get_search_name (EShellView *shell_view)
+{
+ EShellSearchbar *searchbar;
+ EFilterRule *rule;
+ const gchar *search_text;
+
+ rule = e_shell_view_get_search_rule (shell_view);
+ g_return_val_if_fail (E_IS_FILTER_RULE (rule), NULL);
+
+ searchbar = E_SHELL_SEARCHBAR (shell_view->priv->searchbar);
+ search_text = e_shell_searchbar_get_search_text (searchbar);
+
+ if (search_text == NULL || *search_text == '\0')
+ search_text = "''";
+
+ return g_strdup_printf ("%s %s", rule->name, search_text);
}
static void
@@ -663,6 +764,9 @@ shell_view_class_init (EShellViewClass *class)
class->new_shell_sidebar = e_shell_sidebar_new;
class->new_shell_taskbar = e_shell_taskbar_new;
+ class->construct_searchbar = shell_view_construct_searchbar;
+ class->get_search_name = shell_view_get_search_name;
+
class->toggled = shell_view_toggled;
class->clear_search = shell_view_clear_search;
class->custom_search = shell_view_custom_search;
@@ -976,9 +1080,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;
@@ -1201,6 +1314,29 @@ e_shell_view_set_page_num (EShellView *shell_view,
}
/**
+ * e_shell_view_get_search_name:
+ * @shell_view: an #EShellView
+ *
+ * Returns a newly-allocated string containing a suitable name for the
+ * current search criteria. This is used as the suggested name in the
+ * Save Search dialog. Free the returned string with g_free().
+ *
+ * Returns: a name for the current search criteria
+ **/
+gchar *
+e_shell_view_get_search_name (EShellView *shell_view)
+{
+ EShellViewClass *class;
+
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ g_return_val_if_fail (class->get_search_name != NULL, NULL);
+
+ return class->get_search_name (shell_view);
+}
+
+/**
* e_shell_view_get_search_rule:
* @shell_view: an #EShellView
*
@@ -1217,6 +1353,20 @@ e_shell_view_get_search_rule (EShellView *shell_view)
}
/**
+ * e_shell_view_get_searchbar:
+ * @shell_view: an #EShellView
+ *
+ * Returns the searchbar widget for @shell_view.
+ **/
+GtkWidget *
+e_shell_view_get_searchbar (EShellView *shell_view)
+{
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
+
+ return shell_view->priv->searchbar;
+}
+
+/**
* e_shell_view_set_search_rule:
* @shell_view: an #EShellView
* @search_rule: an #EFilterRule
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 1e189217e1..4387082f21 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-view
- * @short_description: views within the main window
- * @include: shell/e-shell-view.h
- **/
-
#ifndef E_SHELL_VIEW_H
#define E_SHELL_VIEW_H
@@ -172,6 +166,10 @@ struct _EShellViewClass {
GtkWidget * (*new_shell_sidebar) (EShellView *shell_view);
GtkWidget * (*new_shell_taskbar) (EShellView *shell_view);
+ /* Create, configure and pack a search bar widget. */
+ GtkWidget * (*construct_searchbar) (EShellView *shell_view);
+ gchar * (*get_search_name) (EShellView *shell_view);
+
/* Signals */
void (*toggled) (EShellView *shell_view);
void (*clear_search) (EShellView *shell_view);
@@ -194,6 +192,8 @@ gboolean e_shell_view_is_active (EShellView *shell_view);
gint e_shell_view_get_page_num (EShellView *shell_view);
void e_shell_view_set_page_num (EShellView *shell_view,
gint page_num);
+GtkWidget * e_shell_view_get_searchbar (EShellView *shell_view);
+gchar * e_shell_view_get_search_name (EShellView *shell_view);
EFilterRule * e_shell_view_get_search_rule (EShellView *shell_view);
void e_shell_view_set_search_rule (EShellView *shell_view,
EFilterRule *search_rule);
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index faccac8052..eda1d9106b 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -300,7 +300,6 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
merge_id = gtk_ui_manager_new_merge_id (ui_manager);
priv->gal_view_merge_id = merge_id;
-
/* Construct window widgets. */
widget = gtk_vbox_new (FALSE, 0);
@@ -425,14 +424,17 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
key = "/apps/evolution/shell/view_defaults/sidebar_visible";
gconf_bridge_bind_property (bridge, key, object, "sidebar-visible");
- object = G_OBJECT (shell_window);
- key = "/apps/evolution/shell/view_defaults/statusbar_visible";
- gconf_bridge_bind_property (bridge, key, object, "taskbar-visible");
-
if (e_shell_get_express_mode (shell)) {
+ const char *active_view = e_shell_window_get_active_view (shell_window);
e_shell_window_set_switcher_visible (shell_window, FALSE);
+ e_shell_window_set_taskbar_visible (shell_window, active_view &&
+ !strcmp (active_view, "mail"));
} else {
object = G_OBJECT (shell_window);
+ key = "/apps/evolution/shell/view_defaults/statusbar_visible";
+ gconf_bridge_bind_property (bridge, key, object, "taskbar-visible");
+
+ object = G_OBJECT (shell_window);
key = "/apps/evolution/shell/view_defaults/buttons_visible";
gconf_bridge_bind_property (bridge, key, object, "switcher-visible");
}
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 5513efbe95..f6176c1a35 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -19,10 +19,17 @@
*
*/
+/**
+ * SECTION: e-shell-window
+ * @short_description: the main window
+ * @include: shell/e-shell-window.h
+ **/
+
#include "e-shell-window-private.h"
#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 +52,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 +309,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 +318,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 *
@@ -337,17 +349,21 @@ static GtkWidget *
shell_window_construct_toolbar (EShellWindow *shell_window)
{
GtkUIManager *ui_manager;
- GtkWidget *main_toolbar;
+ GtkWidget *toolbar;
+ GtkWidget *box;
GtkToolItem *item;
ui_manager = e_shell_window_get_ui_manager (shell_window);
- main_toolbar = e_shell_window_get_managed_widget (
- shell_window, "/main-toolbar");
+ box = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (box);
e_binding_new (
shell_window, "toolbar-visible",
- main_toolbar, "visible");
+ box, "visible");
+
+ toolbar = e_shell_window_get_managed_widget (
+ shell_window, "/main-toolbar");
/* XXX Having this separator in the UI definition doesn't work
* because GtkUIManager is unaware of the "New" button, so
@@ -360,7 +376,7 @@ shell_window_construct_toolbar (EShellWindow *shell_window)
* convinced having it proxy some new type of GtkAction
* is worth the extra effort. */
item = gtk_separator_tool_item_new ();
- gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, 0);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
gtk_widget_show (GTK_WIDGET (item));
item = e_menu_tool_button_new (_("New"));
@@ -369,7 +385,7 @@ shell_window_construct_toolbar (EShellWindow *shell_window)
GTK_WIDGET (item), "clicked",
gtk_ui_manager_get_accel_group (ui_manager),
GDK_N, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
- gtk_toolbar_insert (GTK_TOOLBAR (main_toolbar), item, 0);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
gtk_widget_show (GTK_WIDGET (item));
g_signal_connect (
@@ -377,7 +393,14 @@ shell_window_construct_toolbar (EShellWindow *shell_window)
G_CALLBACK (shell_window_toolbar_update_new_menu),
GTK_MENU_TOOL_BUTTON (item));
- return main_toolbar;
+ gtk_box_pack_start (GTK_BOX (box), toolbar, TRUE, TRUE, 0);
+
+ toolbar = e_shell_window_get_managed_widget (
+ shell_window, "/search-toolbar");
+ gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
+ gtk_box_pack_start (GTK_BOX (box), toolbar, FALSE, FALSE, 0);
+
+ return box;
}
static GtkWidget *
@@ -582,11 +605,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 +801,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-window.h b/shell/e-shell-window.h
index 0bd71075c9..58401b2dba 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell-window
- * @short_description: the main window
- * @include: shell/e-shell-window.h
- **/
-
#ifndef E_SHELL_WINDOW_H
#define E_SHELL_WINDOW_H
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 459ebdc64a..f877bca4ec 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -19,6 +19,12 @@
*
*/
+/**
+ * SECTION: e-shell
+ * @short_description: the backbone of Evolution
+ * @include: shell/e-shell.h
+ **/
+
#include "e-shell.h"
#include <glib/gi18n.h>
@@ -46,7 +52,7 @@ struct _EShellPrivate {
GtkWidget *preferences_window;
/* Shell Backends */
- GList *loaded_backends;
+ GList *loaded_backends; /* not referenced */
GHashTable *backends_by_name;
GHashTable *backends_by_scheme;
@@ -401,23 +407,14 @@ shell_split_and_insert_items (GHashTable *hash_table,
}
static void
-shell_add_backend (GType type,
- EShell *shell)
+shell_process_backend (EShellBackend *shell_backend,
+ EShell *shell)
{
EShellBackendClass *class;
- EShellBackend *shell_backend;
GHashTable *backends_by_name;
GHashTable *backends_by_scheme;
const gchar *string;
- shell_backend = g_object_new (type, "shell", shell, NULL);
-
- shell->priv->loaded_backends = g_list_insert_sorted (
- shell->priv->loaded_backends, shell_backend,
- (GCompareFunc) e_shell_backend_compare);
-
- /* Bookkeeping */
-
class = E_SHELL_BACKEND_GET_CLASS (shell_backend);
backends_by_name = shell->priv->backends_by_name;
backends_by_scheme = shell->priv->backends_by_scheme;
@@ -595,10 +592,6 @@ shell_dispose (GObject *object)
priv->preferences_window = NULL;
}
- g_list_foreach (priv->loaded_backends, (GFunc) g_object_unref, NULL);
- g_list_free (priv->loaded_backends);
- priv->loaded_backends = NULL;
-
if (priv->preparing_for_line_change != NULL) {
g_object_remove_weak_pointer (
G_OBJECT (priv->preparing_for_line_change),
@@ -623,6 +616,8 @@ shell_finalize (GObject *object)
if (!unique_app_is_running (UNIQUE_APP (object)))
e_file_lock_destroy ();
+ g_list_free (priv->loaded_backends);
+
g_free (priv->geometry);
g_free (priv->module_directory);
@@ -634,6 +629,7 @@ static void
shell_constructed (GObject *object)
{
EShellPrivate *priv;
+ GList *list;
priv = E_SHELL_GET_PRIVATE (object);
@@ -653,11 +649,13 @@ shell_constructed (GObject *object)
shell_load_modules (E_SHELL (object));
- e_type_traverse (
- E_TYPE_SHELL_BACKEND, (ETypeFunc)
- shell_add_backend, object);
-
- e_extensible_load_extensions (E_EXTENSIBLE (object));
+ /* Process shell backends. */
+ list = g_list_sort (
+ e_extensible_list_extensions (
+ E_EXTENSIBLE (object), E_TYPE_SHELL_BACKEND),
+ (GCompareFunc) e_shell_backend_compare);
+ g_list_foreach (list, (GFunc) shell_process_backend, object);
+ priv->loaded_backends = list;
}
static UniqueResponse
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 5ff9abb77d..adc0ffd126 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -19,12 +19,6 @@
*
*/
-/**
- * SECTION: e-shell
- * @short_description: the backbone of Evolution
- * @include: shell/e-shell.h
- **/
-
#ifndef E_SHELL_H
#define E_SHELL_H