projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
EXAMINE: Convert another test to Autotest framework.
[pspp]
/
src
/
ui
/
gui
/
psppire-window.c
diff --git
a/src/ui/gui/psppire-window.c
b/src/ui/gui/psppire-window.c
index 54c751d6fab5e4ed2a93a1baad6bc9682a262bec..e03732fc365c6c555adf0e513454a91e22e66db6 100644
(file)
--- a/
src/ui/gui/psppire-window.c
+++ b/
src/ui/gui/psppire-window.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2009 Free Software Foundation
+ Copyright (C) 2009
, 2010
Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-25,6
+25,7
@@
#include <gtk/gtkmain.h>
#include <stdlib.h>
#include <gtk/gtkmain.h>
#include <stdlib.h>
+#include <xalloc.h>
#include <gettext.h>
#define _(msgid) gettext (msgid)
#include <gettext.h>
#define _(msgid) gettext (msgid)
@@
-137,7
+138,7
@@
psppire_window_set_property (GObject *object,
name = g_value_get_string (&def);
}
name = g_value_get_string (&def);
}
- candidate_name = strdup (name);
+ candidate_name =
x
strdup (name);
while ( psppire_window_register_lookup (reg, candidate_name))
{
while ( psppire_window_register_lookup (reg, candidate_name))
{
@@
-145,7
+146,7
@@
psppire_window_set_property (GObject *object,
candidate_name = uniquify (name, &x);
}
candidate_name = uniquify (name, &x);
}
- window->basename = g_
path_get
_basename (candidate_name);
+ window->basename = g_
filename_display
_basename (candidate_name);
g_value_unset (&def);
}
g_value_unset (&def);
}
@@
-202,19
+203,6
@@
on_realize (GtkWindow *window, gpointer data)
}
}
-static gboolean
-save_geometry (GtkWidget *window, GdkEvent *event, gpointer data)
-{
- const gchar *base = G_OBJECT_TYPE_NAME (window);
-
- PsppireConf *conf = psppire_conf_new ();
-
- psppire_conf_save_window_geometry (conf, base, event);
-
- return FALSE;
-}
-
-
static void
psppire_window_finalize (GObject *object)
{
static void
psppire_window_finalize (GObject *object)
{
@@
-255,7
+243,8
@@
psppire_window_class_init (PsppireWindowClass *class)
g_param_spec_string ("filename",
"File name",
"The name of the file associated with this window, if any",
g_param_spec_string ("filename",
"File name",
"The name of the file associated with this window, if any",
- "Untitled",
+ /* TRANSLATORS: This will form a filename. Please avoid whitespace. */
+ _("Untitled"),
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_unichar_to_utf8 (0x2014, mdash);
G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_unichar_to_utf8 (0x2014, mdash);
@@
-315,7
+304,10
@@
menu_activate (GtkMenuItem *mi, gpointer data)
static void
insert_menuitem_into_menu (PsppireWindow *window, gpointer key)
{
static void
insert_menuitem_into_menu (PsppireWindow *window, gpointer key)
{
- GtkWidget *item = gtk_check_menu_item_new_with_label (key);
+ gchar *filename = g_filename_display_name (key);
+ GtkWidget *item = gtk_check_menu_item_new_with_label (filename);
+
+ g_free (filename);
g_signal_connect (item, "toggled", G_CALLBACK (menu_toggled), NULL);
g_signal_connect (item, "activate", G_CALLBACK (menu_activate), key);
g_signal_connect (item, "toggled", G_CALLBACK (menu_toggled), NULL);
g_signal_connect (item, "activate", G_CALLBACK (menu_activate), key);
@@
-378,6
+370,13
@@
on_delete (PsppireWindow *w, GdkEvent *event, gpointer user_data)
{
PsppireWindowRegister *reg = psppire_window_register_new ();
{
PsppireWindowRegister *reg = psppire_window_register_new ();
+ const gchar *base = G_OBJECT_TYPE_NAME (w);
+
+ PsppireConf *conf = psppire_conf_new ();
+
+ psppire_conf_save_window_geometry (conf, base, GTK_WINDOW (w));
+
+
if ( w->dirty )
{
gint response = psppire_window_query_save (w);
if ( w->dirty )
{
gint response = psppire_window_query_save (w);
@@
-408,7
+407,7
@@
psppire_window_init (PsppireWindow *window)
{
window->name = NULL;
window->menu = NULL;
{
window->name = NULL;
window->menu = NULL;
- window->description = strdup ("");
+ window->description =
x
strdup ("");
window->menuitem_table = g_hash_table_new (g_str_hash, g_str_equal);
window->menuitem_table = g_hash_table_new (g_str_hash, g_str_equal);
@@
-431,12
+430,6
@@
psppire_window_init (PsppireWindow *window)
g_object_set (window, "icon-name", "psppicon", NULL);
g_object_set (window, "icon-name", "psppicon", NULL);
- g_signal_connect (window, "configure-event",
- G_CALLBACK (save_geometry), window);
-
- g_signal_connect (window, "window-state-event",
- G_CALLBACK (save_geometry), window);
-
g_signal_connect (window, "realize",
G_CALLBACK (on_realize), window);
g_signal_connect (window, "realize",
G_CALLBACK (on_realize), window);
@@
-449,6
+442,7
@@
psppire_window_init (PsppireWindow *window)
gint
psppire_window_query_save (PsppireWindow *se)
{
gint
psppire_window_query_save (PsppireWindow *se)
{
+ gchar *fn;
gint response;
GtkWidget *dialog;
GtkWidget *cancel_button;
gint response;
GtkWidget *dialog;
GtkWidget *cancel_button;
@@
-465,13
+459,16
@@
psppire_window_query_save (PsppireWindow *se)
g_return_val_if_fail (filename != NULL, GTK_RESPONSE_NONE);
g_return_val_if_fail (filename != NULL, GTK_RESPONSE_NONE);
+ fn = g_filename_display_basename (filename);
+
dialog =
gtk_message_dialog_new (GTK_WINDOW (se),
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
dialog =
gtk_message_dialog_new (GTK_WINDOW (se),
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
- _("Save the changes to \"%s\" before closing?"),
- filename);
+ _("Save the changes to `%s' before closing?"),
+ fn);
+ g_free (fn);
g_object_set (dialog, "icon-name", "psppicon", NULL);
g_object_set (dialog, "icon-name", "psppicon", NULL);
@@
-625,6
+622,7
@@
psppire_window_load (PsppireWindow *w, const gchar *file)
if ( ok )
{
if ( ok )
{
+ psppire_window_set_filename (w, file);
add_most_recent (file, the_recent_mgr);
w->dirty = FALSE;
}
add_most_recent (file, the_recent_mgr);
w->dirty = FALSE;
}