Пример #1
0
void XttTblGtk::activate_command(GtkWidget* w, gpointer data)
{
  XttTbl* xtt = (XttTbl*)data;

  if (!xtt->is_authorized())
    return;

  if (xtt->command_open) {
    g_object_set(((XttTblGtk*)xtt)->cmd_input, "visible", FALSE, NULL);
    xtt->set_prompt("");
    xtt->command_open = 0;
    return;
  }

  gtk_editable_delete_text(GTK_EDITABLE(((XttTblGtk*)xtt)->cmd_input), 0, -1);

  g_object_set(((XttTblGtk*)xtt)->cmd_input, "visible", TRUE, NULL);
  xtt->message(' ', "");
  gtk_widget_grab_focus(((XttTblGtk*)xtt)->cmd_input);

  xtt->set_prompt("xtt >");
  xtt->command_open = 1;
}
Пример #2
0
void XttTblGtk::valchanged_cmd_input(GtkWidget* w, gpointer data)
{
  XttTbl* xtt = (XttTbl*)data;
  int sts;
  char *text, *textutf8;

  textutf8 = gtk_editable_get_chars(GTK_EDITABLE(w), 0, -1);
  text = g_convert(textutf8, -1, "ISO8859-1", "UTF-8", NULL, NULL, NULL);
  g_free(textutf8);

  sts = xtt->command(text);
  g_object_set(w, "visible", FALSE, NULL);
  xtt->set_prompt("");
  xtt->command_open = 0;
  xtt->tblnav->set_inputfocus();
}