From 3722c94e232b39d2a05ef359a60d25ac0cbe7887 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sun, 15 Oct 2006 21:57:09 +0000 Subject: Make menu shortcuts work, plug memory leaks, socket code cleanup --- hardinfo2/menu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'hardinfo2/menu.c') diff --git a/hardinfo2/menu.c b/hardinfo2/menu.c index d5303507..09ced371 100644 --- a/hardinfo2/menu.c +++ b/hardinfo2/menu.c @@ -27,6 +27,8 @@ #include #include +#include + static GtkActionEntry entries[] = { @@ -84,6 +86,7 @@ void menu_init(Shell *shell) GtkUIManager *menu_manager; /* The magic widget! */ GError *error; /* For reporting exceptions or errors */ gchar *uidefs_path; + GtkAccelGroup *accel_group; /* Create our objects */ menu_box = shell->vbox; @@ -105,16 +108,20 @@ void menu_init(Shell *shell) /* Read in the UI from our XML file */ error = NULL; - uidefs_path = g_strdup_printf("%s/hardinfo/uidefs.xml", - gbr_find_data_dir(PREFIX)); + uidefs_path = g_strdup_printf("%s/hardinfo/uidefs.xml", path_data); gtk_ui_manager_add_ui_from_file(menu_manager, uidefs_path, &error); g_free(uidefs_path); if (error) { g_error("building menus failed: %s", error->message); g_error_free(error); + return; } + /* Enable menu accelerators */ + accel_group = gtk_ui_manager_get_accel_group(menu_manager); + gtk_window_add_accel_group(GTK_WINDOW(shell->window), accel_group); + /* Connect up important signals */ /* This signal is necessary in order to place widgets from the UI manager * into the menu_box */ -- cgit v1.2.3