gtk/examples/statusbar/statusbar.c

74 lines
2.0 KiB
C
Raw Normal View History

/* example-start statusbar statusbar.c */
#include <gtk/gtk.h>
#include <glib.h>
GtkWidget *status_bar;
Removed g_object_pointer_hash, which was just g_direct_hash. Tue Jun 9 18:44:57 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkobject.c: Removed g_object_pointer_hash, which was just g_direct_hash. Mon May 25 19:54:20 1998 Owen Taylor <otaylor@gtk.org> * configure.in: x_libs=, not $x_libs=. Enough said. (Case only hit for --disable-xshm) Mon May 25 12:08:14 1998 Owen Taylor <otaylor@gtk.org> * configure.in (LDFLAGS): Add to $CFLAGS and $LDFLAGS when testing for X libraries, don't replace them. Because the user might have specified the path to the X libraries themself before running configure. * examples/**.c: Changed all gpointer * to gpointer Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org> * configure.in (LDFLAGS): Bomb out with a moderately helpful message if detection of X libraries fails. Sat May 23 18:57:06 1998 Owen Taylor <otaylor@gtk.org> [ Combination of: gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>) gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ] * gdk/gdk.h gdk/gdkcc.c gdk/gdkfont.c gtk/gtkmain.c gtk/gtksignal.c gtk/gtktext.c: Fixups for warnings from adding const to type of GHashFunc, GCompareFunc * gtk/gtkcombo.c (gtk_combo_entry_key_press): Minor style/ ansi-warnings fixups. Tue Jun 9 17:47:33 1998 Owen Taylor <otaylor@gtk.org> * glib.h: Remove #error - HP/UX. Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org> [ Combination of: gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>) gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ] * glib.h ghash.c gstring.c gdataset.c gutils.c: - Added new typedef g_const_pointer; expunged all incorrect uses of 'const gpointer'. - Fixed up warnings that that created, - Changed GHashFunc and GCompareFunc to take g_const_pointer arguments. (Necessary, but will cause warnings in existing code until fixed) - Added other new const in harmless positions.
1998-06-09 23:18:11 +00:00
void push_item (GtkWidget *widget, gpointer data)
{
static int count = 1;
char buff[20];
g_snprintf(buff, 20, "Item %d", count++);
gtk_statusbar_push( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data), buff);
return;
}
Removed g_object_pointer_hash, which was just g_direct_hash. Tue Jun 9 18:44:57 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkobject.c: Removed g_object_pointer_hash, which was just g_direct_hash. Mon May 25 19:54:20 1998 Owen Taylor <otaylor@gtk.org> * configure.in: x_libs=, not $x_libs=. Enough said. (Case only hit for --disable-xshm) Mon May 25 12:08:14 1998 Owen Taylor <otaylor@gtk.org> * configure.in (LDFLAGS): Add to $CFLAGS and $LDFLAGS when testing for X libraries, don't replace them. Because the user might have specified the path to the X libraries themself before running configure. * examples/**.c: Changed all gpointer * to gpointer Sat May 23 21:54:05 1998 Owen Taylor <otaylor@gtk.org> * configure.in (LDFLAGS): Bomb out with a moderately helpful message if detection of X libraries fails. Sat May 23 18:57:06 1998 Owen Taylor <otaylor@gtk.org> [ Combination of: gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>) gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ] * gdk/gdk.h gdk/gdkcc.c gdk/gdkfont.c gtk/gtkmain.c gtk/gtksignal.c gtk/gtktext.c: Fixups for warnings from adding const to type of GHashFunc, GCompareFunc * gtk/gtkcombo.c (gtk_combo_entry_key_press): Minor style/ ansi-warnings fixups. Tue Jun 9 17:47:33 1998 Owen Taylor <otaylor@gtk.org> * glib.h: Remove #error - HP/UX. Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org> [ Combination of: gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>) gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ] * glib.h ghash.c gstring.c gdataset.c gutils.c: - Added new typedef g_const_pointer; expunged all incorrect uses of 'const gpointer'. - Fixed up warnings that that created, - Changed GHashFunc and GCompareFunc to take g_const_pointer arguments. (Necessary, but will cause warnings in existing code until fixed) - Added other new const in harmless positions.
1998-06-09 23:18:11 +00:00
void pop_item (GtkWidget *widget, gpointer data)
{
gtk_statusbar_pop( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data) );
return;
}
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *vbox;
GtkWidget *button;
gint context_id;
gtk_init (&argc, &argv);
/* create a new window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
gtk_window_set_title(GTK_WINDOW (window), "GTK Statusbar Example");
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
(GtkSignalFunc) gtk_exit, NULL);
vbox = gtk_vbox_new(FALSE, 1);
gtk_container_add(GTK_CONTAINER(window), vbox);
gtk_widget_show(vbox);
status_bar = gtk_statusbar_new();
gtk_box_pack_start (GTK_BOX (vbox), status_bar, TRUE, TRUE, 0);
gtk_widget_show (status_bar);
context_id = gtk_statusbar_get_context_id( GTK_STATUSBAR(status_bar), "Statusbar example");
button = gtk_button_new_with_label("push item");
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (push_item), GINT_TO_POINTER(context_id) );
gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2);
gtk_widget_show(button);
button = gtk_button_new_with_label("pop last item");
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC (pop_item), GINT_TO_POINTER(context_id) );
gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 2);
gtk_widget_show(button);
/* always display the window as the last step so it all splashes on
* the screen at once. */
gtk_widget_show(window);
gtk_main ();
return 0;
}
/* example-end */