+2003-03-03 [christoph] 0.8.10claws76
+
+ * src/mainwindow.[ch]
+ * src/common/Makefile.am
+ * src/common/progressindicator.[ch]
+ add UI independent progress indicator handling
+
+ * src/news.[ch]
+ use new progress indicator for message info fetching
+
+ * src/common/hooks.h
+ code cleanup
+
2003-03-03 [oliver] 0.8.10claws75
* src/toolbar.c
MICRO_VERSION=10
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws75
+EXTRA_VERSION=claws76
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
passcrypt.c passcrypt.h \
plugin.c plugin.h \
prefs.c prefs.h \
+ progressindicator.c progressindicator.h \
quoted-printable.c quoted-printable.h \
session.c session.h \
smtp.c smtp.h \
#ifndef HOOKS_H
#define HOOKS_H
+#include <glib.h>
+
typedef gboolean (*SylpheedHookFunction) (gpointer source,
gpointer userdata);
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+
+#include "hooks.h"
+#include "progressindicator.h"
+
+void progressindicator_start(ProgressType type)
+{
+ ProgressData data;
+
+ data.cmd = PROGRESS_COMMAND_START;
+ data.type = type;
+
+ hooks_invoke(PROGRESSINDICATOR_HOOKLIST, &data);
+}
+
+void progressindicator_set_percentage(ProgressType type, gfloat percent)
+{
+ ProgressData data;
+
+ data.cmd = PROGRESS_COMMAND_SET_PERCENTAGE;
+ data.type = type;
+ data.value = percent;
+
+ hooks_invoke(PROGRESSINDICATOR_HOOKLIST, &data);
+}
+
+void progressindicator_stop(ProgressType type)
+{
+ ProgressData data;
+
+ data.cmd = PROGRESS_COMMAND_START;
+ data.type = type;
+
+ hooks_invoke(PROGRESSINDICATOR_HOOKLIST, &data);
+}
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PROCESSINDICATOR_H
+#define PROCESSINDICATOR_H
+
+#include <glib.h>
+
+#define PROGRESSINDICATOR_HOOKLIST "progressindicator_hooklist"
+
+typedef struct _ProgressData ProgressData;
+
+typedef enum {
+ PROGRESS_COMMAND_START,
+ PROGRESS_COMMAND_SET_PERCENTAGE,
+ PROGRESS_COMMAND_STOP,
+} ProgressCommand;
+
+typedef enum {
+ PROGRESS_TYPE_NETWORK,
+} ProgressType;
+
+struct _ProgressData {
+ ProgressCommand cmd;
+ ProgressType type;
+ gfloat value;
+};
+
+void progressindicator_start(ProgressType type);
+void progressindicator_set_percentage(ProgressType type, gfloat percent);
+void progressindicator_stop(ProgressType type);
+
+#endif /* PROCESSINDICATOR_H */
#include "sslcertwindow.h"
#include "prefs_gtk.h"
#include "pluginwindow.h"
+#include "hooks.h"
+#include "progressindicator.h"
#define AC_LABEL_WIDTH 240
void main_window_reply_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
+gboolean mainwindow_progressindicator_hook (gpointer source,
+ gpointer userdata);
#define SEPARATE_ACTION 500
static GtkItemFactoryEntry mainwin_entries[] =
mainwin->menu_lock_count = 0;
mainwin->cursor_count = 0;
+ mainwin->progressindicator_hook =
+ hooks_register_hook(PROGRESSINDICATOR_HOOKLIST, mainwindow_progressindicator_hook, mainwin);
+
if (!watch_cursor)
watch_cursor = gdk_cursor_new(GDK_WATCH);
return NULL;
}
+gboolean mainwindow_progressindicator_hook(gpointer source, gpointer userdata)
+{
+ ProgressData *data = (ProgressData *) source;
+ MainWindow *mainwin = (MainWindow *) userdata;
+
+ switch (data->cmd) {
+ case PROGRESS_COMMAND_START:
+ case PROGRESS_COMMAND_STOP:
+ gtk_progress_set_percentage(GTK_PROGRESS(mainwin->progressbar), 0.0);
+ break;
+ case PROGRESS_COMMAND_SET_PERCENTAGE:
+ gtk_progress_set_percentage(GTK_PROGRESS(mainwin->progressbar), data->value);
+ break;
+ }
+ while (gtk_events_pending()) gtk_main_iteration ();
+
+ return FALSE;
+}
+
/*
* End of Source.
*/
SummaryView *summaryview;
MessageView *messageview;
LogWindow *logwin;
+
+ gint progressindicator_hook;
};
MainWindow *main_window_create (SeparateType type);
#include "inputdialog.h"
#include "alertpanel.h"
#include "log.h"
+#include "progressindicator.h"
#if USE_OPENSSL
# include "ssl.h"
#endif
GSList *newlist = NULL;
GSList *llast = NULL;
MsgInfo *msginfo;
+ guint count = 0, lines = (end - begin + 1) * 3;
g_return_val_if_fail(session != NULL, NULL);
g_return_val_if_fail(item != NULL, NULL);
log_warning(_("error occurred while getting xover.\n"));
return newlist;
}
+ count++;
+ progressindicator_set_percentage
+ (PROGRESS_TYPE_NETWORK, session->fetch_base_percentage + ((gfloat) count / (gfloat) lines));
if (buf[0] == '.' && buf[1] == '\r') break;
log_warning(_("error occurred while getting xhdr.\n"));
return newlist;
}
+ count++;
+ progressindicator_set_percentage
+ (PROGRESS_TYPE_NETWORK, session->fetch_base_percentage + ((gfloat) count / (gfloat) lines));
if (buf[0] == '.' && buf[1] == '\r') break;
if (!llast) {
log_warning(_("error occurred while getting xhdr.\n"));
return newlist;
}
+ count++;
+ progressindicator_set_percentage
+ (PROGRESS_TYPE_NETWORK, session->fetch_base_percentage + ((gfloat) count / (gfloat) lines));
if (buf[0] == '.' && buf[1] == '\r') break;
if (!llast) {
NNTPSession *session;
GSList *elem, *msginfo_list = NULL, *tmp_msgnum_list, *tmp_msginfo_list;
guint first, last, next;
+ guint tofetch, fetched;
g_return_val_if_fail(folder != NULL, NULL);
g_return_val_if_fail(folder->type == F_NEWS, NULL);
tmp_msgnum_list = g_slist_copy(msgnum_list);
tmp_msgnum_list = g_slist_sort(tmp_msgnum_list, news_fetch_msgnum_sort);
+ progressindicator_start(PROGRESS_TYPE_NETWORK);
+ tofetch = g_slist_length(tmp_msgnum_list);
+ fetched = 0;
+
first = GPOINTER_TO_INT(tmp_msgnum_list->data);
last = first;
for(elem = g_slist_next(tmp_msgnum_list); elem != NULL; elem = g_slist_next(elem)) {
next = GPOINTER_TO_INT(elem->data);
if(next != (last + 1)) {
+ session->fetch_base_percentage = (gfloat) fetched / (gfloat) tofetch;
tmp_msginfo_list = news_get_msginfos_for_range(session, item, first, last);
msginfo_list = g_slist_concat(msginfo_list, tmp_msginfo_list);
+ fetched = last - first + 1;
first = next;
}
last = next;
g_slist_free(tmp_msgnum_list);
+ progressindicator_stop(PROGRESS_TYPE_NETWORK);
+
return msginfo_list;
}
NNTPSockInfo *nntp_sock;
gchar *group;
+ gfloat fetch_base_percentage;
};
struct _NewsGroupInfo