Re: How to write an applet?



On Sat, Jan 08, 2000 at 09:52:05PM -0500, Havoc Pennington wrote:
> 
> These errors look like gtk_init/gnome_init wasn't called.
> 
> Havoc
> 
hm. Look at this.

-------------------
#include <applet-widget.h>
#include <gtk/gtk.h>

int main (int argc, char** argv) {
	GtkWidget *input,*output;
	GtkWidget *table;
	GtkWidget *history_button;
	GtkWidget* applet;
	
	/* create table */
	table =gtk_table_new(2,2,FALSE);
		
	/* create input entry and attach it */
	input =gtk_entry_new_with_max_length(20);
	if (!input) {
		g_print("Couldn instantiate input\n");
		exit (-1);
	}
	gtk_table_attach_defaults(GTK_TABLE(table),GTK_WIDGET(input),
					0,2,0,1);
	
	/* create output entry and attach it */
	output=gtk_entry_new_with_max_length(16);
	gtk_table_attach_defaults(GTK_TABLE(table),GTK_WIDGET(output),
					0,1,1,2);
	
	/* create history button and attach it */
	history_button=gtk_button_new();        
	gtk_table_attach_defaults(GTK_TABLE(table),GTK_WIDGET(history_button),
					1,2,1,2);

	/* now the rest */
	applet_widget_init("galg2_applet", NULL, argc, argv, 0, NULL,
	argv[0],TRUE,TRUE,applet_start_new_applet,NULL);
	applet==applet_widget_new("Galgulator2");
	applet_widget_add(APPLET_WIDGET(applet),table);
	gtk_widget_show(applet);
	applet_widget_init("Galgulator2","0.1",argc,argv,NULL,0,NULL);
	applet_widget_gtk_main();
	return 0;
}
-------------------
My main prob is that I dont know how to write main() correctly, cause there
is no doc for it ... or I didnt find it.

mfg
-- 
Andreas Sliwka   | goff@nef.wh.uni-dortmund.de | ICQ goff:13961062




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