xfce4 in CVS (Don't use it)

Thomas Leonard tal00r at ecs.soton.ac.uk
Tue May 21 12:17:25 CEST 2002


On Mon, May 20, 2002 at 08:04:13PM +0200, Jasper Huijsmans wrote:
> Hi all,
> 
> Maybe some of you noticed when they did a checkout of xfce-devel there
> is now an xfce4 directory with several files containing seemingly random
> code. This is my attempt at a gtk2 based panel. 
> 
> However it is not anywhere near finished. Really, it's not. I put it
> there to keep an archive and to let people who are interested have a
> look at my ideas. Things will change without prior notice, there is no
> documentation and no fancy configuration system (yet).

On thing I noticed: in the dialog for editing items, the buttons at the
bottom go [Apply] [Cancel]. Is XFCE going to adopt the ordering system
used in other Gtk+-2.0 apps (including GNOME and ROX), where the 'Yes'
button is always in the bottom-right corner? I think Macs use this style
too.

> You cannot change the configuration and some of the buttons do strange
> stuff like changing style or changing the panel size.

If you want a nice, well tested options box, you can lift options.c out
of ROX-Filer and drop it in with only minor changes[1]. It's very easy to
use, eg:

	static Option big_icons;

	void module_init(void)
	{
		/* Register options, giving a name and default value */
		option_add_int(&big_icons, "big_icons", TRUE);

		option_add_notify(check_options);
	}

The use it with:

	if (big_icons.int_value == TRUE)
		...
	else
		...

When the user edits the options, check_options is called:

	void check_options(void)
	{
		if (big_icons.has_changed)
			recreate_icons();
	}

The options box is built automatically from an XML file. The 'name'
field corresponds to the name passed to option_add_int().

	<?xml version='1.0' encoding='UTF-8'?>
	<options>
	  <section title='Panel'>
	    <toggle name='big_icons' label='Use large icons'>
	      Turn this option on if you want large icons.
	    </toggle>
	  </section>
	</options>

The options are saved and loaded in an XML format too. You can register
additional widgets (like 'toggle') to extend the basic set (ROX-Filer adds
a 'toolbar' widget to set it toolbar layout, for example).

All changes made in the options box are instant effect, and there is a
Revert button to undo changes. Screenshot here:

	http://www.ecs.soton.ac.uk/~tal00r/screen.png


[1] Changes needed: create choices_* functions which tell the options
system where to load and save the choices, and remove code for converting
old format options files to XML.


-- 
Thomas Leonard			http://rox.sourceforge.net
tal00r at ecs.soton.ac.uk		tal197 at users.sourceforge.net



More information about the Xfce4-dev mailing list