[evolution] EComposer: Use a header bar as title bar
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EComposer: Use a header bar as title bar
- Date: Thu, 21 Jul 2022 11:49:06 +0000 (UTC)
commit c07df7aaab0e50c793b92de943c5c6cb984d36e9
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date: Tue Jun 7 16:46:45 2022 +0200
EComposer: Use a header bar as title bar
src/composer/e-composer-actions.c | 22 ++-----------------
src/composer/e-composer-actions.h | 4 ----
src/composer/e-composer-private.c | 45 +++++++++++++++++++++++++++++++-------
src/composer/evolution-composer.ui | 10 ---------
src/e-util/e-html-editor.c | 2 ++
5 files changed, 41 insertions(+), 42 deletions(-)
---
diff --git a/src/composer/e-composer-actions.c b/src/composer/e-composer-actions.c
index 3700ddb7d5..815c399788 100644
--- a/src/composer/e-composer-actions.c
+++ b/src/composer/e-composer-actions.c
@@ -446,7 +446,7 @@ static GtkToggleActionEntry toggle_entries[] = {
FALSE },
{ "prioritize-message",
- NULL,
+ "mail-mark-important",
N_("_Prioritize Message"),
NULL,
N_("Set the message priority to high"),
@@ -454,7 +454,7 @@ static GtkToggleActionEntry toggle_entries[] = {
FALSE },
{ "request-read-receipt",
- NULL,
+ "preferences-system-notifications",
N_("Re_quest Read Receipt"),
NULL,
N_("Get delivery notification when your message is read"),
@@ -493,22 +493,6 @@ static GtkToggleActionEntry toggle_entries[] = {
NULL,
FALSE },
- { "toolbar-prioritize-message",
- "emblem-important",
- NULL,
- NULL,
- NULL,
- NULL,
- FALSE },
-
- { "toolbar-request-read-receipt",
- "mail-forward",
- NULL,
- NULL,
- NULL,
- NULL,
- FALSE },
-
{ "toolbar-smime-encrypt",
"security-high",
NULL,
@@ -678,8 +662,6 @@ e_composer_actions_init (EMsgComposer *composer)
init_toolbar_option (PGP_SIGN, FALSE);
init_toolbar_option (PGP_ENCRYPT, FALSE);
- init_toolbar_option (PRIORITIZE_MESSAGE, TRUE);
- init_toolbar_option (REQUEST_READ_RECEIPT, TRUE);
init_toolbar_option (SMIME_SIGN, FALSE);
init_toolbar_option (SMIME_ENCRYPT, FALSE);
diff --git a/src/composer/e-composer-actions.h b/src/composer/e-composer-actions.h
index 2094e09e76..25f2a26a84 100644
--- a/src/composer/e-composer-actions.h
+++ b/src/composer/e-composer-actions.h
@@ -62,10 +62,6 @@
E_COMPOSER_ACTION ((composer), "toolbar-pgp-encrypt")
#define E_COMPOSER_ACTION_TOOLBAR_PGP_SIGN(composer) \
E_COMPOSER_ACTION ((composer), "toolbar-pgp-sign")
-#define E_COMPOSER_ACTION_TOOLBAR_PRIORITIZE_MESSAGE(composer) \
- E_COMPOSER_ACTION ((composer), "toolbar-prioritize-message")
-#define E_COMPOSER_ACTION_TOOLBAR_REQUEST_READ_RECEIPT(composer) \
- E_COMPOSER_ACTION ((composer), "toolbar-request-read-receipt")
#define E_COMPOSER_ACTION_TOOLBAR_SMIME_ENCRYPT(composer) \
E_COMPOSER_ACTION ((composer), "toolbar-smime-encrypt")
#define E_COMPOSER_ACTION_TOOLBAR_SMIME_SIGN(composer) \
diff --git a/src/composer/e-composer-private.c b/src/composer/e-composer-private.c
index 3def0021b1..0aff0e0341 100644
--- a/src/composer/e-composer-private.c
+++ b/src/composer/e-composer-private.c
@@ -81,6 +81,39 @@ composer_update_gallery_visibility (EMsgComposer *composer)
}
}
+static GtkWidget *
+composer_construct_header_bar (EMsgComposer *composer)
+{
+ GtkWidget *widget;
+ GtkWidget *button;
+
+ widget = gtk_header_bar_new ();
+ gtk_widget_show (widget);
+ gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (widget), TRUE);
+
+ button = e_header_bar_button_new (_("Send"), ACTION (SEND));
+ e_header_bar_button_css_add_class (E_HEADER_BAR_BUTTON (button), "suggested-action");
+ gtk_widget_show (button);
+ gtk_header_bar_pack_start (GTK_HEADER_BAR (widget), button);
+
+ button = e_header_bar_button_new (NULL, ACTION (SAVE_DRAFT));
+ e_header_bar_button_css_add_class (E_HEADER_BAR_BUTTON (button), "flat");
+ gtk_widget_show (button);
+ gtk_header_bar_pack_start (GTK_HEADER_BAR (widget), button);
+
+ button = e_header_bar_button_new (NULL, ACTION (PRIORITIZE_MESSAGE));
+ e_header_bar_button_css_add_class (E_HEADER_BAR_BUTTON (button), "flat");
+ gtk_widget_show (button);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (widget), button);
+
+ button = e_header_bar_button_new (NULL, ACTION (REQUEST_READ_RECEIPT));
+ e_header_bar_button_css_add_class (E_HEADER_BAR_BUTTON (button), "flat");
+ gtk_widget_show (button);
+ gtk_header_bar_pack_end (GTK_HEADER_BAR (widget), button);
+
+ return widget;
+}
+
static gchar *
e_composer_extract_lang_from_source (ESourceRegistry *registry,
const gchar *uid)
@@ -194,10 +227,8 @@ e_composer_private_constructed (EMsgComposer *composer)
GtkAction *action;
GtkWidget *container;
GtkWidget *widget;
- GtkWidget *send_widget;
GtkWindow *window;
GSettings *settings;
- const gchar *path;
gchar *filename, *gallery_path;
gint ii;
GError *error = NULL;
@@ -242,11 +273,6 @@ e_composer_private_constructed (EMsgComposer *composer)
gtk_ui_manager_add_ui_from_file (ui_manager, filename, &error);
g_free (filename);
- /* We set the send button as important to have a label */
- path = "/main-toolbar/pre-main-toolbar/send";
- send_widget = gtk_ui_manager_get_widget (ui_manager, path);
- gtk_tool_item_set_is_important (GTK_TOOL_ITEM (send_widget), TRUE);
-
composer_setup_charset_menu (composer);
if (error != NULL) {
@@ -269,7 +295,10 @@ e_composer_private_constructed (EMsgComposer *composer)
container = widget;
- /* Construct the main menu and toolbar. */
+ /* Construct the main menu and headerbar. */
+
+ widget = composer_construct_header_bar (composer);
+ gtk_window_set_titlebar (window, widget);
widget = e_html_editor_get_managed_widget (editor, "/main-menu");
diff --git a/src/composer/evolution-composer.ui b/src/composer/evolution-composer.ui
index c63a417544..f67e553f08 100644
--- a/src/composer/evolution-composer.ui
+++ b/src/composer/evolution-composer.ui
@@ -59,16 +59,6 @@
</menu>
</menubar>
<toolbar name='main-toolbar'>
- <placeholder name='pre-main-toolbar'>
- <toolitem action='send'/>
- <separator/>
- <toolitem action='save-draft'/>
- <separator/>
- </placeholder>
- <separator/>
- <toolitem action='toolbar-prioritize-message'/>
- <toolitem action='toolbar-request-read-receipt'/>
- <separator/>
<toolitem action='toolbar-pgp-sign'/>
<toolitem action='toolbar-pgp-encrypt'/>
<toolitem action='toolbar-smime-sign'/>
diff --git a/src/e-util/e-html-editor.c b/src/e-util/e-html-editor.c
index fc210af6cc..b2358e4a92 100644
--- a/src/e-util/e-html-editor.c
+++ b/src/e-util/e-html-editor.c
@@ -916,6 +916,7 @@ html_editor_constructed (GObject *object)
widget = e_html_editor_get_managed_widget (editor, "/edit-toolbar");
gtk_widget_set_hexpand (widget, TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
+ gtk_toolbar_set_icon_size (GTK_TOOLBAR (widget), GTK_ICON_SIZE_BUTTON);
gtk_grid_attach (GTK_GRID (editor), widget, 0, 0, 1, 1);
priv->edit_toolbar = g_object_ref (widget);
gtk_widget_show (widget);
@@ -923,6 +924,7 @@ html_editor_constructed (GObject *object)
widget = e_html_editor_get_managed_widget (editor, "/html-toolbar");
gtk_widget_set_hexpand (widget, TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (widget), GTK_TOOLBAR_BOTH_HORIZ);
+ gtk_toolbar_set_icon_size (GTK_TOOLBAR (widget), GTK_ICON_SIZE_BUTTON);
gtk_grid_attach (GTK_GRID (editor), widget, 0, 1, 1, 1);
priv->html_toolbar = g_object_ref (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]