Commit 96f4969f authored by Antenore Gatta's avatar Antenore Gatta

Cleaning up printer channel sharing

parent 46badd64
......@@ -842,6 +842,8 @@ int remmina_rdp_set_printers(void *user_data, unsigned flags, cups_dest_t *dest)
{
rfContext *rfi = (rfContext *)user_data;
RemminaProtocolWidget* gp = rfi->protocol_widget;
rdpChannels* channels;
channels = rfi->instance->context->channels;
/** @warning printer-make-and-model is not always the same as on the Windows,
* therefore it fails finding to right one and it fails to add
......@@ -862,10 +864,15 @@ int remmina_rdp_set_printers(void *user_data, unsigned flags, cups_dest_t *dest)
const gchar *s = remmina_plugin_service->file_get_string(remminafile, "printer_overrides");
RDPDR_PRINTER* printer;
printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER));
//printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER));
printer = (RDPDR_PRINTER*) malloc(sizeof(RDPDR_PRINTER));
ZeroMemory(printer, sizeof(RDPDR_PRINTER));
printer->Type = RDPDR_DTYP_PRINT;
g_debug("Printer Type: %d", printer->Type);
rfi->settings->RedirectPrinters = TRUE;
remmina_rdp_load_static_channel_addin(channels, rfi->settings, "rdpdr", rfi->settings);
g_debug("Destination: %s", dest->name);
if (!(printer->Name = _strdup(dest->name))) {
......@@ -904,6 +911,7 @@ int remmina_rdp_set_printers(void *user_data, unsigned flags, cups_dest_t *dest)
free(printer);
return (1);
}
rfi->settings->DeviceRedirection = TRUE;
return (1);
}
#endif /* HAVE_CUPS */
......@@ -1277,8 +1285,6 @@ static gboolean remmina_rdp_main(RemminaProtocolWidget* gp)
if (remmina_plugin_service->file_get_int(remminafile, "shareprinter", FALSE)) {
rfi->settings->DeviceRedirection = TRUE;
remmina_rdp_load_static_channel_addin(channels, rfi->settings, "rdpdr", rfi->settings);
#ifdef HAVE_CUPS
g_debug ("Sharing printers");
if (cupsEnumDests(CUPS_DEST_FLAGS_NONE, 1000, NULL, 0, 0, remmina_rdp_set_printers, rfi)) {
......@@ -1596,7 +1602,8 @@ static gboolean remmina_rdp_close_connection(RemminaProtocolWidget* gp)
if (instance) {
if ( rfi->connected ) {
freerdp_disconnect(instance);
//freerdp_disconnect(instance);
freerdp_abort_connect(instance);
rfi->connected = False;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment