X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fgui%2Fpsppire-window.c;h=8e34c214be3db729a4b5f7fb9d99eb35214e7b2c;hb=64c3106b6b4900aa3515fb3ebc930ce80b59bb1e;hp=e7dd0315f37c0b05a39ccec5b257622c2ff56de5;hpb=be1157c5591142920a95d587acf97f5eaf3d04fe;p=pspp
diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c
index e7dd0315f3..8e34c214be 100644
--- a/src/ui/gui/psppire-window.c
+++ b/src/ui/gui/psppire-window.c
@@ -15,6 +15,7 @@
along with this program. If not, see . */
#include
+#include
#include "psppire-window.h"
#include "psppire-window-base.h"
@@ -29,7 +30,7 @@
#define N_(msgid) msgid
#include "data/any-reader.h"
-#include "data/file-name.h"
+#include "data/file-handle-def.h"
#include "data/dataset.h"
#include "libpspp/version.h"
@@ -38,7 +39,6 @@
#include "psppire-encoding-selector.h"
#include "psppire-syntax-window.h"
#include "psppire-window-register.h"
-#include "psppire.h"
static void psppire_window_base_init (PsppireWindowClass *class);
static void psppire_window_class_init (PsppireWindowClass *class);
@@ -311,8 +311,10 @@ psppire_window_base_init (PsppireWindowClass *class)
static void
menu_toggled (GtkCheckMenuItem *mi, gpointer data)
{
+#if GTK3_TRANSITION
/* Prohibit changes to the state */
mi->active = !mi->active;
+#endif
}
@@ -356,9 +358,11 @@ insert_menuitem_into_menu (PsppireWindow *window, gpointer key)
gtk_menu_shell_append (window->menu, item);
+#if GTK3_TRANSITION
/* Set the state without emitting a signal */
GTK_CHECK_MENU_ITEM (item)->active =
(psppire_window_register_lookup (psppire_window_register_new (), key) == window);
+#endif
g_hash_table_insert (window->menuitem_table, key, item);
}
@@ -516,11 +520,11 @@ psppire_window_query_save (PsppireWindow *se)
GTK_RESPONSE_REJECT);
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL,
+ _("Cancel"),
GTK_RESPONSE_CANCEL);
gtk_dialog_add_button (GTK_DIALOG (dialog),
- GTK_STOCK_SAVE,
+ _("Save"),
GTK_RESPONSE_APPLY);
gtk_widget_grab_focus (cancel_button);
@@ -695,8 +699,8 @@ psppire_window_file_chooser_dialog (PsppireWindow *toplevel)
gtk_file_chooser_dialog_new (_("Open"),
GTK_WINDOW (toplevel),
GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ _("Cancel"), GTK_RESPONSE_CANCEL,
+ _("Open"), GTK_RESPONSE_ACCEPT,
NULL);
g_object_set (dialog, "local-only", FALSE, NULL);
@@ -766,7 +770,7 @@ 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);
+ gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), relocate (examples_dir), NULL);
switch (gtk_dialog_run (GTK_DIALOG (dialog)))
{
@@ -775,19 +779,22 @@ psppire_window_open (PsppireWindow *de)
gchar *name =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
- gchar *sysname = convert_glib_filename_to_system_filename (name, NULL);
+ const gchar **cs = NULL;
+ g_get_filename_charsets (&cs);
gchar *encoding = psppire_encoding_selector_get_encoding (
gtk_file_chooser_get_extra_widget (GTK_FILE_CHOOSER (dialog)));
- int retval = any_reader_detect (sysname, NULL);
+ struct file_handle *fh = fh_create_file (NULL, name, cs[0], fh_default_properties ());
+
+ int retval = any_reader_detect (fh, NULL);
if (retval == 1)
open_data_window (de, name, encoding, NULL);
else if (retval == 0)
open_syntax_window (name, encoding);
g_free (encoding);
- g_free (sysname);
+ fh_unref (fh);
g_free (name);
}
break;