[geary/wip/730682-refine-convo-list: 4/11] ConversationListItem fixes and tweaks.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/730682-refine-convo-list: 4/11] ConversationListItem fixes and tweaks.
- Date: Fri, 5 Jan 2018 04:20:56 +0000 (UTC)
commit 533b8c89220fc8f3b45f88d0b9c3498e32ca151b
Author: Michael James Gratton <mike vee net>
Date: Wed Jan 3 20:49:11 2018 +1100
ConversationListItem fixes and tweaks.
* src/client/conversation-list/conversation-list-item.vala
(ConversationListItem): Update selected state when marked so items are
highlighted as selected. Add click handlers to stop button presses on
the star/unstar buttons updating marked items. Fix unstar action name.
.../conversation-list/conversation-list-item.vala | 19 +++++++++++++++++
ui/conversation-list-item.ui | 22 ++++++++++---------
2 files changed, 31 insertions(+), 10 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-item.vala
b/src/client/conversation-list/conversation-list-item.vala
index e9c855f..b2f65f3 100644
--- a/src/client/conversation-list/conversation-list-item.vala
+++ b/src/client/conversation-list/conversation-list-item.vala
@@ -177,6 +177,11 @@ public class ConversationListItem : Gtk.ListBoxRow {
internal void set_marked(bool marked) {
this.is_marked = marked;
this.mark_revealer.set_reveal_child(marked);
+ if (marked) {
+ this.set_state_flags(Gtk.StateFlags.SELECTED, false);
+ } else {
+ this.unset_state_flags(Gtk.StateFlags.SELECTED);
+ }
item_marked(marked);
}
@@ -332,4 +337,18 @@ public class ConversationListItem : Gtk.ListBoxRow {
);
}
+ [GtkCallback]
+ public bool on_flag_button_button_release(Gtk.Widget button,
+ Gdk.EventButton event) {
+ // Need to manually remove prelight since the button will be
+ // hidden before the mouse exits and if shown again will show
+ // up as prelighted.
+ button.unset_state_flags(Gtk.StateFlags.PRELIGHT);
+
+ // Need to stop propagation of clicks on the flag buttons so
+ // they aren't propagated to the ConversationList and
+ // interpreted as normal clicks and alter marked items when
+ // selection mode is enabled.
+ return Gdk.EVENT_STOP;
+ }
}
diff --git a/ui/conversation-list-item.ui b/ui/conversation-list-item.ui
index 3a35e96..a744422 100644
--- a/ui/conversation-list-item.ui
+++ b/ui/conversation-list-item.ui
@@ -50,22 +50,22 @@
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<child>
- <object class="GtkButton" id="star_button">
- <property name="visible">True</property>
+ <object class="GtkButton" id="unstar_button">
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
- <property name="tooltip_text" translatable="yes" comments="Note: The application will never
show this button at the same time as unstar_button, one will always be hidden.">Mark this conversation as
starred</property>
+ <property name="tooltip_text" translatable="yes" comments="Note: The application will never
show this button at the same time as star_button, one will always be hidden.">Mark this conversation as not
starred</property>
<property name="valign">center</property>
<property name="vexpand">True</property>
- <property name="action_name">win.conversation-mark-starred</property>
+ <property name="action_name">win.conversation-mark-unstarred</property>
<property name="relief">none</property>
+ <signal name="button-release-event" handler="on_flag_button_button_release" after="yes"
swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">non-starred-symbolic</property>
+ <property name="icon_name">starred-symbolic</property>
</object>
</child>
<style>
@@ -74,25 +74,27 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="unstar_button">
+ <object class="GtkButton" id="star_button">
+ <property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
- <property name="tooltip_text" translatable="yes" comments="Note: The application will never
show this button at the same time as star_button, one will always be hidden.">Mark this conversation as not
starred</property>
+ <property name="tooltip_text" translatable="yes" comments="Note: The application will never
show this button at the same time as unstar_button, one will always be hidden.">Mark this conversation as
starred</property>
<property name="valign">center</property>
<property name="vexpand">True</property>
<property name="action_name">win.conversation-mark-starred</property>
<property name="relief">none</property>
+ <signal name="button-release-event" handler="on_flag_button_button_release" after="yes"
swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="icon_name">starred-symbolic</property>
+ <property name="icon_name">non-starred-symbolic</property>
</object>
</child>
<style>
@@ -101,7 +103,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
</packing>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]