diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-03-30 15:18:49 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-04-09 11:56:17 -0400 |
| commit | 395ef10599bb35b100ecf3a87bad9a22d010b178 (patch) | |
| tree | 5d7d0635a8cab6012f4279ec4af276d566cbc474 | |
| parent | 7f5dd7b6e1aa1ea12b8d4d802b8aadd501876ba5 (diff) | |
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>
| -rw-r--r-- | kernel-shark.c | 76 |
1 files changed, 76 insertions, 0 deletions
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 @@ | |||
| 31 | 31 | ||
| 32 | #include "trace-compat.h" | 32 | #include "trace-compat.h" |
| 33 | #include "trace-cmd.h" | 33 | #include "trace-cmd.h" |
| 34 | #include "trace-gui.h" | ||
| 34 | #include "kernel-shark.h" | 35 | #include "kernel-shark.h" |
| 35 | #include "version.h" | 36 | #include "version.h" |
| 36 | 37 | ||
| @@ -362,6 +363,34 @@ plot_tasks_clicked (gpointer data) | |||
| 362 | free(selected); | 363 | free(selected); |
| 363 | } | 364 | } |
| 364 | 365 | ||
| 366 | /* Callback for the clicked signal of the help contents button */ | ||
| 367 | static void | ||
| 368 | help_content_clicked (gpointer data) | ||
| 369 | { | ||
| 370 | struct shark_info *info = data; | ||
| 371 | GError *error = NULL; | ||
| 372 | gchar *link; | ||
| 373 | |||
| 374 | link = "http://www.google.com"; | ||
| 375 | |||
| 376 | trace_show_help(info->window, link, &error); | ||
| 377 | } | ||
| 378 | |||
| 379 | |||
| 380 | /* Callback for the clicked signal of the help about button */ | ||
| 381 | static void | ||
| 382 | help_about_clicked (gpointer data) | ||
| 383 | { | ||
| 384 | struct shark_info *info = data; | ||
| 385 | |||
| 386 | trace_dialog(GTK_WINDOW(info->window), TRACE_GUI_INFO, | ||
| 387 | "KernelShark\n\n" | ||
| 388 | "version %s\n\n" | ||
| 389 | "Copyright (C) 2009, 2010 Red Hat Inc\n\n" | ||
| 390 | " Author: Steven Rostedt <srostedt@redhat.com>", | ||
| 391 | VERSION_STRING); | ||
| 392 | } | ||
| 393 | |||
| 365 | static void graph_follows_tree(struct shark_info *info, | 394 | static void graph_follows_tree(struct shark_info *info, |
| 366 | GtkTreeView *treeview, | 395 | GtkTreeView *treeview, |
| 367 | GtkTreePath *path) | 396 | GtkTreePath *path) |
| @@ -939,6 +968,53 @@ void kernel_shark(int argc, char **argv) | |||
| 939 | gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); | 968 | gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); |
| 940 | 969 | ||
| 941 | 970 | ||
| 971 | |||
| 972 | /* --- Help Option --- */ | ||
| 973 | |||
| 974 | menu_item = gtk_menu_item_new_with_label("Help"); | ||
| 975 | gtk_widget_show(menu_item); | ||
| 976 | |||
| 977 | gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), menu_item); | ||
| 978 | |||
| 979 | menu = gtk_menu_new(); /* Don't need to show menus */ | ||
| 980 | |||
| 981 | |||
| 982 | /* --- Help - Contents Option --- */ | ||
| 983 | |||
| 984 | sub_item = gtk_menu_item_new_with_label("Contents"); | ||
| 985 | |||
| 986 | /* Add them to the menu */ | ||
| 987 | gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); | ||
| 988 | |||
| 989 | /* We can attach the Quit menu item to our exit function */ | ||
| 990 | g_signal_connect_swapped (G_OBJECT (sub_item), "activate", | ||
| 991 | G_CALLBACK (help_content_clicked), | ||
| 992 | (gpointer) info); | ||
| 993 | |||
| 994 | /* We do need to show menu items */ | ||
| 995 | gtk_widget_show(sub_item); | ||
| 996 | |||
| 997 | |||
| 998 | /* --- Help - About Option --- */ | ||
| 999 | |||
| 1000 | sub_item = gtk_menu_item_new_with_label("About"); | ||
| 1001 | |||
| 1002 | /* Add them to the menu */ | ||
| 1003 | gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); | ||
| 1004 | |||
| 1005 | /* We can attach the Quit menu item to our exit function */ | ||
| 1006 | g_signal_connect_swapped (G_OBJECT (sub_item), "activate", | ||
| 1007 | G_CALLBACK (help_about_clicked), | ||
| 1008 | (gpointer) info); | ||
| 1009 | |||
| 1010 | /* We do need to show menu items */ | ||
| 1011 | gtk_widget_show(sub_item); | ||
| 1012 | |||
| 1013 | |||
| 1014 | /* --- End Help Options --- */ | ||
| 1015 | gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); | ||
| 1016 | |||
| 1017 | |||
| 942 | /* --- Top Level Vpaned --- */ | 1018 | /* --- Top Level Vpaned --- */ |
| 943 | 1019 | ||
| 944 | vpaned = gtk_vpaned_new(); | 1020 | vpaned = gtk_vpaned_new(); |
