2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2004 Hiroyuki Yamamoto
4 * This file (C) 2005 Andrej Kacian <andrej@kacian.sk>
6 * - callback handler functions for GTK signals and timeouts
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 #include <gdk/gdkkeysyms.h>
30 #include "folderview.h"
31 #include "alertpanel.h"
32 #include "gtk/inputdialog.h"
37 #include "rssyl_gtk.h"
38 #include "rssyl_cb_gtk.h"
39 #include "prefs_common.h"
41 gboolean rssyl_props_cancel_cb(GtkWidget *widget, gpointer data)
43 RSSylFolderItem *ritem = (RSSylFolderItem *)data;
45 debug_print("RSSyl: Cancel pressed\n");
46 gtk_widget_destroy(ritem->feedprop->window);
50 gboolean rssyl_props_ok_cb(GtkWidget *widget, gpointer data)
52 RSSylFolderItem *ritem = (RSSylFolderItem *)data;
54 debug_print("RSSyl: OK pressed\n");
55 rssyl_gtk_prop_store(ritem);
57 gtk_widget_destroy(ritem->feedprop->window);
62 gboolean rssyl_refresh_timeout_cb(gpointer data)
64 RSSylRefreshCtx *ctx = (RSSylRefreshCtx *)data;
65 time_t tt = time(NULL);
68 g_return_val_if_fail(ctx != NULL, FALSE);
70 if( prefs_common_get_prefs()->work_offline)
73 if( ctx->ritem == NULL || ctx->ritem->url == NULL ) {
74 debug_print("RSSyl: refresh_timeout_cb - ritem or url NULL\n");
79 if( ctx->id != ctx->ritem->refresh_id ) {
80 tmpdate = createRFC822Date(&tt);
81 debug_print(" %s: timeout id changed, stopping: %d != %d\n",
82 tmpdate, ctx->id, ctx->ritem->refresh_id);
88 tmpdate = createRFC822Date(&tt);
89 debug_print(" %s: refresh %s (%d)\n", tmpdate, ctx->ritem->url,
90 ctx->ritem->refresh_id);
92 rssyl_update_feed(ctx->ritem);
97 gboolean rssyl_default_refresh_interval_toggled_cb(GtkToggleButton *default_ri,
100 gboolean active = gtk_toggle_button_get_active(default_ri);
101 GtkWidget *refresh_interval = (GtkWidget *)data;
103 debug_print("default is %s\n", ( active ? "ON" : "OFF" ) );
105 gtk_widget_set_sensitive(refresh_interval, !active);
110 gboolean rssyl_default_expired_num_toggled_cb(GtkToggleButton *default_ex,
113 gboolean active = gtk_toggle_button_get_active(default_ex);
114 GtkWidget *expired_num = (GtkWidget *)data;
116 debug_print("default is %s\n", ( active ? "ON" : "OFF" ) );
118 gtk_widget_set_sensitive(expired_num, !active);
123 gboolean rssyl_fetch_comments_toggled_cb(GtkToggleButton *fetch_comments,
126 gboolean active = gtk_toggle_button_get_active(fetch_comments);
127 GtkWidget *num_comments = (GtkWidget *)data;
129 debug_print("fetch comments is %s\n", (active ? "ON" : "OFF") );
131 gtk_widget_set_sensitive(num_comments, active);
136 gboolean rssyl_props_key_press_cb(GtkWidget *widget, GdkEventKey *event,
140 switch (event->keyval) {
142 rssyl_props_cancel_cb(widget, data);
146 rssyl_props_ok_cb(widget, data);