[gq-commit] gq/src input.c,1.77,1.78
Status: Beta
Brought to you by:
sur5r
From: <sta...@us...> - 2003-10-27 22:19:58
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv2505 Modified Files: input.c Log Message: * Restore the scrolled-window position in the right pane of browser tabs upon refresh Index: input.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/input.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** input.c 24 Oct 2003 19:17:47 -0000 1.77 --- input.c 27 Oct 2003 22:15:17 -0000 1.78 *************** *** 141,158 **** struct snapshot_info { struct inputform *iform; ! int x, y; }; ! static void vp_pos(GtkWidget *vp, struct snapshot_info *si) { GtkAdjustment *adj; adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(vp)); ! gtk_adjustment_set_value(adj, si->x * adj->upper / 100.0); adj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(vp)); ! gtk_adjustment_set_value(adj, si->y * adj->upper / 100.0); ! gtk_signal_disconnect_by_func(GTK_OBJECT(vp), vp_pos, si); g_free(si); --- 141,162 ---- struct snapshot_info { struct inputform *iform; ! double x, y; }; ! static void vp_pos(GtkWidget *w, struct snapshot_info *si) { GtkAdjustment *adj; + GtkWidget *vp = GTK_BIN(si->iform->scwin)->child; adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(vp)); ! gtk_adjustment_set_value(adj, si->x * adj->upper); adj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(vp)); ! gtk_adjustment_set_value(adj, si->y * adj->upper); ! if (w) { ! gtk_signal_disconnect_by_func(GTK_OBJECT(w), ! GTK_SIGNAL_FUNC(vp_pos), si); ! } g_free(si); *************** *** 189,196 **** si = g_malloc0(sizeof(struct snapshot_info)); si->iform = iform; ! si->x = x; ! si->y = y; ! gtk_signal_connect(GTK_OBJECT(w), "realize", vp_pos, si); } } --- 193,201 ---- si = g_malloc0(sizeof(struct snapshot_info)); si->iform = iform; ! si->x = x / 100.0; ! si->y = y / 100.0; ! gtk_signal_connect(GTK_OBJECT(w), "realize", ! GTK_SIGNAL_FUNC(vp_pos), si); } } *************** *** 995,998 **** --- 1000,1017 ---- { GList *oldlist, *newlist, *children; + double frac_x = 0.0, frac_y = 0.0; + GtkWidget *w; + + w = iform->scwin; + if (w) { + GtkAdjustment *adj; + + w = GTK_BIN(w)->child; + adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(w)); + frac_x = adj->value / adj->upper; + + adj = gtk_viewport_get_vadjustment(GTK_VIEWPORT(w)); + frac_y = adj->value / adj->upper; + } while ((children = gtk_container_children(GTK_CONTAINER(iform->target_vbox))) != NULL) { *************** *** 1022,1030 **** create_form_content(iform); build_inputform(iform); } ! } void edit_entry(struct ldapserver *server, const char *dn) --- 1041,1066 ---- create_form_content(iform); + build_inputform(iform); } ! /* let the main loop run to get all the geometry sorted out for ! the new inputform, afterwards restore the previously set ! viewport position */ + while(gtk_events_pending()) + gtk_main_iteration(); + + if (iform->scwin) { + struct snapshot_info *si; + + si = g_malloc0(sizeof(struct snapshot_info)); + si->iform = iform; + si->x = frac_x; + si->y = frac_y; + + vp_pos(NULL, si); + } + } void edit_entry(struct ldapserver *server, const char *dn) |