From 6ce34839ccf1d653a82fff291b22f455e2a9469a Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 14 Aug 2010 09:57:36 +0200 Subject: [PATCH] Added menu item file -> close. --- autogen.sh | 0 data/audit-gui/gui/audit-gui.gui | 81 ++++++++++++++++++-------------- src/main.c | 20 ++++++++ 3 files changed, 65 insertions(+), 36 deletions(-) mode change 100644 => 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh old mode 100644 new mode 100755 diff --git a/data/audit-gui/gui/audit-gui.gui b/data/audit-gui/gui/audit-gui.gui index 9f4412f..2f99d0e 100644 --- a/data/audit-gui/gui/audit-gui.gui +++ b/data/audit-gui/gui/audit-gui.gui @@ -32,6 +32,15 @@ + + + gtk-close + True + True + True + + + True @@ -244,6 +253,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Table - Audit GUI True @@ -344,42 +389,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Datasources - Audit GUI True diff --git a/src/main.c b/src/main.c index 968faf8..d28ed6d 100644 --- a/src/main.c +++ b/src/main.c @@ -31,6 +31,9 @@ #include "datasources.h" #include "openauditds.h" +G_MODULE_EXPORT void on_mnu_file_close_activate (GtkMenuItem *menuitem, + gpointer user_data); + static Commons *commons; static GtkWidget *w; @@ -84,6 +87,7 @@ main_on_ds_opened (gpointer instance, const gchar *arg1, gpointer user_data) vbx = datasources_get_widget (m); main_set_vbx_body_child (vbx); + gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem2")), TRUE); } G_MODULE_EXPORT void @@ -92,6 +96,11 @@ on_mnu_file_open_audit_ds_activate (GtkMenuItem *menuitem, { GtkWidget *vbx; + if (vbx_body_child != NULL) + { + on_mnu_file_close_activate (NULL, user_data); + } + OpenAuditDS *m = open_audit_ds_new (commons); vbx = open_audit_ds_get_widget (m); @@ -103,6 +112,15 @@ on_mnu_file_open_audit_ds_activate (GtkMenuItem *menuitem, gtk_widget_show_all (vbx); } +G_MODULE_EXPORT void +on_mnu_file_close_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + gtk_widget_destroy (vbx_body_child); + vbx_body_child = NULL; + gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem2")), FALSE); +} + G_MODULE_EXPORT void on_mnu_help_about_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -184,6 +202,8 @@ main (int argc, char *argv[]) gtk_widget_show (w); + gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem2")), FALSE); + if (argc > 0) { /* try to user the first argument of command line as a cnc_string */ -- 2.49.0