Re: Re: Tab width

Tommi Komulainen <[email protected]> Sun, 10 Apr 2005 21:44:12 +0300
Newsgroups gmane.comp.web.galeon.devel
Message-ID <[email protected]>
--=-CkaN3oMib4xuUSLvj4Gu
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Tue, 2005-04-05 at 00:38 +0200, Stelian Ionescu wrote:
> what about this patch ?
> I made two new functions for GulNotebook: gul_notebook_set_tab_width()
> and gul_notebook_refresh_tab_width(). They could me merged but I think th=
at
> having these functionalities apart could be useful(some day).

Going to right direction, few things still.

Introducing new functions just because someone might want to use them
when standing on their head and scratching their back doesn't pay off.
Better do the refactoring *when* there's a need, not before.

Besides in this particular case set_tab_width() should just work and do
the right thing; why force the programmer to call two functions when one
is sufficient?


+       tab_width =3D tab_width >=3D 0 ? tab_width : 0;

This should be:
        tab_width =3D tab_width > 0 ? tab_width : TAB_WIDTH_DEFAULT;

(where TAB_WIDTH_DEFAULT equals to the value in the schemas with a note
to keep the two in sync.)

The rationale for this is that when gconf key is missing we should fall
back to the default value and eel_gconf returns 0 in that case.

The gul_notebook_set_tab_width() implementation should do its own sanity
checking to guard against < 0 values.


+       GtkWidget *curr_tab =3D gtk_notebook_get_nth_page(&nb->parent, 0);

Please use gtk+ style casts, GTK_NOTEBOOK(nb)


+       for(curr_tab_num =3D 0; curr_tab_num < total_tab_num; curr_tab_num+=
+) {
+               label =3D tab_get_label(GUL_NOTEBOOK (nb), GTK_WIDGET(curr_=
tab));
+               hbox =3D GTK_WIDGET (gtk_widget_get_ancestor (label, GTK_TY=
PE_HBOX));

This loop fails to go through all the tabs, it just reuses 'curr_tab'
several times.

It's also slightly backwards about getting the label and hbox (the right
one?) - please use gtk_notebook_get_tab_label() and the 'label' and
'label-hbox' datas.

Almost there... =3D)


--=20
Tommi Komulainen                                 [email protected]
GPG 1024D/68388EE6    6FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6

--=-CkaN3oMib4xuUSLvj4Gu
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQBCWXP7BKiYcWg4juYRAnwyAJ0S1zO+rlxf/sZsQNk0D2iGR2BNrACdG0Bj
icO29KUNDCh024JOa3jxnSg=
=wT1f
-----END PGP SIGNATURE-----

--=-CkaN3oMib4xuUSLvj4Gu--


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click