gnome-messagebox patch
- From: Havoc Pennington <hp pobox com>
- To: gnome-list gnome org
- Subject: gnome-messagebox patch
- Date: Sat, 21 Mar 1998 01:38:27 -0600 (CST)
Hi,
gnome-messagebox didn't use the first cell of its list of buttons,
AFAICT. This made it a little harder to decipher whether the button arg
of the clicked signal started with 1 or 0 (and wasted an insignificant
amount of memory and a couple of microseconds :)
Also, the _new function didn't call va_end().
There is still some weird bug when the messagebox is destroyed:
** WARNING **: invalid cast from `(unknown)' to `GnomeMessageBox'
** WARNING **: file gtkwidget.c: line 1190 (gtk_widget_destroy):
"GTK_IS_WIDGET (widget)"
May be my program's fault though.
Havoc Pennington
http://pobox.com/~hp
Index: gnome-libs/libgnomeui/gnome-messagebox.c
===================================================================
RCS file: /debian/home/gnomecvs/gnome-libs/libgnomeui/gnome-messagebox.c,v
retrieving revision 1.6
diff -u -r1.6 gnome-messagebox.c
--- gnome-messagebox.c 1998/02/17 14:54:41 1.6
+++ gnome-messagebox.c 1998/03/21 07:25:14
@@ -226,7 +226,7 @@
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
gtk_widget_show (hbox);
- messagebox->buttons = g_list_alloc ();
+ messagebox->buttons = 0;
for (;;) {
GtkWidget *button;
char *text = va_arg (ap, char *);
@@ -249,6 +249,8 @@
messagebox->buttons = g_list_append (messagebox->buttons, button);
}
+ va_end(ap);
+
return GTK_WIDGET (messagebox);
}
@@ -264,8 +266,8 @@
gint button)
{
GList *list = messagebox->buttons;
-
- while (button-- && list)
+
+ while (--button && list)
list = list->next;
if (list && list->data)
gtk_widget_grab_default (GTK_WIDGET (list->data));
@@ -276,7 +278,8 @@
GtkWidget *messagebox)
{
GList *list = GNOME_MESSAGEBOX (messagebox)->buttons;
- int which = 0;
+ /* buttons are numbered starting with 1 */
+ int which = 1;
while (list){
if (list->data == button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]