X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkdlg.c;h=6c532024c488febf3b6784ad4d064f1a3d5cf00a;hb=89da2ddf564a93414ee9ab2df3f053608094e417;hp=9fd28ce7e8bd8055c940627f2d9b629e0f483c83;hpb=d0ca84935e7f1ea686b57f75c13d883c4093e758;p=PuTTY.git diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 9fd28ce7..6c532024 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -37,8 +37,6 @@ struct Shortcuts { 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 */ @@ -189,8 +187,6 @@ static void dlg_cleanup(struct dlgparam *dp) 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); } @@ -228,34 +224,6 @@ static struct uctrl *dlg_find_bywidget(struct dlgparam *dp, GtkWidget *w) 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; @@ -1087,7 +1055,7 @@ static void set_transient_window_pos(GtkWidget *parent, GtkWidget *child) gtk_widget_set_uposition(GTK_WIDGET(child), dx, dy); } -void dlg_error_msg(void *dlg, char *msg) +void dlg_error_msg(void *dlg, const char *msg) { struct dlgparam *dp = (struct dlgparam *)dlg; GtkWidget *window, *hbox, *text, *ok; @@ -1832,8 +1800,6 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, 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) @@ -2032,7 +1998,7 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs, { GtkWidget *ww; GtkRequisition req; - char *browsebtn = + const char *browsebtn = (ctrl->generic.type == CTRL_FILESELECT ? "Browse..." : "Change..."); @@ -3172,7 +3138,8 @@ static void messagebox_handler(union control *ctrl, void *dlg, if (event == EVENT_ACTION) dlg_end(dlg, ctrl->generic.context.i); } -int messagebox(GtkWidget *parentwin, char *title, char *msg, int minwid, ...) +int messagebox(GtkWidget *parentwin, const char *title, const char *msg, + int minwid, ...) { GtkWidget *window, *w0, *w1; struct controlbox *ctrlbox; @@ -3269,7 +3236,7 @@ int messagebox(GtkWidget *parentwin, char *title, char *msg, int minwid, ...) return dp.retval; } -int string_width(char *text) +int string_width(const char *text) { GtkWidget *label = gtk_label_new(text); GtkRequisition req; @@ -3291,8 +3258,8 @@ int reallyclose(void *frontend) return ret; } -int verify_ssh_host_key(void *frontend, char *host, int port, char *keytype, - char *keystr, char *fingerprint, +int verify_ssh_host_key(void *frontend, char *host, int port, + const char *keytype, char *keystr, char *fingerprint, void (*callback)(void *ctx, int result), void *ctx) { static const char absenttxt[] = @@ -3389,21 +3356,21 @@ void old_keyfile_warning(void) */ } -void fatal_message_box(void *window, char *msg) +void fatal_message_box(void *window, const char *msg) { messagebox(window, "PuTTY Fatal Error", msg, string_width("REASONABLY LONG LINE OF TEXT FOR BASIC SANITY"), "OK", 'o', 1, 1, NULL); } -void nonfatal_message_box(void *window, char *msg) +void nonfatal_message_box(void *window, const 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, ...) +void fatalbox(const char *p, ...) { va_list ap; char *msg; @@ -3415,7 +3382,7 @@ void fatalbox(char *p, ...) cleanup_exit(1); } -void nonfatal(char *p, ...) +void nonfatal(const char *p, ...) { va_list ap; char *msg; @@ -3438,7 +3405,7 @@ static void licence_clicked(GtkButton *button, gpointer data) { char *title; - char *licence = + const char *licence = "Copyright 1997-2015 Simon Tatham.\n\n" "Portions copyright Robert de Bath, Joris van Rantwijk, Delian "