MCPcopy Create free account
hub / github.com/NetHack/NetHack / ghack_menu_window_clear

Function ghack_menu_window_clear

outdated/win/gnome/gnmenu.c:86–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void
87ghack_menu_window_clear(GtkWidget *menuWin, gpointer data)
88{
89 MenuWinType isMenu;
90 int i, numRows;
91 menuItem *item;
92
93 isMenu = (MenuWinType) GPOINTER_TO_INT(
94 gtk_object_get_data(GTK_OBJECT(menuWin), "isMenu"));
95
96 if (isMenu == MenuMenu) {
97 GtkWidget *clist;
98
99 clist = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(menuWin), "clist"));
100 g_assert(clist != NULL);
101
102 /* destroy existing menu data, if any */
103 if (clist) {
104 /* destroy all the row_data we stored in the clist */
105 numRows = GPOINTER_TO_INT(
106 gtk_object_get_data(GTK_OBJECT(clist), "numRows"));
107 for (i = 0; i < numRows; i++) {
108 item =
109 (menuItem *) gtk_clist_get_row_data(GTK_CLIST(clist), i);
110 if (item != NULL) {
111 g_free(item);
112 gtk_clist_set_row_data(GTK_CLIST(clist), i,
113 (gpointer) NULL);
114 }
115 }
116 gtk_object_set_data(GTK_OBJECT(clist), "numItems",
117 GINT_TO_POINTER(-1));
118 gtk_clist_clear(GTK_CLIST(clist));
119 }
120 }
121
122 else if (isMenu == MenuText) {
123 GnomeLess *gless;
124
125 gless = GNOME_LESS(gtk_object_get_data(GTK_OBJECT(menuWin), "gless"));
126 g_assert(gless != NULL);
127
128 gtk_editable_delete_text(GTK_EDITABLE(gless->text), 0, 0);
129 }
130}
131
132void
133ghack_menu_window_display(GtkWidget *menuWin, gboolean blocking,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected