Add examples directory "shortcut" to file_open dialog
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 22 Jan 2015 19:56:19 +0000 (20:56 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 22 Jan 2015 19:56:19 +0000 (20:56 +0100)
src/libpspp/automake.mk
src/libpspp/version.h
src/ui/gui/psppire-window.c

index 7db91fe2b743c4112b362bac6f4277dc6a2a47b9..55e1a1f6cc7f60474dd75d49402cd95cd931b0b5 100644 (file)
@@ -127,6 +127,7 @@ $(AM_V_at)(`LC_ALL=C TZ=UTC date`).\";" >> $@
        $(AM_V_at)echo "const char host_system[] = \"$(host_triplet)\";" >> $@
        $(AM_V_at)echo "const char build_system[] = \"$(build_triplet)\";" >> $@
        $(AM_V_at)echo "const char locale_dir[] = \"$(datadir)/locale\";" >> $@
+       $(AM_V_at)echo "const char examples_dir[] = \"$(examplesdir)\";" >> $@
        $(AM_V_at)echo "const char *const authors[] = {" >> $@
        $(AM_V_at)sed -e 's/^/  \"/' -e 's/$$/\",/' $(top_srcdir)/AUTHORS >> $@
        $(AM_V_at)echo "0 };" >> $@
index e2125154a8ca20ccd57005012957bf7d4ae68fec..4ce892f9a20a6fca39430d8fb5ecb221d455d17f 100644 (file)
@@ -36,7 +36,11 @@ extern const char build_system[];
 /* Locale directory. */
 extern const char locale_dir[];
 
+/* The Examples directory */
+extern const char const examples_dir[];
+
 /* From the AUTHORS file */
 extern const char *const authors[];
 
+
 #endif /* !version_h */
index 4d2f085cada746aa88d9283556b2f6bb8732287a..e7dd0315f37c0b05a39ccec5b257622c2ff56de5 100644 (file)
@@ -31,6 +31,7 @@
 #include "data/any-reader.h"
 #include "data/file-name.h"
 #include "data/dataset.h"
+#include "libpspp/version.h"
 
 #include "helper.h"
 #include "psppire-data-window.h"
@@ -765,6 +766,8 @@ psppire_window_open (PsppireWindow *de)
 {
   GtkWidget *dialog = psppire_window_file_chooser_dialog (de);
 
+  gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), examples_dir, NULL);
+
   switch (gtk_dialog_run (GTK_DIALOG (dialog)))
     {
     case GTK_RESPONSE_ACCEPT:
@@ -777,9 +780,7 @@ psppire_window_open (PsppireWindow *de)
         gchar *encoding = psppire_encoding_selector_get_encoding (
           gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog)));
 
-        int retval;
-
-        retval = any_reader_detect (sysname, NULL);
+        int retval = any_reader_detect (sysname, NULL);
        if (retval == 1)
           open_data_window (de, name, encoding, NULL);
        else if (retval == 0)