X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkdlg.c;h=ffdf3236b2e10e5c4e0496e4f206961294e6b0d3;hb=38ec5cbb6b9a492490a5dd1802bb9972fdba3075;hp=2781db73be3d85c600a5a0dac2c8428d68180ad0;hpb=62cbc7dc0b33808dc8794c59f60971fbba97894b;p=PuTTY.git diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 2781db73..ffdf3236 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -910,9 +910,13 @@ void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn) { struct dlgparam *dp = (struct dlgparam *)dlg; struct uctrl *uc = dlg_find_byctrl(dp, ctrl); + /* We must copy fn->path before passing it to gtk_entry_set_text. + * See comment in dlg_editbox_set() for the reasons. */ + char *duppath = dupstr(fn->path); assert(uc->ctrl->generic.type == CTRL_FILESELECT); assert(uc->entry != NULL); - gtk_entry_set_text(GTK_ENTRY(uc->entry), fn->path); + gtk_entry_set_text(GTK_ENTRY(uc->entry), duppath); + sfree(duppath); } Filename *dlg_filesel_get(union control *ctrl, void *dlg) @@ -928,9 +932,13 @@ void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fs) { struct dlgparam *dp = (struct dlgparam *)dlg; struct uctrl *uc = dlg_find_byctrl(dp, ctrl); + /* We must copy fs->name before passing it to gtk_entry_set_text. + * See comment in dlg_editbox_set() for the reasons. */ + char *dupname = dupstr(fs->name); assert(uc->ctrl->generic.type == CTRL_FONTSELECT); assert(uc->entry != NULL); - gtk_entry_set_text(GTK_ENTRY(uc->entry), fs->name); + gtk_entry_set_text(GTK_ENTRY(uc->entry), dupname); + sfree(dupname); } FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg) @@ -2268,15 +2276,22 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, cols = cols ? cols : 1; for (i = 0; i < cols; i++) { GtkTreeViewColumn *column; + GtkCellRenderer *cellrend; /* * It appears that GTK 2 doesn't leave us any * particularly sensible way to honour the * "percentages" specification in the ctrl * structure. */ + cellrend = gtk_cell_renderer_text_new(); + if (!ctrl->listbox.hscroll) { + gtk_object_set(GTK_OBJECT(cellrend), + "ellipsize", PANGO_ELLIPSIZE_END, + "ellipsize-set", TRUE, + NULL); + } column = gtk_tree_view_column_new_with_attributes - ("heading", gtk_cell_renderer_text_new(), - "text", i+1, (char *)NULL); + ("heading", cellrend, "text", i+1, (char *)NULL); gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_GROW_ONLY); gtk_tree_view_append_column(GTK_TREE_VIEW(w), column); @@ -3254,7 +3269,7 @@ int messagebox(GtkWidget *parentwin, char *title, char *msg, int minwid, ...) return dp.retval; } -static int string_width(char *text) +int string_width(char *text) { GtkWidget *label = gtk_label_new(text); GtkRequisition req; @@ -3381,6 +3396,13 @@ void fatal_message_box(void *window, char *msg) "OK", 'o', 1, 1, NULL); } +void nonfatal_message_box(void *window, char *msg) +{ + messagebox(window, "PuTTY Error", msg, + string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"), + "OK", 'o', 1, 1, NULL); +} + void fatalbox(char *p, ...) { va_list ap; @@ -3393,6 +3415,17 @@ void fatalbox(char *p, ...) cleanup_exit(1); } +void nonfatal(char *p, ...) +{ + va_list ap; + char *msg; + va_start(ap, p); + msg = dupvprintf(p, ap); + va_end(ap); + nonfatal_message_box(NULL, msg); + sfree(msg); +} + static GtkWidget *aboutbox = NULL; static void about_close_clicked(GtkButton *button, gpointer data) @@ -3406,12 +3439,12 @@ static void licence_clicked(GtkButton *button, gpointer data) char *title; char *licence = - "Copyright 1997-2011 Simon Tatham.\n\n" + "Copyright 1997-2014 Simon Tatham.\n\n" "Portions copyright Robert de Bath, Joris van Rantwijk, Delian " "Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas " "Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, " - "Markus Kuhn, Colin Watson, and CORE SDI S.A.\n\n" + "Markus Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A.\n\n" "Permission is hereby granted, free of charge, to any person " "obtaining a copy of this software and associated documentation " @@ -3487,7 +3520,7 @@ void about_box(void *window) w, FALSE, FALSE, 5); gtk_widget_show(w); - w = gtk_label_new("Copyright 1997-2011 Simon Tatham. All rights reserved"); + w = gtk_label_new("Copyright 1997-2014 Simon Tatham. All rights reserved"); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(aboutbox)->vbox), w, FALSE, FALSE, 5); gtk_widget_show(w); @@ -3517,6 +3550,7 @@ static void eventlog_destroy(GtkWidget *widget, gpointer data) es->window = NULL; sfree(es->seldata); + es->seldata = NULL; dlg_cleanup(&es->dp); ctrl_free_box(es->eventbox); }