Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

status.c

Go to the documentation of this file.
00001 
00005 /* GtkSQL -- an interactive graphical query tool for PostgreSQL
00006  * Copyright (C) 1998-2003 Lionel Ulmer, Darryl Luff
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 #include <stdlib.h>
00024 #include <gtk/gtk.h>
00025 
00026 #include "status.h"
00027 
00028 static GtkWidget *hbox;
00029 static GtkWidget *sbar;
00030 static guint contextId;
00031 static GtkWidget *pbar;
00032 
00035 GtkWidget *status_bar_new(void)
00036 {
00037     hbox = gtk_hbox_new(FALSE, 5);
00038     sbar = gtk_statusbar_new();
00039     contextId = gtk_statusbar_get_context_id(GTK_STATUSBAR(sbar),
00040                                               "GtkSQL status");
00041     gtk_widget_show(sbar);
00042     pbar = gtk_progress_bar_new();
00043     gtk_widget_set_usize(pbar, 150, 20);
00044     gtk_widget_show(pbar);
00045 
00046     gtk_box_pack_start(GTK_BOX(hbox), sbar, TRUE, TRUE, 0);
00047     gtk_box_pack_start(GTK_BOX(hbox), pbar, FALSE, FALSE, 0);
00048 
00049     return hbox;
00050 }
00051 
00053 void status_pop(void)
00054 {
00055     gtk_statusbar_pop(GTK_STATUSBAR(sbar), contextId);
00056     while (gtk_events_pending())
00057         gtk_main_iteration();
00058 }
00059 
00061 void status_push(gchar * msg)
00062 {
00063     gtk_statusbar_push(GTK_STATUSBAR(sbar), contextId, msg);
00064     while (gtk_events_pending())
00065         gtk_main_iteration();
00066 }
00067 
00069 void progress_reset(void)
00070 {
00071     gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), 0.0);
00072     while (gtk_events_pending())
00073         gtk_main_iteration();
00074 }
00075 
00077 void progress_update(gfloat percentage)
00078 {
00079     gtk_progress_bar_update(GTK_PROGRESS_BAR(pbar), percentage);
00080     while (gtk_events_pending())
00081         gtk_main_iteration();
00082 }

Generated on Sun May 9 19:19:17 2004 for GtkSQL by doxygen1.2.18