[PATCH] gtk-gui.c: Move the download dialog related code to a new file

Lubomir I. Ivanov neolit123 at gmail.com
Wed Jan 9 11:28:05 PST 2013


On 9 January 2013 20:56, Dirk Hohndel <dirk at hohndel.org> wrote:
> "Lubomir I. Ivanov" <neolit123 at gmail.com> writes:
>
>> this is sensitive stuff, so i may have messed up a little or at least things
>> may be out of place here and there.
>>
>> the patch performs the move with minimal changes i.e. so that it compiles +
>> runs, but not much else.
>>
>> brief notes:
>> - new file is called download-dialog.c
>> - display-gtk.h now exposes some more functions such as update_screen()
>> and is_default_dive_computer()
>> - display-gtk.h now includes the OPTIONCALLBACK and UNITCALLBACK macros, but
>> renamed briefly with a SCREEN_ prefix, since these are related to
>> update_screen(). the rename was required since OPTIONCALLBACK was also present
>> in print.c. now..this may not be a good idea, but the only reason for them
>> to be in the header is because download-dialog.c requires the same
>> OPTIONCALLBACK and i've simply moved them both as a "couple of similar
>> macros". this may require changes...
>
> Should they go into their own header file then? One that isn't included
> except in the two .c files that actually use them?
>

(attached is a patch update)

i've added a new file callbacks-gtk.h (naming scheme from display-gtk.h).
but i've kept the SCREEN_ prefix for the two macros, since this file can be used
by other dialogs in the future - e.g. a similar macro from print.c can
be moved here.

>> - download_dialog_init() and download_dialog_exit() from download-dialog.c
>> are used only to retrieve the default DC from the user config. can be
>> approached differently if the declarations of default_dive_computer_*
>> are simply made extern in display-gtk.h, which might be a better choice.
>
> Yes, I think those could be globals.

default_dive_computer_* are now declared extern in display-gtk.h.

>
>> please comment on the patch + notes, so that i can improve on it (if required)
>> and until the mod is acceptable, of course. it moves near 500 LOC from
>> gtk-gui.c.
>
> That's a good thing :-)
>

yeah, i also see potential for the nickname code to be moved to
nicknames.c, given we have the UI.
perhaps both the "backend" + UI.

lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gtk-gui.c-Move-the-download-dialog-related-code-to-a.patch
Type: application/octet-stream
Size: 41087 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130109/0a72b8b3/attachment-0001.obj>


More information about the subsurface mailing list