[geary/wip/765516-gtk-widget-conversation-viewer: 89/107] 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: 89/107] Convert ConversationWebView HML CSS file to a resource, remove theme dir.
- Date: Sun, 5 Jun 2016 12:34:58 +0000 (UTC)
commit 7901e670da89b17957871ad8e900b1408bffd080
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 5aa1b19..298d745 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,4 +149,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 65f787e..a1f7521 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -287,23 +287,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 480f573..6e4d9e5 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -59,7 +59,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,
@@ -127,14 +127,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 134b269..7f23a55 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 "login.glade"
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]