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

gui_common.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 "dialogs.h"
00024 #include "support.h"
00025 
00027 int running = 0;
00028 
00029 
00030 /* Other Widgets    */
00032 GtkWidget *queryNotebook = NULL;
00033 
00035 GtkWidget *resultNotebook = NULL;
00036 
00038 GtkWidget *mainWindow = NULL;
00040 GtkWidget *aboutDialog = NULL;
00042 GtkFileSelection *queryImportDialog = NULL;
00044 GtkFileSelection *querySaveDialog = NULL;
00046 GtkWidget *scriptOpenDialog = NULL;
00047 
00049 GtkWidget *scriptSaveDialog = NULL;
00050 
00051 /* Main menu widgets    */
00052 
00053 /* Main Config menu.    */
00054 GtkWidget *mainmenu_databaseConnect = NULL;     
00055 GtkWidget *mainmenu_databaseDisconnect = NULL;  
00057 GtkWidget *mainmenu_fileScriptLoad = NULL;      
00058 GtkWidget *mainmenu_fileScriptSave = NULL;      
00059 GtkWidget *mainmenu_fileQueryImport = NULL;     
00060 GtkWidget *mainmenu_fileQueryLoad = NULL;       
00061 GtkWidget *mainmenu_fileQuerySave = NULL;       
00062 GtkWidget *mainmenu_fileQuerySaveAs = NULL;     
00063 GtkWidget *mainmenu_fileResultExport = NULL;    
00065 GtkWidget *mainmenu_queryClear = NULL;          
00066 GtkWidget *mainmenu_queryClose = NULL;          
00067 GtkWidget *mainmenu_queryNew = NULL;            
00068 GtkWidget *mainmenu_querySend = NULL;           
00070 GtkWidget *mainmenu_tableRefresh = NULL;        
00076 void common_cancel_callback(GtkWidget * widget, gpointer data)
00077 {
00078     GtkWidget *fd = (GtkWidget *) data;
00079     gtk_widget_hide(GTK_WIDGET(fd));
00080 }
00081 
00085 int notebook_page_count(GtkNotebook *nb) {
00086     GList *children;
00087 
00088     if (nb == NULL)
00089         return -1;
00090 
00091     children = gtk_container_children(GTK_CONTAINER(nb));
00092     if (children == NULL)
00093         return -1;
00094 
00095     return g_list_length(children);
00096 }
00097 
00099 void setup_widget_vars() {
00100     mainmenu_databaseConnect = lookup_widget(mainWindow, "mainmenu_databaseConnect");
00101     mainmenu_databaseDisconnect = lookup_widget(mainWindow, "mainmenu_databaseDisconnect");
00102 
00103     mainmenu_fileQueryImport = lookup_widget(mainWindow, "mainmenu_fileQueryImport");
00104     mainmenu_fileQueryLoad = lookup_widget(mainWindow, "mainmenu_fileQueryLoad");
00105     mainmenu_fileQuerySave = lookup_widget(mainWindow, "mainmenu_fileQuerySave");
00106     mainmenu_fileQuerySaveAs = lookup_widget(mainWindow, "mainmenu_fileQuerySaveAs");
00107     mainmenu_fileResultExport = lookup_widget(mainWindow, "mainmenu_fileResultExport");
00108 
00109     mainmenu_fileScriptSave = lookup_widget(mainWindow, "mainmenu_fileScriptSaveAs");
00110     mainmenu_fileScriptLoad = lookup_widget(mainWindow, "mainmenu_fileScriptLoad");
00111 
00112     mainmenu_queryClear = lookup_widget(mainWindow, "mainmenu_queryClear");
00113     mainmenu_queryClose = lookup_widget(mainWindow, "mainmenu_queryClose");
00114     mainmenu_queryNew = lookup_widget(mainWindow, "mainmenu_queryNew");
00115     mainmenu_querySend = lookup_widget(mainWindow, "mainmenu_querySend");
00116 
00117     mainmenu_tableRefresh = lookup_widget(mainWindow, "mainmenu_tableRefresh");
00118 }
00119 
00120 void show_error_message(gchar *title, gchar *msg) {
00121     GtkWidget *dialog = create_standard_dialog("Error in query name", "You need to specify a non empty name.", 1, NULL, "Ok", NULL, NULL, NULL, NULL);
00122     gtk_widget_show(dialog);
00123 }
00124 
00131 void show_widget_paths(GtkWidget *widget, char *id) {
00132     gchar *path = NULL;
00133     gint plen = 2048;
00134 
00135     if (! widget)
00136         return;
00137 
00138     gtk_widget_path(GTK_WIDGET(widget), &plen, &path, NULL);
00139     g_print("%s: widget path = %s\n", id, path);
00140 
00141     gtk_widget_class_path(GTK_WIDGET(widget), &plen, &path, NULL);
00142     g_print("%s: widget class path = %s\n", id, path);
00143 }

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