Use folderview_get_selected_item() more.
authorAndrej Kacian <andrej@kacian.sk>
Wed, 21 Oct 2015 18:49:03 +0000 (20:49 +0200)
committerAndrej Kacian <andrej@kacian.sk>
Wed, 21 Oct 2015 18:49:03 +0000 (20:49 +0200)
src/folderview.c
src/imap_gtk.c
src/mh_gtk.c
src/news_gtk.c
src/plugins/mailmbox/plugin_gtk.c
src/plugins/rssyl/rssyl_cb_menu.c
src/plugins/vcalendar/vcal_folder.c

index a9a1fd1..1db8aa4 100644 (file)
@@ -552,7 +552,7 @@ void folderview_set_column_order(FolderView *folderview)
        }
 
        if (folderview->selected)
-               sel_item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(ctree), folderview->selected);
+               sel_item = folderview_get_selected_item(folderview);
        if (folderview->opened)
                op_item = gtk_cmctree_node_get_row_data(GTK_CMCTREE(ctree), folderview->opened);
 
@@ -769,7 +769,7 @@ void folderview_set(FolderView *folderview)
        main_window_cursor_wait(mainwin);
 
        if (folderview->selected)
-               sel_item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+               sel_item = folderview_get_selected_item(folderview);
        if (folderview->opened)
                op_item = gtk_cmctree_node_get_row_data(ctree, folderview->opened);
 
@@ -2350,7 +2350,6 @@ static void folderview_create_folder_node(FolderView *folderview, FolderItem *it
 static void folderview_empty_trash_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        GSList *mlist = NULL;
        GSList *cur = NULL;
@@ -2358,7 +2357,7 @@ static void folderview_empty_trash_cb(GtkAction *action, gpointer data)
        PrefsAccount *ac;
 
        if (!folderview->selected) return;
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
@@ -2394,14 +2393,13 @@ static void folderview_empty_trash_cb(GtkAction *action, gpointer data)
 static void folderview_send_queue_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        FolderItem *special_queue = NULL;
        PrefsAccount *ac;
        gchar *errstr = NULL;
 
        if (!folderview->selected) return;
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
@@ -2456,12 +2454,11 @@ static void folderview_search_cb(GtkAction *action, gpointer data)
 static void folderview_run_processing_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
@@ -2473,12 +2470,11 @@ static void folderview_run_processing_cb(GtkAction *action, gpointer data)
 static void folderview_property_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
@@ -2615,13 +2611,12 @@ static gint folderview_clist_compare(GtkCMCList *clist,
 static void folderview_processing_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        gchar *id, *title;
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
index abbb805..0b0a2b9 100644 (file)
@@ -176,7 +176,6 @@ static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item)
 static void new_folder_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        FolderItem *new_item;
        gchar *new_folder;
@@ -186,7 +185,7 @@ static void new_folder_cb(GtkAction *action, gpointer data)
        
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
        cm_return_if_fail(item->folder->account != NULL);
@@ -349,7 +348,7 @@ static void delete_folder_cb(GtkAction *action, gpointer data)
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->path != NULL);
        cm_return_if_fail(item->folder != NULL);
@@ -492,7 +491,7 @@ static void subscribe_cb_full(FolderView *folderview, guint action)
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
@@ -613,7 +612,7 @@ static void subscribed_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
        GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
-       FolderItem *item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       FolderItem *item = folderview_get_selected_item(folderview);
        
        if (!item || !item->folder || !item->folder->account)
                return;
@@ -635,11 +634,10 @@ static void subscribed_cb(GtkAction *action, gpointer data)
 static void download_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        imap_gtk_synchronise(item, 0);
 }
index d5f0fd5..f98cc1e 100644 (file)
@@ -129,7 +129,6 @@ static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item)
 static void new_folder_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        FolderItem *new_item;
        gchar *new_folder;
@@ -138,7 +137,7 @@ static void new_folder_cb(GtkAction *action, gpointer data)
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
        cm_return_if_fail(item->folder != NULL);
 
index 74d82df..2783f78 100644 (file)
@@ -162,7 +162,7 @@ static void subscribe_newsgroup_cb(GtkAction *action, gpointer data)
        
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
 
        if (mainwin->lock_count || news_folder_locked(item->folder))
@@ -240,7 +240,6 @@ static void subscribe_newsgroup_cb(GtkAction *action, gpointer data)
 static void unsubscribe_newsgroup_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        gchar *name;
        gchar *message;
@@ -250,7 +249,7 @@ static void unsubscribe_newsgroup_cb(GtkAction *action, gpointer data)
        
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        cm_return_if_fail(item != NULL);
 
        if (mainwin->lock_count || news_folder_locked(item->folder))
@@ -411,11 +410,10 @@ void news_gtk_synchronise(FolderItem *item, gint days)
 static void download_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        news_gtk_synchronise(item, 0);
 }
index 9402879..75de2f2 100644 (file)
@@ -229,7 +229,6 @@ static void add_mailbox(GtkAction *action, gpointer callback_data)
 static void new_folder_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        FolderItem *new_item;
        gchar *new_folder;
@@ -238,7 +237,7 @@ static void new_folder_cb(GtkAction *action, gpointer data)
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
 
index 73347f4..476d2bc 100644 (file)
@@ -51,7 +51,6 @@ void rssyl_new_feed_cb(GtkAction *action,
                gpointer data)
 {
        FolderView *folderview = (FolderView*)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        gchar *url;
 
@@ -59,7 +58,7 @@ void rssyl_new_feed_cb(GtkAction *action,
 
        g_return_if_fail(folderview->selected != NULL);
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
 
@@ -78,7 +77,6 @@ void rssyl_new_folder_cb(GtkAction *action,
                gpointer data)
 {
        FolderView *folderview = (FolderView*)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item;
        FolderItem *new_item;
        gchar *new_folder, *p, *tmp;
@@ -86,7 +84,7 @@ void rssyl_new_folder_cb(GtkAction *action,
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
 
@@ -342,7 +340,6 @@ void rssyl_remove_mailbox_cb(GtkAction *action, gpointer data)
 void rssyl_import_feed_list_cb(GtkAction *action, gpointer data)
 {
        FolderView *folderview = (FolderView *)data;
-       GtkCMCTree *ctree = GTK_CMCTREE(folderview->ctree);
        FolderItem *item = NULL;
        gchar *path = NULL;
        OPMLImportCtx *ctx = NULL;
@@ -359,7 +356,7 @@ void rssyl_import_feed_list_cb(GtkAction *action, gpointer data)
 
        /* Find the destination folder for the import */
        g_return_if_fail(folderview->selected != NULL);
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->folder != NULL);
 
index b02ee76..ec86574 100644 (file)
@@ -1959,7 +1959,7 @@ static void unsubscribe_cal_cb(GtkAction *action, gpointer data)
 
        if (!folderview->selected) return;
 
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
        g_return_if_fail(item != NULL);
        g_return_if_fail(item->path != NULL);
        g_return_if_fail(item->folder != NULL);
@@ -2073,7 +2073,7 @@ static void set_view_cb(GtkAction *gaction, GtkRadioAction *current, gpointer da
        if (setting_sensitivity) return;
 
        oitem = gtk_cmctree_node_get_row_data(ctree, folderview->opened);
-       item = gtk_cmctree_node_get_row_data(ctree, folderview->selected);
+       item = folderview_get_selected_item(folderview);
 
        if (!item)
                return;