replace deprecated gtk_progress*
[claws.git] / src / action.c
index 2987b1e659043c7610c2b267b22a4559b5d7a4e3..6e580006e9d282f1241e77df28d3d4c75b0792e9 100644 (file)
@@ -100,7 +100,7 @@ struct _ChildInfo
 };
 
 static void action_update_menu         (GtkItemFactory *ifactory,
-                                        const gchar    *branch_path,
+                                        gchar          *branch_path,
                                         gpointer        callback,
                                         gpointer        data);
 static void compose_actions_execute_cb (Compose        *compose,
@@ -406,7 +406,7 @@ void actions_execute(gpointer data,
 }
 
 void action_update_mainwin_menu(GtkItemFactory *ifactory,
-                               const gchar *branch_path,
+                               gchar *branch_path,
                                MainWindow *mainwin)
 {
        action_update_menu(ifactory, branch_path,
@@ -414,7 +414,7 @@ void action_update_mainwin_menu(GtkItemFactory *ifactory,
 }
 
 void action_update_msgview_menu(GtkItemFactory *ifactory,
-                               const gchar *branch_path,
+                               gchar *branch_path,
                                MessageView *msgview)
 {
        action_update_menu(ifactory, branch_path,
@@ -422,7 +422,7 @@ void action_update_msgview_menu(GtkItemFactory *ifactory,
 }
 
 void action_update_compose_menu(GtkItemFactory *ifactory, 
-                               const gchar *branch_path,
+                               gchar *branch_path,
                                Compose *compose)
 {
        action_update_menu(ifactory, branch_path,
@@ -430,7 +430,7 @@ void action_update_compose_menu(GtkItemFactory *ifactory,
 }
 
 static void action_update_menu(GtkItemFactory *ifactory, 
-                              const gchar *branch_path,
+                              gchar *branch_path,
                               gpointer callback, gpointer data)
 {
        GtkWidget *menuitem;
@@ -1048,12 +1048,6 @@ static void update_io_dialog(Children *children)
 
        debug_print("Updating actions input/output dialog.\n");
 
-       if (children->progress_bar) {
-               gtk_progress_configure(GTK_PROGRESS(children->progress_bar),
-                               children->initial_nb -children->nb,
-                               0.0, children->initial_nb);
-       }
-
        if (!children->nb) {
                gtk_widget_set_sensitive(children->abort_btn, FALSE);
                gtk_widget_set_sensitive(children->close_btn, TRUE);
@@ -1072,14 +1066,13 @@ static void update_io_dialog(Children *children)
                ChildInfo *child_info;
                GtkTextBuffer *textbuf;
                GtkTextIter iter, start_iter, end_iter;
-               GdkFont *font;
 
-               font = g_object_get_data(G_OBJECT(children->dialog), 
-                                        "s_txtfont");
                gtk_widget_show(children->scrolledwin);
-               textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW(text));
-               gtk_text_buffer_get_start_iter (textbuf, &start_iter);
-               gtk_text_buffer_get_end_iter (textbuf, &end_iter);
+               textbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
+               gtk_text_buffer_get_start_iter(textbuf, &start_iter);
+               gtk_text_buffer_get_end_iter(textbuf, &end_iter);
+               gtk_text_buffer_delete(textbuf, &start_iter, &end_iter);
+               gtk_text_buffer_get_start_iter(textbuf, &start_iter);
                iter = start_iter;
                for (cur = children->list; cur; cur = cur->next) {
                        child_info = (ChildInfo *)cur->data;
@@ -1116,7 +1109,7 @@ static void create_io_dialog(Children *children)
        GtkWidget *progress_bar = NULL;
        GtkWidget *abort_button;
        GtkWidget *close_button;
-       GdkFont   *output_font;
+       PangoFontDescription *text_font;
 
        debug_print("Creating action IO dialog\n");
 
@@ -1150,6 +1143,13 @@ static void create_io_dialog(Children *children)
        gtk_widget_hide(scrolledwin);
 
        text = gtk_text_view_new();
+       if (prefs_common.textfont) {
+               if (NULL != (text_font = pango_font_description_from_string
+                               (prefs_common.textfont))) {
+                       gtk_widget_modify_font(text, text_font);
+                       pango_font_description_free(text_font);
+               }                       
+       }                       
        gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
        gtk_container_add(GTK_CONTAINER(scrolledwin), text);
        gtk_widget_show(text);
@@ -1180,18 +1180,10 @@ static void create_io_dialog(Children *children)
 
        if (children->initial_nb > 1) {
                progress_bar = gtk_progress_bar_new();
-               gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(progress_bar),
-                               GTK_PROGRESS_CONTINUOUS);
                gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(progress_bar),
                                GTK_PROGRESS_LEFT_TO_RIGHT);
-               gtk_progress_set_activity_mode(GTK_PROGRESS(progress_bar), 
-                               FALSE);
-               gtk_progress_set_format_string(GTK_PROGRESS(progress_bar),
-                               _("Completed %v/%u"));
-               gtk_progress_set_show_text(GTK_PROGRESS(progress_bar), TRUE);
-               gtk_progress_configure(GTK_PROGRESS(progress_bar),
-                               children->initial_nb -children->nb,
-                               0.0, children->initial_nb);
+               gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress_bar),
+                                         _("Completed %v/%u"));
 
                gtk_box_pack_start(GTK_BOX(vbox), progress_bar, FALSE, FALSE, 0);
                gtk_widget_show(progress_bar);
@@ -1219,13 +1211,6 @@ static void create_io_dialog(Children *children)
        children->abort_btn    = abort_button;
        children->close_btn    = close_button;
 
-#warning FIXME_GTK2 convert to Pango / FontDesc?
-#if 0
-       output_font = gtkut_font_load_from_fontset(prefs_common.textfont);
-       gtk_object_set_data_full(GTK_OBJECT(dialog), "s_txtfont",
-                                output_font, 
-                                (GtkDestroyNotify)gdk_font_unref); 
-#endif
        gtk_widget_show(dialog);
 }