Chi-square Dialog: Cosmetic changes
[pspp] / src / ui / gui / psppire-window.c
index 81fcb8c0591f2ffa9cb6e2121707121d94a611e8..54ece05de51b7386573d0179b8bca49f6f73ab25 100644 (file)
@@ -38,7 +38,6 @@
 #include "psppire-window-register.h"
 #include "psppire.h"
 
-static void psppire_window_base_finalize (PsppireWindowClass *, gpointer);
 static void psppire_window_base_init     (PsppireWindowClass *class);
 static void psppire_window_class_init    (PsppireWindowClass *class);
 static void psppire_window_init          (PsppireWindow      *window);
@@ -57,7 +56,7 @@ psppire_window_get_type (void)
       {
        sizeof (PsppireWindowClass),
        (GBaseInitFunc) psppire_window_base_init,
-        (GBaseFinalizeFunc) psppire_window_base_finalize,
+        (GBaseFinalizeFunc) NULL,
        (GClassInitFunc) psppire_window_class_init,
        (GClassFinalizeFunc) NULL,
        NULL,
@@ -85,12 +84,6 @@ enum
 };
 
 
-gchar *
-uniquify (const gchar *str, int *x)
-{
-  return g_strdup_printf ("%s%d", str, (*x)++);
-}
-
 static void
 psppire_window_set_title (PsppireWindow *window)
 {
@@ -328,12 +321,6 @@ psppire_window_base_init (PsppireWindowClass *class)
 
 
 
-static void
-psppire_window_base_finalize (PsppireWindowClass *class,
-                               gpointer class_data)
-{
-}
-
 static void
 menu_toggled (GtkCheckMenuItem *mi, gpointer data)
 {
@@ -692,8 +679,6 @@ psppire_window_save_as (PsppireWindow *w)
     }
 }
 
-
-static void add_most_recent (const char *file_name);
 static void delete_recent (const char *file_name);
 
 gboolean
@@ -713,7 +698,6 @@ psppire_window_load (PsppireWindow *w, const gchar *file)
   if ( ok )
     {
       psppire_window_set_filename (w, file);
-      add_most_recent (file);
       w->dirty = FALSE;
     }
   else
@@ -832,16 +816,31 @@ psppire_window_open (PsppireWindow *de)
 }
 
 
-/* Puts FILE_NAME into the recent list.
-   If it's already in the list, it moves it to the top
-*/
-static void
-add_most_recent (const char *file_name)
+/* Puts FILE_NAME (encoded in the glib file name encoding) into the recent list
+   with associated MIME_TYPE.  If it's already in the list, it moves it to the
+   top. */
+void
+add_most_recent (const char *file_name, const char *mime_type)
 {
   gchar *uri = g_filename_to_uri  (file_name, NULL, NULL);
 
   if ( uri )
-    gtk_recent_manager_add_item (gtk_recent_manager_get_default (), uri);
+    {
+      GtkRecentData recent_data;
+
+      recent_data.display_name = NULL;
+      recent_data.description = NULL;
+      recent_data.mime_type = CONST_CAST (gchar *, mime_type);
+      recent_data.app_name = CONST_CAST (gchar *, g_get_application_name ());
+      recent_data.app_exec = g_strjoin (" ", g_get_prgname (), "%u", NULL);
+      recent_data.groups = NULL;
+      recent_data.is_private = FALSE;
+
+      gtk_recent_manager_add_full (gtk_recent_manager_get_default (),
+                                   uri, &recent_data);
+
+      g_free (recent_data.app_exec);
+    }
 
   g_free (uri);
 }