[chronojump] personSelect window selects person better (not hiding photo)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] personSelect window selects person better (not hiding photo)
- Date: Thu, 16 May 2019 12:21:07 +0000 (UTC)
commit b728dd2819a83d52e314d9e976bfb4ff82319b77
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu May 16 14:20:07 2019 +0200
personSelect window selects person better (not hiding photo)
src/gui/personSelect.cs | 22 +++++++++++++++-------
src/utilGtk.cs | 11 +++++++++++
2 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/gui/personSelect.cs b/src/gui/personSelect.cs
index 9bd1a885..9fdb3980 100644
--- a/src/gui/personSelect.cs
+++ b/src/gui/personSelect.cs
@@ -444,10 +444,12 @@ public class PersonPhotoButton
//image
Gtk.Image image = (Gtk.Image) box_elements.GetValue(0); //the image
+ Gtk.Viewport viewport = (Gtk.Viewport) box_elements.GetValue(2); //the name
+
if(select)
- assignPhotoToPixbuf(image, false, Util.GetImagePath(false) + "image_selected.png");
+ UtilGtk.ViewportColor(viewport, UtilGtk.YELLOW);
else
- addUserPhotoIfExists(image);
+ UtilGtk.ViewportColorDefault(viewport);
Selected = select;
}
@@ -465,7 +467,8 @@ public class PersonPhotoButton
//LogB.Information("UniqueID: " + l.Text.ToString());
//access name
- l = (Gtk.Label) box_elements.GetValue(2); //the name
+ Gtk.Viewport v = (Gtk.Viewport) box_elements.GetValue(2); //the name
+ l = (Gtk.Label) v.Child; //the name
personName = l.Text;
//LogB.Information("Name: " + l.Text.ToString());
}
@@ -485,12 +488,17 @@ public class PersonPhotoButton
Gtk.Label label_id = new Gtk.Label(personID.ToString());
label_id.Visible = false; //hide this to the user
+ Gtk.Viewport viewport = new Gtk.Viewport();
+ UtilGtk.ViewportColorDefault(viewport);
Gtk.Label label_name = new Gtk.Label(personName);
label_name.Visible = true;
+ label_name.Show();
+ viewport.Add(label_name);
+ viewport.Show();
vbox.PackStart(image); //0
vbox.PackStart(label_id); //1
- vbox.PackEnd(label_name, false, false, 1); //2
+ vbox.PackEnd(viewport, false, false, 1); //2 (contains label_name)
vbox.Show();
@@ -499,10 +507,10 @@ public class PersonPhotoButton
button.HeightRequest = 170;
}
- private Array getButtonBoxElements (Gtk.Button b)
+ private Array getButtonBoxElements (Gtk.Button button)
{
//access the vbox
- Gtk.VBox box = (Gtk.VBox) b.Child;
+ Gtk.VBox box = (Gtk.VBox) button.Child;
/*
LogB.Information("printing children");
@@ -510,7 +518,7 @@ public class PersonPhotoButton
LogB.Information(w.ToString());
*/
- //access the memebers of vbox
+ //access the members of vbox
return box.Children;
}
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 4b76fe22..616319a2 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -545,6 +545,17 @@ public class UtilGtk
{
v.ModifyBg(StateType.Normal, color);
}
+ public static void ViewportColorDefault(Gtk.Viewport v)
+ {
+ //v.ModifyBg(StateType.Normal); //resets to the default color
+
+ //create a new viewport and get the color
+ Gtk.Viewport vTemp = new Gtk.Viewport();
+ Gdk.Color colorViewportDefault = vTemp.Style.Background(StateType.Normal);
+
+ //assign the color to our requested viewport
+ v.ModifyBg(StateType.Normal, colorViewportDefault); //resets to the default color
+ }
public static void ChronopicColors(Gtk.Viewport v, Gtk.Label l1, Gtk.Label l2, bool connected) {
//if(! v.Style.Background(StateType.Normal).Equal(BLUE))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]