2 #include "syntax-editor.h"
3 #include "data-editor.h"
6 #define _(msgid) gettext (msgid)
7 #define N_(msgid) msgid
10 #include "window-manager.h"
14 /* A list of struct editor_windows */
15 static GSList *window_list = NULL;
19 deregister_window (GtkWindow *w, gpointer data)
21 struct editor_window *e = data;
23 window_list = g_slist_remove (window_list, e);
25 if ( g_slist_length (window_list) == 0 )
31 register_window (struct editor_window *e)
33 window_list = g_slist_prepend (window_list, e);
40 return g_slist_length (window_list);
44 minimise_all_windows (void)
46 const GSList *i = NULL;
48 for (i = window_list; i != NULL ; i = i->next)
50 struct editor_window *e = i->data;
51 gtk_window_iconify (e->window);
55 static void set_window_name (struct editor_window *e, const gchar *name );
58 struct editor_window *
59 window_create (enum window_type type, const gchar *name)
61 struct editor_window *e;
65 e = (struct editor_window *) new_syntax_editor ();
68 e = (struct editor_window *) new_data_editor ();
71 g_assert_not_reached ();
77 set_window_name (e, name);
80 gtk_window_set_icon_from_file (GTK_WINDOW (e->window),
81 PKGDATADIR "/psppicon.png", 0);
83 g_signal_connect (e->window, "destroy",
84 G_CALLBACK (deregister_window), e);
88 gtk_widget_show (e->window);
95 set_window_name (struct editor_window *e,
104 e->name = g_strdup (name);
111 e->name = g_strdup_printf (_("Syntax%d"), next_window_id () );
112 title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), e->name);
115 e->name = g_strdup_printf (_("Untitled%d"), next_window_id () );
116 title = g_strdup_printf (_("%s --- PSPP Data Editor"), e->name);
119 g_assert_not_reached ();
122 gtk_window_set_title (GTK_WINDOW (e->window), title);
129 window_set_name_from_filename (struct editor_window *e,
130 const gchar *filename)
133 gchar *basename = g_path_get_basename (filename);
135 set_window_name (e, filename);
140 title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), basename);
143 title = g_strdup_printf (_("%s --- PSPP Data Editor"), basename);
146 g_assert_not_reached ();
150 gtk_window_set_title (GTK_WINDOW (e->window), title);
156 window_name (const struct editor_window *e)