diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2011-11-30 19:36:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2011-11-30 19:36:20 (GMT) |
commit | bc2abb81b39dc4d80cdec75477a0adad8ed23a63 (patch) | |
tree | 3eec01bc3cfaf10a960a02e43fe590b1649d6587 /src/gui/menus | |
parent | bdc8b4cfd84f938e9d75969f89b0d8381471399b (diff) |
Added the new "File" menu allowing to terminate the program.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@214 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/Makefile.am | 1 | ||||
-rw-r--r-- | src/gui/menus/file.c | 91 | ||||
-rw-r--r-- | src/gui/menus/file.h | 38 | ||||
-rw-r--r-- | src/gui/menus/menubar.c | 6 |
4 files changed, 136 insertions, 0 deletions
diff --git a/src/gui/menus/Makefile.am b/src/gui/menus/Makefile.am index 36fffc2..67d65b6 100644 --- a/src/gui/menus/Makefile.am +++ b/src/gui/menus/Makefile.am @@ -3,6 +3,7 @@ noinst_LTLIBRARIES = libguimenus.la libguimenus_la_SOURCES = \ debug.h debug.c \ + file.h file.c \ help.h help.c \ menubar.h menubar.c diff --git a/src/gui/menus/file.c b/src/gui/menus/file.c new file mode 100644 index 0000000..880fb8a --- /dev/null +++ b/src/gui/menus/file.c @@ -0,0 +1,91 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * file.c - gestion du menu 'Fichier' + * + * Copyright (C) 2011 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * OpenIDA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include "file.h" + + +#include <i18n.h> + + +#include "../../gtkext/easygtk.h" + + + +/* Réagit avec le menu "Fichier -> Quitter". */ +static void mcb_file_quit(GtkMenuItem *, GObject *); + + + +/****************************************************************************** +* * +* Paramètres : ref = espace de référencement global. * +* accgroup = groupe d'accélérateurs pour les menus. * +* * +* Description : Construit le menu "Fichier". * +* * +* Retour : Panneau de menus mis en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkWidget *build_menu_file(GObject *ref, GtkAccelGroup *accgroup) +{ + GtkWidget *result; /* Support à retourner */ + GtkWidget *menubar; /* Support pour éléments */ + GtkWidget *submenuitem; /* Sous-élément de menu */ + + result = gtk_menu_item_new_with_mnemonic(_("_File")); + gtk_widget_show(result); + + menubar = gtk_menu_new(); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(result), menubar); + + submenuitem = qck_create_menu_item(NULL, NULL, _("Quit"), G_CALLBACK(mcb_file_quit), ref); + add_accelerator_to_menu_item(submenuitem, "<Ctrl>Q", accgroup); + gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : menuitem = élément de menu sélectionné. * +* ref = adresse de l'espace de référencement global. * +* * +* Description : Réagit avec le menu "Fichier -> Quitter". * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void mcb_file_quit(GtkMenuItem *menuitem, GObject *ref) +{ + gtk_main_quit(); + +} diff --git a/src/gui/menus/file.h b/src/gui/menus/file.h new file mode 100644 index 0000000..13da6aa --- /dev/null +++ b/src/gui/menus/file.h @@ -0,0 +1,38 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * file.h - prototypes pour la gestion du menu 'Fichier' + * + * Copyright (C) 2011 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * OpenIDA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#ifndef _GUI_MENUS_FILE_H +#define _GUI_MENUS_FILE_H + + +#include <gtk/gtk.h> + + + +/* Construit le menu "Fichier". */ +GtkWidget *build_menu_file(GObject *, GtkAccelGroup *); + + + +#endif /* _GUI_MENUS_FILE_H */ diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 4718caa..e6c9007 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -26,6 +26,7 @@ #include "debug.h" +#include "file.h" #include "help.h" #include "../editem-int.h" @@ -131,6 +132,11 @@ GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup) g_object_ref(ref); item->ref = ref; + /* Fichier */ + + menuitem = build_menu_file(ref, accgroup); + gtk_container_add(GTK_CONTAINER(item->widget), menuitem); + /* Débogage */ menuitem = build_menu_debug(ref, accgroup); |