Author: Carlos Lopez <[email protected]>
Date:   Thu Feb  9 20:25:23 2012 +0100

When showing a warning or error dialog use a scrolled window. It avoid a crash 
if the warning or error message is huge.

---

 synfig-studio/src/gui/app.cpp |   23 +++++++++++++++--------
 synfig-studio/src/gui/app.h   |    2 +-
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/synfig-studio/src/gui/app.cpp b/synfig-studio/src/gui/app.cpp
index 0061921..71598e6 100644
--- a/synfig-studio/src/gui/app.cpp
+++ b/synfig-studio/src/gui/app.cpp
@@ -2168,18 +2168,25 @@ App::dialog_save_file(const std::string &title, 
std::string &filename, std::stri
 void
 App::dialog_error_blocking(const std::string &title, const std::string 
&message)
 {
-       Gtk::MessageDialog dialog(message, false, Gtk::MESSAGE_ERROR, 
Gtk::BUTTONS_CLOSE, true);
-       dialog.set_title(title);
-       dialog.show();
-       dialog.run();
+       dialog_warning_blocking(title, message, Gtk::Stock::DIALOG_ERROR);
 }
 
 void
-App::dialog_warning_blocking(const std::string &title, const std::string 
&message)
+App::dialog_warning_blocking(const std::string &title, const std::string 
&message, const Gtk::StockID &stock_id)
 {
-       Gtk::MessageDialog dialog(message, false, Gtk::MESSAGE_WARNING, 
Gtk::BUTTONS_CLOSE, true);
-       dialog.set_title(title);
-       dialog.show();
+       Gtk::Dialog dialog(title, true, true);
+       Gtk::ScrolledWindow scrolled;
+       Gtk::Label label(message);
+       scrolled.add(label);
+       scrolled.set_shadow_type(Gtk::SHADOW_NONE);
+       Gtk::Table table(2, 2);
+       Gtk::Image image(stock_id, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));
+       table.attach(image, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
+       table.attach(scrolled, 1, 2, 0, 2, Gtk::FILL|Gtk::EXPAND, 
Gtk::FILL|Gtk::EXPAND);
+       dialog.get_vbox()->pack_start(table);
+       dialog.add_button(Gtk::StockID("gtk-close"),1);
+       dialog.set_default_size(450, 250);
+       dialog.show_all();
        dialog.run();
 }
 
diff --git a/synfig-studio/src/gui/app.h b/synfig-studio/src/gui/app.h
index 8891fe5..56f28f8 100644
--- a/synfig-studio/src/gui/app.h
+++ b/synfig-studio/src/gui/app.h
@@ -336,7 +336,7 @@ public:
 
        static void dialog_error_blocking(const std::string &title, const 
std::string &message);
 
-       static void dialog_warning_blocking(const std::string &title, const 
std::string &message);
+       static void dialog_warning_blocking(const std::string &title, const 
std::string &message, const Gtk::StockID &stock_id=Gtk::Stock::DIALOG_WARNING);
 
        static bool dialog_entry(const std::string &title, const std::string 
&message,std::string &text);
        static bool dialog_paragraph(const std::string &title, const 
std::string &message,std::string &text);


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to