aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-view.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-09-07 12:02:27 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-09-07 12:02:27 +0800
commit52d683e48cf1103a9806da95c72abce2db3ae1f4 (patch)
treeb6cee16af70a03666a2d7add2e5bff5c6ed8035c /shell/e-shell-view.c
parenteca687589d106ff87cd4fca7bf581cb0532caf96 (diff)
downloadgsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.tar
gsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.tar.gz
gsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.tar.bz2
gsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.tar.lz
gsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.tar.xz
gsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.tar.zst
gsoc2013-evolution-52d683e48cf1103a9806da95c72abce2db3ae1f4.zip
Progress update:
- Contacts module mostly working now. - View and search UI not yet working. - Still refining shell design. svn path=/branches/kill-bonobo/; revision=36268
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r--shell/e-shell-view.c78
1 files changed, 76 insertions, 2 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 2cb2ec9f3c..7620cb92a7 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -23,9 +23,12 @@
#include <string.h>
#include <glib/gi18n.h>
-#include <e-task-bar.h>
+#include <filter/rule-context.h>
+#include <widgets/misc/e-search-bar.h>
+#include <widgets/misc/e-task-bar.h>
#include <e-shell-content.h>
+#include <e-shell-module.h>
#include <e-shell-sidebar.h>
#include <e-shell-window.h>
#include <e-shell-window-actions.h>
@@ -63,6 +66,70 @@ static gpointer parent_class;
static gulong signals[LAST_SIGNAL];
static void
+shell_view_setup_search_context (EShellView *shell_view)
+{
+ RuleContext *context;
+ EShellViewClass *class;
+ EShellModule *shell_module;
+ FilterRule *rule;
+ FilterPart *part;
+ GtkWidget *widget;
+ gchar *system_filename;
+ gchar *user_filename;
+
+ class = E_SHELL_VIEW_GET_CLASS (shell_view);
+ shell_module = E_SHELL_MODULE (class->type_module);
+
+ /* The filename for built-in searches is specified in a
+ * module's EShellModuleInfo. All built-in search rules
+ * live in the same directory. */
+ system_filename = g_build_filename (
+ EVOLUTION_RULEDIR,
+ e_shell_module_get_searches (shell_module), NULL);
+
+ /* The filename for custom saved searches is always of
+ * the form "$(shell_module_data_dir)/searches.xml". */
+ user_filename = g_build_filename (
+ e_shell_module_get_data_dir (shell_module),
+ "searches.xml", NULL);
+
+ context = rule_context_new ();
+ rule_context_add_part_set (
+ context, "partset", FILTER_TYPE_PART,
+ rule_context_add_part, rule_context_next_part);
+ rule_context_add_rule_set (
+ context, "ruleset", FILTER_TYPE_RULE,
+ rule_context_add_rule, rule_context_next_rule);
+ rule_context_load (context, system_filename, user_filename);
+
+ /* XXX Not sure why this is necessary. */
+ g_object_set_data_full (
+ G_OBJECT (context), "system", system_filename, g_free);
+ g_object_set_data_full (
+ G_OBJECT (context), "user", user_filename, g_free);
+
+ /* XXX I don't really understand what this does. */
+ rule = filter_rule_new ();
+ part = rule_context_next_part (context, NULL);
+ if (part == NULL)
+ g_warning (
+ "Could not load %s search; no parts.",
+ class->type_module->name);
+ else
+ filter_rule_add_part (rule, filter_part_clone (part));
+
+ g_free (system_filename);
+ g_free (user_filename);
+
+ /* Hand the context off to the search bar. */
+ widget = e_shell_view_get_content_widget (shell_view);
+ widget = e_shell_content_get_search_bar (E_SHELL_CONTENT (widget));
+ e_search_bar_set_context (E_SEARCH_BAR (widget), context);
+
+ g_object_unref (context);
+}
+
+static void
shell_view_set_page_num (EShellView *shell_view,
gint page_num)
{
@@ -205,15 +272,19 @@ static void
shell_view_constructed (GObject *object)
{
EShellViewClass *class;
+ EShellView *shell_view;
GtkWidget *sidebar;
+ shell_view = E_SHELL_VIEW (object);
class = E_SHELL_VIEW_GET_CLASS (object);
- sidebar = e_shell_view_get_sidebar_widget (E_SHELL_VIEW (object));
+ sidebar = e_shell_view_get_sidebar_widget (shell_view);
e_shell_sidebar_set_icon_name (
E_SHELL_SIDEBAR (sidebar), class->icon_name);
e_shell_sidebar_set_primary_text (
E_SHELL_SIDEBAR (sidebar), class->label);
+ shell_view_setup_search_context (shell_view);
+
/* XXX GObjectClass doesn't implement constructed(), so we will.
* Then subclasses won't have to check the function pointer
* before chaining up.
@@ -369,6 +440,9 @@ e_shell_view_set_title (EShellView *shell_view,
{
g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
+ if (title == NULL)
+ title = E_SHELL_VIEW_GET_CLASS (shell_view)->label;
+
g_free (shell_view->priv->title);
shell_view->priv->title = g_strdup (title);