From 395ef10599bb35b100ecf3a87bad9a22d010b178 Mon Sep 17 00:00:00 2001 From: Steven Rostedt <srostedt@redhat.com> Date: Tue, 30 Mar 2010 15:18:49 -0400 Subject: kernelshark: Add "Help" menu options Add help content and about to menu options. Still need to write the help content, right now it just points to google. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> --- kernel-shark.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/kernel-shark.c b/kernel-shark.c index fcb0f54..58aa860 100644 --- a/kernel-shark.c +++ b/kernel-shark.c @@ -31,6 +31,7 @@ #include "trace-compat.h" #include "trace-cmd.h" +#include "trace-gui.h" #include "kernel-shark.h" #include "version.h" @@ -362,6 +363,34 @@ plot_tasks_clicked (gpointer data) free(selected); } +/* Callback for the clicked signal of the help contents button */ +static void +help_content_clicked (gpointer data) +{ + struct shark_info *info = data; + GError *error = NULL; + gchar *link; + + link = "http://www.google.com"; + + trace_show_help(info->window, link, &error); +} + + +/* Callback for the clicked signal of the help about button */ +static void +help_about_clicked (gpointer data) +{ + struct shark_info *info = data; + + trace_dialog(GTK_WINDOW(info->window), TRACE_GUI_INFO, + "KernelShark\n\n" + "version %s\n\n" + "Copyright (C) 2009, 2010 Red Hat Inc\n\n" + " Author: Steven Rostedt <srostedt@redhat.com>", + VERSION_STRING); +} + static void graph_follows_tree(struct shark_info *info, GtkTreeView *treeview, GtkTreePath *path) @@ -939,6 +968,53 @@ void kernel_shark(int argc, char **argv) gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); + + /* --- Help Option --- */ + + menu_item = gtk_menu_item_new_with_label("Help"); + gtk_widget_show(menu_item); + + gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), menu_item); + + menu = gtk_menu_new(); /* Don't need to show menus */ + + + /* --- Help - Contents Option --- */ + + sub_item = gtk_menu_item_new_with_label("Contents"); + + /* Add them to the menu */ + gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); + + /* We can attach the Quit menu item to our exit function */ + g_signal_connect_swapped (G_OBJECT (sub_item), "activate", + G_CALLBACK (help_content_clicked), + (gpointer) info); + + /* We do need to show menu items */ + gtk_widget_show(sub_item); + + + /* --- Help - About Option --- */ + + sub_item = gtk_menu_item_new_with_label("About"); + + /* Add them to the menu */ + gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); + + /* We can attach the Quit menu item to our exit function */ + g_signal_connect_swapped (G_OBJECT (sub_item), "activate", + G_CALLBACK (help_about_clicked), + (gpointer) info); + + /* We do need to show menu items */ + gtk_widget_show(sub_item); + + + /* --- End Help Options --- */ + gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); + + /* --- Top Level Vpaned --- */ vpaned = gtk_vpaned_new(); -- cgit v1.2.2