[geary/wip/765516-gtk-widget-conversation-viewer: 70/207] Convert ConversationWebView HML CSS file to a resource, remove theme dir.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/765516-gtk-widget-conversation-viewer: 70/207] Convert ConversationWebView HML CSS file to a resource, remove theme dir.
- Date: Tue, 4 Oct 2016 00:02:18 +0000 (UTC)
commit 3dcf3ce7d652dee50e7f738f3867b363314009de
Author: Michael James Gratton <mike vee net>
Date: Fri Apr 22 15:41:05 2016 +1000
Convert ConversationWebView HML CSS file to a resource, remove theme dir.
* src/client/application/geary-application.vala
(GearyApplication::read_theme_file): Renamed to ::read_resource, do the
lookup on a GResource instead of from the file system.
(GearyApplication::get_ui_file): Remove unused method.
* src/client/conversation-viewer/conversation-web-view.vala
(ConversationWebView): Chase CSS file rename and load method.
* theming/CMakeLists.txt: Removed, no longer needed.
* theming/message-viewer.css: Moved to ui/conversation-web-view.css.
* ui/CMakeLists.txt: Add conversation-web-view.css resource.
* CMakeLists.txt: Remove theming include.
* src/client/application/geary-application.vala :
CMakeLists.txt | 1 -
src/client/application/geary-application.vala | 25 +++++++------------
.../conversation-viewer/conversation-web-view.vala | 6 ++--
theming/CMakeLists.txt | 4 ---
ui/CMakeLists.txt | 1 +
.../conversation-web-view.css | 0
6 files changed, 13 insertions(+), 24 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2966f60..ac379e7 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 e597899..4419bba 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 File get_ui_file(string filename) {
- return get_resource_directory().get_child("ui").get_child(filename);
+ 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);
}
-
+
// 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 f969af9..06d407c 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/ui/CMakeLists.txt b/ui/CMakeLists.txt
index 35223da..3106cbc 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]