Start button-activated browse near old field contents GTK
[xboard.git] / gtk / xoptions.c
index a13ceff..7a3a831 100644 (file)
@@ -1113,9 +1113,11 @@ void BrowseGTK(GtkWidget *widget, gpointer gdata)
     gtkfilter     = gtk_file_filter_new();
     gtkfilter_all = gtk_file_filter_new();
 
-    char fileext[MSG_SIZ], *filter = currentOption[opt_i].textValue;
+    char fileext[MSG_SIZ], *filter = currentOption[opt_i].textValue, *old;
 
-    StartDir(filter, NULL); // change to start directory for this file type
+    GetWidgetText(&currentOption[opt_i], &old); // start in same directory as current widget contents
+    StartDir(filter, old); // change to start directory for this file type
+    g_free(old);
 
     /* select file or folder depending on option_type */
     if (currentOption[opt_i].type == PathName)
@@ -1392,7 +1394,7 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
                GtkAttachOptions x = GTK_FILL;
                // make sure hbox is always available when we have more options on same row
                 hbox = gtk_hbox_new (option[i].type == Button && option[i].textValue || option[i].type == Graph, 0);
-               if(!currentCps && option[i].value > 80) x |= GTK_EXPAND; // only vertically extended widgets should size vertically
+               if(!currentCps && option[i].value > 80 && option[i].type == TextBox) x |= GTK_EXPAND; // only vertically extended widgets should size vertically
                 if (strcmp(option[i].name, "") == 0 || option[i].type == Label || option[i].type == Button)
                     // for Label and Button name is contained inside option
                     gtk_table_attach(GTK_TABLE(table), hbox, left, left+r, top, top+1, GTK_FILL | GTK_EXPAND, x, 2, 1);
@@ -1549,7 +1551,8 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
                 Pack(hbox, table, fbutton, left, left+r, top, 0);
                 break;
             }
-            if(!strcmp(option[i].name, "R") || !strcmp(option[i].name, "G") || !strcmp(option[i].name, "B")) {
+            if(!strcmp(option[i].name, "R") || !strcmp(option[i].name, "G") ||
+               !strcmp(option[i].name, "B") && !strcmp(option[i+1].name, "D")) {
                 break;
             } else
             if(!strcmp(option[i].name, "D")) {
@@ -1826,8 +1829,10 @@ if(appData.debugMode) printf("n=%d, h=%d, w=%d\n",n,height,width);
        gtk_window_resize(GTK_WINDOW(dialog), wp[dlgNr]->width, wp[dlgNr]->height);
     }
 
-    for(i=0; option[i].type != EndMark; i++) if(option[i].type == Graph || dlgNr == BoardWindow && option[i].handle)
+    for(i=0; option[i].type != EndMark; i++) if(option[i].type == Graph || dlgNr == BoardWindow && option[i].handle) {
        gtk_widget_set_size_request(option[i].handle, -1, -1); // remove size requests after realization, so user can shrink
+       if(option[i].type == Label) gtk_label_set_ellipsize(option[i].handle, PANGO_ELLIPSIZE_END);
+    }
 
     return 1; // tells caller he must do initialization (e.g. add specific event handlers)
 }