CVS: sylpheedclaws/plugins/rssyl/src feed.c,1.1.2.63,1.1.2.64 feed.h,1.1.2.16,1.1.2.17 rssyl.c,1.1.2.17,1.1.2.18 rssyl_cb_menu.c,1.1.2.11,1.1.2.12 rssyl_prefs.c,1.1.2.3,1.1.2.4 rssyl_prefs.h,1.1.2.1,1.1.2.2

[email protected] Thu, 28 Dec 2006 14:26:01 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /pack/anoncvs/sylpheedclaws/plugins/rssyl/src
In directory sunsite.dk:/tmp/cvs-serv16845/src

Modified Files:
      Tag: gtk2
	feed.c feed.h rssyl.c rssyl_cb_menu.c rssyl_prefs.c 
	rssyl_prefs.h 
Log Message:
2006-12-28 [ticho]	0.8.0cvs2

	* src/feed.c
	* src/feed.h
	* src/rssyl.c
	* src/rssyl_cb_menu.c
	* src/rssyl_prefs.c
	* src/rssyl_prefs.h
		Add option to refresh all feeds on application startup. Defaults
		to FALSE.

Index: feed.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/plugins/rssyl/src/Attic/feed.c,v
retrieving revision 1.1.2.63
retrieving revision 1.1.2.64
diff -u -d -r1.1.2.63 -r1.1.2.64
--- feed.c	2006/11/27 08:21:54	1.1.2.63
+++ feed.c	2006/12/28 14:25:57	1.1.2.64
@@ -47,6 +47,7 @@
 #include "log.h"
 #include "prefs_common.h"
 #include "defs.h"
+#include "inc.h"
 
 #include "gettext.h"
 
@@ -1523,4 +1524,35 @@
 	folder_item_scan(&ritem->item);
 
 	debug_print("RSSyl: finished expiring\n");
+}
+
+
+void rssyl_refresh_all_func(FolderItem *item, gpointer data)
+{
+	RSSylFolderItem *ritem = (RSSylFolderItem *)item;
+	/* Only try to refresh our feed folders */
+	if( !IS_RSSYL_FOLDER_ITEM(item) )
+		return;
+
+	/* Don't try to refresh the root folder */
+	if( folder_item_parent(item) == NULL )
+		return;
+	/* Don't try to update normal folders */
+	if (ritem->url == NULL)
+		return;
+	rssyl_update_feed((RSSylFolderItem *)item);
+}
+
+void rssyl_refresh_all_feeds(void)
+{
+	if (prefs_common.work_offline && 
+	    !inc_offline_should_override(ngettext(
+			    "Claws Mail needs network access in order "
+			    "to update the feed.",
+			    "Claws Mail needs network access in order "
+			    "to update the feeds.", 2))) {
+			return;
+	}
+
+	folder_func_to_all_folders((FolderItemFunc)rssyl_refresh_all_func, NULL);
 }

Index: feed.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/plugins/rssyl/src/Attic/feed.h,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -u -d -r1.1.2.16 -r1.1.2.17
--- feed.h	2006/09/21 17:02:57	1.1.2.16
+++ feed.h	2006/12/28 14:25:57	1.1.2.17
@@ -66,4 +66,7 @@
 void rssyl_free_feeditem(RSSylFeedItem *item);
 gchar *rssyl_format_string(gchar *str, gboolean replace_html, gboolean replace_returns);
 
+void rssyl_refresh_all_func(FolderItem *item, gpointer data);
+void rssyl_refresh_all_feeds(void);
+
 #endif /* __FEED_H */

Index: rssyl.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/plugins/rssyl/src/Attic/rssyl.c,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -d -r1.1.2.17 -r1.1.2.18
--- rssyl.c	2006/11/27 08:21:55	1.1.2.17
+++ rssyl.c	2006/12/28 14:25:57	1.1.2.18
@@ -106,6 +106,10 @@
 
 	if( existing_tree_found == FALSE )
 		rssyl_create_default_mailbox();
+
+	if( rssyl_prefs_get()->refresh_on_startup &&
+			claws_is_starting() )
+		rssyl_refresh_all_feeds();
 }
 
 void rssyl_done(void)

Index: rssyl_cb_menu.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/plugins/rssyl/src/Attic/rssyl_cb_menu.c,v
retrieving revision 1.1.2.11
retrieving revision 1.1.2.12
diff -u -d -r1.1.2.11 -r1.1.2.12
--- rssyl_cb_menu.c	2006/11/07 10:58:58	1.1.2.11
+++ rssyl_cb_menu.c	2006/12/28 14:25:57	1.1.2.12
@@ -281,35 +281,10 @@
 	rssyl_update_feed(ritem);
 }
 
-static void rssyl_refresh_all_func(FolderItem *item, gpointer data)
-{
-	RSSylFolderItem *ritem = (RSSylFolderItem *)item;
-	/* Only try to refresh our feed folders */
-	if( !IS_RSSYL_FOLDER_ITEM(item) )
-		return;
-
-	/* Don't try to refresh the root folder */
-	if( folder_item_parent(item) == NULL )
-		return;
-	/* Don't try to update normal folders */
-	if (ritem->url == NULL)
-		return;
-	rssyl_update_feed((RSSylFolderItem *)item);
-}
-
 void rssyl_refresh_all_cb(FolderView *folderview, guint action,
 		GtkWidget *widget)
 {
-	if (prefs_common.work_offline && 
-	    !inc_offline_should_override(ngettext(
-			    "Claws Mail needs network access in order "
-			    "to update the feed.",
-			    "Claws Mail needs network access in order "
-			    "to update the feeds.", 2))) {
-			return;
-	}
-
-	folder_func_to_all_folders((FolderItemFunc)rssyl_refresh_all_func, NULL);
+	rssyl_refresh_all_feeds();
 }
 
 void rssyl_prop_cb(FolderView *folderview, guint action, GtkWidget *widget)

Index: rssyl_prefs.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/plugins/rssyl/src/Attic/rssyl_prefs.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- rssyl_prefs.c	2006/10/04 08:53:46	1.1.2.3
+++ rssyl_prefs.c	2006/12/28 14:25:57	1.1.2.4
@@ -40,13 +40,15 @@
 		GtkWindow *window, gpointer data);
 static void save_rssyl_prefs(PrefsPage *page);
 
-	static PrefParam param[] = {
+static PrefParam param[] = {
 	{ "refresh_interval", RSSYL_PREF_DEFAULT_REFRESH, &rssyl_prefs.refresh, P_INT,
 		NULL, NULL, NULL },
 	{ "expired_keep", RSSYL_PREF_DEFAULT_EXPIRED, &rssyl_prefs.expired, P_INT,
 		NULL, NULL, NULL },
 	{ "timeout", RSSYL_PREF_DEFAULT_TIMEOUT, &rssyl_prefs.timeout, P_INT,
 		NULL, NULL, NULL },
+	{ "refresh_on_startup", FALSE, &rssyl_prefs.refresh_on_startup, P_BOOL,
+		NULL, NULL, NULL },
 	{ 0, 0, 0, 0, 0, 0, 0 }
 };
 
@@ -86,6 +88,7 @@
 	GtkWidget *refresh;
 	GtkWidget *expired;
 	GtkWidget *timeout;
+	GtkWidget *refresh_on_startup;
 	GtkWidget *label;
 	GtkObject *refresh_adj, *expired_adj, *timeout_adj;
 	GtkTooltips *tooltips;
@@ -135,12 +138,20 @@
 	gtk_table_attach(GTK_TABLE(table), timeout, 1, 2, 2, 3,
 			GTK_FILL, 0, 0, 0);
 
+	refresh_on_startup = gtk_check_button_new_with_label(
+			_("Refresh all feeds on application start"));
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(refresh_on_startup),
+			rssyl_prefs.refresh_on_startup);
+	gtk_table_attach(GTK_TABLE(table), refresh_on_startup, 0, 2, 3, 4,
+			GTK_FILL, 0, 0, 0);
+
 	gtk_widget_show_all(table);
 
 	prefs_page->page.widget = table;
 	prefs_page->refresh = refresh;
 	prefs_page->expired = expired;
 	prefs_page->timeout = timeout;
+	prefs_page->refresh_on_startup = refresh_on_startup;
 }
 
 static void destroy_rssyl_prefs_page(PrefsPage *page)
@@ -161,6 +172,8 @@
 			GTK_SPIN_BUTTON(prefs_page->expired));
 	rssyl_prefs.timeout = gtk_spin_button_get_value_as_int(
 			GTK_SPIN_BUTTON(prefs_page->timeout));
+	rssyl_prefs.refresh_on_startup = gtk_toggle_button_get_active(
+			GTK_TOGGLE_BUTTON(prefs_page->refresh_on_startup));
 
 	pref_file = prefs_write_open(rc_file_path);
 	g_free(rc_file_path);

Index: rssyl_prefs.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/plugins/rssyl/src/Attic/rssyl_prefs.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- rssyl_prefs.h	2006/07/02 02:50:44	1.1.2.1
+++ rssyl_prefs.h	2006/12/28 14:25:58	1.1.2.2
@@ -3,7 +3,7 @@
 
 #define PREFS_BLOCK_NAME	"rssyl"
 
-#define RSSYL_NUM_PREFS		3
+#define RSSYL_NUM_PREFS		4
 
 #define RSSYL_PREF_DEFAULT_REFRESH	"180"
 #define RSSYL_PREF_DEFAULT_EXPIRED	"-1"
@@ -15,6 +15,7 @@
 	gint refresh;
 	gint expired;
 	gint timeout;
+	gboolean refresh_on_startup;
 };
 
 typedef struct _RSSylPrefsPage RSSylPrefsPage;
@@ -24,6 +25,7 @@
 	GtkWidget *refresh;
 	GtkWidget *expired;
 	GtkWidget *timeout;
+	GtkWidget *refresh_on_startup;
 };
 
 void rssyl_prefs_init(void);