Disallow unsetting priorities
authorJose Dapena Paz <jdapena@igalia.com>
Mon, 22 Dec 2008 17:02:04 +0000 (17:02 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Mon, 22 Dec 2008 17:02:04 +0000 (17:02 +0000)
pmo-trunk-r6988

src/hildon2/modest-msg-edit-window.c

index 85ed799..6f3b220 100644 (file)
@@ -3628,8 +3628,8 @@ static void
 on_priority_toggle (HildonCheckButton *button, 
                    GSList *priority_group)
 {
 on_priority_toggle (HildonCheckButton *button, 
                    GSList *priority_group)
 {
+       GSList *node;
        if (hildon_check_button_get_active (button)) {
        if (hildon_check_button_get_active (button)) {
-               GSList *node;
 
                for (node = priority_group; node != NULL; node = g_slist_next (node)) {
                        HildonCheckButton *node_button = (HildonCheckButton *) node->data;
 
                for (node = priority_group; node != NULL; node = g_slist_next (node)) {
                        HildonCheckButton *node_button = (HildonCheckButton *) node->data;
@@ -3638,6 +3638,19 @@ on_priority_toggle (HildonCheckButton *button,
                                hildon_check_button_set_active (node_button, FALSE);
                        }
                }
                                hildon_check_button_set_active (node_button, FALSE);
                        }
                }
+       } else {
+               gboolean found = FALSE;
+               /* If no one is active, activate it again */
+               for (node = priority_group; node != NULL; node = g_slist_next (node)) {
+                       HildonCheckButton *node_button = (HildonCheckButton *) node->data;
+                       if (hildon_check_button_get_active (node_button)) {
+                               found = TRUE;
+                               break;
+                       }
+               }
+               if (!found) {
+                       hildon_check_button_set_active (button, TRUE);
+               }
        }
 }
 
        }
 }