commit 41dd9c5ac2fe84d297c8ced55176b0190e0e8744
parent b9565000500c1d669b8ffd6c77c5edc850ac7220
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Sun, 15 Jul 2018 10:25:42 +0200
RSSyl: add more missing checks for offline mode
Closes bug #4014 - "Work offline" doesn't seem to affect RSS
Diffstat:
5 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
@@ -38,6 +38,7 @@
#include <mh.h>
#include <xml.h>
#include <toolbar.h>
+#include <prefs_common.h>
#include <prefs_toolbar.h>
#include <utils.h>
@@ -156,6 +157,7 @@ void rssyl_init(void)
prefs_toolbar_register_plugin_item(TOOLBAR_MAIN, PLUGIN_NAME, _("Refresh all feeds"), rssyl_toolbar_cb_refresh_all_feeds, NULL);
if( rssyl_prefs_get()->refresh_on_startup &&
+ !prefs_common_get_prefs()->work_offline &&
claws_is_starting() )
g_timeout_add(2000, rssyl_update_all_feeds_deferred, NULL);
}
diff --git a/src/plugins/rssyl/rssyl_cb_menu.c b/src/plugins/rssyl/rssyl_cb_menu.c
@@ -292,6 +292,16 @@ void rssyl_update_all_cb( GtkAction *action, gpointer data)
return;
}
+ /* Offline check */
+ if( prefs_common_get_prefs()->work_offline &&
+ !inc_offline_should_override(TRUE,
+ ngettext("Claws Mail needs network access in order "
+ "to update the feed.",
+ "Claws Mail needs network access in order "
+ "to update feeds.", 1))) {
+ return;
+ }
+
rssyl_update_recursively(item);
}
diff --git a/src/plugins/rssyl/rssyl_feed.c b/src/plugins/rssyl/rssyl_feed.c
@@ -82,10 +82,17 @@ gboolean rssyl_refresh_timeout_cb(gpointer data)
}
tmpdate = createRFC822Date(&tt);
- debug_print(" %s: refresh %s (%d)\n", tmpdate, ctx->ritem->url,
- ctx->ritem->refresh_id);
+
+ if (prefs_common_get_prefs()->work_offline) {
+ debug_print("RSSyl: %s: skipping update of %s (%d), we are offline\n",
+ tmpdate, ctx->ritem->url, ctx->ritem->refresh_id);
+ } else {
+ debug_print("RSSyl: %s: updating %s (%d)\n",
+ tmpdate, ctx->ritem->url, ctx->ritem->refresh_id);
+ rssyl_update_feed(ctx->ritem, 0);
+ }
+
g_free(tmpdate);
- rssyl_update_feed(ctx->ritem, 0);
return TRUE;
}
diff --git a/src/plugins/rssyl/rssyl_feed_props.c b/src/plugins/rssyl/rssyl_feed_props.c
@@ -30,7 +30,9 @@
#include <gdk/gdkkeysyms.h>
/* Claws Mail includes */
+#include <inc.h>
#include <mainwindow.h>
+#include <prefs_common.h>
#include <prefs_gtk.h>
/* Local includes */
@@ -194,6 +196,15 @@ rssyl_props_trim_cb(GtkWidget *widget, gpointer data)
RFolderItem *ritem = (RFolderItem *)data;
gboolean k = ritem->keep_old;
+ if( prefs_common_get_prefs()->work_offline &&
+ !inc_offline_should_override(TRUE,
+ ngettext("Claws Mail needs network access in order "
+ "to update the feed.",
+ "Claws Mail needs network access in order "
+ "to update feeds.", 1))) {
+ return FALSE;
+ }
+
if( k )
ritem->keep_old = FALSE;
diff --git a/src/plugins/rssyl/rssyl_subscribe.c b/src/plugins/rssyl/rssyl_subscribe.c
@@ -41,7 +41,6 @@
#include "rssyl_add_item.h"
#include "rssyl_feed.h"
#include "rssyl_gtk.h"
-#include "rssyl_update_feed.h"
#include "rssyl_subscribe_gtk.h"
#include "strutils.h"