From f45a960006121e20158cbd6de5414a2192fc0f46 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Tue, 30 May 2006 04:37:29 +0000 Subject: Fix for bug #332936 svn path=/trunk/; revision=32053 --- e-util/e-error.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'e-util/e-error.c') diff --git a/e-util/e-error.c b/e-util/e-error.c index e8cf041310..0ad7e2e77e 100644 --- a/e-util/e-error.c +++ b/e-util/e-error.c @@ -35,7 +35,8 @@ #include #include #include - +#include +#include #include #include @@ -62,6 +63,7 @@ struct _e_error { char *primary; char *secondary; char *help_uri; + gboolean scroll; struct _e_error_button *buttons; }; @@ -215,6 +217,8 @@ ee_load(const char *path) e = g_malloc0(sizeof(*e)); e->id = g_strdup(tmp); + e->scroll = FALSE; + xmlFree(tmp); lastbutton = (struct _e_error_button *)&e->buttons; @@ -235,6 +239,13 @@ ee_load(const char *path) e->default_response = map_response(tmp); xmlFree(tmp); } + + tmp = xmlGetProp(error, "scroll"); + if (tmp) { + if (!strcmp(tmp, "yes")) + e->scroll = TRUE; + xmlFree(tmp); + } for (scan = error->children;scan;scan=scan->next) { if (!strcmp(scan->name, "primary")) { @@ -406,7 +417,7 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap) struct _e_error_table *table; struct _e_error *e; struct _e_error_button *b; - GtkWidget *hbox, *w; + GtkWidget *hbox, *w, *scroll=NULL; char *tmp, *domain, *id; GString *out; GPtrArray *args; @@ -524,12 +535,22 @@ e_error_newv(GtkWindow *parent, const char *tag, const char *arg0, va_list ap) g_ptr_array_free(args, TRUE); + if (e->scroll) { + scroll = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy ((GtkScrolledWindow *)scroll, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + } w = gtk_label_new(NULL); gtk_label_set_selectable((GtkLabel *)w, TRUE); gtk_label_set_line_wrap((GtkLabel *)w, TRUE); gtk_label_set_markup((GtkLabel *)w, out->str); g_string_free(out, TRUE); - gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 0); + if (e->scroll) { + gtk_scrolled_window_add_with_viewport ((GtkScrolledWindow *)scroll, w); + gtk_box_pack_start((GtkBox *)hbox, scroll, FALSE, FALSE, 0); + gtk_window_set_default_size ((GtkWindow *)dialog, 360, 180); + } else + gtk_box_pack_start((GtkBox *)hbox, w, FALSE, FALSE, 0); + gtk_widget_show_all(hbox); gtk_box_pack_start((GtkBox *)dialog->vbox, hbox, TRUE, TRUE, 0); -- cgit v1.2.3