Set default name on File->New
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 1 Jan 2009 12:26:45 +0000 (21:26 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 1 Jan 2009 12:26:45 +0000 (21:26 +0900)
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-window.c

index 16e8a8a016bfaa674e9b59bd19f0b3f4cb683b1a..90e749d318af0bab38a7c7f42450e88fe16b2a10 100644 (file)
@@ -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);
 }
 
 
index 78eda412c5746ad568f85cd04da89329d9367305..ebced6d7478fcb44e3c4fea38d52472d093c55fa 100644 (file)
@@ -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: