[evolution] Bug 777267 - Enhance UI appearance with gtk+ 3.20 and later
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 777267 - Enhance UI appearance with gtk+ 3.20 and later
- Date: Tue, 17 Jan 2017 17:29:00 +0000 (UTC)
commit e1b58a9f4be3721c78ea906d4768637fedbc7ee4
Author: Trinh Anh Ngoc <atw1990 gmail com>
Date: Tue Jan 17 18:29:15 2017 +0100
Bug 777267 - Enhance UI appearance with gtk+ 3.20 and later
src/addressbook/gui/widgets/e-addressbook-view.c | 3 -
src/e-util/e-attachment-bar.c | 8 ++-
src/e-util/e-attachment-paned.c | 18 ++----
src/e-util/e-preview-pane.c | 3 -
src/e-util/e-table-header-item.c | 15 +----
src/e-util/e-table-header-utils.c | 6 +--
src/modules/addressbook/e-book-shell-sidebar.c | 3 -
src/modules/calendar/e-cal-base-shell-sidebar.c | 3 -
src/modules/calendar/e-cal-shell-content.c | 5 +-
src/modules/mail/e-mail-shell-sidebar.c | 3 -
src/shell/e-shell-searchbar.c | 3 +-
src/shell/e-shell-sidebar.c | 2 +-
src/shell/e-shell-switcher.c | 53 +++------------
src/shell/e-shell-window.c | 80 +++++-----------------
14 files changed, 44 insertions(+), 161 deletions(-)
---
diff --git a/src/addressbook/gui/widgets/e-addressbook-view.c
b/src/addressbook/gui/widgets/e-addressbook-view.c
index b0ff40c..3d92a2b 100644
--- a/src/addressbook/gui/widgets/e-addressbook-view.c
+++ b/src/addressbook/gui/widgets/e-addressbook-view.c
@@ -918,9 +918,6 @@ e_addressbook_view_init (EAddressbookView *view)
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (view),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (view),
- GTK_SHADOW_IN);
}
static void
diff --git a/src/e-util/e-attachment-bar.c b/src/e-util/e-attachment-bar.c
index fbe0add..2da7112 100644
--- a/src/e-util/e-attachment-bar.c
+++ b/src/e-util/e-attachment-bar.c
@@ -651,9 +651,10 @@ e_attachment_bar_init (EAttachmentBar *bar)
GtkAction *action;
GtkAdjustment *adjustment;
+ gtk_widget_set_name (GTK_WIDGET (bar), "e-attachment-bar");
+
bar->priv = E_ATTACHMENT_BAR_GET_PRIVATE (bar);
- gtk_box_set_spacing (GTK_BOX (bar), 6);
gtk_orientable_set_orientation (GTK_ORIENTABLE (bar), GTK_ORIENTATION_VERTICAL);
/* Keep the expander label and save button the same height. */
@@ -671,7 +672,7 @@ e_attachment_bar_init (EAttachmentBar *bar)
container = bar->priv->vbox;
widget = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
+ gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_NONE);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
bar->priv->icon_frame = g_object_ref (widget);
gtk_widget_show (widget);
@@ -694,7 +695,7 @@ e_attachment_bar_init (EAttachmentBar *bar)
container = bar->priv->vbox;
widget = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
+ gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_NONE);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
bar->priv->tree_frame = g_object_ref (widget);
gtk_widget_hide (widget);
@@ -719,6 +720,7 @@ e_attachment_bar_init (EAttachmentBar *bar)
container = GTK_WIDGET (bar);
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
diff --git a/src/e-util/e-attachment-paned.c b/src/e-util/e-attachment-paned.c
index 71242ab..92afe20 100644
--- a/src/e-util/e-attachment-paned.c
+++ b/src/e-util/e-attachment-paned.c
@@ -98,21 +98,11 @@ attachment_paned_notify_cb (EAttachmentPaned *paned,
label = GTK_LABEL (paned->priv->show_hide_label);
- /* Update the expander label and set the right bottom margin around the handle. */
- if (gtk_expander_get_expanded (expander)) {
- gint bottom, value;
-
+ /* Update the expander label. */
+ if (gtk_expander_get_expanded (expander))
text = _("Hide Attachment _Bar");
-
- bottom = gtk_widget_get_margin_bottom (paned->priv->controls_container);
- value = bottom - paned->priv->vpaned_handle_size;
-
- gtk_widget_set_margin_bottom (
- paned->priv->controls_container, (value < 0) ? 0 : value);
- } else {
- gtk_widget_set_margin_bottom (paned->priv->controls_container, 6);
+ else
text = _("Show Attachment _Bar");
- }
gtk_label_set_text_with_mnemonic (label, text);
@@ -641,6 +631,7 @@ e_attachment_paned_init (EAttachmentPaned *paned)
widget = gtk_notebook_new ();
gtk_widget_set_size_request (widget, -1, initial_height);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
gtk_paned_pack2 (GTK_PANED (container), widget, FALSE, FALSE);
paned->priv->notebook = g_object_ref (widget);
gtk_widget_hide (widget);
@@ -704,6 +695,7 @@ e_attachment_paned_init (EAttachmentPaned *paned)
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_margin_right (widget, 6);
gtk_widget_set_margin_left (widget, 6);
+ gtk_widget_set_margin_bottom (widget, 6);
gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0);
paned->priv->controls_container = widget;
gtk_widget_show (widget);
diff --git a/src/e-util/e-preview-pane.c b/src/e-util/e-preview-pane.c
index eeb84bf..824f556 100644
--- a/src/e-util/e-preview-pane.c
+++ b/src/e-util/e-preview-pane.c
@@ -162,9 +162,6 @@ preview_pane_constructed (GObject *object)
/* EAlertBar controls its own visibility. */
widget = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (widget),
- GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (object), widget, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (widget), priv->web_view);
gtk_widget_show (widget);
diff --git a/src/e-util/e-table-header-item.c b/src/e-util/e-table-header-item.c
index 6252121..4b16d44 100644
--- a/src/e-util/e-table-header-item.c
+++ b/src/e-util/e-table-header-item.c
@@ -1078,7 +1078,6 @@ ethi_draw (GnomeCanvasItem *item,
for (col = 0; col < cols; col++, x1 = x2) {
ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
gint col_width;
- GtkRegionFlags flags = 0;
col_width = ecol->width;
@@ -1093,20 +1092,10 @@ ethi_draw (GnomeCanvasItem *item,
if (x2 <= x1)
continue;
- if (((col + 1) % 2) == 0)
- flags |= GTK_REGION_EVEN;
- else
- flags |= GTK_REGION_ODD;
-
- if (col == 0)
- flags |= GTK_REGION_FIRST;
+ gtk_style_context_save (context);
if (col + 1 == cols)
- flags |= GTK_REGION_LAST;
-
- gtk_style_context_save (context);
- gtk_style_context_add_region (
- context, GTK_STYLE_REGION_COLUMN_HEADER, flags);
+ gtk_style_context_add_class (context, "last");
e_table_header_draw_button (
cr, ecol, GTK_WIDGET (canvas),
diff --git a/src/e-util/e-table-header-utils.c b/src/e-util/e-table-header-utils.c
index 9be35c9..a4ee366 100644
--- a/src/e-util/e-table-header-utils.c
+++ b/src/e-util/e-table-header-utils.c
@@ -149,10 +149,6 @@ e_table_header_draw_button (cairo_t *cr,
gtk_style_context_save (context);
gtk_style_context_set_state (context, state_flags);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
- if (!ecol->icon_name)
- gtk_style_context_add_class (context, "text-button");
- else
- gtk_style_context_add_class (context, "image-button");
gtk_style_context_get_padding (context, state_flags, &padding);
@@ -252,7 +248,7 @@ e_table_header_draw_button (cairo_t *cr,
}
gtk_render_icon (
- context, cr, ecol->pixbuf, xpos,
+ context, cr, ecol->pixbuf, xpos + 1,
inner_y + (inner_height - clip_height) / 2);
} else {
diff --git a/src/modules/addressbook/e-book-shell-sidebar.c b/src/modules/addressbook/e-book-shell-sidebar.c
index b87252e..ee3fc90 100644
--- a/src/modules/addressbook/e-book-shell-sidebar.c
+++ b/src/modules/addressbook/e-book-shell-sidebar.c
@@ -151,9 +151,6 @@ book_shell_sidebar_constructed (GObject *object)
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (widget),
- GTK_SHADOW_IN);
gtk_container_add (container, widget);
gtk_widget_show (widget);
diff --git a/src/modules/calendar/e-cal-base-shell-sidebar.c b/src/modules/calendar/e-cal-base-shell-sidebar.c
index 084cc9c..529abfb 100644
--- a/src/modules/calendar/e-cal-base-shell-sidebar.c
+++ b/src/modules/calendar/e-cal-base-shell-sidebar.c
@@ -719,9 +719,6 @@ cal_base_shell_sidebar_constructed (GObject *object)
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (widget),
- GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
container = widget;
diff --git a/src/modules/calendar/e-cal-shell-content.c b/src/modules/calendar/e-cal-shell-content.c
index 64c2343..518091e 100644
--- a/src/modules/calendar/e-cal-shell-content.c
+++ b/src/modules/calendar/e-cal-shell-content.c
@@ -1593,6 +1593,7 @@ cal_shell_content_constructed (GObject *object)
widget = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE);
gtk_paned_pack1 (GTK_PANED (container), widget, TRUE, FALSE);
cal_shell_content->priv->calendar_notebook = g_object_ref (widget);
gtk_widget_show (widget);
@@ -1620,10 +1621,6 @@ cal_shell_content_constructed (GObject *object)
container = widget;
- widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0);
- gtk_widget_show (widget);
-
widget = gtk_label_new (NULL);
markup = g_strdup_printf ("<b>%s</b>", _("Tasks"));
gtk_label_set_markup (GTK_LABEL (widget), markup);
diff --git a/src/modules/mail/e-mail-shell-sidebar.c b/src/modules/mail/e-mail-shell-sidebar.c
index 7c4ecb4..538cb68 100644
--- a/src/modules/mail/e-mail-shell-sidebar.c
+++ b/src/modules/mail/e-mail-shell-sidebar.c
@@ -153,9 +153,6 @@ mail_shell_sidebar_constructed (GObject *object)
gtk_scrolled_window_set_policy (
GTK_SCROLLED_WINDOW (widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (
- GTK_SCROLLED_WINDOW (widget),
- GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
diff --git a/src/shell/e-shell-searchbar.c b/src/shell/e-shell-searchbar.c
index 4de9470..bbd0b51 100644
--- a/src/shell/e-shell-searchbar.c
+++ b/src/shell/e-shell-searchbar.c
@@ -901,7 +901,8 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
searchbar->priv = E_SHELL_SEARCHBAR_GET_PRIVATE (searchbar);
gtk_box_set_spacing (GTK_BOX (searchbar), 6);
- gtk_container_set_border_width (GTK_CONTAINER (searchbar), 3);
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (searchbar)),
+ "header-box");
/* Filter Combo Widgets */
diff --git a/src/shell/e-shell-sidebar.c b/src/shell/e-shell-sidebar.c
index 4d83e5b..0d3ae3d 100644
--- a/src/shell/e-shell-sidebar.c
+++ b/src/shell/e-shell-sidebar.c
@@ -447,7 +447,7 @@ e_shell_sidebar_init (EShellSidebar *shell_sidebar)
container = widget;
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- gtk_container_set_border_width (GTK_CONTAINER (widget), 6);
+ gtk_style_context_add_class (gtk_widget_get_style_context (widget), "header-box");
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
diff --git a/src/shell/e-shell-switcher.c b/src/shell/e-shell-switcher.c
index 31d46fe..4f117d7 100644
--- a/src/shell/e-shell-switcher.c
+++ b/src/shell/e-shell-switcher.c
@@ -53,7 +53,6 @@ struct _EShellSwitcherPrivate {
GtkSettings *settings;
gulong settings_handler_id;
gboolean toolbar_visible;
- gint hpaned_handle_size;
};
enum {
@@ -116,7 +115,7 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
}
/* Figure out how many rows and columns we'll use. */
- btns_per_row = MAX (1, (allocation.width - 1) / (max_width + H_PADDING + H_PADDING -
switcher->priv->hpaned_handle_size));
+ btns_per_row = MAX (1, allocation.width / (max_width + H_PADDING));
if (!icons_only) {
/* If using text buttons, we want to try to have a
* completely filled-in grid, but if we can't, we want
@@ -151,22 +150,20 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
/* Layout the buttons. */
for (i = row_last; i >= 0; i--) {
- gint len, extra_width, left_width;
+ gint len, extra_width;
- left_width = allocation.width - 1;
x = H_PADDING + allocation.x;
y -= max_height + V_PADDING;
len = g_list_length (rows[i]);
- for (p = rows[i]; p != NULL; p = p->next, len--) {
+ if (!icons_only)
+ extra_width =
+ (allocation.width - (len * max_width) -
+ (len * H_PADDING + H_PADDING)) / len;
+ else
+ extra_width = 0;
+ for (p = rows[i]; p != NULL; p = p->next) {
GtkAllocation child_allocation;
- if (!icons_only)
- extra_width =
- (left_width - (len * max_width) -
- (len * H_PADDING + H_PADDING - switcher->priv->hpaned_handle_size)) /
len;
- else
- extra_width = 0;
-
child_allocation.x = x;
child_allocation.y = y;
child_allocation.width = max_width + extra_width;
@@ -176,7 +173,6 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
GTK_WIDGET (p->data), &child_allocation);
x += child_allocation.width + H_PADDING;
- left_width = left_width - child_allocation.width - H_PADDING;
}
}
@@ -453,31 +449,6 @@ shell_switcher_style_changed (EShellSwitcher *switcher,
g_object_notify (G_OBJECT (switcher), "toolbar-style");
}
-static void
-shell_switcher_read_handle_size (EShellSwitcher *switcher)
-{
- GtkWidget *paned;
-
- g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
-
- paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_style_get (paned, "handle-size", &switcher->priv->hpaned_handle_size, NULL);
- gtk_widget_destroy (paned);
-
- if (switcher->priv->hpaned_handle_size < 0)
- switcher->priv->hpaned_handle_size = 0;
- else if (switcher->priv->hpaned_handle_size > H_PADDING)
- switcher->priv->hpaned_handle_size = H_PADDING;
-}
-
-static void
-shell_switcher_style_updated_cb (EShellSwitcher *switcher)
-{
- g_return_if_fail (E_IS_SHELL_SWITCHER (switcher));
-
- shell_switcher_read_handle_size (switcher);
-}
-
static GtkIconSize
shell_switcher_get_icon_size (GtkToolShell *shell)
{
@@ -595,12 +566,6 @@ e_shell_switcher_init (EShellSwitcher *switcher)
gtk_widget_set_has_window (GTK_WIDGET (switcher), FALSE);
e_extensible_load_extensions (E_EXTENSIBLE (switcher));
-
- switcher->priv->hpaned_handle_size = 5;
-
- shell_switcher_read_handle_size (switcher);
-
- g_signal_connect (switcher, "style-updated", G_CALLBACK (shell_switcher_style_updated_cb), NULL);
}
static void
diff --git a/src/shell/e-shell-window.c b/src/shell/e-shell-window.c
index b063a40..8f0fc95 100644
--- a/src/shell/e-shell-window.c
+++ b/src/shell/e-shell-window.c
@@ -66,66 +66,32 @@ G_DEFINE_TYPE_WITH_CODE (
E_TYPE_EXTENSIBLE, NULL))
static const char *css =
-".table-header > .button {\
- border-radius: 0;\
- border-width: 1px 1px 1px 0;\
- border-color: @borders;\
+".table-header {\
+ border-bottom: 1px solid @borders;\
}\
-.toolbar {\
- border-bottom: 1px solid alpha(black, 0.1);\
+.button {\
+ padding: 3px 5px;\
}\
-.taskbar {\
- border-width: 1px 0 0 0;\
+.table-header .button {\
+ border-right: 1px solid @borders;\
}\
-EMailBrowser EPreviewPane GtkScrolledWindow {\
- border: none;\
+.table-header .button.last {\
+ border-right: none;\
}\
-EPaned.horizontal EPreviewPane GtkScrolledWindow {\
- border-width: 1px 0 0 0;\
+toolbar {\
+ border-bottom: 1px solid @borders;\
}\
-EPaned.vertical EPreviewPane GtkScrolledWindow {\
- border: none;\
+.taskbar border {\
+ border-width: 1px 0 0 0;\
}\
-EAddressbookView {\
- border-width: 1px 0 0 0;\
+.header-box {\
+ border-bottom: 1px solid @borders;\
+ padding: 3px;\
}\
-ECalShellContent GtkSeparator {\
- color: @borders;\
+#e-attachment-bar {\
+ border-top: 1px solid @borders;\
}\
-ECalShellContent GtkNotebook {\
- border-width: 1px 0 0 0;\
-}\
-EShellSidebar GtkScrolledWindow {\
- border-width: 1px 0 0 0;\
-}\
-.switcher-visible EShellSidebar GtkScrolledWindow {\
- border-width: 1px 0;\
-}\
-.switcher-visible ECalBaseShellSidebar EPaned {\
- -GtkPaned-handle-size: 0;\
-}\
-EMAccountPrefs GtkFrame {\
- border: none;\
-}\
-EAttachmentPaned > GtkBox > GtkPaned > GtkScrolledWindow {\
- border-width: 1px 0;\
-}\
-EHTMLEditor .toolbar {\
- border-bottom: none;\
- background: transparent;\
-}\
-ECalendar .button {\
- border: none;\
- background: none;\
- box-shadow: none;\
- padding: 4px;\
-}\
-ECalendar .button:hover {\
- color: @theme_selected_bg_color;\
-}\
-EMailConfigAssistant .sidebar {\
- border-width: 0 1px 0 0;\
-}";
+";
static void
shell_window_menubar_update_new_menu (EShellWindow *shell_window)
@@ -1717,8 +1683,6 @@ void
e_shell_window_set_switcher_visible (EShellWindow *shell_window,
gboolean switcher_visible)
{
- GtkStyleContext *style_context;
-
g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
if (shell_window->priv->switcher_visible == switcher_visible)
@@ -1726,14 +1690,6 @@ e_shell_window_set_switcher_visible (EShellWindow *shell_window,
shell_window->priv->switcher_visible = switcher_visible;
- style_context = gtk_widget_get_style_context (GTK_WIDGET (shell_window->priv->sidebar_notebook));
-
- if (switcher_visible)
- gtk_style_context_add_class (style_context, "switcher-visible");
- else
- gtk_style_context_remove_class (style_context, "switcher-visible");
-
-
g_object_notify (G_OBJECT (shell_window), "switcher-visible");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]