Beispiel #1
0
static void
dcc_dclick_cb (GtkTreeView *view, GtkTreePath *path,
					GtkTreeViewColumn *column, gpointer data)
{
	struct DCC *dcc;
	GSList *list;

	list = dcc_get_selected ();
	if (!list)
		return;
	dcc = list->data;
	g_slist_free (list);

	if (dcc->type == TYPE_RECV)
	{
		accept_clicked (0, 0);
		return;
	}

	switch (dcc->dccstat)
	{
	case STAT_FAILED:
	case STAT_ABORTED:
	case STAT_DONE:
		dcc_abort (dcc->serv->front_session, dcc);
	}
}
Beispiel #2
0
void
fe_dcc_add (struct DCC *dcc)
{
    if (dcc->type == TYPE_CHATRECV || dcc->type == TYPE_CHATSEND) {
        /* chats */
        if (prefs.autodccchat == FALSE) {
            GtkWidget *dialog;
            gint response;

            dialog = gtk_message_dialog_new (GTK_WINDOW (gui.main_window),
                                             GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                             GTK_MESSAGE_QUESTION,
                                             GTK_BUTTONS_CANCEL,
                                             _("Incoming DCC Chat"));
            gtk_dialog_add_button (GTK_DIALOG (dialog),
                                   _("_Accept"),
                                   GTK_RESPONSE_ACCEPT);
            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                    _("%s is attempting to create a direct chat. Do you wish to accept the connection?"),
                    dcc->nick);

            response = gtk_dialog_run (GTK_DIALOG (dialog));
            if (response == GTK_RESPONSE_ACCEPT) {
                dcc_get (dcc);
            } else {
                dcc_abort (dcc->serv->server_session, dcc);
            }
            gtk_widget_destroy (dialog);
        }
    } else {
        /* file transfers */
        dcc_window_add (gui.dcc, dcc);
    }
}
Beispiel #3
0
static void
abort_chat_clicked (GtkWidget * wid, gpointer none)
{
	int row;
	struct DCC *dcc;

	row = gtkutil_clist_selection (dcccwin.list);
	if (row != -1)
	{
		dcc = gtk_clist_get_row_data (GTK_CLIST (dcccwin.list), row);
		dcc_abort (dcc);
	}
}
Beispiel #4
0
static void
abort_chat_clicked (GtkWidget * wid, gpointer none)
{
	struct DCC *dcc;
	GSList *start, *list;

	start = list = dcc_chat_get_selected ();
	for (; list; list = list->next)
	{
		dcc = list->data;
		dcc_abort (dcc->serv->front_session, dcc);
	}
	g_slist_free (start);
}
Beispiel #5
0
static void
abort_clicked (GtkWidget * wid, gpointer none)
{
	struct DCC *dcc;
	GSList *start, *list;

	start = list = dcc_get_selected ();
	for (; list; list = list->next)
	{
		dcc = list->data;
		dcc_abort (dcc->serv->front_session, dcc);
	}
	g_slist_free (start);
	
	/* Enable the clear button if it wasn't already enabled */
	update_clear_button_sensitivity ();
}
Beispiel #6
0
static void
clear_completed (GtkWidget * wid, gpointer none)
{
	struct DCC *dcc;
	GSList *completed;

	/* Make a new list of only the completed items and abort each item.
	 * A new list is made because calling dcc_abort removes items from the original list,
	 * making it impossible to iterate over that list directly.
	*/
	for (completed = dcc_get_completed (); completed; completed = completed->next)
	{
		dcc = completed->data;
		dcc_abort (dcc->serv->front_session, dcc);
	}

	/* The data was freed by dcc_close */
	g_slist_free (completed);
	update_clear_button_sensitivity ();
}
Beispiel #7
0
static void
send_row_selected (GtkWidget * clist, gint row, gint column,
						 GdkEventButton * even)
{
	struct DCC *dcc;

	if (even && even->type == GDK_2BUTTON_PRESS)
	{
		dcc = gtk_clist_get_row_data (GTK_CLIST (clist), row);
		if (dcc)
		{
			switch (dcc->dccstat)
			{
			case STAT_FAILED:
			case STAT_ABORTED:
			case STAT_DONE:
				dcc_abort (dcc);
			}
		}
	}
}