struct uctrl {
union control *ctrl;
GtkWidget *toplevel;
- void *privdata;
- int privdata_needs_free;
GtkWidget **buttons; int nbuttons; /* for radio buttons */
GtkWidget *entry; /* for editbox, filesel, fontsel */
GtkWidget *button; /* for filesel, fontsel */
dp->byctrl = NULL;
while ( (uc = index234(dp->bywidget, 0)) != NULL) {
del234(dp->bywidget, uc);
- if (uc->privdata_needs_free)
- sfree(uc->privdata);
sfree(uc->buttons);
sfree(uc);
}
return ret;
}
-void *dlg_get_privdata(union control *ctrl, void *dlg)
-{
- struct dlgparam *dp = (struct dlgparam *)dlg;
- struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
- return uc->privdata;
-}
-
-void dlg_set_privdata(union control *ctrl, void *dlg, void *ptr)
-{
- struct dlgparam *dp = (struct dlgparam *)dlg;
- struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
- uc->privdata = ptr;
- uc->privdata_needs_free = FALSE;
-}
-
-void *dlg_alloc_privdata(union control *ctrl, void *dlg, size_t size)
-{
- struct dlgparam *dp = (struct dlgparam *)dlg;
- struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
- /*
- * This is an internal allocation routine, so it's allowed to
- * use smalloc directly.
- */
- uc->privdata = smalloc(size);
- uc->privdata_needs_free = FALSE;
- return uc->privdata;
-}
-
union control *dlg_last_focused(union control *ctrl, void *dlg)
{
struct dlgparam *dp = (struct dlgparam *)dlg;
uc = snew(struct uctrl);
uc->ctrl = ctrl;
- uc->privdata = NULL;
- uc->privdata_needs_free = FALSE;
uc->buttons = NULL;
uc->entry = NULL;
#if !GTK_CHECK_VERSION(2,4,0)
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);
"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;
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)
char *title;
char *licence =
- "Copyright 1997-2012 Simon Tatham.\n\n"
+ "Copyright 1997-2015 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 "
w, FALSE, FALSE, 5);
gtk_widget_show(w);
- w = gtk_label_new("Copyright 1997-2012 Simon Tatham. All rights reserved");
+ w = gtk_label_new("Copyright 1997-2015 Simon Tatham. All rights reserved");
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(aboutbox)->vbox),
w, FALSE, FALSE, 5);
gtk_widget_show(w);
es->window = NULL;
sfree(es->seldata);
+ es->seldata = NULL;
dlg_cleanup(&es->dp);
ctrl_free_box(es->eventbox);
}