Exemple #1
0
void
delete_dialog (GtkAction * a, gpointer data)
{
    gftp_file * tempfle, * newfle;
    GList * templist, * filelist;
    gftp_transfer * transfer;
    gftp_window_data * wdata;
    int ret;
    GtkTreeSelection *select;
    GtkTreeIter iter;
    GtkTreeModel * model;

    wdata = data;
    if (!check_status (_("Delete"), wdata,
                       gftpui_common_use_threads (wdata->request), 0, 1, 1))
        return;

    transfer = g_malloc0 (sizeof (*transfer));
    transfer->fromreq = gftp_copy_request (wdata->request);
    transfer->fromwdata = wdata;

    select = gtk_tree_view_get_selection (GTK_TREE_VIEW (wdata->listbox));
    templist = gtk_tree_selection_get_selected_rows(select, &model);
    for (filelist = templist ; filelist != NULL; filelist = g_list_next(filelist))
    {
        gtk_tree_model_get_iter(model, &iter, (GtkTreePath*)filelist->data);
        gtk_tree_model_get(model, &iter, 0, &tempfle, -1);

        if (strcmp (tempfle->file, "..") == 0 ||
                strcmp (tempfle->file, ".") == 0)
            continue;
        newfle = copy_fdata (tempfle);
        transfer->files = g_list_append (transfer->files, newfle);
    }
    g_list_foreach (templist, (GFunc) gtk_tree_path_free, NULL);
    g_list_free (templist);

    if (transfer->files == NULL)
    {
        free_tdata (transfer);
        return;
    }

    gftp_swap_socks (transfer->fromreq, wdata->request);

    ret = gftp_gtk_get_subdirs (transfer);

    gftp_swap_socks (wdata->request, transfer->fromreq);

    if (!GFTP_IS_CONNECTED (wdata->request))
    {
        gftpui_disconnect (wdata);
        return;
    }

    if (!ret)
        return;

    askdel (transfer);
}
Exemple #2
0
bool CertificatesScreen::Certificate::processKeyInFocus(const Key &key)
{
	if (key == key_DELETECERTIFICATE)
	{
		std::vector<myServer *>::iterator b, e;

		for (b=myServer::server_list.begin(),
			     e=myServer::server_list.end();
		     b != e; ++b)
		{
			if ((*b)->certificate == id)
			{
				isused( (*b)->serverName);
				return true;
			}
		}

		if (id == myServer::smtpServerCertificate)
		{
			mail::loginInfo SMTPServerLoginInfo;

			mail::loginUrlDecode(myServer::smtpServerURL,
					     SMTPServerLoginInfo);

			isused(Gettext(_("%1% (SMTP server)")) <<
			       SMTPServerLoginInfo.server);
			return true;

		}

		myServer::promptInfo askdel(_("Delete this certificate? (Y/N) "));

		askdel=myServer::prompt(askdel.yesno());

		if (askdel.abortflag || (std::string)askdel != "Y")
			return true;

		parent->removeCertificate(myIter);
		return true;
	}

	if (key == key_RENAMECERTIFICATE)
	{
		myServer::promptInfo
			newname(_("New certificate name: "));

		newname=myServer::prompt(newname);

		if (newname.abortflag)
			return true;

		std::string newname_s=newname;

		if (newname_s.size() == 0)
			return true;

		myServer::certs->certs[id].name=newname_s;
		setText(newname_s);
		PasswordList::passwordList.save();
		return true;
	}

	return CursesButton::processKeyInFocus(key);
}