[geary/wip/730682-refine-convo-list] Re-enable conversation action bar flag buttons, fix their behaviour.



commit ae7d7ad723446da19eae9a3032d9c3ce9bd8d397
Author: Michael James Gratton <mike vee net>
Date:   Sat Jan 6 21:31:10 2018 +1100

    Re-enable conversation action bar flag buttons, fix their behaviour.

 src/client/components/conversation-action-bar.vala |   28 +++++++++++++------
 src/client/components/main-window.vala             |    2 +
 ui/conversation-action-bar.ui                      |   12 +++-----
 3 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/src/client/components/conversation-action-bar.vala 
b/src/client/components/conversation-action-bar.vala
index c3e1d92..e5cce09 100644
--- a/src/client/components/conversation-action-bar.vala
+++ b/src/client/components/conversation-action-bar.vala
@@ -143,11 +143,8 @@ public class ConversationActionBar : Gtk.ActionBar {
             break;
         }
 
-        // XXX just always hide these for now while the UX is sorted out
-        //this.flag_actions.set_visible(show_flag_actions);
-        this.flag_actions.set_visible(false);
-        update_action_pair(this.mark_read_action, this.mark_unread_action);
-        update_action_pair(this.mark_starred_action, this.mark_unstarred_action);
+        this.flag_actions.set_visible(show_flag_actions);
+        update_flags();
 
         this.folder_actions.set_visible(primary_action != null || show_folder_actions);
         this.archive_action.set_visible(primary_action == this.archive_action);
@@ -169,6 +166,11 @@ public class ConversationActionBar : Gtk.ActionBar {
         this.delete_action.set_visible(show_delete && !show_trash);
     }
 
+    public void update_flags() {
+        update_action_pair(this.mark_read_action, this.mark_unread_action);
+        update_action_pair(this.mark_starred_action, this.mark_unstarred_action);
+    }
+
     private void update_account() {
         try {
             this.has_archive = (
@@ -201,14 +203,22 @@ public class ConversationActionBar : Gtk.ActionBar {
 
     private inline void update_action_pair(Gtk.Button primary, Gtk.Button secondary) {
         bool show_primary = true;
-        string? secondary_action_name = secondary.get_action_name();
+        string primary_action_name = primary.get_action_name();
+        string secondary_action_name = secondary.get_action_name();
         MainWindow? window = get_toplevel() as MainWindow;
-        if (window != null && secondary_action_name != null) {
+        if (window != null) {
+            Action? primary_action = window.lookup_action(
+                primary_action_name.substring(4) // chop off the "win."
+            );
             Action? secondary_action = window.lookup_action(
                 secondary_action_name.substring(4) // chop off the "win."
             );
-            if (secondary_action != null) {
-                show_primary = !secondary_action.get_enabled();
+
+            if (primary_action != null && secondary_action != null) {
+                show_primary = (
+                    primary_action.get_enabled() ||
+                    !secondary_action.get_enabled()
+                );
             }
         }
 
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 202e093..31e89e9 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -643,6 +643,8 @@ public class MainWindow : Gtk.ApplicationWindow {
             mark_starred.set_enabled(false);
             mark_unstarred.set_enabled(false);
         }
+
+        this.conversation_list_actions.update_flags();
     }
 
     private void show_conversation_context_menu(Menu menu,
diff --git a/ui/conversation-action-bar.ui b/ui/conversation-action-bar.ui
index 9ba0a79..3dc8a77 100644
--- a/ui/conversation-action-bar.ui
+++ b/ui/conversation-action-bar.ui
@@ -20,7 +20,7 @@
               <object class="GtkImage">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="icon_name">mail-unread-symbolic</property>
+                <property name="icon_name">mail-read-symbolic</property>
               </object>
             </child>
           </object>
@@ -38,7 +38,7 @@
               <object class="GtkImage">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="icon_name">mail-read-symbolic</property>
+                <property name="icon_name">mail-unread-symbolic</property>
               </object>
             </child>
           </object>
@@ -75,7 +75,7 @@
               <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>
           </object>
@@ -93,7 +93,7 @@
         <property name="position">0</property>
       </packing>
     </child>
-    <child>
+    <child type="center">
       <object class="GtkGrid" id="folder_actions">
         <property name="can_focus">False</property>
         <child>
@@ -164,10 +164,6 @@
           <class name="linked"/>
         </style>
       </object>
-      <packing>
-        <property name="pack_type">start</property>
-        <property name="position">1</property>
-      </packing>
     </child>
     <child>
       <object class="GtkGrid" id="destructive_actions">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]