problem refreshing image widget
- From: amarnath bandekar <amar_bandekar yahoo co in>
- To: gtk-devel-list gnome org
- Subject: problem refreshing image widget
- Date: Sun, 23 Apr 2006 04:04:04 +0100 (BST)
hi
i hv a program in which i have inserted an image widget in a window...i hv used g_timeout_add function to auto refresh it after particular time...but i dont kno wat should be the code of callback function (timeout_callback) so that the image in the window gets refreshed....
here is the code
#include<gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include<time.h>
GtkWidget *window1;
GtkWidget *image1;
gint timeout_callback(GtkWidget *window, gpointer *data) {
free(image1);
image1=gtk_image_new_from_file("/root/thisthing.jpeg");
gtk_widget_show(image1);
g_signal_connect ((gpointer) image1, "show",
G_CALLBACK (gtk_widget_show),
NULL);
printf("hi amar\n");
}
void close_g_image(GtkWidget *window,gpointer data) {
printf("quit it\n");
gtk_main_quit();
exit(0);
}
int main(int argc, char *argv[]) {
gint tag;
gtk_set_locale ();
gtk_init (&argc, &argv);
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window1), "window1");
image1 = gtk_image_new_from_file ("/root/something.jpeg");
gtk_widget_show (image1);
gtk_container_add (GTK_CONTAINER (window1), image1);
g_signal_connect ((gpointer) image1, "show",
G_CALLBACK (gtk_widget_show),
NULL);
tag=g_timeout_add(10000,GTK_SIGNAL_FUNC(timeout_callback),NULL);
g_signal_connect(GTK_OBJECT(window1),"destroy",GTK_SIGNAL_FUNC(close_g_image),window1);
gtk_widget_show (window1);
gtk_main ();
return 0;
}
Jiyo cricket on
Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]