#include <glade/glade.h>
#include <gtk/gtk.h>
-
+#include "window-manager.h"
#include <gtksheet/gtksheet.h>
#include "helper.h"
connect_help (de->xml);
- e->window = get_widget_assert (de->xml, "data_editor");
+ e->window = GTK_WINDOW (get_widget_assert (de->xml, "data_editor"));
g_signal_connect (get_widget_assert (de->xml,"file_new_data"),
"activate",
G_CALLBACK (file_quit), de);
+ g_signal_connect (get_widget_assert (de->xml, "windows_minimise_all"),
+ "activate",
+ G_CALLBACK (minimise_all_windows), NULL);
+
+
select_sheet (de, PAGE_DATA_SHEET);
return de;
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image41">
+ <widget class="GtkImage" id="image44">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
<signal name="activate" handler="on_go_to_case_activate" last_modification_time="Mon, 19 Jun 2006 10:29:37 GMT"/>
<child internal-child="image">
- <widget class="GtkImage" id="image42">
+ <widget class="GtkImage" id="image45">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
</widget>
</child>
+ <child>
+ <widget class="GtkMenuItem" id="Windows">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Windows</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_Windows_activate" last_modification_time="Wed, 27 Dec 2006 23:16:44 GMT"/>
+
+ <child>
+ <widget class="GtkMenu" id="Windows_menu">
+
+ <child>
+ <widget class="GtkMenuItem" id="windows_minimise_all">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Minimise All Windows</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_minimiseall_activate" last_modification_time="Wed, 27 Dec 2006 23:17:26 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
<child>
<widget class="GtkMenuItem" id="menuitem5">
<property name="visible">True</property>
const struct syntax_editor_source *ses =
(const struct syntax_editor_source *) i;
- return window_name ((struct window_editor *) ses->se);
+ return window_name ((const struct editor_window *) ses->se);
}
return ;
}
- gtk_widget_destroy (e->window);
+ gtk_widget_destroy (GTK_WIDGET (e->window));
}
/* Callback for the File->SaveAs menuitem */
e = (struct editor_window *)se;
- e->window = get_widget_assert (xml, "syntax_editor");
+ e->window = GTK_WINDOW (get_widget_assert (xml, "syntax_editor"));
text_view = get_widget_assert (xml, "syntax_text_view");
se->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
se->lexer = lex_create (the_source_stream);
se);
+ g_signal_connect (get_widget_assert (xml,"windows_minimise_all"),
+ "activate",
+ G_CALLBACK (minimise_all_windows),
+ NULL);
+
+
+
g_object_unref (xml);
g_signal_connect (e->window, "delete-event",
</widget>
</child>
+ <child>
+ <widget class="GtkMenuItem" id="windows">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Windows</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_windows_activate" last_modification_time="Thu, 28 Dec 2006 00:31:09 GMT"/>
+
+ <child>
+ <widget class="GtkMenu" id="windows_menu">
+
+ <child>
+ <widget class="GtkMenuItem" id="windows_minimise_all">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Minimise All Windows</property>
+ <property name="use_underline">True</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
<child>
<widget class="GtkMenuItem" id="menuitem9">
<property name="visible">True</property>
+#include <glib.h>
#include "syntax-editor.h"
#include "data-editor.h"
#include "window-manager.h"
-static int window_count = 0;
+
+/* A list of struct editor_windows */
+static GSList *window_list = NULL;
+
static void
-deregister (GtkObject *o, gpointer data)
+deregister_window (GtkWindow *w, gpointer data)
{
- window_count --;
+ struct editor_window *e = data;
- if ( 0 == window_count )
+ window_list = g_slist_remove (window_list, e);
+
+ if ( g_slist_length (window_list) == 0 )
gtk_main_quit ();
};
+
+static void
+register_window (struct editor_window *e)
+{
+ window_list = g_slist_prepend (window_list, e);
+}
+
+
+static gint
+next_window_id (void)
+{
+ return g_slist_length (window_list);
+}
+
+void
+minimise_all_windows (void)
+{
+ const GSList *i = NULL;
+
+ for (i = window_list; i != NULL ; i = i->next)
+ {
+ struct editor_window *e = i->data;
+ gtk_window_iconify (e->window);
+ }
+}
+
static void set_window_name (struct editor_window *e, const gchar *name );
gtk_window_set_icon_from_file (GTK_WINDOW (e->window),
PKGDATADIR "/psppicon.png", 0);
- g_signal_connect (e->window, "destroy", G_CALLBACK (deregister), NULL);
+ g_signal_connect (e->window, "destroy",
+ G_CALLBACK (deregister_window), e);
- gtk_widget_show (e->window);
+ register_window (e);
- window_count ++;
+ gtk_widget_show (e->window);
return e;
}
switch (e->type )
{
case WINDOW_SYNTAX:
- e->name = g_strdup_printf (_("Syntax%d"), window_count);
+ e->name = g_strdup_printf (_("Syntax%d"), next_window_id () );
title = g_strdup_printf (_("%s --- PSPP Syntax Editor"), e->name);
break;
case WINDOW_DATA:
- e->name = g_strdup_printf (_("Untitled%d"), window_count);
+ e->name = g_strdup_printf (_("Untitled%d"), next_window_id () );
title = g_strdup_printf (_("%s --- PSPP Data Editor"), e->name);
break;
default:
g_free (title);
}
-
-GtkWindow *
-window_toplevel (const struct editor_window *e)
-{
- return GTK_WINDOW (e->window);
-}
-
const gchar *
window_name (const struct editor_window *e)
{
struct editor_window
{
- GtkWidget *window; /* The top level window of the editor */
+ GtkWindow *window; /* The top level window of the editor */
gchar *name; /* The name of this editor */
enum window_type type;
} ;
struct editor_window * window_create (enum window_type type,
const gchar *name);
-
-GtkWindow * window_toplevel (const struct editor_window *);
-
const gchar * window_name (const struct editor_window *);
void window_set_name_from_filename (struct editor_window *e,
const gchar *filename);
+void minimise_all_windows (void);
+
+
#endif