[shotwell] UI refresh: Update main window layout and CSS: Bug #742326
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] UI refresh: Update main window layout and CSS: Bug #742326
- Date: Tue, 6 Jan 2015 02:55:41 +0000 (UTC)
commit b5501d3f0466749321cc094c6c1852f8cb7ffc1c
Author: Trinh Anh Ngoc <atw1990 gmail com>
Date: Mon Jan 5 18:42:33 2015 -0800
UI refresh: Update main window layout and CSS: Bug #742326
This bumps the version requirement for GTK+ to 3.12.
Makefile | 2 +-
THANKS | 1 +
src/AppWindow.vala | 8 +++
src/Page.vala | 10 +----
src/Resources.vala | 97 ++++-----------------------------------
src/SearchFilter.vala | 51 ++-------------------
src/library/LibraryWindow.vala | 26 ++---------
7 files changed, 30 insertions(+), 165 deletions(-)
---
diff --git a/Makefile b/Makefile
index 368bb73..7f8a1b1 100644
--- a/Makefile
+++ b/Makefile
@@ -294,7 +294,7 @@ EXT_PKG_VERSIONS = \
gstreamer-base-1.0 >= 1.0.0 \
gstreamer-plugins-base-1.0 >= 1.0.0 \
gstreamer-pbutils-1.0 >= 1.0.0 \
- gtk+-3.0 >= 3.6.0 \
+ gtk+-3.0 >= 3.12.2 \
gudev-1.0 >= 145 \
libexif >= 0.6.16 \
libgphoto2 >= 2.4.2 \
diff --git a/THANKS b/THANKS
index c0a60b5..21834d4 100644
--- a/THANKS
+++ b/THANKS
@@ -51,6 +51,7 @@ Trevor Mehard <mehardtj g cofc edu>
mnemo <mnemo minimum se>
Rafael Monica <monraaf gmail com>
Thomas Moschny <thomas moschny gmx de>
+Trinh Anh Ngoc <atw1990 gmail com>
Paul Novak <pnovak alumni caltech edu>
Joseph Nuzman <jnuzman gmail com>
Carlos Penichet <cperezpenichet gmail com>
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 5a8e9c4..23dd0c8 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -490,6 +490,14 @@ public abstract class AppWindow : PageWindow {
ui.ensure_update();
add_accel_group(ui.get_accel_group());
+
+ Gtk.CssProvider provider = new Gtk.CssProvider();
+ try {
+ provider.load_from_data(Resources.CUSTOM_CSS, -1);
+ Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ } catch (Error err) {
+ debug("Unable to load custom CSS: %s", err.message);
+ }
}
private Gtk.ActionEntry[] create_common_actions() {
diff --git a/src/Page.vala b/src/Page.vala
index 807a926..1e6d706 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -95,8 +95,6 @@ public abstract class Page : Gtk.ScrolledWindow {
init_ui();
realize.connect(attach_view_signals);
-
- Resources.style_widget(this, Resources.SCROLL_FRAME_STYLESHEET);
}
~Page() {
@@ -218,6 +216,7 @@ public abstract class Page : Gtk.ScrolledWindow {
toolbar = toolbar_path == null ? new Gtk.Toolbar() :
ui.get_widget(toolbar_path) as Gtk.Toolbar;
toolbar.get_style_context().add_class("bottom-toolbar"); // for elementary theme
+ toolbar.set_icon_size(Gtk.IconSize.SMALL_TOOLBAR);
}
return toolbar;
}
@@ -1210,8 +1209,6 @@ public abstract class CheckerboardPage : Page {
viewport.set_border_width(0);
viewport.set_shadow_type(Gtk.ShadowType.NONE);
- Resources.style_widget(viewport, Resources.VIEWPORT_STYLESHEET);
-
viewport.add(layout);
// want to set_adjustments before adding to ScrolledWindow to let our signal handlers
@@ -1228,8 +1225,6 @@ public abstract class CheckerboardPage : Page {
// scrollbar policy
set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
- Resources.style_widget(this, Resources.PAGE_STYLESHEET);
}
public void init_item_context_menu(string path) {
@@ -1952,9 +1947,6 @@ public abstract class SinglePhotoPage : Page {
canvas.draw.connect(on_canvas_exposed);
set_event_source(canvas);
-
- // style the viewport
- Resources.style_widget(viewport, Resources.VIEWPORT_STYLESHEET);
}
public bool is_transition_in_progress() {
diff --git a/src/Resources.vala b/src/Resources.vala
index b4acbc1..61bd518 100644
--- a/src/Resources.vala
+++ b/src/Resources.vala
@@ -1054,97 +1054,20 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc.,
providers.set(widget, styler);
}
-
- public const string INSET_FRAME_STYLESHEET =
- """ .frame {
- border-style: inset;
- border-width: 1px;
- }""";
-
- public const string SCROLL_FRAME_STYLESHEET =
- """ GtkScrolledWindow {
- border-width: 0;
- border-style: none;
- border-radius: 0;
- padding: 0;
- }
-
- .frame {
- border-width: 1px;
- border-style: inset;
- }""";
-
- public const string PAGE_STYLESHEET =
- """ .frame {
- border-width: 1px;
- border-style: inset;
- border-radius: 0;
-
- padding: 0;
- }""";
-
- public const string VIEWPORT_STYLESHEET =
- """ GtkViewport {
- border-width: 1px;
- border-style: inset;
- border-radius: 0;
- padding: 0;
- }""";
-
- public const string TOOLBAR_STYLESHEET_TEMPLATE =
- """
- @define-color primary-bg %s;
-
- .toolbar {
- background-color: @primary-bg;
- border-width: 1px;
- border-color: shade (@primary-bg, 0.75);
- border-style: solid;
- }""";
- public const string SEARCH_BUTTON_STYLESHEET_TEMPLATE =
- """
- @define-color primary-bg %s;
-
- .button {
- background-image: none;
- background-color: @primary-bg;
- border-image: none;
- border-color: shade (@primary-bg, 0.75) @primary-bg shade (@primary-bg, 0.75) @primary-bg;
- border-style: solid;
- margin: 5px;
-
- -unico-border-gradient: none;
- -unico-outer-stroke-width: 0;
- -unico-outer-stroke-gradient: none;
- -unico-glow-radius: 0;
- -unico-inner-stroke-width: 0;
- -unico-inner-stroke-color: shade (@primary-bg, 1.1);
+ public const string CUSTOM_CSS =
+ """LibraryWindow {
+ -GtkPaned-handle-size: 1;
}
-
- .button:prelight {
- border-style: solid;
- border-width: 1px;
- border-color: shade (@primary-bg, 1.1);
-
- -unico-inner-stroke-color: shade (@primary-bg, 1.1);
- -unico-inner-stroke-width: 0;
-
- -unico-outer-stroke-width: 1px;
- -unico-outer-stroke-color: shade (@primary-bg, 0.8);
+ LibraryWindow .pane-separator {
+ background-color: @borders;
}
-
- .button:active {
- background-image: none;
- background-color: shade (@primary-bg, 0.75);
- border-style: solid;
- border-width: 1px;
- border-color: shade (@primary-bg, 0.6);
-
- -unico-outer-stroke-width: 1px;
- -unico-outer-stroke-color: shade (@primary-bg, 1.1);
+ SearchFilterToolbar {
+ border-width: 0 0 1px 0;
+ border-style: solid;
+ border-color: @borders;
}""";
-
+
public const string ONIMAGE_FONT_COLOR = "#000000";
public const string ONIMAGE_FONT_BACKGROUND = "rgba(255,255,255,0.5)";
}
diff --git a/src/SearchFilter.vala b/src/SearchFilter.vala
index e8f0986..d8c386a 100644
--- a/src/SearchFilter.vala
+++ b/src/SearchFilter.vala
@@ -671,10 +671,6 @@ public class SearchFilterToolbar : Gtk.Toolbar {
add(label);
}
}
-
- public void set_color(Gdk.RGBA color) {
- label.override_color(Gtk.StateFlags.NORMAL, color);
- }
}
private class ToggleActionToolButton : Gtk.ToolItem {
@@ -688,8 +684,8 @@ public class SearchFilterToolbar : Gtk.Toolbar {
button.set_active(action.active);
button.clicked.connect(on_button_activate);
button.set_has_tooltip(true);
-
- restyle();
+ button.set_relief(Gtk.ReliefStyle.NONE);
+ button.set_margin_start(2);
this.add(button);
}
@@ -711,14 +707,6 @@ public class SearchFilterToolbar : Gtk.Toolbar {
button.set_image(image);
}
-
- public void restyle() {
- string bgcolorname =
- Resources.to_css_color(Config.Facade.get_instance().get_bg_color());
- string stylesheet = Resources.SEARCH_BUTTON_STYLESHEET_TEMPLATE.printf(bgcolorname);
-
- Resources.style_widget(button, stylesheet);
- }
}
// Ticket #3260 - Add a 'close' context menu to
@@ -812,10 +800,10 @@ public class SearchFilterToolbar : Gtk.Toolbar {
button = new Gtk.Button();
button.set_image(get_filter_icon(RatingFilter.UNRATED_OR_HIGHER));
button.set_can_focus(false);
+ button.set_relief(Gtk.ReliefStyle.NONE);
+ button.set_margin_start(2);
button.clicked.connect(on_clicked);
-
- restyle();
set_homogeneous(false);
@@ -911,14 +899,6 @@ public class SearchFilterToolbar : Gtk.Toolbar {
private int get_filter_button_size(RatingFilter filter) {
return get_filter_icon_size(filter) + 2 * FILTER_BUTTON_MARGIN;
}
-
- public void restyle() {
- string bgcolorname =
- Resources.to_css_color(Config.Facade.get_instance().get_bg_color());
- string stylesheet = Resources.SEARCH_BUTTON_STYLESHEET_TEMPLATE.printf(bgcolorname);
-
- Resources.style_widget(button, stylesheet);
- }
}
public Gtk.UIManager ui = new Gtk.UIManager();
@@ -1016,10 +996,6 @@ public class SearchFilterToolbar : Gtk.Toolbar {
// Search box.
insert(search_box, -1);
- // Set background color of toolbar and update them when the configuration is updated
- Config.Facade.get_instance().bg_color_name_changed.connect(on_bg_color_name_changed);
- on_bg_color_name_changed();
-
// hook up signals to actions to be notified when they change
actions.flagged_toggled.connect(on_flagged_toggled);
actions.photos_toggled.connect(on_photos_toggled);
@@ -1037,7 +1013,6 @@ public class SearchFilterToolbar : Gtk.Toolbar {
}
~SearchFilterToolbar() {
- Config.Facade.get_instance().bg_color_name_changed.disconnect(on_bg_color_name_changed);
actions.media_context_changed.disconnect(on_media_context_changed);
@@ -1075,24 +1050,6 @@ public class SearchFilterToolbar : Gtk.Toolbar {
toolbtn_flag.set_icon_name(Resources.ICON_FILTER_FLAGGED_DISABLED);
}
- private void on_bg_color_name_changed() {
- string bgcolorname =
- Resources.to_css_color(Config.Facade.get_instance().get_bg_color());
- string toolbar_stylesheet = Resources.TOOLBAR_STYLESHEET_TEMPLATE.printf(bgcolorname);
- Resources.style_widget(this, toolbar_stylesheet);
-
- label_type.set_color(Config.Facade.get_instance().get_unselected_color());
- label_flagged.set_color(Config.Facade.get_instance().get_unselected_color());
- label_rating.set_color(Config.Facade.get_instance().get_unselected_color());
-
- toolbtn_photos.restyle();
- toolbtn_videos.restyle();
- toolbtn_raw.restyle();
- toolbtn_flag.restyle();
- rating_button.restyle();
-
- }
-
// Ticket #3260 part IV - display the context menu on secondary click
private bool on_context_menu_requested(int x, int y, int button) {
close_menu.popup(null, null, null, button, Gtk.get_current_event_time());
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index dab1f6f..908a892 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -1285,52 +1285,36 @@ public class LibraryWindow : AppWindow {
Gtk.ScrolledWindow scrolled_sidebar = new Gtk.ScrolledWindow(null, null);
scrolled_sidebar.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
scrolled_sidebar.add(sidebar_tree);
- scrolled_sidebar.get_style_context().add_class(Gtk.STYLE_CLASS_SIDEBAR);
- scrolled_sidebar.set_shadow_type(Gtk.ShadowType.IN);
- get_style_context().add_class("sidebar-pane-separator");
-
- // divy the sidebar up into selection tree list, background progress bar, and properties
- Gtk.Frame top_frame = new Gtk.Frame(null);
- top_frame.add(scrolled_sidebar);
- top_frame.set_shadow_type(Gtk.ShadowType.IN);
+ background_progress_frame.set_border_width(2);
background_progress_frame.add(background_progress_bar);
- background_progress_frame.set_shadow_type(Gtk.ShadowType.IN);
+ background_progress_frame.get_style_context().remove_class("frame");
// pad the bottom frame (properties)
Gtk.Alignment bottom_alignment = new Gtk.Alignment(0, 0.5f, 1, 0);
-
- Resources.style_widget(scrolled_sidebar, Resources.SCROLL_FRAME_STYLESHEET);
- Resources.style_widget(bottom_frame, Resources.INSET_FRAME_STYLESHEET);
bottom_alignment.set_padding(10, 10, 6, 0);
bottom_alignment.add(basic_properties);
bottom_frame.add(bottom_alignment);
- bottom_frame.set_shadow_type(Gtk.ShadowType.IN);
+ bottom_frame.get_style_context().remove_class("frame");
// "attach" the progress bar to the sidebar tree, so the movable ridge is to resize the
// top two and the basic information pane
- top_section.pack_start(top_frame, true, true, 0);
+ top_section.pack_start(scrolled_sidebar, true, true, 0);
sidebar_paned.pack1(top_section, true, false);
sidebar_paned.pack2(bottom_frame, false, false);
sidebar_paned.set_position(1000);
-
- // layout the selection tree to the left of the collection/toolbar box with an adjustable
- // gutter between them, framed for presentation
- Gtk.Frame right_frame = new Gtk.Frame(null);
- right_frame.set_shadow_type(Gtk.ShadowType.IN);
right_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
- right_frame.add(right_vbox);
right_vbox.pack_start(search_toolbar, false, false, 0);
right_vbox.pack_start(notebook, true, true, 0);
client_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
client_paned.pack1(sidebar_paned, false, false);
sidebar_tree.set_size_request(SIDEBAR_MIN_WIDTH, -1);
- client_paned.pack2(right_frame, true, false);
+ client_paned.pack2(right_vbox, true, false);
client_paned.set_position(Config.Facade.get_instance().get_sidebar_position());
// TODO: Calc according to layout's size, to give sidebar a maximum width
notebook.set_size_request(PAGE_MIN_WIDTH, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]