gEDA-dev: [PATCH] gschem: remember dialog size and position

Peter Clifton pcjc2 at cam.ac.uk
Mon Apr 30 17:29:39 EDT 2007


On Mon, 2007-04-30 at 20:49 +0200, Ivan Stankovic wrote:
> Hi,
> 
> This patch makes gschem able to remember position and
> size for all dialogs (yes, I've tested them all :)).
> The information is stored in ~/.gEDA/gschem-dialog-geometry.
> This functionality is enabled only if glib version >= 2.6.0 is
> available, and applies cleanly on top of current CVS/git.
> 
> Here is how it works. After creating the dialog widget, set
> the dialog name with a call like
> 
>    gtk_object_set_data(GTK_OBJECT(dialog), "dialog-name", "whatever");
> 
> Here, "whatever" can be anything, as long as it's unique (usually,
> the name will be something meaningful, like "text-find").
> After that, you call 
> 
>    dialog_restore_geometry(dialog);

I'd not inline the functions - they don't appear to be called in a
performance critical path. Also, they might be useful outside the
x_dialog.c code?

I'm being lazy here.. do all the dialogs come via x_dialog.c? I thought
the component selector at least sub-classed GtkDialog internally.

A quick grep:

x_compselect.c:    compselect_type = g_type_register_static (GTK_TYPE_DIALOG,
x_dialog.c:      g_type_register_static (GTK_TYPE_DIALOG,
x_log.c:    log_type = g_type_register_static (GTK_TYPE_DIALOG,
x_multiattrib.c:    multiattrib_type = g_type_register_static (GTK_TYPE_DIALOG,
x_pagesel.c:    pagesel_type = g_type_register_static (GTK_TYPE_DIALOG,
x_print.c:      print_dialog_type = g_type_register_static (GTK_TYPE_DIALOG,


I love your neat implementation though.

I just had a further thought..

Perhaps we could sub-class GtkDialog, to "GschemDialog" or "GedaDialog",
which adds the size save/restore functionality, then sub-class
"GSCHEM_TYPE_DIALOG" or "GEDA_TYPE_DIALOG", catching appropriate events
to make it happen auto-magically for the whole app.

Again, this is a way to make things auto-magically work for many cases
without having to explicitly add hooks to every dialog.

We'd want the functionality for the main window probably too, so I guess
you can just call the same set size hooks on that manually.


Really glad to see the great patches,

Regards,

Peter C.




More information about the geda-dev mailing list