Commit f733f3ad authored by Milan Crha's avatar Milan Crha
Browse files

Bug 266621 - Add "To Do" bar with events and tasks for Mail view

parent b5eba9fd
......@@ -658,6 +658,32 @@
<_description>An Archive folder to use for Messages|Archive... feature when in an On This Computer folder.</_description>
</key>
<key name="show-to-do-bar" type="b">
<default>true</default>
<_summary>Whether the To Do bar is visible in the main window</_summary>
<_description>Stores whether the To Do bar is visible in the main window.</_description>
</key>
<key name="to-do-bar-width" type="i">
<default>9999</default>
<_summary>Width of the To Do bar in the main window</_summary>
<_description>Holds the width of the To Do bar for the main window.</_description>
</key>
<key name="show-to-do-bar-sub" type="b">
<default>true</default>
<_summary>Whether the To Do bar is visible in a sub-window</_summary>
<_description>Stores whether the To Do bar is visible in a sub-window.</_description>
</key>
<key name="to-do-bar-width-sub" type="i">
<default>9999</default>
<_summary>Width of the To Do bar in a sub-window</_summary>
<_description>Holds the width of the To Do bar for a sub-window.</_description>
</key>
<key name="to-do-bar-show-completed-tasks" type="b">
<default>false</default>
<_summary>Whether the To Do bar should show also completed tasks</_summary>
<_description>Stores whether the To Do bar should show also completed tasks.</_description>
</key>
<!-- The following keys are deprecated. -->
<key name="forward-style" type="i">
......
......@@ -16,6 +16,11 @@
</placeholder>
</menu>
<menu action='view-menu'>
<menu action='layout-menu'>
<placeholder name='view-layout-custom-menus'>
<menuitem action='mail-to-do-bar'/>
</placeholder>
</menu>
<placeholder name='view-custom-menus'>
<menu action='mail-preview-menu'>
<menuitem action='mail-preview'/>
......
......@@ -47,6 +47,7 @@
<menuitem action='show-toolbar'/>
<menuitem action='show-taskbar'/>
<menuitem action='show-sidebar'/>
<placeholder name='view-layout-custom-menus'/>
</menu>
<placeholder name='view-custom-menus'/>
<menu action='switcher-menu'>
......
......@@ -107,6 +107,7 @@ src/calendar/gui/e-memo-table.etspec
src/calendar/gui/e-task-table.c
src/calendar/gui/e-task-table.etspec
src/calendar/gui/e-timezone-entry.c
src/calendar/gui/e-to-do-pane.c
src/calendar/gui/e-week-view.c
src/calendar/gui/e-week-view-main-item.c
src/calendar/gui/itip-utils.c
......
......@@ -72,6 +72,7 @@ set(SOURCES
e-select-names-renderer.c
e-send-options-utils.c
e-task-table.c
e-to-do-pane.c
e-week-view-event-item.c
e-week-view-layout.c
e-week-view-main-item.c
......@@ -147,6 +148,7 @@ set(HEADERS
e-select-names-renderer.h
e-send-options-utils.h
e-task-table.h
e-to-do-pane.h
e-week-view-event-item.h
e-week-view-layout.h
e-week-view-main-item.h
......
......@@ -1822,7 +1822,7 @@ e_cal_ops_new_component_editor_from_model (ECalModel *model,
/**
* e_cal_ops_open_component_in_editor_sync:
* @model: an #ECalModel instance
* @model: (nullable): an #ECalModel instance
* @client: an #ECalClient, to which the component belongs
* @icalcomp: an #icalcomponent to open in an editor
* @force_attendees: set to TRUE to force to show attendees, FALSE to auto-detect
......@@ -1842,7 +1842,8 @@ e_cal_ops_open_component_in_editor_sync (ECalModel *model,
ECalComponent *comp;
ECompEditor *comp_editor;
g_return_if_fail (E_IS_CAL_MODEL (model));
if (model)
g_return_if_fail (E_IS_CAL_MODEL (model));
g_return_if_fail (E_IS_CAL_CLIENT (client));
g_return_if_fail (icalcomp != NULL);
......@@ -1857,8 +1858,8 @@ e_cal_ops_open_component_in_editor_sync (ECalModel *model,
ncd = g_new0 (NewComponentData, 1);
ncd->is_new_component = FALSE;
ncd->shell = g_object_ref (e_cal_model_get_shell (model));
ncd->model = g_object_ref (model);
ncd->shell = g_object_ref (model ? e_cal_model_get_shell (model) : e_shell_get_default ());
ncd->model = model ? g_object_ref (model) : NULL;
ncd->source_type = e_cal_client_get_source_type (client);
ncd->is_assigned = force_attendees;
ncd->extension_name = NULL;
......
This diff is collapsed.
/*
* Copyright (C) 2017 Red Hat, Inc. (www.redhat.com)
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation.
*
* 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 General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef E_TO_DO_PANE_H
#define E_TO_DO_PANE_H
#include <gtk/gtk.h>
#include <libedataserver/libedataserver.h>
#include <shell/e-shell-view.h>
/* Standard GObject macros */
#define E_TYPE_TO_DO_PANE \
(e_to_do_pane_get_type ())
#define E_TO_DO_PANE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), E_TYPE_TO_DO_PANE, EToDoPane))
#define E_TO_DO_PANE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), E_TYPE_TO_DO_PANE, EToDoPaneClass))
#define E_IS_TO_DO_PANE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_TO_DO_PANE))
#define E_IS_TO_DO_PANE_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), E_TYPE_TO_DO_PANE))
#define E_TO_DO_PANE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_TO_DO_PANE, EToDoPaneClass))
G_BEGIN_DECLS
typedef struct _EToDoPane EToDoPane;
typedef struct _EToDoPaneClass EToDoPaneClass;
typedef struct _EToDoPanePrivate EToDoPanePrivate;
struct _EToDoPane {
GtkGrid parent;
EToDoPanePrivate *priv;
};
struct _EToDoPaneClass {
GtkGridClass parent_class;
};
GType e_to_do_pane_get_type (void) G_GNUC_CONST;
GtkWidget * e_to_do_pane_new (EShellView *shell_view);
EShellView * e_to_do_pane_ref_shell_view (EToDoPane *to_do_pane);
gboolean e_to_do_pane_get_highlight_overdue
(EToDoPane *to_do_pane);
void e_to_do_pane_set_highlight_overdue
(EToDoPane *to_do_pane,
gboolean highlight_overdue);
const GdkRGBA * e_to_do_pane_get_overdue_color (EToDoPane *to_do_pane);
void e_to_do_pane_set_overdue_color (EToDoPane *to_do_pane,
const GdkRGBA *overdue_color);
gboolean e_to_do_pane_get_show_completed_tasks
(EToDoPane *to_do_pane);
void e_to_do_pane_set_show_completed_tasks
(EToDoPane *to_do_pane,
gboolean show_completed_tasks);
gboolean e_to_do_pane_get_use_24hour_format
(EToDoPane *to_do_pane);
void e_to_do_pane_set_use_24hour_format
(EToDoPane *to_do_pane,
gboolean use_24hour_format);
G_END_DECLS
#endif /* E_TO_DO_PANE_H */
set(extra_deps
email-engine
evolution-calendar
evolution-mail
evolution-mail-composer
evolution-mail-formatter
......
......@@ -26,6 +26,8 @@
#include <e-util/e-util-private.h>
#include "calendar/gui/e-to-do-pane.h"
#include <mail/e-mail-paned-view.h>
#include <mail/e-mail-reader.h>
#include <mail/e-mail-reader-utils.h>
......@@ -41,6 +43,7 @@
struct _EMailShellContentPrivate {
EMailView *mail_view;
GtkWidget *to_do_pane; /* not referenced */
};
enum {
......@@ -49,7 +52,8 @@ enum {
PROP_GROUP_BY_THREADS,
PROP_MAIL_VIEW,
PROP_REPLY_STYLE,
PROP_MARK_SEEN_ALWAYS
PROP_MARK_SEEN_ALWAYS,
PROP_TO_DO_PANE
};
/* Forward Declarations */
......@@ -171,6 +175,12 @@ mail_shell_content_get_property (GObject *object,
value, e_mail_reader_get_mark_seen_always (
E_MAIL_READER (object)));
return;
case PROP_TO_DO_PANE:
g_value_set_object (
value, e_mail_shell_content_get_to_do_pane (
E_MAIL_SHELL_CONTENT (object)));
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -200,9 +210,11 @@ mail_shell_content_constructed (GObject *object)
EShellView *shell_view;
EAttachmentStore *attachment_store;
EMailDisplay *display;
GtkPaned *paned;
GtkWindow *window;
GtkWidget *widget;
GtkBox *vbox;
GSettings *settings;
priv = E_MAIL_SHELL_CONTENT_GET_PRIVATE (object);
......@@ -214,10 +226,16 @@ mail_shell_content_constructed (GObject *object)
/* Build content widgets. */
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
widget = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (shell_content), widget);
gtk_widget_show (widget);
paned = GTK_PANED (widget);
widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4);
gtk_paned_pack1 (paned, widget, TRUE, FALSE);
gtk_widget_show (widget);
vbox = GTK_BOX (widget);
widget = e_mail_paned_view_new (shell_view);
......@@ -244,6 +262,33 @@ mail_shell_content_constructed (GObject *object)
mail_shell_content_transform_num_attachments_to_visible_boolean_with_settings,
NULL, NULL, NULL);
widget = e_to_do_pane_new (shell_view);
gtk_paned_pack2 (paned, widget, FALSE, FALSE);
gtk_widget_show (widget);
priv->to_do_pane = widget;
settings = e_util_ref_settings ("org.gnome.evolution.mail");
if (e_shell_window_is_main_instance (e_shell_view_get_shell_window (shell_view))) {
g_settings_bind (
settings, "to-do-bar-width",
paned, "position",
G_SETTINGS_BIND_DEFAULT);
} else {
g_settings_bind (
settings, "to-do-bar-width-sub",
paned, "position",
G_SETTINGS_BIND_DEFAULT);
}
g_settings_bind (
settings, "to-do-bar-show-completed-tasks",
priv->to_do_pane, "show-completed-tasks",
G_SETTINGS_BIND_DEFAULT);
g_object_unref (settings);
window = e_mail_reader_get_window (E_MAIL_READER (object));
widget = e_mail_reader_get_message_list (E_MAIL_READER (object));
......@@ -489,6 +534,16 @@ e_mail_shell_content_class_init (EMailShellContentClass *class)
object_class,
PROP_MARK_SEEN_ALWAYS,
"mark-seen-always");
g_object_class_install_property (
object_class,
PROP_TO_DO_PANE,
g_param_spec_object (
"to-do-pane",
"To Do Pane",
NULL,
E_TYPE_TO_DO_PANE,
G_PARAM_READABLE));
}
static void
......@@ -564,3 +619,11 @@ e_mail_shell_content_get_searchbar (EMailShellContent *mail_shell_content)
return E_SHELL_SEARCHBAR (searchbar);
}
GtkWidget *
e_mail_shell_content_get_to_do_pane (EMailShellContent *mail_shell_content)
{
g_return_val_if_fail (E_IS_MAIL_SHELL_CONTENT (mail_shell_content), NULL);
return mail_shell_content->priv->to_do_pane;
}
......@@ -70,6 +70,8 @@ EMailView * e_mail_shell_content_get_mail_view
EShellSearchbar *
e_mail_shell_content_get_searchbar
(EMailShellContent *mail_shell_content);
GtkWidget * e_mail_shell_content_get_to_do_pane
(EMailShellContent *mail_shell_content);
G_END_DECLS
......
......@@ -276,6 +276,21 @@ action_mail_attachment_bar_cb (GtkAction *action,
}
}
static void
action_mail_to_do_bar_cb (GtkAction *action,
EShellView *shell_view)
{
EShellContent *shell_content;
GtkWidget *to_do_pane;
g_return_if_fail (E_IS_MAIL_SHELL_VIEW (shell_view));
shell_content = e_shell_view_get_shell_content (shell_view);
to_do_pane = e_mail_shell_content_get_to_do_pane (E_MAIL_SHELL_CONTENT (shell_content));
gtk_widget_set_visible (to_do_pane, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
static void
action_mail_download_finished_cb (CamelStore *store,
GAsyncResult *result,
......@@ -1969,6 +1984,14 @@ static GtkToggleActionEntry mail_toggle_entries[] = {
NULL, /* Handled by property bindings */
FALSE },
{ "mail-to-do-bar",
NULL,
N_("Show To _Do Bar"),
NULL,
N_("Show To Do bar with appointments and tasks"),
G_CALLBACK (action_mail_to_do_bar_cb),
TRUE },
{ "mail-vfolder-unmatched-enable",
NULL,
N_("_Unmatched Folder Enabled"),
......@@ -2259,6 +2282,18 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view)
ACTION (MAIL_ATTACHMENT_BAR), "active",
G_SETTINGS_BIND_DEFAULT);
if (e_shell_window_is_main_instance (shell_window)) {
g_settings_bind (
settings, "show-to-do-bar",
ACTION (MAIL_TO_DO_BAR), "active",
G_SETTINGS_BIND_DEFAULT);
} else {
g_settings_bind (
settings, "show-to-do-bar-sub",
ACTION (MAIL_TO_DO_BAR), "active",
G_SETTINGS_BIND_DEFAULT);
}
g_object_unref (settings);
/* Fine tuning. */
......
......@@ -208,6 +208,8 @@
E_SHELL_WINDOW_ACTION ((window), "mail-tools-search-folders")
#define E_SHELL_WINDOW_ACTION_MAIL_TOOLS_SUBSCRIPTIONS(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-tools-subscriptions")
#define E_SHELL_WINDOW_ACTION_MAIL_TO_DO_BAR(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-to-do-bar")
#define E_SHELL_WINDOW_ACTION_MAIL_UNDELETE(window) \
E_SHELL_WINDOW_ACTION ((window), "mail-undelete")
#define E_SHELL_WINDOW_ACTION_MAIL_VFOLDER_UNMATCHED_ENABLE(window) \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment