aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-04 23:04:51 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:48 +0800
commit31b5261fdbe2c98e7f4f71e908e5d9b58609de94 (patch)
treee9157fa12b3978c68492b04c10137c74eee21b17 /modules
parent7d6027be1a9989549c80fdbe6dcf8317c54a6a6a (diff)
downloadgsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.tar
gsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.tar.gz
gsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.tar.bz2
gsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.tar.lz
gsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.tar.xz
gsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.tar.zst
gsoc2013-evolution-31b5261fdbe2c98e7f4f71e908e5d9b58609de94.zip
EShellView: Add a "view-instance" property.
EShellView now holds a reference to the active GalViewInstance. Where applicable, the EShellView subclass is responsible for keeping this up to date when the sidebar selection changes. Holding a reference allows EShellView to implement common actions like "Save Current View" directly instead pushing it on to subclasses. New functions: e_shell_view_get_view_instance e_shell_view_set_view_instance
Diffstat (limited to 'modules')
-rw-r--r--modules/addressbook/e-book-shell-view-actions.c26
-rw-r--r--modules/calendar/e-cal-shell-content.c29
-rw-r--r--modules/calendar/e-cal-shell-content.h3
-rw-r--r--modules/calendar/e-cal-shell-view-actions.c24
-rw-r--r--modules/calendar/e-cal-shell-view-private.c9
-rw-r--r--modules/calendar/e-memo-shell-content.c20
-rw-r--r--modules/calendar/e-memo-shell-content.h3
-rw-r--r--modules/calendar/e-memo-shell-view-actions.c24
-rw-r--r--modules/calendar/e-memo-shell-view-private.c9
-rw-r--r--modules/calendar/e-task-shell-content.c20
-rw-r--r--modules/calendar/e-task-shell-content.h3
-rw-r--r--modules/calendar/e-task-shell-view-actions.c24
-rw-r--r--modules/calendar/e-task-shell-view-private.c9
-rw-r--r--modules/mail/e-mail-shell-view-actions.c27
14 files changed, 23 insertions, 207 deletions
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 9d72ef377c..fe43821eaf 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -870,28 +870,6 @@ action_contact_view_cb (GtkRadioAction *action,
gtk_orientable_set_orientation (orientable, orientation);
}
-static void
-action_gal_save_custom_view_cb (GtkAction *action,
- EBookShellView *book_shell_view)
-{
- EBookShellContent *book_shell_content;
- EShellView *shell_view;
- EAddressbookView *address_view;
- GalViewInstance *view_instance;
-
- /* All shell views respond to the activation of this action,
- * which is defined by EShellWindow. But only the currently
- * active shell view proceeds with saving the custom view. */
- shell_view = E_SHELL_VIEW (book_shell_view);
- if (!e_shell_view_is_active (shell_view))
- return;
-
- book_shell_content = book_shell_view->priv->book_shell_content;
- address_view = e_book_shell_content_get_current_view (book_shell_content);
- view_instance = e_addressbook_view_get_view_instance (address_view);
- gal_view_instance_save_as (view_instance);
-}
-
static GtkActionEntry contact_entries[] = {
{ "address-book-copy",
@@ -1325,10 +1303,6 @@ e_book_shell_view_actions_init (EBookShellView *book_shell_view)
/* Fine tuning. */
- g_signal_connect (
- ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
- G_CALLBACK (action_gal_save_custom_view_cb), book_shell_view);
-
g_object_bind_property (
ACTION (CONTACT_PREVIEW), "active",
ACTION (CONTACT_VIEW_CLASSIC), "sensitive",
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index 38724aca3e..5c91354d51 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -50,8 +50,6 @@ struct _ECalShellContentPrivate {
GtkWidget *calendar;
GtkWidget *task_table;
GtkWidget *memo_table;
-
- GalViewInstance *view_instance;
};
enum {
@@ -291,11 +289,6 @@ cal_shell_content_dispose (GObject *object)
priv->memo_table = NULL;
}
- if (priv->view_instance != NULL) {
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_cal_shell_content_parent_class)->dispose (object);
}
@@ -520,7 +513,8 @@ cal_shell_content_constructed (GObject *object)
object);
/* XXX Actually, don't load the view instance just yet.
* The GtkWidget::map() callback below explains why. */
- priv->view_instance = view_instance;
+ e_shell_view_set_view_instance (shell_view, view_instance);
+ g_object_unref (view_instance);
g_signal_connect_swapped (
shell_view, "notify::view-id",
@@ -545,7 +539,13 @@ cal_shell_content_constructed (GObject *object)
static void
cal_shell_content_map (GtkWidget *widget)
{
- ECalShellContentPrivate *priv;
+ EShellView *shell_view;
+ EShellContent *shell_content;
+ GalViewInstance *view_instance;
+
+ shell_content = E_SHELL_CONTENT (widget);
+ shell_view = e_shell_content_get_shell_view (shell_content);
+ view_instance = e_shell_view_get_view_instance (shell_view);
/* XXX Delay loading the GalViewInstance until after ECalShellView
* has a chance to install the sidebar's date navigator into
@@ -553,8 +553,7 @@ cal_shell_content_map (GtkWidget *widget)
* callback in GnomeCalendar that requires the date navigator.
* Ordinarily we would do this at the end of constructed(), but
* that's too soon in this case. (This feels kind of kludgy.) */
- priv = E_CAL_SHELL_CONTENT_GET_PRIVATE (widget);
- gal_view_instance_load (priv->view_instance);
+ gal_view_instance_load (view_instance);
/* Chain up to parent's map() method. */
GTK_WIDGET_CLASS (e_cal_shell_content_parent_class)->map (widget);
@@ -932,11 +931,3 @@ e_cal_shell_content_get_searchbar (ECalShellContent *cal_shell_content)
return E_SHELL_SEARCHBAR (widget);
}
-GalViewInstance *
-e_cal_shell_content_get_view_instance (ECalShellContent *cal_shell_content)
-{
- g_return_val_if_fail (
- E_IS_CAL_SHELL_CONTENT (cal_shell_content), NULL);
-
- return cal_shell_content->priv->view_instance;
-}
diff --git a/modules/calendar/e-cal-shell-content.h b/modules/calendar/e-cal-shell-content.h
index 45aedf90c2..b42d099cb6 100644
--- a/modules/calendar/e-cal-shell-content.h
+++ b/modules/calendar/e-cal-shell-content.h
@@ -90,9 +90,6 @@ ETaskTable * e_cal_shell_content_get_task_table
EShellSearchbar *
e_cal_shell_content_get_searchbar
(ECalShellContent *cal_shell_content);
-GalViewInstance *
- e_cal_shell_content_get_view_instance
- (ECalShellContent *cal_shell_content);
void e_cal_shell_content_save_state
(ECalShellContent *cal_shell_content);
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 9a54b0603f..b59a3f3ef4 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1345,26 +1345,6 @@ action_event_schedule_appointment_cb (GtkAction *action,
edit_event_as (cal_shell_view, FALSE);
}
-static void
-action_gal_save_custom_view_cb (GtkAction *action,
- ECalShellView *cal_shell_view)
-{
- ECalShellContent *cal_shell_content;
- EShellView *shell_view;
- GalViewInstance *view_instance;
-
- /* All shell views respond to the activation of this action,
- * which is defined by EShellWindow. But only the currently
- * active shell view proceeds with saving the custom view. */
- shell_view = E_SHELL_VIEW (cal_shell_view);
- if (!e_shell_view_is_active (shell_view))
- return;
-
- cal_shell_content = cal_shell_view->priv->cal_shell_content;
- view_instance = e_cal_shell_content_get_view_instance (cal_shell_content);
- gal_view_instance_save_as (view_instance);
-}
-
static GtkActionEntry calendar_entries[] = {
{ "calendar-copy",
@@ -1938,10 +1918,6 @@ e_cal_shell_view_actions_init (ECalShellView *cal_shell_view)
action = ACTION (CALENDAR_VIEW_WORKWEEK);
gtk_action_set_is_important (action, TRUE);
- g_signal_connect (
- ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
- G_CALLBACK (action_gal_save_custom_view_cb), cal_shell_view);
-
/* Initialize the memo and task pad actions. */
e_cal_shell_view_memopad_actions_init (cal_shell_view);
e_cal_shell_view_taskpad_actions_init (cal_shell_view);
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index c8ace44255..7b0c6c472b 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -460,16 +460,13 @@ cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
}
static void
-cal_shell_view_notify_view_id_cb (ECalShellView *cal_shell_view)
+cal_shell_view_notify_view_id_cb (EShellView *shell_view)
{
- ECalShellContent *cal_shell_content;
GalViewInstance *view_instance;
const gchar *view_id;
- cal_shell_content = cal_shell_view->priv->cal_shell_content;
- view_instance =
- e_cal_shell_content_get_view_instance (cal_shell_content);
- view_id = e_shell_view_get_view_id (E_SHELL_VIEW (cal_shell_view));
+ view_id = e_shell_view_get_view_id (shell_view);
+ view_instance = e_shell_view_get_view_instance (shell_view);
/* A NULL view ID implies we're in a custom view. But you can
* only get to a custom view via the "Define Views" dialog, which
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index 3df2c424ee..ec97019f65 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -44,7 +44,6 @@ struct _EMemoShellContentPrivate {
GtkWidget *preview_pane;
ECalModel *memo_model;
- GalViewInstance *view_instance;
GtkOrientation orientation;
gchar *current_uid;
@@ -401,11 +400,6 @@ memo_shell_content_dispose (GObject *object)
priv->memo_model = NULL;
}
- if (priv->view_instance != NULL) {
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_memo_shell_content_parent_class)->dispose (object);
}
@@ -553,11 +547,9 @@ memo_shell_content_constructed (GObject *object)
view_instance, "display-view",
G_CALLBACK (memo_shell_content_display_view_cb),
object);
- priv->view_instance = view_instance;
-
- /* Do this last so e_memo_shell_content_get_view_instance() returns
- * the correct instance in GalViewInstance::loaded signal handlers. */
+ e_shell_view_set_view_instance (shell_view, view_instance);
gal_view_instance_load (view_instance);
+ g_object_unref (view_instance);
/* Restore pane positions from the last session once
* the shell view is fully initialized and visible. */
@@ -771,11 +763,3 @@ e_memo_shell_content_get_searchbar (EMemoShellContent *memo_shell_content)
return E_SHELL_SEARCHBAR (widget);
}
-GalViewInstance *
-e_memo_shell_content_get_view_instance (EMemoShellContent *memo_shell_content)
-{
- g_return_val_if_fail (
- E_IS_MEMO_SHELL_CONTENT (memo_shell_content), NULL);
-
- return memo_shell_content->priv->view_instance;
-}
diff --git a/modules/calendar/e-memo-shell-content.h b/modules/calendar/e-memo-shell-content.h
index 03a7fdc2eb..29b6985c4c 100644
--- a/modules/calendar/e-memo-shell-content.h
+++ b/modules/calendar/e-memo-shell-content.h
@@ -88,9 +88,6 @@ void e_memo_shell_content_set_preview_visible
EShellSearchbar *
e_memo_shell_content_get_searchbar
(EMemoShellContent *memo_shell_content);
-GalViewInstance *
- e_memo_shell_content_get_view_instance
- (EMemoShellContent *memo_shell_content);
G_END_DECLS
diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c
index f0c16bb99a..29dd68df9c 100644
--- a/modules/calendar/e-memo-shell-view-actions.c
+++ b/modules/calendar/e-memo-shell-view-actions.c
@@ -26,26 +26,6 @@
#include "e-memo-shell-view-private.h"
static void
-action_gal_save_custom_view_cb (GtkAction *action,
- EMemoShellView *memo_shell_view)
-{
- EMemoShellContent *memo_shell_content;
- EShellView *shell_view;
- GalViewInstance *view_instance;
-
- /* All shell views respond to the activation of this action,
- * which is defined by EShellWindow. But only the currently
- * active shell view proceeds with saving the custom view. */
- shell_view = E_SHELL_VIEW (memo_shell_view);
- if (!e_shell_view_is_active (shell_view))
- return;
-
- memo_shell_content = memo_shell_view->priv->memo_shell_content;
- view_instance = e_memo_shell_content_get_view_instance (memo_shell_content);
- gal_view_instance_save_as (view_instance);
-}
-
-static void
action_memo_delete_cb (GtkAction *action,
EMemoShellView *memo_shell_view)
{
@@ -961,10 +941,6 @@ e_memo_shell_view_actions_init (EMemoShellView *memo_shell_view)
/* Fine tuning. */
- g_signal_connect (
- ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
- G_CALLBACK (action_gal_save_custom_view_cb), memo_shell_view);
-
g_object_bind_property (
ACTION (MEMO_PREVIEW), "active",
ACTION (MEMO_VIEW_CLASSIC), "sensitive",
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index e83685548f..78d636027a 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -154,16 +154,13 @@ memo_shell_view_load_view_collection (EShellViewClass *shell_view_class)
}
static void
-memo_shell_view_notify_view_id_cb (EMemoShellView *memo_shell_view)
+memo_shell_view_notify_view_id_cb (EShellView *shell_view)
{
- EMemoShellContent *memo_shell_content;
GalViewInstance *view_instance;
const gchar *view_id;
- memo_shell_content = memo_shell_view->priv->memo_shell_content;
- view_instance =
- e_memo_shell_content_get_view_instance (memo_shell_content);
- view_id = e_shell_view_get_view_id (E_SHELL_VIEW (memo_shell_view));
+ view_id = e_shell_view_get_view_id (shell_view);
+ view_instance = e_shell_view_get_view_instance (shell_view);
/* A NULL view ID implies we're in a custom view. But you can
* only get to a custom view via the "Define Views" dialog, which
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index c4fa849609..33c65081c4 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -43,7 +43,6 @@ struct _ETaskShellContentPrivate {
GtkWidget *preview_pane;
ECalModel *task_model;
- GalViewInstance *view_instance;
GtkOrientation orientation;
gchar *current_uid;
@@ -400,11 +399,6 @@ task_shell_content_dispose (GObject *object)
priv->task_model = NULL;
}
- if (priv->view_instance != NULL) {
- g_object_unref (priv->view_instance);
- priv->view_instance = NULL;
- }
-
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_task_shell_content_parent_class)->dispose (object);
}
@@ -552,11 +546,9 @@ task_shell_content_constructed (GObject *object)
view_instance, "display-view",
G_CALLBACK (task_shell_content_display_view_cb),
object);
- priv->view_instance = view_instance;
-
- /* Do this last so e_task_shell_content_get_view_instance() returns
- * the correct instance in GalViewInstance::loaded signal handlers. */
+ e_shell_view_set_view_instance (shell_view, view_instance);
gal_view_instance_load (view_instance);
+ g_object_unref (view_instance);
/* Restore pane positions from the last session once
* the shell view is fully initialized and visible. */
@@ -795,11 +787,3 @@ e_task_shell_content_get_searchbar (ETaskShellContent *task_shell_content)
return E_SHELL_SEARCHBAR (widget);
}
-GalViewInstance *
-e_task_shell_content_get_view_instance (ETaskShellContent *task_shell_content)
-{
- g_return_val_if_fail (
- E_IS_TASK_SHELL_CONTENT (task_shell_content), NULL);
-
- return task_shell_content->priv->view_instance;
-}
diff --git a/modules/calendar/e-task-shell-content.h b/modules/calendar/e-task-shell-content.h
index 778dbde875..7f5fac68b1 100644
--- a/modules/calendar/e-task-shell-content.h
+++ b/modules/calendar/e-task-shell-content.h
@@ -92,9 +92,6 @@ void e_task_shell_content_set_preview_visible
EShellSearchbar *
e_task_shell_content_get_searchbar
(ETaskShellContent *task_shell_content);
-GalViewInstance *
- e_task_shell_content_get_view_instance
- (ETaskShellContent *task_shell_content);
G_END_DECLS
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index 5102def69b..fe0dd051b2 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -26,26 +26,6 @@
#include "e-task-shell-view-private.h"
static void
-action_gal_save_custom_view_cb (GtkAction *action,
- ETaskShellView *task_shell_view)
-{
- ETaskShellContent *task_shell_content;
- EShellView *shell_view;
- GalViewInstance *view_instance;
-
- /* All shell views respond to the activation of this action,
- * which is defined by EShellWindow. But only the currently
- * active shell view proceeds with saving the custom view. */
- shell_view = E_SHELL_VIEW (task_shell_view);
- if (!e_shell_view_is_active (shell_view))
- return;
-
- task_shell_content = task_shell_view->priv->task_shell_content;
- view_instance = e_task_shell_content_get_view_instance (task_shell_content);
- gal_view_instance_save_as (view_instance);
-}
-
-static void
action_task_assign_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
@@ -1160,10 +1140,6 @@ e_task_shell_view_actions_init (ETaskShellView *task_shell_view)
/* Fine tuning. */
- g_signal_connect (
- ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
- G_CALLBACK (action_gal_save_custom_view_cb), task_shell_view);
-
g_object_bind_property (
ACTION (TASK_PREVIEW), "active",
ACTION (TASK_VIEW_CLASSIC), "sensitive",
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 5cba0571b7..fa70b5bcae 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -219,16 +219,13 @@ task_shell_view_load_view_collection (EShellViewClass *shell_view_class)
}
static void
-task_shell_view_notify_view_id_cb (ETaskShellView *task_shell_view)
+task_shell_view_notify_view_id_cb (EShellView *shell_view)
{
- ETaskShellContent *task_shell_content;
GalViewInstance *view_instance;
const gchar *view_id;
- task_shell_content = task_shell_view->priv->task_shell_content;
- view_instance =
- e_task_shell_content_get_view_instance (task_shell_content);
- view_id = e_shell_view_get_view_id (E_SHELL_VIEW (task_shell_view));
+ view_id = e_shell_view_get_view_id (shell_view);
+ view_instance = e_shell_view_get_view_instance (shell_view);
/* A NULL view ID implies we're in a custom view. But you can
* only get to a custom view via the "Define Views" dialog, which
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index c8bec966d2..e451574ecf 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -26,29 +26,6 @@
#include "e-mail-shell-view-private.h"
static void
-action_gal_save_custom_view_cb (GtkAction *action,
- EMailShellView *mail_shell_view)
-{
- EMailShellContent *mail_shell_content;
- EShellView *shell_view;
- EMailView *mail_view;
- GalViewInstance *view_instance;
-
- /* All shell views repond to the activation of this action,
- * which is defined by EShellWindow. But only the currently
- * active shell view proceeds with saving the custom view. */
- shell_view = E_SHELL_VIEW (mail_shell_view);
- if (!e_shell_view_is_active (shell_view))
- return;
-
- mail_shell_content = mail_shell_view->priv->mail_shell_content;
- mail_view = e_mail_shell_content_get_mail_view (mail_shell_content);
- view_instance = e_mail_view_get_view_instance (mail_view);
-
- gal_view_instance_save_as (view_instance);
-}
-
-static void
action_mail_account_disable_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
@@ -2225,10 +2202,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
shell, "online",
ACTION (MAIL_DOWNLOAD), "sensitive",
G_BINDING_SYNC_CREATE);
-
- g_signal_connect (
- ACTION (GAL_SAVE_CUSTOM_VIEW), "activate",
- G_CALLBACK (action_gal_save_custom_view_cb), mail_shell_view);
}
/* Helper for e_mail_shell_view_update_popup_labels() */