replace deprecated gtk_progress*
[claws.git] / src / inc.c
index 9387e86262796c8b290819ada0d757f5648b95dd..e8cd43244845e4c63987e810032f350b2b507071 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -386,7 +386,7 @@ static IncProgressDialog *inc_progress_dialog_create(gboolean autocheck)
                         G_CALLBACK(inc_dialog_delete_cb), dialog);
        /* manage_window_set_transient(GTK_WINDOW(progress->window)); */
 
-       progress_dialog_set_value(progress, 0.0);
+       progress_dialog_get_fraction(progress);
 
        stock_pixmap_gdk(progress->clist, STOCK_PIXMAP_COMPLETE,
                         &okxpm, &okxpmmask);
@@ -433,7 +433,7 @@ static void inc_progress_dialog_set_list(IncProgressDialog *inc_dialog)
 
 static void inc_progress_dialog_clear(IncProgressDialog *inc_dialog)
 {
-       progress_dialog_set_value(inc_dialog->dialog, 0.0);
+       progress_dialog_get_fraction(inc_dialog->dialog);
        progress_dialog_set_label(inc_dialog->dialog, "");
        if (inc_dialog->mainwin)
                main_window_progress_off(inc_dialog->mainwin);
@@ -642,6 +642,8 @@ static gint inc_start(IncProgressDialog *inc_dialog)
                }
                g_slist_free(msglist);
 
+               statusbar_pop_all();
+
                new_msgs += pop3_session->cur_total_num;
 
                if (pop3_session->error_val == PS_AUTHFAIL &&
@@ -913,16 +915,14 @@ static void inc_progress_dialog_set_progress(IncProgressDialog *inc_dialog,
                progress_dialog_set_label(inc_dialog->dialog, buf);
        }
 
-       progress_dialog_set_percentage
+       progress_dialog_set_fraction
                (inc_dialog->dialog,(gfloat)cur_total / (gfloat)total);
 
-       gtk_progress_set_show_text
-               (GTK_PROGRESS(inc_dialog->mainwin->progressbar), TRUE);
        g_snprintf(buf, sizeof(buf), "%d / %d",
                   pop3_session->cur_msg, pop3_session->count);
-       gtk_progress_set_format_string
-               (GTK_PROGRESS(inc_dialog->mainwin->progressbar), buf);
-       gtk_progress_bar_update
+       gtk_progress_bar_set_text
+               (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar), buf);
+       gtk_progress_bar_set_fraction
                (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
                 (gfloat)cur_total / (gfloat)total);
 
@@ -1315,18 +1315,22 @@ static gpointer autocheck_data = NULL;
 static void inc_notify_cmd(gint new_msgs, gboolean notify)
 {
 
-       gchar *buf;
+       gchar *buf, *numpos;
 
        if (!(new_msgs && notify && prefs_common.newmail_notify_cmd &&
            *prefs_common.newmail_notify_cmd))
                     return;
-       if ((buf = strchr(prefs_common.newmail_notify_cmd, '%')) &&
-               buf[1] == 'd' && !strchr(&buf[1], '%'))
-               buf = g_strdup_printf(prefs_common.newmail_notify_cmd, 
-                                     new_msgs);
-       else
-               buf = g_strdup(prefs_common.newmail_notify_cmd);
+       buf = g_strdup(prefs_common.newmail_notify_cmd);
+       if ((numpos = strstr(buf, "%d")) != NULL) {
+               gchar *buf2;
+
+               *numpos = '\0';
+               buf2 = g_strdup_printf("%s%d%s", buf, new_msgs, numpos + 2);
+               g_free(buf);
+               buf = buf2;
+       }
 
+       debug_print("executing new mail notification command: %s\n", buf);
        execute_command_line(buf, TRUE);
 
        g_free(buf);