Attention applet writers!!



ok ... I've done it again ... I've made a slightly incompatible change
to applet widget yet again .. but this time it actually does break
compatibility and applets need to be altered in a minor way

most notably, applet_widget_new() now takes no argument, and gnome_init
is replaced by applet_widget_init_defaults (for normal applets), which
takes all the gnome_init arguments and the argv[0] argument as the last
one

I've changed all the applets on CVS ... so look there ...

multiple applet stuff has changed interface almost completely, but I
doubt anybody used it extensively since ysterday .... it occured to me
that some stuff wasn't "per widget" but global to the entire process so
those things are now done through applet_widget_init (this is including
the start_new_applet callback) .. again look at the clock applet to see
how this would all work

another simplification is the fact that binding  the destroy signal is
no longer neccessary, by default the applet dies when it's last
AppletWidget was destroyed, this can be changed in applet_widget_init

all this makes it now extremely simple to write an applet, just do:

#include <config.h>
#include <gnome.h>
#include <applet-widget.h>

int
main(int argc, char **argv)
{
	GtkWidget *applet;
	GtkWidget *label;

	applet_widget_init_defaults("some_applet", NULL, argc, argv, 0,
				    NULL, argv[0]);

	applet = applet_widget_new();
	if (!applet)
		g_error("Can't create applet!\n");

	label = gtk_label_new("Hello There");
	gtk_widget_show(label);
	applet_widget_add (APPLET_WIDGET (applet), label);
	gtk_widget_show (applet);

	applet_widget_gtk_main ();

	return 0;
}

and that's it ... that's a complete applet ... (well not an extremely
useful one:)

I will (time permits) write up a little tutorial on writing applets,
since there can be a little bit more to it then the above, but I'm now
pretty happy with the way the interface works so it shouldn't change
(much) anymore

George

-- 
------------------------------------------------------------------------------
George Lebl <jirka@5z.com> http://www.5z.com/jirka/
------------------------------------------------------------------------------
  The following implements RSA in perl and is illegal to export from the US:

          #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
          $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
          lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]