"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gnucash/gnome-utils/dialog-file-access.c" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

dialog-file-access.c  (gnucash-5.0.tar.bz2):dialog-file-access.c  (gnucash-5.1.tar.bz2)
skipping to change at line 25 skipping to change at line 25
* GNU General Public License for more details. * * GNU General Public License for more details. *
* * * *
* You should have received a copy of the GNU General Public License* * You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: * * along with this program; if not, contact: *
* * * *
* Free Software Foundation Voice: +1-617-542-5942 * * Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org * * Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/ \********************************************************************/
#include <stdbool.h>
#include <config.h> #include <config.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include "gnc-ui.h" #include "gnc-ui.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "gnc-uri-utils.h" #include "gnc-uri-utils.h"
#include "dialog-utils.h" #include "dialog-utils.h"
#include "dialog-file-access.h" #include "dialog-file-access.h"
#include "gnc-file.h" #include "gnc-file.h"
#include "gnc-filepath-utils.h"
#include "gnc-plugin-file-history.h" #include "gnc-plugin-file-history.h"
#include "gnc-session.h" #include "gnc-session.h"
static QofLogModule log_module = GNC_MOD_GUI; static QofLogModule log_module = GNC_MOD_GUI;
#define DEFAULT_HOST "localhost" #define DEFAULT_HOST "localhost"
#define DEFAULT_DATABASE PROJECT_NAME #define DEFAULT_DATABASE PROJECT_NAME
#define FILE_ACCESS_OPEN 0 #define FILE_ACCESS_OPEN 0
#define FILE_ACCESS_SAVE_AS 1 #define FILE_ACCESS_SAVE_AS 1
#define FILE_ACCESS_EXPORT 2 #define FILE_ACCESS_EXPORT 2
skipping to change at line 249 skipping to change at line 251
default_db = g_getenv( "GNC_DEFAULT_DATABASE" ); default_db = g_getenv( "GNC_DEFAULT_DATABASE" );
if ( default_db == NULL ) if ( default_db == NULL )
{ {
default_db = DEFAULT_DATABASE; default_db = DEFAULT_DATABASE;
} }
return default_db; return default_db;
} }
typedef bool (*CharToBool)(const char*);
static bool datafile_filter (const GtkFileFilterInfo* filter_info,
CharToBool filename_checker)
{
return filter_info && filter_info->filename &&
filename_checker (filter_info->filename);
}
static void free_file_access_window (FileAccessWindow *faw) static void free_file_access_window (FileAccessWindow *faw)
{ {
g_free (faw->starting_dir); g_free (faw->starting_dir);
g_free (faw); g_free (faw);
} }
static void static void
gnc_ui_file_access (GtkWindow *parent, int type) gnc_ui_file_access (GtkWindow *parent, int type)
{ {
FileAccessWindow *faw; FileAccessWindow *faw;
skipping to change at line 346 skipping to change at line 357
op = GTK_BUTTON(gtk_builder_get_object (builder, "pb_op" )); op = GTK_BUTTON(gtk_builder_get_object (builder, "pb_op" ));
if ( op != NULL ) if ( op != NULL )
gtk_button_set_label( op, button_label ); gtk_button_set_label( op, button_label );
file_chooser = GTK_WIDGET(gtk_builder_get_object (builder, "file_chooser" )) ; file_chooser = GTK_WIDGET(gtk_builder_get_object (builder, "file_chooser" )) ;
fileChooser = GTK_FILE_CHOOSER_WIDGET(gtk_file_chooser_widget_new( fileChoos erAction )); fileChooser = GTK_FILE_CHOOSER_WIDGET(gtk_file_chooser_widget_new( fileChoos erAction ));
faw->fileChooser = GTK_FILE_CHOOSER(fileChooser); faw->fileChooser = GTK_FILE_CHOOSER(fileChooser);
gtk_box_pack_start( GTK_BOX(file_chooser), GTK_WIDGET(fileChooser), TRUE, TR UE, 6 ); gtk_box_pack_start( GTK_BOX(file_chooser), GTK_WIDGET(fileChooser), TRUE, TR UE, 6 );
/* set up .gnucash filters for Datafile operations */
GtkFileFilter *filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All files"));
gtk_file_filter_add_pattern (filter, "*");
gtk_file_chooser_add_filter (faw->fileChooser, filter);
filter = gtk_file_filter_new ();
/* Translators: *.gnucash and *.xac are file patterns and must not
be translated*/
gtk_file_filter_set_name (filter, _("Datafiles only (*.gnucash, *.xac)"));
gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
(GtkFileFilterFunc)datafile_filter,
gnc_filename_is_datafile, NULL);
gtk_file_chooser_add_filter (faw->fileChooser, filter);
gtk_file_chooser_set_filter (faw->fileChooser, filter);
filter = gtk_file_filter_new ();
/* Translators: *.gnucash.*.gnucash, *.xac.*.xac are file
patterns and must not be translated*/
gtk_file_filter_set_name (filter, _("Backups only (*.gnucash.*.gnucash, *.xa
c.*.xac)"));
gtk_file_filter_add_custom (filter, GTK_FILE_FILTER_FILENAME,
(GtkFileFilterFunc)datafile_filter,
gnc_filename_is_backup, NULL);
gtk_file_chooser_add_filter (faw->fileChooser, filter);
/* Set the default directory */ /* Set the default directory */
if (type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS) if (type == FILE_ACCESS_OPEN || type == FILE_ACCESS_SAVE_AS)
{ {
last = gnc_history_get_last(); last = gnc_history_get_last();
if ( last && *last && gnc_uri_targets_local_fs (last)) if ( last && *last && gnc_uri_targets_local_fs (last))
{ {
gchar *filepath = gnc_uri_get_path ( last ); gchar *filepath = gnc_uri_get_path ( last );
faw->starting_dir = g_path_get_dirname( filepath ); faw->starting_dir = g_path_get_dirname( filepath );
g_free ( filepath ); g_free ( filepath );
} }
 End of changes. 4 change blocks. 
0 lines changed or deleted 37 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)