aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog35
-rw-r--r--mail/em-account-prefs.c4
-rw-r--r--mail/em-folder-tree-model.c2
-rw-r--r--mail/em-folder-view.c4
-rw-r--r--mail/em-format-html-display.c4
-rw-r--r--mail/em-format-html.c3
-rw-r--r--mail/em-migrate.c20
-rw-r--r--mail/em-utils.c2
-rw-r--r--mail/mail-component.c2
-rw-r--r--mail/mail-send-recv.c336
-rw-r--r--mail/mail-tools.c2
-rw-r--r--mail/message-list.c3
12 files changed, 252 insertions, 165 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 75b68a8981..2b73bf38af 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,38 @@
+2007-04-19 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #429422
+
+ * mail-tools.c (mail_tool_get_local_movemail_path):
+ * em-utils.c (em_utils_save_part_to_file):
+ * em-migrate.c (cp_r), (em_migrate_folder),
+ (em_migrate_pop_uid_caches_1_4), (em_migrate_folder_expand_state_1_4),
+ (em_migrate_folder_view_settings), (em_migrate_imap_cmeta_1_4),
+ (em_migrate_1_4), (emm_setup_initial), (em_migrate):
+ * em-folder-tree-model.c (em_folder_tree_model_save_state):
+ * mail-component.c (mail_component_init):
+ Use g_mkdir_with_parents() instead of e_util_mkdir_hier().
+
+ * mail-send-recv.c:
+ Some cosmetic refactoring.
+
+ * mail-send-recv.c (dialog_map):
+ Use gtk_widget_set_size_request() instead of gtk_widget_set_usize().
+
+ * mail-send-recv.c (build_dialog):
+ e_gtk_button_new_with_icon() is dead; just do it manually.
+
+ * em-format-html-display.c (efhd_bonobo_object):
+ * em-format-html.c (efh_init):
+ * message-list.c (message_list_init):
+ Use g_object_ref_sink() instead of gtk_object_sink().
+
+ * em-account-prefs.c (em_account_prefs_construct):
+ Use g_object_ref() instead of gtk_widget_ref().
+ Use g_object_unref() instead of gtk_widget_unref().
+
+ * em-folder-view.c (emfv_setup_view):
+ Use g_build_filename() instead of g_concat_dir_and_file().
+
2007-04-18 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #423766
diff --git a/mail/em-account-prefs.c b/mail/em-account-prefs.c
index 7e31d637b3..64ebeaf755 100644
--- a/mail/em-account-prefs.c
+++ b/mail/em-account-prefs.c
@@ -566,10 +566,10 @@ em_account_prefs_construct (EMAccountPrefs *prefs)
toplevel = glade_xml_get_widget (gui, "toplevel");
/* reparent */
- gtk_widget_ref (toplevel);
+ g_object_ref (toplevel);
gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel);
gtk_container_add (GTK_CONTAINER (prefs), toplevel);
- gtk_widget_unref (toplevel);
+ g_object_unref (toplevel);
widget = glade_xml_get_widget (gui, "etableMailAccounts");
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 2467b71a7c..aced299122 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -1054,7 +1054,7 @@ em_folder_tree_model_save_state (EMFolderTreeModel *model)
return;
dirname = g_path_get_dirname (model->filename);
- if (e_util_mkdir_hier (dirname, 0777) == -1 && errno != EEXIST) {
+ if (g_mkdir_with_parents (dirname, 0777) == -1 && errno != EEXIST) {
g_free (dirname);
return;
}
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index e45b5e37e2..78b5d00790 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -571,10 +571,10 @@ emfv_setup_view_instance(EMFolderView *emfv)
safe_id = g_strdup (id);
e_filename_make_safe (safe_id);
filename = g_strdup_printf ("custom_wide_view-%s.xml", safe_id);
- p->view_instance->custom_filename = g_concat_dir_and_file (collection->local_dir, filename);
+ p->view_instance->custom_filename = g_build_filename (collection->local_dir, filename, NULL);
g_free (filename);
filename = g_strdup_printf ("current_wide_view-%s.xml", safe_id);
- p->view_instance->current_view_filename = g_concat_dir_and_file (collection->local_dir, filename);
+ p->view_instance->current_view_filename = g_build_filename (collection->local_dir, filename, NULL);
g_free (safe_id);
}
g_free (id);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index d4c7a01d11..502f9a5090 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -1982,7 +1982,7 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *
persist = (Bonobo_PersistStream)Bonobo_Unknown_queryInterface(bonobo_widget_get_objref((BonoboWidget *)embedded),
"IDL:Bonobo/PersistStream:1.0", &ev);
if (persist == CORBA_OBJECT_NIL) {
- gtk_object_sink((GtkObject *)embedded);
+ g_object_ref_sink(embedded);
CORBA_exception_free(&ev);
return FALSE;
}
@@ -2011,7 +2011,7 @@ efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *
CORBA_Object_release(persist, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
- gtk_object_sink((GtkObject *)embedded);
+ g_object_ref_sink(embedded);
CORBA_exception_free(&ev);
return FALSE;
}
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 0811e4a575..66ca8885b9 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -141,8 +141,7 @@ efh_init(GObject *o)
efh->html = (GtkHTML *)gtk_html_new();
gtk_html_set_blocking(efh->html, FALSE);
- g_object_ref(efh->html);
- gtk_object_sink((GtkObject *)efh->html);
+ g_object_ref_sink(efh->html);
gtk_html_set_default_content_type(efh->html, "text/html; charset=utf-8");
gtk_html_set_editable(efh->html, FALSE);
diff --git a/mail/em-migrate.c b/mail/em-migrate.c
index 40e1c28f6c..b6d4d7d1b8 100644
--- a/mail/em-migrate.c
+++ b/mail/em-migrate.c
@@ -1523,7 +1523,7 @@ cp_r (const char *src, const char *dest, const char *pattern, int mode)
struct stat st;
DIR *dir;
- if (e_util_mkdir_hier (dest, 0777) == -1)
+ if (g_mkdir_with_parents (dest, 0777) == -1)
return -1;
if (!(dir = opendir (src)))
@@ -1644,7 +1644,7 @@ em_migrate_folder(EMMigrateSession *session, const char *dirname, const char *fu
slen = src->len;
dlen = dest->len;
- if (e_util_mkdir_hier (dest->str, 0777) == -1 && errno != EEXIST) {
+ if (g_mkdir_with_parents (dest->str, 0777) == -1 && errno != EEXIST) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
_("Unable to create new folder `%s': %s"),
dest->str, g_strerror(errno));
@@ -2073,7 +2073,7 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
g_free (cache_dir);
cache_dir = g_build_filename (evolution_dir, "mail", "pop", NULL);
- if (e_util_mkdir_hier (cache_dir, 0777) == -1) {
+ if (g_mkdir_with_parents (cache_dir, 0777) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unable to create POP3 keep-on-server data directory `%s': %s"),
cache_dir, g_strerror(errno));
@@ -2101,7 +2101,7 @@ em_migrate_pop_uid_caches_1_4 (const char *evolution_dir, CamelException *ex)
/* strip the trailing '_' */
g_string_truncate (newpath, newpath->len - 1);
- if (e_util_mkdir_hier (newpath->str, 0777) == -1
+ if (g_mkdir_with_parents (newpath->str, 0777) == -1
|| cp(oldpath->str, (g_string_append(newpath, "/uid-cache"))->str, FALSE, CP_UNIQUE)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unable to copy POP3 keep-on-server data `%s': %s"),
@@ -2161,7 +2161,7 @@ em_migrate_folder_expand_state_1_4 (const char *evolution_dir, CamelException *e
destpath = g_string_new (evolution_dir);
g_string_append (destpath, "/mail/config");
- if (e_util_mkdir_hier (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) {
+ if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) {
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
return 0;
@@ -2259,7 +2259,7 @@ em_migrate_folder_view_settings_1_4 (const char *evolution_dir, CamelException *
destpath = g_string_new (evolution_dir);
g_string_append (destpath, "/mail/views");
- if (e_util_mkdir_hier (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) {
+ if (g_mkdir_with_parents (destpath->str, 0777) == -1 || !(dir = opendir (srcpath->str))) {
g_string_free (destpath, TRUE);
g_string_free (srcpath, TRUE);
return 0;
@@ -2475,7 +2475,7 @@ em_migrate_imap_cmeta_1_4(const char *evolution_dir, CamelException *ex)
url->host?url->host:"");
dir = e_path_to_physical(base, path);
- if (e_util_mkdir_hier(dir, 0777) == 0) {
+ if (g_mkdir_with_parents(dir, 0777) == 0) {
char *cmeta;
FILE *fp;
@@ -2573,7 +2573,7 @@ em_migrate_1_4 (const char *evolution_dir, xmlDocPtr filters, xmlDocPtr vfolders
path = g_strdup_printf ("mbox:%s/.evolution/mail/local", g_get_home_dir ());
if (stat (path + 5, &st) == -1) {
- if (errno != ENOENT || e_util_mkdir_hier (path + 5, 0777) == -1) {
+ if (errno != ENOENT || g_mkdir_with_parents (path + 5, 0777) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to create local mail storage `%s': %s"),
path + 5, g_strerror (errno));
@@ -2654,7 +2654,7 @@ emm_setup_initial(const char *evolution_dir)
d(printf("Setting up initial mail tree\n"));
base = g_build_filename(evolution_dir, "mail", "local", NULL);
- if (e_util_mkdir_hier(base, 0777) == -1 && errno != EEXIST) {
+ if (g_mkdir_with_parents(base, 0777) == -1 && errno != EEXIST) {
g_free(base);
return -1;
}
@@ -2704,7 +2704,7 @@ em_migrate (const char *evolution_dir, int major, int minor, int revision, Camel
/* make sure ~/.evolution/mail exists */
path = g_build_filename (evolution_dir, "mail", NULL);
if (g_stat (path, &st) == -1) {
- if (errno != ENOENT || e_util_mkdir_hier (path, 0777) == -1) {
+ if (errno != ENOENT || g_mkdir_with_parents (path, 0777) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Unable to create local mail folders at `%s': %s"),
path, g_strerror (errno));
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 98be4854df..ab958efc12 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -479,7 +479,7 @@ em_utils_save_part_to_file(GtkWidget *parent, const char *filename, CamelMimePar
return FALSE;
dirname = g_path_get_dirname(filename);
- if (e_util_mkdir_hier(dirname, 0777) == -1) {
+ if (g_mkdir_with_parents(dirname, 0777) == -1) {
e_error_run((GtkWindow *)parent, "mail:no-create-path", filename, g_strerror(errno), NULL);
g_free(dirname);
return FALSE;
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 4f06665fa9..c898c08e84 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -1181,7 +1181,7 @@ mail_component_init (MailComponent *component)
*p++ = '/';
}
#endif
- if (e_util_mkdir_hier (priv->base_directory, 0777) == -1 && errno != EEXIST)
+ if (g_mkdir_with_parents (priv->base_directory, 0777) == -1 && errno != EEXIST)
abort ();
priv->model = em_folder_tree_model_new (priv->base_directory);
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 9d00ec8f58..007d09bfef 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -29,19 +29,18 @@
/* for the dialog stuff */
#include <glib.h>
-#include <gtk/gtkmain.h>
+#include <glib/gi18n.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkbutton.h>
#include <gtk/gtkdialog.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtklabel.h>
#include <gtk/gtkimage.h>
-#include <gtk/gtkbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkprogressbar.h>
#include <gtk/gtkscrolledwindow.h>
-#include <libgnomeui/gnome-window-icon.h>
-#include <glib/gi18n.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtktable.h>
-#include "e-util/e-gtk-utils.h"
#include "libedataserver/e-account-list.h"
#include "misc/e-clipped-label.h"
@@ -116,9 +115,9 @@ struct _send_info {
char *uri;
int keep;
send_state_t state;
- GtkProgressBar *bar;
- GtkButton *stop;
- EClippedLabel *status;
+ GtkWidget *progress_bar;
+ GtkWidget *cancel_button;
+ GtkWidget *status_label;
int again; /* need to run send again */
@@ -135,7 +134,8 @@ static CamelFolder *receive_get_folder(CamelFilterDriver *d, const char *uri, vo
static struct _send_data *send_data = NULL;
static GtkWidget *send_recv_dialog = NULL;
-static struct _send_data *setup_send_data(void)
+static struct _send_data *
+setup_send_data(void)
{
struct _send_data *data;
@@ -155,12 +155,14 @@ receive_cancel(GtkButton *button, struct _send_info *info)
{
if (info->state == SEND_ACTIVE) {
camel_operation_cancel(info->cancel);
- if (info->status)
- e_clipped_label_set_text(info->status, _("Canceling..."));
+ if (info->status_label)
+ e_clipped_label_set_text (
+ E_CLIPPED_LABEL (info->status_label),
+ _("Canceling..."));
info->state = SEND_CANCELLED;
}
- if (info->stop)
- gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE);
+ if (info->cancel_button)
+ gtk_widget_set_sensitive(info->cancel_button, FALSE);
}
static void
@@ -173,7 +175,8 @@ free_folder_info(void *key, struct _folder_info *info, void *data)
g_free(info);
}
-static void free_send_info(void *key, struct _send_info *info, void *data)
+static void
+free_send_info(void *key, struct _send_info *info, void *data)
{
g_free(info->uri);
camel_operation_unref(info->cancel);
@@ -206,16 +209,18 @@ free_send_data(void)
send_data = NULL;
}
-static void cancel_send_info(void *key, struct _send_info *info, void *data)
+static void
+cancel_send_info(void *key, struct _send_info *info, void *data)
{
- receive_cancel(info->stop, info);
+ receive_cancel (GTK_BUTTON (info->cancel_button), info);
}
-static void hide_send_info(void *key, struct _send_info *info, void *data)
+static void
+hide_send_info(void *key, struct _send_info *info, void *data)
{
- info->stop = NULL;
- info->bar = NULL;
- info->status = NULL;
+ info->cancel_button = NULL;
+ info->progress_bar = NULL;
+ info->status_label = NULL;
if (info->timeout_id != 0) {
g_source_remove (info->timeout_id);
@@ -252,8 +257,52 @@ dialog_response(GtkDialog *gd, int button, struct _send_data *data)
}
}
-static void operation_status(CamelOperation *op, const char *what, int pc, void *data);
-static int operation_status_timeout(void *data);
+static int
+operation_status_timeout(void *data)
+{
+ struct _send_info *info = data;
+
+ if (info->progress_bar) {
+ gtk_progress_bar_set_fraction (
+ GTK_PROGRESS_BAR (info->progress_bar),
+ info->pc / 100.0);
+ if (info->what)
+ e_clipped_label_set_text (
+ E_CLIPPED_LABEL (info->status_label),
+ info->what);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+set_send_status(struct _send_info *info, const char *desc, int pc)
+{
+ /* FIXME: LOCK */
+ g_free(info->what);
+ info->what = g_strdup(desc);
+ info->pc = pc;
+}
+
+/* for camel operation status */
+static void
+operation_status(CamelOperation *op, const char *what, int pc, void *data)
+{
+ struct _send_info *info = data;
+
+ /*printf("Operation '%s', percent %d\n");*/
+ switch (pc) {
+ case CAMEL_OPERATION_START:
+ pc = 0;
+ break;
+ case CAMEL_OPERATION_END:
+ pc = 100;
+ break;
+ }
+
+ set_send_status(info, what, pc);
+}
static char *
format_url(const char *internal_url, const char *account_name)
@@ -283,7 +332,8 @@ format_url(const char *internal_url, const char *account_name)
return pretty_url;
}
-static send_info_t get_receive_type(const char *url)
+static send_info_t
+get_receive_type(const char *url)
{
CamelProvider *provider;
CamelException ex;
@@ -312,7 +362,7 @@ static send_info_t get_receive_type(const char *url)
return SEND_INVALID;
}
-gboolean
+static gboolean
dialog_map (GtkWidget *window, GdkEvent *event, GtkWidget *table)
{
int h, w;
@@ -324,22 +374,26 @@ dialog_map (GtkWidget *window, GdkEvent *event, GtkWidget *table)
w = 750;
if (h > 400)
h = 400;
- gtk_widget_set_usize (window, w, h);
+ gtk_widget_set_size_request (window, w, h);
+
+ return FALSE;
}
static struct _send_data *
build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destination)
{
GtkDialog *gd;
- GtkTable *table;
+ GtkWidget *table;
int row, num_sources;
GList *list = NULL;
struct _send_data *data;
- GtkWidget *send_icon, *recv_icon,*scrolled_window;
- GtkLabel *label;
- EClippedLabel *status_label;
- GtkProgressBar *bar;
- GtkButton *stop;
+ GtkWidget *send_icon;
+ GtkWidget *recv_icon;
+ GtkWidget *scrolled_window;
+ GtkWidget *label;
+ GtkWidget *status_label;
+ GtkWidget *progress_bar;
+ GtkWidget *cancel_button;
struct _send_info *info;
char *pretty_url;
EAccount *account;
@@ -353,9 +407,13 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
gtk_container_set_border_width ((GtkContainer *)gd->vbox, 0);
gtk_container_set_border_width ((GtkContainer *)gd->action_area, 6);
- stop = (GtkButton *)e_gtk_button_new_with_icon(_("Cancel _All"), GTK_STOCK_CANCEL);
- gtk_widget_show((GtkWidget *)stop);
- gtk_dialog_add_action_widget(gd, (GtkWidget *)stop, GTK_RESPONSE_CANCEL);
+ cancel_button = gtk_button_new_with_mnemonic (_("Cancel _All"));
+ gtk_button_set_image (
+ GTK_BUTTON (cancel_button),
+ gtk_image_new_from_stock (
+ GTK_STOCK_CANCEL, GTK_ICON_SIZE_BUTTON));
+ gtk_widget_show (cancel_button);
+ gtk_dialog_add_action_widget (gd, cancel_button, GTK_RESPONSE_CANCEL);
icon_list = e_icon_factory_get_icon_list ("stock_mail-send-receive");
if (icon_list) {
@@ -378,20 +436,22 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
g_object_unref (iter);
- table = (GtkTable *) gtk_table_new (num_sources, 4, FALSE);
- gtk_container_set_border_width ((GtkContainer *) table, 6);
- gtk_table_set_row_spacings (table, 6);
- gtk_table_set_col_spacings (table, 6);
+ table = gtk_table_new (num_sources, 4, FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (table), 6);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_policy (
+ GTK_SCROLLED_WINDOW (scrolled_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), GTK_WIDGET (table));
- gtk_box_pack_start (GTK_BOX (gd->vbox), scrolled_window,TRUE, TRUE, 0);
- gtk_widget_set_usize (gd->vbox, 600,200);
- gtk_widget_show (GTK_WIDGET (scrolled_window));
+ gtk_scrolled_window_add_with_viewport (
+ GTK_SCROLLED_WINDOW (scrolled_window), table);
+ gtk_box_pack_start (
+ GTK_BOX (gd->vbox), scrolled_window, TRUE, TRUE, 0);
+ gtk_widget_set_size_request (gd->vbox, 600, 200);
+ gtk_widget_show (scrolled_window);
/* must bet setup after send_recv_dialog as it may re-trigger send-recv button */
data = setup_send_data ();
@@ -433,42 +493,57 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
g_hash_table_insert (data->active, info->uri, info);
list = g_list_prepend (list, info);
- } else if (info->bar != NULL) {
+ } else if (info->progress_bar != NULL) {
/* incase we get the same source pop up again */
e_iterator_next (iter);
continue;
} else if (info->timeout_id == 0)
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
- recv_icon = e_icon_factory_get_image ("stock_mail-receive", E_ICON_SIZE_LARGE_TOOLBAR);
+ recv_icon = e_icon_factory_get_image (
+ "stock_mail-receive", E_ICON_SIZE_LARGE_TOOLBAR);
pretty_url = format_url (source->url, account->name);
- label = (GtkLabel *)gtk_label_new (NULL);
- gtk_label_set_markup (label, pretty_url);
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup (GTK_LABEL (label), pretty_url);
g_free (pretty_url);
- bar = (GtkProgressBar *)gtk_progress_bar_new ();
+ progress_bar = gtk_progress_bar_new ();
- stop = (GtkButton *)e_gtk_button_new_with_icon(_("Cancel"), GTK_STOCK_CANCEL);
+ cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- status_label = (EClippedLabel *)e_clipped_label_new((info->type == SEND_UPDATE)?_("Updating..."):_("Waiting..."),
- PANGO_WEIGHT_NORMAL, 1.0);
+ status_label = e_clipped_label_new (
+ (info->type == SEND_UPDATE) ?
+ _("Updating...") : _("Waiting..."),
+ PANGO_WEIGHT_NORMAL, 1.0);
/* g_object_set(data->label, "bold", TRUE, NULL); */
gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5);
- gtk_table_attach (table, (GtkWidget *)recv_icon, 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, (GtkWidget *)label, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, (GtkWidget *)bar, 2, 3, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, (GtkWidget *)stop, 3, 4, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, (GtkWidget *)status_label, 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), recv_icon,
+ 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), label,
+ 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), progress_bar,
+ 2, 3, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), cancel_button,
+ 3, 4, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), status_label,
+ 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- info->bar = bar;
- info->status = status_label;
- info->stop = stop;
+ info->progress_bar = progress_bar;
+ info->status_label = status_label;
+ info->cancel_button = cancel_button;
info->data = data;
- g_signal_connect (stop, "clicked", G_CALLBACK(receive_cancel), info);
+ g_signal_connect (
+ cancel_button, "clicked",
+ G_CALLBACK (receive_cancel), info);
e_iterator_next (iter);
row = row + 2;
}
@@ -493,34 +568,48 @@ build_dialog (EAccountList *accounts, CamelFolder *outbox, const char *destinati
} else if (info->timeout_id == 0)
info->timeout_id = g_timeout_add (STATUS_TIMEOUT, operation_status_timeout, info);
- send_icon = e_icon_factory_get_image ("stock_mail-send", E_ICON_SIZE_LARGE_TOOLBAR);
+ send_icon = e_icon_factory_get_image (
+ "stock_mail-send", E_ICON_SIZE_LARGE_TOOLBAR);
pretty_url = format_url (destination, NULL);
- label = (GtkLabel *)gtk_label_new (NULL);
- gtk_label_set_markup (label, pretty_url);
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup (GTK_LABEL (label), pretty_url);
g_free (pretty_url);
- bar = (GtkProgressBar *)gtk_progress_bar_new ();
- stop = (GtkButton *)e_gtk_button_new_with_icon(_("Cancel"), GTK_STOCK_CANCEL);
+ progress_bar = gtk_progress_bar_new ();
+ cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
- status_label = (EClippedLabel *)e_clipped_label_new(_("Waiting..."), PANGO_WEIGHT_NORMAL, 1.0);
+ status_label = e_clipped_label_new (
+ _("Waiting..."), PANGO_WEIGHT_NORMAL, 1.0);
gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
gtk_misc_set_alignment (GTK_MISC (status_label), 0, .5);
- gtk_table_attach (table, GTK_WIDGET (send_icon), 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, GTK_WIDGET (label), 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, GTK_WIDGET (bar), 2, 3, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, GTK_WIDGET (stop), 3, 4, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_table_attach (table, GTK_WIDGET (status_label), 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), send_icon,
+ 0, 1, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), label,
+ 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), progress_bar,
+ 2, 3, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), cancel_button,
+ 3, 4, row, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (
+ GTK_TABLE (table), status_label,
+ 1, 2, row+1, row+2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
- info->bar = bar;
- info->stop = stop;
+ info->progress_bar = progress_bar;
+ info->cancel_button = cancel_button;
info->data = data;
- info->status = status_label;
+ info->status_label = status_label;
- g_signal_connect(stop, "clicked", G_CALLBACK(receive_cancel), info);
- gtk_widget_show_all (GTK_WIDGET (table));
+ g_signal_connect (
+ cancel_button, "clicked",
+ G_CALLBACK (receive_cancel), info);
+ gtk_widget_show_all (table);
}
gtk_widget_show (GTK_WIDGET (gd));
@@ -554,14 +643,6 @@ update_folders(char *uri, struct _folder_info *info, void *data)
}
}
-static void set_send_status(struct _send_info *info, const char *desc, int pc)
-{
- /* FIXME: LOCK */
- g_free(info->what);
- info->what = g_strdup(desc);
- info->pc = pc;
-}
-
static void
receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, void *data)
{
@@ -593,38 +674,6 @@ receive_status (CamelFilterDriver *driver, enum camel_filter_status_t status, in
}
}
-static int operation_status_timeout(void *data)
-{
- struct _send_info *info = data;
-
- if (info->bar) {
- gtk_progress_bar_set_fraction((GtkProgressBar *)info->bar, (gfloat)(info->pc/100.0));
- if (info->what)
- e_clipped_label_set_text(info->status, info->what);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* for camel operation status */
-static void operation_status(CamelOperation *op, const char *what, int pc, void *data)
-{
- struct _send_info *info = data;
-
- /*printf("Operation '%s', percent %d\n");*/
- switch (pc) {
- case CAMEL_OPERATION_START:
- pc = 0;
- break;
- case CAMEL_OPERATION_END:
- pc = 100;
- break;
- }
-
- set_send_status(info, what, pc);
-}
-
/* when receive/send is complete */
static void
receive_done (char *uri, void *data)
@@ -644,21 +693,25 @@ receive_done (char *uri, void *data)
return;
}
- if (info->bar) {
- gtk_progress_bar_set_fraction((GtkProgressBar *)info->bar, (gfloat)1.0);
+ if (info->progress_bar) {
+ const gchar *text;
- switch(info->state) {
- case SEND_CANCELLED:
- e_clipped_label_set_text(info->status, _("Canceled."));
- break;
- default:
+ gtk_progress_bar_set_fraction(
+ GTK_PROGRESS_BAR (info->progress_bar), 1.0);
+
+ if (info->state == SEND_CANCELLED)
+ text = _("Canceled.");
+ else {
+ text = _("Complete");
info->state = SEND_COMPLETE;
- e_clipped_label_set_text(info->status, _("Complete"));
}
+
+ e_clipped_label_set_text (
+ E_CLIPPED_LABEL (info->status_label), text);
}
- if (info->stop)
- gtk_widget_set_sensitive((GtkWidget *)info->stop, FALSE);
+ if (info->cancel_button)
+ gtk_widget_set_sensitive (info->cancel_button, FALSE);
/* remove/free this active download */
d(printf("%s: freeing info %p\n", G_GNUC_FUNCTION, info));
@@ -687,7 +740,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep
struct _send_info *info = data;
CamelFolder *folder;
struct _folder_info *oldinfo;
- char *oldkey;
+ gpointer oldkey;
g_mutex_lock(info->data->lock);
oldinfo = g_hash_table_lookup(info->data->folders, uri);
@@ -704,7 +757,7 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep
/* and we assume the newer one is the same, but unref the old one anyway */
g_mutex_lock(info->data->lock);
- if (g_hash_table_lookup_extended(info->data->folders, uri, (void **)&oldkey, (void **)&oldinfo)) {
+ if (g_hash_table_lookup_extended(info->data->folders, uri, &oldkey, (void **)&oldinfo)) {
camel_object_unref(oldinfo->folder);
oldinfo->folder = folder;
} else {
@@ -839,7 +892,8 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
}
}
-GtkWidget *mail_send_receive (void)
+GtkWidget *
+mail_send_receive (void)
{
CamelFolder *outbox_folder;
struct _send_data *data;
@@ -1056,12 +1110,12 @@ mail_receive_uri (const char *uri, int keep)
info = g_malloc0 (sizeof (*info));
info->type = type;
- info->bar = NULL;
- info->status = NULL;
+ info->progress_bar = NULL;
+ info->status_label = NULL;
info->uri = g_strdup (uri);
info->keep = keep;
info->cancel = camel_operation_new (operation_status, info);
- info->stop = NULL;
+ info->cancel_button = NULL;
info->data = data;
info->state = SEND_ACTIVE;
info->timeout_id = 0;
@@ -1128,12 +1182,12 @@ mail_send (void)
info = g_malloc0 (sizeof (*info));
info->type = SEND_SEND;
- info->bar = NULL;
- info->status = NULL;
+ info->progress_bar = NULL;
+ info->status_label = NULL;
info->uri = g_strdup (transport->url);
info->keep = FALSE;
info->cancel = camel_operation_new (operation_status, info);
- info->stop = NULL;
+ info->cancel_button = NULL;
info->data = data;
info->state = SEND_ACTIVE;
info->timeout_id = 0;
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 85b149df1b..195a02fe18 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -116,7 +116,7 @@ mail_tool_get_local_movemail_path (const unsigned char *uri, CamelException *ex)
*c = '_';
path = g_strdup_printf("%s/mail/spool", mail_component_peek_base_directory(NULL));
- if (g_stat(path, &st) == -1 && e_util_mkdir_hier(path, 0777) == -1) {
+ if (g_stat(path, &st) == -1 && g_mkdir_with_parents(path, 0777) == -1) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create spool directory `%s': %s"),
path, g_strerror(errno));
g_free(path);
diff --git a/mail/message-list.c b/mail/message-list.c
index 08d9aaabe5..71b33fb4e7 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2043,8 +2043,7 @@ message_list_init (MessageList *message_list)
p = message_list->priv = g_malloc0(sizeof(*message_list->priv));
p->invisible = gtk_invisible_new();
p->destroyed = FALSE;
- g_object_ref(p->invisible);
- gtk_object_sink((GtkObject *)p->invisible);
+ g_object_ref_sink(p->invisible);
matom = gdk_atom_intern ("x-uid-list", FALSE);
gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, matom, 0);