2007/11/4, Matteo Landi <[EMAIL PROTECTED]>:
>
> hi all
> i'm a complete newbie in developing with gtk, but yesterday i had an
> idea about develope a gnome panel which could substitute conky..
> In fact i'm in need of a panel that simply display the output of a bash
> script..
> well, after have googled a bit, i found a guide for implementing gnome
> applet and here is the result
>
> #include <string.h>
> #include <panel-applet.h>
> #include <gtk/gtklabel.h>
> #include <stdio.h>
>
> static gboolean on_button_press (GtkWidget *event_box, GdkEventButton
> *event, GtkWidget* label){
>         if (event->button != 1)
>                 return FALSE;
>         else {
>                 FILE* fp;
>                 char line[160];
>                 fp = popen("~/scripts/allin1", "r");
>                 fgets( line, sizeof line, fp);
>                 pclose(fp);
>                 gtk_label_set_text (label,(const char*) line);
>         }
>         return TRUE;
> }
>
> static gboolean my_applet_fill (PanelApplet *applet, const gchar *iid,
> gpointer data){
>         FILE* fp;
>         int pid;
>         char line[160];
>         GtkWidget *label;
>
>         fp = popen("~/scripts/allin1", "r");
>         fgets( line, sizeof line, fp);
>         pclose(fp);
>
>         label = gtk_label_new (line);
>         gtk_container_add (GTK_CONTAINER (applet), label);
>
>         g_signal_connect (G_OBJECT(applet), "button_press_event",
> G_CALLBACK
> (on_button_press), label);
>
>         gtk_widget_show_all (GTK_WIDGET (applet));
>
>
>         return TRUE;
> }
>
> PANEL_APPLET_BONOBO_FACTORY ("OAFIID:my_applet_Factory",
> PANEL_TYPE_APPLET, "Conky Porting", "0", my_applet_fill, NULL);
>
> what i'm asking for is how could i refresh the label of the applet after
> a fixed period of time... (now the applets refresh when mouse-clicked)
> tnx in advance


Try whith g_timeout_add() or g_idle_add()
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to