aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-content.c32
-rw-r--r--shell/e-shell-content.h3
-rw-r--r--shell/e-shell-module.c1
-rw-r--r--shell/e-shell-module.h7
-rw-r--r--shell/e-shell-view.c4
-rw-r--r--shell/e-shell-window-actions.c9
-rw-r--r--shell/e-shell-window.c38
-rw-r--r--shell/e-shell-window.h3
-rw-r--r--shell/e-shell.c22
-rw-r--r--shell/e-shell.h2
10 files changed, 86 insertions, 35 deletions
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 87c1bbfd50..7a9d7cf3f0 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -207,6 +207,7 @@ shell_content_entry_key_press_cb (EShellContent *shell_content,
static void
shell_content_init_search_context (EShellContent *shell_content)
{
+ EShellContentClass *shell_content_class;
EShellView *shell_view;
EShellViewClass *shell_view_class;
EShellModule *shell_module;
@@ -221,9 +222,12 @@ shell_content_init_search_context (EShellContent *shell_content)
shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
g_return_if_fail (shell_view_class->search_rules != NULL);
- /* The filename for built-in searches is specified in a
- * module's EShellModuleInfo. All built-in search rules
- * live in the same directory. */
+ shell_content_class = E_SHELL_CONTENT_GET_CLASS (shell_content);
+ g_return_if_fail (shell_content_class->new_search_context != NULL);
+
+ /* The basename for built-in searches is specified in the
+ * shell view class. All built-in search rules live in the
+ * same directory. */
system_filename = g_build_filename (
EVOLUTION_RULEDIR, shell_view_class->search_rules, NULL);
@@ -233,7 +237,7 @@ shell_content_init_search_context (EShellContent *shell_content)
e_shell_module_get_data_dir (shell_module),
"searches.xml", NULL);
- context = rule_context_new ();
+ context = shell_content_class->new_search_context ();
rule_context_add_part_set (
context, "partset", FILTER_TYPE_PART,
rule_context_add_part, rule_context_next_part);
@@ -533,25 +537,8 @@ shell_content_constructed (GObject *object)
widget = shell_content->priv->search_bar;
gtk_size_group_add_widget (size_group, widget);
-}
-static void
-shell_content_realize (GtkWidget *widget)
-{
- EShellContent *shell_content;
-
- /* We can't call this during object construction because the
- * shell view is still in its instance initialization phase,
- * and so its GET_CLASS() macro won't work correctly. So we
- * delay the bits of our own initialization that require the
- * E_SHELL_VIEW_GET_CLASS() macro until after the shell view
- * is fully constructed. */
-
- shell_content = E_SHELL_CONTENT (widget);
shell_content_init_search_context (shell_content);
-
- /* Chain up to parent's realize() method. */
- GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
static void
@@ -664,7 +651,6 @@ shell_content_class_init (EShellContentClass *class)
object_class->constructed = shell_content_constructed;
widget_class = GTK_WIDGET_CLASS (class);
- widget_class->realize = shell_content_realize;
widget_class->size_request = shell_content_size_request;
widget_class->size_allocate = shell_content_size_allocate;
@@ -672,6 +658,8 @@ shell_content_class_init (EShellContentClass *class)
container_class->remove = shell_content_remove;
container_class->forall = shell_content_forall;
+ class->new_search_context = rule_context_new;
+
g_object_class_install_property (
object_class,
PROP_FILTER_ACTION,
diff --git a/shell/e-shell-content.h b/shell/e-shell-content.h
index 68e80f7dac..8d1276c94e 100644
--- a/shell/e-shell-content.h
+++ b/shell/e-shell-content.h
@@ -73,6 +73,9 @@ struct _EShellContent {
struct _EShellContentClass {
GtkBinClass parent_class;
+
+ /* Factory Methods */
+ RuleContext * (*new_search_context) (void);
};
GType e_shell_content_get_type (void);
diff --git a/shell/e-shell-module.c b/shell/e-shell-module.c
index 1fff07ee97..5ec13e00bc 100644
--- a/shell/e-shell-module.c
+++ b/shell/e-shell-module.c
@@ -49,6 +49,7 @@ struct _EShellModulePrivate {
gchar *data_dir;
GType shell_view_type;
+ GHashTable *events;
/* Initializes the loaded type module. */
void (*init) (GTypeModule *type_module);
diff --git a/shell/e-shell-module.h b/shell/e-shell-module.h
index 24bc690533..7186b13a62 100644
--- a/shell/e-shell-module.h
+++ b/shell/e-shell-module.h
@@ -60,6 +60,9 @@ typedef struct _EShellModuleInfo EShellModuleInfo;
typedef struct _EShellModuleClass EShellModuleClass;
typedef struct _EShellModulePrivate EShellModulePrivate;
+typedef struct _EShellModuleEvent EShellModuleEvent;
+typedef void (*EShellModuleEventFunc) (EShellModuleEvent *event);
+
/**
* EShellModuleInfo:
* @name: The name of the module. Also becomes the name of
@@ -85,6 +88,10 @@ typedef struct _EShellModulePrivate EShellModulePrivate;
* settings from the given version. Returns %TRUE if the
* migration was successful or if no action was necessary.
* Returns %FALSE and sets a #GError if the migration failed.
+ *
+ * Provides basic information about an #EShellModule instance. Shell
+ * modules should pass this structure to e_shell_module_set_info() in
+ * their "e_shell_module_init" functions.
**/
struct _EShellModuleInfo {
const gchar *name;
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index dad31c3f2e..e307847116 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -623,8 +623,8 @@ e_shell_view_get_name (EShellView *shell_view)
*
* Returns the switcher action for @shell_view.
*
- * An #EShellWindow creates a #GtkRadioAction for each #EShellView class
- * it instantiates. This action gets passed to the #EShellSwitcher, which
+ * An #EShellWindow creates a #GtkRadioAction for each registered subclass
+ * of #EShellView. This action gets passed to the #EShellSwitcher, which
* displays a button that proxies the action. The icon at the top of the
* sidebar also proxies the action. When @shell_view is active, the
* action's icon becomes the #EShellWindow icon.
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index a5ca5b310d..2dcdd4c4d4 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -2192,7 +2192,6 @@ e_shell_window_update_search_menu (EShellWindow *shell_window)
FilterRule *rule;
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
- GList *list, *iter;
const gchar *source;
const gchar *view_name;
gboolean sensitive;
@@ -2223,13 +2222,7 @@ e_shell_window_update_search_menu (EShellWindow *shell_window)
/* Unmerge the previous menu. */
gtk_ui_manager_remove_ui (ui_manager, merge_id);
-
- /* XXX Annoying that GTK+ doesn't provide a function for this.
- * http://bugzilla.gnome.org/show_bug.cgi?id=550485 */
- list = gtk_action_group_list_actions (action_group);
- for (iter = list; iter != NULL; iter = iter->next)
- gtk_action_group_remove_action (action_group, iter->data);
- g_list_free (list);
+ e_action_group_remove_all_actions (action_group);
rule = rule_context_next_rule (context, NULL, source);
while (rule != NULL) {
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 0d54b92bd8..de68d343e4 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -56,9 +56,8 @@ shell_window_new_view (EShellWindow *shell_window,
page_num = gtk_notebook_get_n_pages (notebook);
/* Get the switcher action for this view. */
- action_name = g_strdup_printf (SWITCHER_FORMAT, view_name);
- action = e_shell_window_get_action (shell_window, action_name);
- g_free (action_name);
+ action = e_shell_window_get_shell_view_action (
+ shell_window, view_name);
/* Create the shell view. */
shell_view = g_object_new (
@@ -434,6 +433,39 @@ e_shell_window_get_shell_view (EShellWindow *shell_window,
}
/**
+ * e_shell_window_get_shell_view_action:
+ * @shell_window: an #EShellWindow
+ * @view_name: name of a shell view
+ *
+ * Returns the switcher action for @view_name.
+ *
+ * An #EShellWindow creates a #GtkRadioAction for each registered subclass
+ * of #EShellView. This action gets passed to the #EShellSwitcher, which
+ * displays a button that proxies the action. The icon at the top of the
+ * sidebar also proxies the action. When the #EShellView named @view_name
+ * is active, the action's icon becomes the @shell_window icon.
+ *
+ * Returns: the switcher action for the #EShellView named @view_name,
+ * or %NULL if no such shell view exists
+ **/
+GtkAction *
+e_shell_window_get_shell_view_action (EShellWindow *shell_window,
+ const gchar *view_name)
+{
+ GtkAction *action;
+ gchar *action_name;
+
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (shell_window), NULL);
+ g_return_val_if_fail (view_name != NULL, NULL);
+
+ action_name = g_strdup_printf (SWITCHER_FORMAT, view_name);
+ action = e_shell_window_get_action (shell_window, action_name);
+ g_free (action_name);
+
+ return action;
+}
+
+/**
* e_shell_window_get_ui_manager:
* @shell_window: an #EShellWindow
*
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index e3bc22beef..00887cadea 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -80,6 +80,9 @@ EShell * e_shell_window_get_shell (EShellWindow *shell_window);
struct _EShellView *
e_shell_window_get_shell_view (EShellWindow *shell_window,
const gchar *view_name);
+GtkAction * e_shell_window_get_shell_view_action
+ (EShellWindow *shell_window,
+ const gchar *view_name);
GtkUIManager * e_shell_window_get_ui_manager (EShellWindow *shell_window);
GtkAction * e_shell_window_get_action (EShellWindow *shell_window,
const gchar *action_name);
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 71eaec483d..c875dcb5cf 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -54,6 +54,7 @@ enum {
};
enum {
+ EVENT,
HANDLE_URI,
SEND_RECEIVE,
WINDOW_CREATED,
@@ -356,6 +357,14 @@ shell_class_init (EShellClass *class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ signals[EVENT] = g_signal_new (
+ "event",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED | G_SIGNAL_ACTION,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
signals[HANDLE_URI] = g_signal_new (
"handle-uri",
G_OBJECT_CLASS_TYPE (object_class),
@@ -615,6 +624,19 @@ e_shell_get_preferences_window (void)
return preferences_window;
}
+void
+e_shell_event (EShell *shell,
+ const gchar *event_name)
+{
+ GQuark detail;
+
+ g_return_if_fail (E_IS_SHELL (shell));
+ g_return_if_fail (event_name != NULL);
+
+ detail = g_quark_from_string (event_name);
+ g_signal_emit (shell, signals[EVENT], detail);
+}
+
gboolean
e_shell_is_busy (EShell *shell)
{
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 183028948c..7bee6b9fff 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -103,6 +103,8 @@ EShellLineStatus
void e_shell_set_line_status (EShell *shell,
EShellLineStatus status);
GtkWidget * e_shell_get_preferences_window (void);
+void e_shell_event (EShell *shell,
+ const gchar *event_name);
gboolean e_shell_is_busy (EShell *shell);
gboolean e_shell_do_quit (EShell *shell);
gboolean e_shell_quit (EShell *shell);