2012-02-03 [wwp] 3.8.0cvs24
[claws.git] / src / gtk / progressdialog.c
index a9fef96fdd40d3fee5c6581ebca5aa813263e821..db9e74d510dbb7128826ad16a8123425ed03f77f 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@
  * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * 
  */
 
 #ifdef HAVE_CONFIG_H
 
 #include <glib.h>
 #include <glib/gi18n.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrendererpixbuf.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtk.h>
 
 #include "progressdialog.h"
 #include "gtkutils.h"
@@ -59,7 +48,9 @@ ProgressDialog *progress_dialog_create(void)
        ProgressDialog *progress;
        GtkWidget *dialog;
        GtkWidget *hbox;
+       GtkWidget *vbox;
        GtkWidget *label;
+       GtkWidget *showlog_btn;
        GtkWidget *cancel_btn;
        GtkWidget *progressbar;
        GtkWidget *scrolledwin;
@@ -73,18 +64,17 @@ ProgressDialog *progress_dialog_create(void)
        progress = g_new0(ProgressDialog, 1);
 
        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_window_set_resizable(GTK_WINDOW(dialog), TRUE);
        gtk_widget_realize(dialog);
 
        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);
+               (GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), 0);
+       vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+       gtk_box_set_spacing(GTK_BOX(vbox), 8);
 
        hbox = gtk_hbox_new(FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox,
+       gtk_box_pack_start(GTK_BOX(vbox), hbox,
                           FALSE, FALSE, 8);
        gtk_widget_show(hbox);
 
@@ -92,6 +82,9 @@ ProgressDialog *progress_dialog_create(void)
        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 8);
        gtk_widget_show(label);
 
+       showlog_btn = gtk_dialog_add_button(GTK_DIALOG(dialog),
+                                          _("_View log"),
+                                          GTK_RESPONSE_NONE);
        cancel_btn = gtk_dialog_add_button(GTK_DIALOG(dialog),
                                           GTK_STOCK_CANCEL,
                                           GTK_RESPONSE_NONE);
@@ -99,19 +92,18 @@ ProgressDialog *progress_dialog_create(void)
        gtk_widget_grab_focus(cancel_btn);
 
        progressbar = gtk_progress_bar_new();
-       gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), progressbar,
+       gtk_box_pack_start(GTK_BOX(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(GTK_DIALOG(dialog)->vbox), scrolledwin,
+       gtk_box_pack_start(GTK_BOX(vbox), scrolledwin,
                           TRUE, TRUE, 0);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
 
-
        store = gtk_list_store_new(N_PROGRESS_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
                                   G_TYPE_STRING, G_TYPE_POINTER);
 
@@ -119,7 +111,7 @@ ProgressDialog *progress_dialog_create(void)
        g_object_unref(G_OBJECT(store));
        gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE);
        gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview),
-                                    prefs_common.enable_rules_hint);
+                                    prefs_common.use_stripes_everywhere);
        gtk_widget_show(treeview);
        gtk_container_add(GTK_CONTAINER(scrolledwin), treeview);
        gtk_widget_set_size_request(treeview, -1, 120);
@@ -153,6 +145,7 @@ ProgressDialog *progress_dialog_create(void)
        
        progress->window      = dialog;
        progress->label       = label;
+       progress->showlog_btn  = showlog_btn;
        progress->cancel_btn  = cancel_btn;
        progress->progressbar = progressbar;
        progress->treeview    = treeview;
@@ -186,28 +179,6 @@ void progress_dialog_destroy(ProgressDialog *progress)
        }
 }
 
-/*!
- *\return      gint Row where account was set
- */
-gint progress_dialog_list_set_account(ProgressDialog *progress,
-                                     gint            row,
-                                     const gchar    *account_name)
-{
-       return progress_dialog_insert_account(progress, row, account_name,
-                                             NULL, NULL);
-}
-
-/*!
- *\return      gint Row where image was set
- */
-gint progress_dialog_list_set_image(ProgressDialog *progress,
-                                   gint            row,
-                                   GdkPixbuf      *image)
-{
-       return progress_dialog_insert_account(progress, row, NULL,
-                                             NULL, image);
-}
-
 /*!
  *\return      gint Row where status was set
  */