[gnome-contacts/new-design] Support focus for field rows
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/new-design] Support focus for field rows
- Date: Thu, 15 Dec 2011 09:37:20 +0000 (UTC)
commit 17df97d4dcf96ad7922483960c376cea0b73b2ca
Author: Alexander Larsson <alexl redhat com>
Date: Tue Dec 13 09:25:45 2011 +0100
Support focus for field rows
src/contacts-clickable.vala | 4 ++++
src/contacts-contact-pane.vala | 11 ++++++++++-
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-clickable.vala b/src/contacts-clickable.vala
index 64ccfe7..6101b94 100644
--- a/src/contacts-clickable.vala
+++ b/src/contacts-clickable.vala
@@ -49,6 +49,10 @@ public class Contacts.Clickable : Object {
Gdk.EventMask.BUTTON_RELEASE_MASK);
}
+ public void set_focus_on_click (bool focus_on_click) {
+ this.focus_on_click = focus_on_click;
+ }
+
public void realize_for (Gdk.Window? event_window) {
this.event_window = event_window;
}
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index d407c94..1433e6b 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -421,6 +421,7 @@ public class Contacts.FieldRow : Contacts.Row {
base (group);
clickable = new Clickable (this);
+ clickable.set_focus_on_click (true);
clickable.clicked.connect ( () => { this.clicked (); } );
start = 0;
}
@@ -438,8 +439,15 @@ public class Contacts.FieldRow : Contacts.Row {
}
public override bool draw (Cairo.Context cr) {
- var state = this.get_state_flags ();
+ Allocation allocation;
+ this.get_allocation (out allocation);
+
var context = this.get_style_context ();
+ var state = this.get_state_flags ();
+
+ if (this.has_visible_focus ())
+ Gtk.render_focus (context, cr, 0, 0, allocation.width, allocation.height);
+
context.save ();
// Don't propagate the clicked prelight and active state to children
this.set_state_flags (state & ~(StateFlags.PRELIGHT | StateFlags.ACTIVE), true);
@@ -569,6 +577,7 @@ public class Contacts.PersonaSheet : Grid {
var row = new FieldRow (sheet.pane.row_group);
this.add (row);
+ row.set_can_focus (true);
row.clicked.connect( () => {
this.set_edit_mode (row);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]