Hello,
Rather than give it in diff -pru form, here is a new
a_Interface_message_window function. I am giving it to you like this
because it's easier for me (and probably you) -- my interface.c is
extremely hacked right now.
This function resembles the old one but is re-organized, has more
comments, and produces a prettier message window. The OK button stays
the same size no matter how big the window is, which I think is
important.
To see this message window in action, apply the patch to cache.c, below.
Rather than have cache.c set the status bar label, I pop up a message
window. I think users might not notice the status bar, and wonder why
Dillo didn't respond when they tried to visit (e.g.) an FTP URL.
Like all of what I've sent so far, these modifications affect the
overall "polish" of Dillo -- its appearance and the organization of the
code. If these are not wanted (my first two patches were ignored),
please let me know why. Thanks.
===
/*
* A general-purpose message window.
*/
void a_Interface_message_window(const char *title, const char *format, ... )
{
GtkAccelGroup *accel_group;
GtkWidget *window, *label, *button, *vbox, *hbox;
static char msg[1024];
va_list argp;
va_start(argp, format);
vsnprintf(msg, 1024, format, argp);
va_end(argp);
/* Create the message window. */
window = gtk_window_new(GTK_WINDOW_DIALOG);
gtk_window_set_wmclass(GTK_WINDOW(window), "message_dialog", "dillo");
gtk_window_set_title(GTK_WINDOW(window), title);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_container_border_width(GTK_CONTAINER(window), 5);
gtk_signal_connect_object(GTK_OBJECT(window), "delete_event",
(GtkSignalFunc)gtk_widget_destroy, (void*)window);
/* Create the accel_group. */
accel_group = gtk_accel_group_new();
gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
/* Create the label. */
label = gtk_label_new(msg);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_FILL);
gtk_misc_set_padding(GTK_MISC(label), 20, 20);
/* Create the OK button and its hbox. */
button = gtk_button_new_with_label(" OK ");
gtk_signal_connect_object(GTK_OBJECT(button), "clicked",
(GtkSignalFunc)gtk_widget_destroy, (void*)window);
gtk_widget_add_accelerator(button, "clicked",
accel_group, GDK_Escape, 0, GTK_ACCEL_LOCKED);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
/* Create and pack the vbox to put the label and the hbox in. */
vbox = gtk_vbox_new(FALSE, 5);
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
/* Show all the widgets. */
gtk_widget_show(label);
gtk_widget_show(button);
gtk_widget_show(hbox);
gtk_widget_show(vbox);
gtk_widget_grab_focus(button);
gtk_widget_show(window);
}
===
--- cache.c Thu Apr 3 15:22:59 2003
+++ cache.c.crp Thu Apr 3 15:22:39 2003
@@ -369,7 +369,9 @@ static gint Cache_open_url(DilloWeb *Web
a_Cache_ccc, BCK, cccFunct, 1, 1);
a_Chain_bcb(OpStart, entry->CCCQuery, (void *)entry->Url, Web);
} else {
- a_Interface_msg(Web->bw, "ERROR: unsupported protocol");
+ a_Interface_message_window("Protocol Not Supported",
+ "Protocol \"%s\" is not supported.",
+ Url->scheme);
a_Cache_ccc(OpAbort, 1, FWD, entry->CCCQuery, NULL, NULL);
ClientKey = 0; /* aborted */
}
Best,
--
Chris music is what numbers feel like San Francisco, CA