2012-02-08 [pawel] 3.8.0cvs27
[claws.git] / src / toolbar.c
index b8ee47e6023947f46b9f1343bde2e59bd64adfe8..9c64b3622cbdb660b009a7b83adfd572c31990d0 100644 (file)
@@ -177,8 +177,8 @@ struct {
        gchar *index_str;
        const gchar *descr;
 } toolbar_text [] = {
-       { "A_RECEIVE_ALL",      N_("Receive Mail on all Accounts")         },
-       { "A_RECEIVE_CUR",      N_("Receive Mail on current Account")      },
+       { "A_RECEIVE_ALL",      N_("Receive Mail from all Accounts")       },
+       { "A_RECEIVE_CUR",      N_("Receive Mail from current Account")    },
        { "A_SEND_QUEUED",      N_("Send Queued Messages")                 },
        { "A_COMPOSE_EMAIL",    N_("Compose Email")                        },
        { "A_COMPOSE_NEWS",     N_("Compose News")                         },
@@ -812,40 +812,52 @@ static void toolbar_action_execute(GtkWidget    *widget,
                            gpointer     data,
                            gint         source) 
 {
-       GSList *cur, *lop;
-       gchar *action, *action_p;
-       gboolean found = FALSE;
+       GSList *cur;
        gint i = 0;
 
        for (cur = action_list; cur != NULL;  cur = cur->next) {
                ToolbarClawsActions *act = (ToolbarClawsActions*)cur->data;
 
                if (widget == act->widget) {
-                       
-                       for (lop = prefs_common.actions_list; lop != NULL; lop = lop->next) {
-                               action = g_strdup((gchar*)lop->data);
-
-                               action_p = strstr(action, ": ");
-                               action_p[0] = 0x00;
-                               if (g_utf8_collate(act->name, action) == 0) {
-                                       found = TRUE;
-                                       g_free(action);
-                                       break;
-                               } else 
-                                       i++;
-                               g_free(action);
-                       }
-                       if (found) 
+                       i = prefs_actions_find_by_name(act->name);
+
+                       if (i != -1) 
                                break;
                }
        }
 
-       if (found
+       if (i != -1
                actions_execute(data, i, widget, source);
        else
                g_warning ("Error: did not find Claws Action to execute");
 }
 
+gboolean toolbar_check_action_btns(ToolbarType type)
+{
+       GSList *temp, *curr, *list = toolbar_config[type].item_list;
+       gboolean modified = FALSE;
+       
+       curr = list;
+       while (curr != NULL) {
+               ToolbarItem *toolbar_item = (ToolbarItem *) curr->data;
+               temp = curr;
+               curr = curr->next;
+               
+               if (toolbar_item->index != A_CLAWS_ACTIONS)
+                       continue;
+
+               if (prefs_actions_find_by_name(toolbar_item->text) == -1) {
+                       list = g_slist_delete_link(list, temp);
+                       g_free(toolbar_item->file);
+                       g_free(toolbar_item->text);
+                       g_free(toolbar_item);
+                       modified = TRUE;
+               }
+       }
+       
+       return modified;
+}
+
 #if !(GTK_CHECK_VERSION(2,12,0))
 #define CLAWS_SET_TOOL_ITEM_TIP(widget,tip) { \
        gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(widget), GTK_TOOLTIPS(toolbar_tips),    \
@@ -1896,12 +1908,12 @@ Toolbar *toolbar_create(ToolbarType      type,
                        break;
                case A_RECEIVE_ALL:
                        TOOLBAR_MENUITEM(item,icon_wid,toolbar_item->text,
-                               _("Receive Mail on all Accounts"),
-                               _("Receive Mail on selected Account"));
+                               _("Receive Mail from all Accounts"),
+                               _("Receive Mail from selected Account"));
                        toolbar_data->getall_btn = item;
                        break;
                case A_RECEIVE_CUR:
-                       TOOLBAR_ITEM(item,icon_wid,toolbar_item->text, _("Receive Mail on current Account"));
+                       TOOLBAR_ITEM(item,icon_wid,toolbar_item->text, _("Receive Mail from current Account"));
                        toolbar_data->get_btn = item;
                        break;
                case A_SEND_QUEUED:
@@ -2348,11 +2360,11 @@ void toolbar_main_set_sensitive(gpointer data)
        
        if (toolbar->get_btn)
                SET_WIDGET_COND(toolbar->get_btn, 
-                       M_HAVE_ACCOUNT|M_UNLOCKED);
+                       M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_RETRIEVABLE_ACCOUNT);
 
        if (toolbar->getall_btn) {
                SET_WIDGET_COND(toolbar->getall_btn, 
-                       M_HAVE_ACCOUNT|M_UNLOCKED);
+                       M_HAVE_ACCOUNT|M_UNLOCKED|M_HAVE_ANY_RETRIEVABLE_ACCOUNT);
        }
        if (toolbar->send_btn) {
                SET_WIDGET_COND(toolbar->send_btn,