2005-02-25 [paul] 1.0.1cvs15.12
[claws.git] / src / gtk / progressdialog.c
index ab4201740897d9dca0a21541ebcb7b28add3fe10..dd4e8e9c38a5409f2500df2821820c876fd332ee 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 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
 #endif
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkvbox.h>
+#include <gtk/gtkdialog.h>
 #include <gtk/gtkhbox.h>
 #include <gtk/gtklabel.h>
 #include <gtk/gtkprogressbar.h>
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtkbutton.h>
+#include <gtk/gtkstock.h>
 
-#include "intl.h"
 #include "progressdialog.h"
 #include "gtkutils.h"
 #include "utils.h"
@@ -56,12 +56,10 @@ static void progress_dialog_create_list_view_columns(GtkTreeView *list_view);
 ProgressDialog *progress_dialog_create(void)
 {
        ProgressDialog *progress;
-       GtkWidget *window;
-       GtkWidget *vbox;
+       GtkWidget *dialog;
        GtkWidget *hbox;
        GtkWidget *label;
        GtkWidget *cancel_btn;
-       GtkWidget *cancel_area;
        GtkWidget *progressbar;
        GtkWidget *scrolledwin;
        GtkWidget *clist;
@@ -74,38 +72,41 @@ ProgressDialog *progress_dialog_create(void)
        debug_print("Creating progress dialog...\n");
        progress = g_new0(ProgressDialog, 1);
 
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       gtk_widget_set_usize(window, 460, -1);
-       gtk_container_set_border_width(GTK_CONTAINER(window), 8);
-       gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
-       gtk_widget_realize(window);
+       dialog = gtk_dialog_new();
+       gtk_widget_set_size_request(dialog, 460, -1);
+       gtk_container_set_border_width(GTK_CONTAINER(dialog), 8);
+       gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, TRUE);
+       gtk_widget_realize(dialog);
 
-       vbox = gtk_vbox_new(FALSE, 8);
-       gtk_container_add(GTK_CONTAINER(window), vbox);
-       gtk_widget_show(vbox);
+       gtk_container_set_border_width
+               (GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), 0);
+       gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 8);
+       gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
 
        hbox = gtk_hbox_new(FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 8);
+       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox,
+                          FALSE, FALSE, 8);
        gtk_widget_show(hbox);
 
        label = gtk_label_new("");
        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8);
        gtk_widget_show(label);
 
-       gtkut_button_set_create_stock(&cancel_area, &cancel_btn, 
-                                     GTK_STOCK_CANCEL, NULL, NULL, 
-                                     NULL, NULL);
-       gtk_box_pack_end(GTK_BOX(vbox), cancel_area, FALSE, FALSE, 0);
+       cancel_btn = gtk_dialog_add_button(GTK_DIALOG(dialog),
+                                          GTK_STOCK_CANCEL,
+                                          GTK_RESPONSE_NONE);
        gtk_widget_grab_default(cancel_btn);
-       gtk_widget_show_all(cancel_area);
+       gtk_widget_grab_focus(cancel_btn);
 
        progressbar = gtk_progress_bar_new();
-       gtk_box_pack_start(GTK_BOX(vbox), progressbar, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), progressbar,
+                          FALSE, FALSE, 0);
        gtk_widget_show(progressbar);
 
        scrolledwin = gtk_scrolled_window_new(NULL, NULL);
        gtk_widget_show(scrolledwin);
-       gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0);
+       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), scrolledwin,
+                          TRUE, TRUE, 0);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
@@ -127,7 +128,7 @@ ProgressDialog *progress_dialog_create(void)
        gtk_container_add(GTK_CONTAINER(scrolledwin), list_view);
        gtk_widget_set_usize(list_view, -1, 120);
 
-       progress->window      = window;
+       progress->window      = dialog;
        progress->label       = label;
        progress->cancel_btn  = cancel_btn;
        progress->progressbar = progressbar;