Example #1
0
/**************************************************************************
...
**************************************************************************/
static void meswin_response_callback(struct gui_dialog *dlg, int response,
                                     gpointer data)
{
  GtkTreeSelection *sel;
  GtkTreeModel *model;
  GtkTreeIter iter;
  gint row;

  if (response != CMD_GOTO && response != CMD_POPCITY) {
    gui_dialog_destroy(dlg);
    return;
  }

  sel = meswin_selection;
  g_return_if_fail(sel != NULL);
  if (!gtk_tree_selection_get_selected(sel, &model, &iter)) {
    return;
  }

  gtk_tree_model_get(model, &iter, 2, &row, -1);

  if (response == CMD_GOTO) {
    meswin_goto(row);
  } else {
    meswin_popup_city(row);
  }
  meswin_set_visited(&iter, TRUE);
}
Example #2
0
/***************************************************************************
  Slot executed when selection on meg_table has changed
***************************************************************************/
void messagewdg::item_selected(const QItemSelection &sl,
                               const QItemSelection &ds)
{
  const struct message *pmsg;
  int i;
  QFont f;
  QModelIndex index;
  QModelIndexList indexes = sl.indexes();
  QTableWidgetItem *item;

  if (indexes.isEmpty()) {
    return;
  }
  index = indexes.at(0);
  i = index.row();
  pmsg = meswin_get_message(i);
  if (i > -1 && pmsg != NULL) {
    if (QApplication::mouseButtons() == Qt::LeftButton
        || QApplication::mouseButtons() == Qt::RightButton) {
      meswin_set_visited_state(i, true);
      item = mesg_table->item(i, 0);
      f = item->font();
      f.setItalic(true);
      item->setFont(f);
    }
    if (QApplication::mouseButtons() == Qt::LeftButton && pmsg->location_ok) {
      meswin_goto(i);
    }
    if (QApplication::mouseButtons() == Qt::RightButton && pmsg->city_ok) {
      meswin_popup_city(i);
    }
  }
  mesg_table->clearSelection();
}