37 #ifdef SPICE_GTK_CHECK_VERSION 38 # if SPICE_GTK_CHECK_VERSION(0, 31, 0) 60 GtkWidget *dialog_content;
64 g_signal_connect(task,
88 gtk_widget_set_size_request(dialog_content, 400, -1);
97 g_hash_table_insert(gpdata->
file_transfers, g_object_ref(task), widgets);
99 gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(gpdata->
file_transfer_dialog))),
103 g_signal_connect(task,
113 TRACE_CALL(__func__);
118 widgets->
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
119 widgets->
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
121 filename = spice_file_transfer_task_get_filename(task);
122 widgets->
label = gtk_label_new(filename);
123 gtk_widget_set_halign(widgets->
label, GTK_ALIGN_START);
124 gtk_widget_set_valign(widgets->
label, GTK_ALIGN_BASELINE);
126 widgets->
progress = gtk_progress_bar_new();
127 gtk_widget_set_hexpand(widgets->
progress, TRUE);
128 gtk_widget_set_valign(widgets->
progress, GTK_ALIGN_CENTER);
130 widgets->
cancel = gtk_button_new_from_icon_name(
"gtk-cancel", GTK_ICON_SIZE_SMALL_TOOLBAR);
131 g_signal_connect(widgets->
cancel,
135 gtk_widget_set_hexpand(widgets->
cancel, FALSE);
136 gtk_widget_set_valign(widgets->
cancel, GTK_ALIGN_CENTER);
138 gtk_box_pack_start(GTK_BOX(widgets->
hbox), widgets->
progress,
140 gtk_box_pack_start(GTK_BOX(widgets->
hbox), widgets->
cancel,
143 gtk_box_pack_start(GTK_BOX(widgets->
vbox), widgets->
label,
145 gtk_box_pack_start(GTK_BOX(widgets->
vbox), widgets->
hbox,
148 gtk_widget_show_all(widgets->
vbox);
157 TRACE_CALL(__func__);
160 gtk_widget_destroy(widgets->
vbox);
166 TRACE_CALL(__func__);
168 spice_file_transfer_task_cancel(task);
174 TRACE_CALL(__func__);
178 SpiceFileTransferTask *task;
181 if (response == GTK_RESPONSE_CANCEL) {
183 while (g_hash_table_iter_next(&iter, &key, &value)) {
185 spice_file_transfer_task_cancel(task);
192 TRACE_CALL(__func__);
199 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->
progress),
200 spice_file_transfer_task_get_progress(SPICE_FILE_TRANSFER_TASK(task)));
206 TRACE_CALL(__func__);
208 gchar *filename, *notification_message;
209 GNotification *notification;
216 filename = spice_file_transfer_task_get_filename(task);
219 notification = g_notification_new(_(
"Transfer error"));
220 notification_message = g_strdup_printf(_(
"%s: %s"),
221 filename, error->message);
223 notification = g_notification_new(_(
"Transfer completed"));
224 notification_message = g_strdup_printf(_(
"The %s file has been transferred"),
228 g_notification_set_body(notification, notification_message);
229 g_application_send_notification(g_application_get_default(),
230 "remmina-plugin-spice-file-transfer-finished",
240 g_free(notification_message);
241 g_object_unref(notification);
static void remmina_plugin_spice_file_transfer_finished_cb(SpiceFileTransferTask *, GError *, RemminaProtocolWidget *)
void remmina_plugin_spice_file_transfer_new_cb(SpiceMainChannel *main_channel, SpiceFileTransferTask *task, RemminaProtocolWidget *gp)
static RemminaPluginSpiceXferWidgets * remmina_plugin_spice_xfer_widgets_new(SpiceFileTransferTask *)
static void remmina_plugin_spice_file_transfer_dialog_response_cb(GtkDialog *, gint, RemminaProtocolWidget *)
GHashTable * file_transfers
static void remmina_plugin_spice_xfer_widgets_free(RemminaPluginSpiceXferWidgets *widgets)
GtkWidget * file_transfer_dialog
struct _RemminaPluginSpiceXferWidgets RemminaPluginSpiceXferWidgets
static void remmina_plugin_spice_file_transfer_cancel_cb(GtkButton *, SpiceFileTransferTask *)
static void remmina_plugin_spice_file_transfer_progress_cb(GObject *, GParamSpec *, RemminaProtocolWidget *)