00001 00005 /* GtkSQL -- an interactive graphical query tool for PostgreSQL and MySQL. 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 tdo_he 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 <gtk/gtk.h> 00024 00025 #include "buf.h" 00026 #include "gui_common.h" 00027 #include "interface.h" 00028 #include "queries.h" 00029 #include "query_save_dlg.h" 00030 00031 /* ==== Variables ==== */ 00032 QuerySaveData querySaveData = { 00033 NULL, NULL 00034 }; 00035 00037 void query_save_dialog_hide() 00038 { 00039 if (querySaveDialog != NULL) 00040 gtk_widget_hide(GTK_WIDGET(querySaveDialog)); 00041 } 00042 00046 void query_save_dialog_create(GtkWidget * qry) 00047 { 00048 ABuf *buf = NULL; 00049 00050 if (querySaveDialog == NULL) { 00051 querySaveDialog = GTK_FILE_SELECTION(create_querySaveDlg()); 00052 00053 buf = buf_strcpy(buf, cfg_get_current_dir()); 00054 buf = buf_strcat(buf, "/"); 00055 buf = buf_strcat(buf, query_get_current_name()); 00056 buf = buf_strcat(buf, ".sql"); 00057 gtk_file_selection_set_filename(GTK_FILE_SELECTION(querySaveDialog), 00058 buf->b_dat); 00059 buf_free(buf); 00060 } 00061 00062 querySaveData.query = qry; 00063 if (qry == NULL) 00064 querySaveData.qdata = NULL; 00065 else 00066 querySaveData.qdata = query_get_querydata(qry); 00067 00068 if (querySaveData.qdata != NULL) 00069 gtk_file_selection_set_filename(GTK_FILE_SELECTION(querySaveDialog), 00070 querydata_get_filename(querySaveData. 00071 qdata)); 00072 } 00073 00074 void query_save_dialog_show(GtkWidget * qry) 00075 { 00076 query_save_dialog_create(qry); 00077 gtk_widget_show(GTK_WIDGET(querySaveDialog)); 00078 }