diff --git a/CMakeLists.txt b/CMakeLists.txt index 2966f600..ac379e73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,4 +212,3 @@ add_subdirectory(po) add_subdirectory(sql) add_subdirectory(ui) add_subdirectory(src) -add_subdirectory(theming) diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala index e5978994..4419bbaf 100644 --- a/src/client/application/geary-application.vala +++ b/src/client/application/geary-application.vala @@ -295,23 +295,16 @@ public class GearyApplication : Gtk.Application { return builder; } - public string? read_theme_file(string filename) { - try { - File file = get_resource_directory().get_child("theming").get_child(filename); - DataInputStream data_input_stream = new DataInputStream(file.read()); - - size_t length; - return data_input_stream.read_upto("\0", 1, out length); - } catch(Error error) { - debug("Unable to load text from theme file: %s", error.message); - return null; - } + public string read_resource(string name) throws Error { + InputStream input_stream = resources_open_stream( + "/org/gnome/Geary/" + name, + ResourceLookupFlags.NONE + ); + DataInputStream data_stream = new DataInputStream(input_stream); + size_t length; + return data_stream.read_upto("\0", 1, out length); } - - public File get_ui_file(string filename) { - return get_resource_directory().get_child("ui").get_child(filename); - } - + // Loads a UI GResource into the specified UI manager. public void load_ui_resource_for_manager(Gtk.UIManager ui, string name) { try { diff --git a/src/client/conversation-viewer/conversation-web-view.vala b/src/client/conversation-viewer/conversation-web-view.vala index f969af94..06d407c2 100644 --- a/src/client/conversation-viewer/conversation-web-view.vala +++ b/src/client/conversation-viewer/conversation-web-view.vala @@ -69,7 +69,7 @@ public class ConversationWebView : StylishWebView { // Overridden since WebKitGTK+ 2.4.10 at least doesn't want to // report a useful height. In combination with the rules from - // theming/message-viewer.css we can get an accurate idea of + // ui/conversation-web-view.css we can get an accurate idea of // the actual height of the content from the BODY element, but // only once loaded. public override void get_preferred_height(out int minimum_height, @@ -134,14 +134,14 @@ public class ConversationWebView : StylishWebView { WebKit.DOM.Document document = get_dom_document(); WebKit.DOM.Element style_element = document.create_element(STYLE_NAME); - string css_text = GearyApplication.instance.read_theme_file("message-viewer.css") ?? ""; + string css_text = GearyApplication.instance.read_resource("conversation-web-view.css"); WebKit.DOM.Text text_node = document.create_text_node(css_text); style_element.append_child(text_node); WebKit.DOM.HTMLHeadElement head_element = document.get_head(); head_element.append_child(style_element); } catch (Error error) { - debug("Unable to load message-viewer document from files: %s", error.message); + debug("Error loading conversation-web-view.css: %s", error.message); } on_document_font_changed(); diff --git a/theming/CMakeLists.txt b/theming/CMakeLists.txt deleted file mode 100644 index d5b3a131..00000000 --- a/theming/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(THEMING_DEST share/geary/theming) - -install(FILES message-viewer.html DESTINATION ${THEMING_DEST}) -install(FILES message-viewer.css DESTINATION ${THEMING_DEST}) diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 35223dad..3106cbce 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -12,6 +12,7 @@ set(RESOURCE_LIST STRIPBLANKS "conversation-message.ui" STRIPBLANKS "conversation-message-menu.ui" STRIPBLANKS "conversation-viewer.ui" + "conversation-web-view.css" STRIPBLANKS "edit_alternate_emails.glade" STRIPBLANKS "find_bar.glade" STRIPBLANKS "folder-popover.ui" diff --git a/theming/message-viewer.css b/ui/conversation-web-view.css similarity index 100% rename from theming/message-viewer.css rename to ui/conversation-web-view.css