This file is indexed.

/usr/share/gtk-sharp3-examples/GtkDemo/DemoMenus.cs is in gtk-sharp3-examples 2.99.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
106
107
108
109
110
111
/* Menus
 *
 * There are several widgets involved in displaying menus. The MenuBar
 * widget is a horizontal menu bar, which normally appears at the top
 * of an application. The Menu widget is the actual menu that pops up.
 * Both MenuBar and Menu are subclasses of MenuShell; a MenuShell
 * contains menu items (MenuItem). Each menu item contains text and/or
 * images and can be selected by the user.
 *
 * There are several kinds of menu item, including plain MenuItem,
 * CheckMenuItem which can be checked/unchecked, RadioMenuItem which
 * is a check menu item that's in a mutually exclusive group,
 * SeparatorMenuItem which is a separator bar, TearoffMenuItem which
 * allows a Menu to be torn off, and ImageMenuItem which can place a
 * Image or other widget next to the menu text.
 *
 * A MenuItem can have a submenu, which is simply a Menu to pop up
 * when the menu item is selected. Typically, all menu items in a menu
 * bar have submenus.
 *
 * UIManager provides a higher-level interface for creating menu bars
 * and menus; while you can construct menus manually, most people
 * don't do that. There's a separate demo for UIManager.
 *
 */

using System;
using Gtk;

namespace GtkDemo
{
	[Demo ("Menus", "DemoMenus.cs")]
	public class DemoMenus : Gtk.Window
	{
		public DemoMenus () : base ("Menus")
		{
			AccelGroup accel_group = new AccelGroup ();
			AddAccelGroup (accel_group);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			MenuBar menubar = new MenuBar ();
			box1.PackStart (menubar, false, true, 0);

			MenuItem menuitem = new MenuItem ("test\nline2");
			menuitem.Submenu = CreateMenu (2, true);
			menubar.Append (menuitem);

 			MenuItem menuitem1 = new MenuItem ("foo");
 			menuitem1.Submenu = CreateMenu (3, true);
 			menubar.Append (menuitem1);

			menuitem = new MenuItem ("bar");
			menuitem.Submenu = CreateMenu (4, true);
			menuitem.RightJustified = true;
			menubar.Append (menuitem);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button close = new Button ("close");
			close.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (close, true, true, 0);

			close.CanDefault = true;
			close.GrabDefault ();

			ShowAll ();
		}

		private Menu CreateMenu (int depth, bool tearoff)
		{
			if (depth < 1)
				return null;

			Menu menu = new Menu ();
			RadioMenuItem[] group = null;

			if (tearoff) {
				TearoffMenuItem menuitem = new TearoffMenuItem ();
				menu.Append (menuitem);
			}

			for (int i = 0, j = 1; i < 5; i++, j++) {
				RadioMenuItem menuitem = new RadioMenuItem (group, String.Format ("item {0} - {1}", depth, j));
				group = menuitem.Group;

				menu.Append (menuitem);
				if (i == 3)
					menuitem.Sensitive = false;

				menuitem.Submenu = CreateMenu ((depth - 1), true);
			}

			return menu;
		}

		private void CloseClicked (object o, EventArgs args)
		{
			Destroy ();
		}

		protected override bool OnDeleteEvent (Gdk.Event evt)
		{
			Destroy ();
			return true;
		}
	}
}