Separate CSS file and better parsing errors. Bug 767814

Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
This commit is contained in:
Niels De Graef 2016-06-18 16:07:55 +02:00 committed by Michael James Gratton
parent fd5b451024
commit a4b004b548
3 changed files with 52 additions and 47 deletions

View file

@ -138,54 +138,16 @@ public class MainWindow : Gtk.ApplicationWindow {
Gtk.CssProvider provider = new Gtk.CssProvider();
Gtk.StyleContext.add_provider_for_screen(Gdk.Display.get_default().get_default_screen(),
provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
string css = """
.geary-folder-frame, /* GTK < 3.20 */
.geary-folder-frame > border {
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
}
.geary-conversation-frame, /* GTK < 3.20 */
.geary-conversation-frame > border {
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
}
/* For 3-pane mode only */
.geary-sidebar-pane-separator.vertical .conversation-frame, /* GTK < 3.20 */
.geary-sidebar-pane-separator.vertical .conversation-frame > border {
border-bottom-width: 0;
}
.geary-composer-box > border {
border-width: 0px;
}
.geary-composer-body > border {
border-left-width: 0;
border-right-width: 0;
border-bottom-width: 0;
}
ComposerEmbed GtkHeaderBar,
ComposerBox GtkHeaderBar,
GtkBox.vertical GtkHeaderBar {
border-radius: 0px;
}
.geary-titlebar-left:dir(ltr),
.geary-titlebar-right:dir(rtl) {
border-top-right-radius: 0px;
}
.geary-titlebar-right:dir(ltr),
.geary-titlebar-left:dir(rtl) {
border-top-left-radius: 0px;
}
""";
try {
provider.load_from_data(css, -1);
} catch (Error error) {
debug("Could not load styling from data: %s", error.message);
}
provider.parsing_error.connect((section, error) => {
uint start = section.get_start_line();
uint end = section.get_end_line();
if (start == end)
debug("Error parsing css on line %u: %s", start, error.message);
else
debug("Error parsing css on lines %u-%u: %s", start, end, error.message);
});
provider.load_from_resource(@"/org/gnome/Geary/geary.css");
}
private void create_layout() {

View file

@ -17,6 +17,7 @@ set(RESOURCE_LIST
STRIPBLANKS "toolbar_empty_menu.ui"
STRIPBLANKS "toolbar_mark_menu.ui"
STRIPBLANKS "upgrade_dialog.glade"
"geary.css"
)
compile_gresources(
@ -48,6 +49,8 @@ add_custom_target(resource_copy ALL
cp ${RESOURCES_XML} ${CMAKE_BINARY_DIR}/ui
COMMAND
cp ${CMAKE_SOURCE_DIR}/ui/*.glade ${CMAKE_SOURCE_DIR}/ui/*.interface ${CMAKE_SOURCE_DIR}/ui/*.ui ${CMAKE_BINARY_DIR}/ui
COMMAND
cp ${CMAKE_SOURCE_DIR}/ui/*.css ${CMAKE_BINARY_DIR}/ui
)
add_dependencies(resource_copy resource_c)

40
ui/geary.css Normal file
View file

@ -0,0 +1,40 @@
.geary-folder-frame, /* GTK < 3.20 */
.geary-folder-frame > border {
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
}
.geary-conversation-frame, /* GTK < 3.20 */
.geary-conversation-frame > border {
border-left-width: 0;
border-top-width: 0;
border-right-width: 0;
}
/* For 3-pane mode only */
.geary-sidebar-pane-separator.vertical .conversation-frame, /* GTK < 3.20 */
.geary-sidebar-pane-separator.vertical .conversation-frame > border {
border-bottom-width: 0;
}
.geary-composer-box > border {
border-width: 0px;
}
.geary-composer-body > border {
border-left-width: 0;
border-right-width: 0;
border-bottom-width: 0;
}
ComposerEmbed GtkHeaderBar,
ComposerBox GtkHeaderBar,
GtkBox.vertical GtkHeaderBar {
border-radius: 0px;
}
.geary-titlebar-left:dir(ltr),
.geary-titlebar-right:dir(rtl) {
border-top-right-radius: 0px;
}
.geary-titlebar-right:dir(ltr),
.geary-titlebar-left:dir(rtl) {
border-top-left-radius: 0px;
}