Various theme fixes

This commit is contained in:
Hylke Bons 2013-10-09 18:05:48 +02:00
parent c026eefdda
commit e9b88bb8a7
4 changed files with 41 additions and 43 deletions

View file

@ -180,8 +180,8 @@ namespace SparkleShare {
Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) {
Application.Invoke (delegate {
this.size_label.Markup = "<b>Size:</b> " + size;
this.history_label.Markup = "<b>History:</b> " + history_size;
this.size_label.Markup = "<b>Size</b> " + size;
this.history_label.Markup = "<b>History</b> " + history_size;
this.size_label.ShowAll ();
this.history_label.ShowAll ();

View file

@ -129,13 +129,13 @@ namespace SparkleShare {
ListStore store = new ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (SparklePlugin));
SparkleTreeView tree = new SparkleTreeView (store) { HeadersVisible = false };
SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false };
ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
scrolled_window.AddWithViewport (tree);
scrolled_window.SetPolicy (PolicyType.Never, PolicyType.Automatic);
// Icon column
tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
tree.Columns [0].Cells [0].Xpad = 6;
tree_view.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
tree_view.Columns [0].Cells [0].Xpad = 6;
// Service column
TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" };
@ -146,12 +146,12 @@ namespace SparkleShare {
foreach (SparklePlugin plugin in Controller.Plugins) {
store.AppendValues (new Gdk.Pixbuf (plugin.ImagePath),
"<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
"<span fgcolor=\"" + SecondaryTextColorSelected + "\">" +
plugin.Description + "</span>" +
"<span fgcolor=\"" + SecondaryTextColor + "\">" + plugin.Description + "</span>" +
"</span>", plugin);
}
tree.AppendColumn (service_column);
tree_view.AppendColumn (service_column);
scrolled_window.AddWithViewport (tree_view);
Entry address_entry = new Entry () {
Text = Controller.PreviousAddress,
@ -181,7 +181,7 @@ namespace SparkleShare {
// Select the first plugin by default
TreeSelection default_selection = tree.Selection;
TreeSelection default_selection = tree_view.Selection;
TreePath default_path = new TreePath ("0");
default_selection.SelectPath (default_path);
Controller.SelectedPluginChanged (0);
@ -211,12 +211,12 @@ namespace SparkleShare {
Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);
// Update the address field text when the selection changes
tree.CursorChanged += delegate (object sender, EventArgs e) {
Controller.SelectedPluginChanged (tree.SelectedRow);
tree_view.CursorChanged += delegate (object sender, EventArgs e) {
Controller.SelectedPluginChanged (tree_view.SelectedRow);
// TODO: Scroll to selected row when using arrow keys
};
tree.Model.Foreach (new TreeModelForeachFunc (delegate (ITreeModel model,
tree_view.Model.Foreach (new TreeModelForeachFunc (delegate (ITreeModel model,
TreePath path, TreeIter iter) {
string address;
@ -231,7 +231,7 @@ namespace SparkleShare {
if (!string.IsNullOrEmpty (address) &&
address.Equals (Controller.PreviousAddress)) {
tree.SetCursor (path, service_column, false);
tree_view.SetCursor (path, service_column, false);
SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2);
if (plugin.Address != null) {
@ -249,11 +249,11 @@ namespace SparkleShare {
}));
address_entry.Changed += delegate {
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree_view.SelectedRow);
};
layout_address.PackStart (new Label () {
Markup = "<b>" + "Address:" + "</b>",
Markup = "<b>" + "Address" + "</b>",
Xalign = 0
}, true, true, 0);
@ -261,11 +261,11 @@ namespace SparkleShare {
layout_address.PackStart (address_example, false, false, 0);
path_entry.Changed += delegate {
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree_view.SelectedRow);
};
layout_path.PackStart (new Label () {
Markup = "<b>" + "Remote Path:" + "</b>",
Markup = "<b>" + "Remote Path" + "</b>",
Xalign = 0
}, true, true, 0);
@ -302,8 +302,11 @@ namespace SparkleShare {
AddOption (check_button);
AddButton (cancel_button);
AddButton (add_button);
// TODO: unfocused treeview row: make background grey
Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);
tree_view.GrabFocus ();
}
if (type == PageType.Invite) {
@ -681,7 +684,7 @@ namespace SparkleShare {
private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell,
ITreeModel model, TreeIter iter)
{
string markup = (string) model.GetValue (iter, 1);
string markup = (string) model.GetValue (iter, 1);
TreeSelection selection = (column.TreeView as TreeView).Selection;
if (selection.IterIsSelected (iter)) {

View file

@ -53,22 +53,17 @@ namespace SparkleShare {
Deletable = false;
TypeHint = Gdk.WindowTypeHint.Dialog;
DeleteEvent += delegate (object sender, DeleteEventArgs args) {
args.RetVal = true;
};
DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };
Gdk.Color color = SparkleUIHelpers.RGBAToColor (StyleContext.GetColor (StateFlags.Insensitive));
SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
SecondaryTextColorSelected =
SparkleUIHelpers.ColorToHex (
MixColors (
new TreeView ().StyleContext.GetColor (StateFlags.Selected),
new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected),
0.15
)
);
color = MixColors (
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
0.39);
SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
SetSizeRequest (680, 400);
HBox = new HBox (false, 0);
@ -183,15 +178,15 @@ namespace SparkleShare {
}
private Gdk.Color MixColors (Gdk.RGBA first_color, Gdk.RGBA second_color, double ratio)
private Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio)
{
return new Gdk.Color (
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) +
second_color.Red * ratio))) / 65535),
second_color.Red * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) +
second_color.Green * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) +
second_color.Blue * ratio))) / 65535)
second_color.Blue * ratio))) / 65535)
);
}
}

View file

@ -67,13 +67,7 @@ namespace SparkleShare {
(int) Math.Truncate (color.Green / 256.00),
(int) Math.Truncate (color.Blue / 256.00));
}
public static string RGBAToHex (Gdk.RGBA rgba)
{
return ColorToHex (RGBAToColor (rgba));
}
public static Gdk.Color RGBAToColor (Gdk.RGBA rgba) {
return new Gdk.Color () {
@ -82,5 +76,11 @@ namespace SparkleShare {
Blue = (ushort)(rgba.Blue * 65535)
};
}
public static string RGBAToHex (Gdk.RGBA rgba)
{
return ColorToHex (RGBAToColor (rgba));
}
}
}