[geary] Separate CSS file and better parsing errors. Bug 767814



commit a4b004b5486b3155c569e8ada5d1f8ae880d2347
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Jun 18 16:07:55 2016 +0200

    Separate CSS file and better parsing errors. Bug 767814
    
    Signed-off-by: Niels De Graef <nielsdegraef gmail com>

 src/client/components/main-window.vala |   56 +++++--------------------------
 ui/CMakeLists.txt                      |    3 ++
 ui/geary.css                           |   40 ++++++++++++++++++++++
 3 files changed, 52 insertions(+), 47 deletions(-)
---
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 7f5755c..11615ea 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -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() {
diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt
index 7133c51..9841d61 100644
--- a/ui/CMakeLists.txt
+++ b/ui/CMakeLists.txt
@@ -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)
 
diff --git a/ui/geary.css b/ui/geary.css
new file mode 100644
index 0000000..df7097a
--- /dev/null
+++ b/ui/geary.css
@@ -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;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]