From a929cd7cbf26547b5ba9deb7ddb515db4b46a364 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Thu, 8 Jul 2010 21:39:15 +0200 Subject: [PATCH] Source list view: update style, get color from parent window style --- src/plugins/catalog-plugin.vala | 4 ++-- src/source-dialog.vala | 2 +- src/source-list-view.vala | 19 +++++++++---------- src/source-list-window.vala | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/plugins/catalog-plugin.vala b/src/plugins/catalog-plugin.vala index 3616e34..831fb3e 100644 --- a/src/plugins/catalog-plugin.vala +++ b/src/plugins/catalog-plugin.vala @@ -90,7 +90,7 @@ class CatalogPlugin : Plugin { } } - var source_list = new SourceListView (available_sources, true); + var source_list = new SourceListView (available_sources, true, window); var content = (VBox) dialog.get_content_area (); content.pack_start (source_list, true, true, 0); @@ -202,7 +202,7 @@ class CatalogPlugin : Plugin { dialog.set_transient_for (window); dialog.set_title (_("Select active movie lists")); - var source_list = new SourceListView (sources, false); + var source_list = new SourceListView (sources, false, window); source_list.set_hildon_ui_mode (UIMode.EDIT); var selection = source_list.get_selection (); diff --git a/src/source-dialog.vala b/src/source-dialog.vala index 35876c7..4e4b012 100644 --- a/src/source-dialog.vala +++ b/src/source-dialog.vala @@ -36,7 +36,7 @@ class SourceDialog : Gtk.Dialog { } } - var source_list = new SourceListView (sources, true); + var source_list = new SourceListView (sources, true, window); content.pack_start (source_list, true, true, 0); source_list.source_activated.connect (on_source_activated); diff --git a/src/source-list-view.vala b/src/source-list-view.vala index 64188be..df492e4 100644 --- a/src/source-list-view.vala +++ b/src/source-list-view.vala @@ -27,7 +27,7 @@ public class SourceListView : PannableArea { public signal void source_activated (MovieSource source); - public SourceListView (List list, bool _filtered) { + public SourceListView (List list, bool _filtered, Gtk.Window window) { filtered = _filtered; // Source list @@ -65,28 +65,27 @@ public class SourceListView : PannableArea { var vbox_renderer = new CellRendererVBox (); var renderer = new CellRendererText (); + renderer.yalign = 1.0f; vbox_renderer.append (renderer, true); vbox_renderer.set_data ("name", renderer); // Add description renderer = new CellRendererText (); - renderer.set ("ellipsize", Pango.EllipsizeMode.END); + renderer.yalign = 0; + renderer.ellipsize = Pango.EllipsizeMode.END; Pango.AttrList attr_list = new Pango.AttrList (); - var style = Gtk.rc_get_style_by_paths (this.get_settings (), "SmallSystemFont", null, typeof (void)); + var style = Gtk.rc_get_style_by_paths (Gtk.Settings.get_default (), "SmallSystemFont", null, typeof (void)); if (style != null) { var attr_font_desc = new Pango.AttrFontDesc (style.font_desc.copy ()); attr_list.insert ((owned) attr_font_desc); - } else { - Pango.Attribute attr_font_scale = Pango.attr_scale_new (Pango.Scale.SMALL); - attr_list.insert ((owned) attr_font_scale); } Gdk.Color color; - if (!style.lookup_color ("SecondaryTextColor", out color)) { - Gdk.Color.parse ("grey", out color); + window.ensure_style (); + if (window.style.lookup_color ("SecondaryTextColor", out color)) { + Pango.Attribute attr_color = Pango.attr_foreground_new (color.red, color.green, color.blue); + attr_list.insert ((owned) attr_color); } - Pango.Attribute attr_color = Pango.attr_foreground_new (color.red, color.green, color.blue); - attr_list.insert ((owned) attr_color); renderer.attributes = attr_list; vbox_renderer.append (renderer, true); diff --git a/src/source-list-window.vala b/src/source-list-window.vala index 98f3df3..708ad16 100644 --- a/src/source-list-window.vala +++ b/src/source-list-window.vala @@ -35,7 +35,7 @@ public class SourceListWindow : StackableWindow { set_main_menu (menu); var sources = new List (); - source_list = new SourceListView (sources, true); + source_list = new SourceListView (sources, true, this); alignment = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); alignment.top_padding = MARGIN_HALF; -- 1.7.9.5