# HG changeset patch # User mhessling@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1053934778 0 # Node ID b0e2ba7c46c57e54a5ddbee8f5d04c42879de8b9 # Parent 1f92eadea7d39d1a8f03354e4da9b0fb231f83d5 For message boxes that have icons, increase the size of the text area (and hence the complete window) by the width of the icon. In dw_mle_export(), force the return value to be NULL in case passed window is "invalid". For dw_mle_export() under GTK 1.2, reduce the number endpoint by 1. This is so that the "bytes" return value from dw_mle_query() can be passed in directly. diff -r 1f92eadea7d3 -r b0e2ba7c46c5 gtk/dw.c --- a/gtk/dw.c Tue May 20 07:43:37 2003 +0000 +++ b/gtk/dw.c Mon May 26 07:39:38 2003 +0000 @@ -1168,7 +1168,7 @@ va_list args; char outbuf[256]; char **xpm_data = NULL; - int x, y; + int x, y, extra_width=0; va_start(args, format); vsprintf(outbuf, format, args); @@ -1200,6 +1200,9 @@ else if(flags & DW_MB_QUESTION) xpm_data = (char **)_dw_messagebox_question; + if(xpm_data) + extra_width = 32; + if(texttargetbox == imagetextbox) { GdkPixmap *icon_pixmap = NULL; @@ -1228,7 +1231,7 @@ /* Create text */ stext = dw_text_new(outbuf, 0); dw_window_set_style(stext, DW_DT_WORDBREAK, DW_DT_WORDBREAK); - dw_box_pack_start(texttargetbox, stext, 235, 50, TRUE, TRUE, 2); + dw_box_pack_start(texttargetbox, stext, 235+extra_width, 50, TRUE, TRUE, 2); /* Buttons */ buttonbox = dw_box_new(DW_HORZ, 10); @@ -1275,14 +1278,14 @@ dw_signal_connect(cancelbutton, DW_SIGNAL_CLICKED, DW_SIGNAL_FUNC(_dw_cancel_func), (void *)dwwait); } - x = (dw_screen_width() - 280)/2; + x = (dw_screen_width() - (280+extra_width))/2; y = (dw_screen_height() - 150)/2; - dw_window_set_pos_size(entrywindow, x, y, 280, 150); + dw_window_set_pos_size(entrywindow, x, y, (280+extra_width), 150); dw_window_show(entrywindow); - return (int)dw_dialog_wait(dwwait);; + return (int)dw_dialog_wait(dwwait); } /* @@ -3060,6 +3063,9 @@ gchar *text; DW_MUTEX_LOCK; + /* force the return value to nul in case the following tests fail */ + if(buffer) + strcpy(buffer,""); #if GTK_MAJOR_VERSION > 1 if(GTK_IS_SCROLLED_WINDOW(handle)) #else @@ -3079,15 +3085,19 @@ gtk_text_buffer_get_iter_at_offset(tbuffer, &end, startpoint + length); text = gtk_text_iter_get_text(&start, &end); if(text) /* Should this get freed? */ - strcpy(buffer, text); + { + if(buffer) + strcpy(buffer, text); + } } #else if(tmp && GTK_IS_TEXT(tmp)) { - text = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), startpoint, startpoint + length); + text = gtk_editable_get_chars(GTK_EDITABLE(&(GTK_TEXT(tmp)->editable)), startpoint, startpoint + length - 1); if(text) { - strcpy(buffer, text); + if(buffer) + strcpy(buffer, text); g_free(text); } }