void terminate_console(int sig);
+extern "C" gint compare_func(const void *data1, const void *data2);
+
gboolean
on_console_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
gtk_main_quit();
terminate_console(0);
+ return TRUE;
}
void
gtk_entry_set_text((GtkEntry *)entry1, "");
} else if (event->keyval == KEY_Up) {
if (!hc) {
+ if (!hist) {
+ return FALSE;
+ }
hc = g_list_last(hist);
} else {
hc = g_list_previous(hc);
}
if (!hc) {
+ if (!hist) {
+ return FALSE;
+ }
hc = g_list_first(hist);
}
gtk_entry_set_text((GtkEntry *)entry1, (gchar *)hc->data);
} else if (event->keyval == KEY_Down) {
if (!hc) {
+ if (!hist) {
+ return FALSE;
+ }
hc = g_list_first(hist);
} else {
hc = g_list_next(hc);
}
if (!hc) {
+ if (!hist) {
+ return FALSE;
+ }
hc = g_list_last(hist);
}
gtk_entry_set_text((GtkEntry *)entry1, (gchar *)hc->data);
/*
* Compare list string items
*/
-static gint compare_func(const void *data1, const void *data2)
+extern "C"
+gint compare_func(const void *data1, const void *data2)
{
return strcmp((const char *)data1, (const char *)data2);
}