summaryrefslogtreecommitdiff
path: root/src/gui/menus/file.c
blob: 95b50cb5cba505f5828fc42f8d6a64ce2b2c4216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

/* OpenIDA - Outil d'analyse de fichiers binaires
 * file.c - gestion du menu 'Fichier'
 *
 * Copyright (C) 2011-2012 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 "../../project.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 #1     */
    GtkWidget *deepmenuitem;                /* Sous-élément de menu #2     */

    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, _("Recent projects..."), NULL, NULL);
    gtk_container_add(GTK_CONTAINER(menubar), submenuitem);

    deepmenuitem = gtk_recent_chooser_menu_new_for_manager(get_projects_manager());
    gtk_recent_chooser_set_sort_type(GTK_RECENT_CHOOSER(deepmenuitem), GTK_RECENT_SORT_MRU);
    gtk_recent_chooser_set_show_tips(GTK_RECENT_CHOOSER(deepmenuitem), TRUE);
    gtk_recent_chooser_set_show_icons(GTK_RECENT_CHOOSER(deepmenuitem), FALSE);
    gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), deepmenuitem);

    submenuitem = qck_create_menu_separator();
    gtk_container_add(GTK_CONTAINER(menubar), submenuitem);

    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();

}