From: John Darrington Date: Thu, 1 Jan 2009 12:26:45 +0000 (+0900) Subject: Set default name on File->New X-Git-Tag: v0.7.3~296^2~11 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1f538f35e5c6cc682550642147ca6ac10174116;p=pspp-builds.git Set default name on File->New --- diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index 16e8a8a0..90e749d3 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -581,7 +581,7 @@ new_file (GtkAction *action, PsppireDataWindow *de) g_free (de->file_name); de->file_name = NULL; - // default_window_name (de); + psppire_window_set_filename (PSPPIRE_WINDOW (de), NULL); } diff --git a/src/ui/gui/psppire-window.c b/src/ui/gui/psppire-window.c index 78eda412..ebced6d7 100644 --- a/src/ui/gui/psppire-window.c +++ b/src/ui/gui/psppire-window.c @@ -99,13 +99,22 @@ psppire_window_set_property (GObject *object, break; case PROP_FILENAME: { + PsppireWindowRegister *reg = psppire_window_register_new (); gchar mdash[6] = {0,0,0,0,0,0}; gchar *basename, *title; const gchar *name = g_value_get_string (value); - gchar *candidate_name = strdup (name); int x = 0; + gchar *candidate_name ; + GValue def = {0}; + g_value_init (&def, pspec->value_type); - PsppireWindowRegister *reg = psppire_window_register_new (); + if ( NULL == name) + { + g_param_value_set_default (pspec, &def); + name = g_value_get_string (&def); + } + + candidate_name = strdup (name); while ( psppire_window_register_lookup (reg, candidate_name)) { @@ -116,6 +125,8 @@ psppire_window_set_property (GObject *object, basename = g_path_get_basename (candidate_name); g_unichar_to_utf8 (0x2014, mdash); + g_value_unset (&def); + switch (window->usage) { case PSPPIRE_WINDOW_USAGE_SYNTAX: