Lines 64-69
Link Here
|
64 |
static gint64 first_update = 0; |
64 |
static gint64 first_update = 0; |
65 |
static gint64 last_update = 0; |
65 |
static gint64 last_update = 0; |
66 |
|
66 |
|
|
|
67 |
static DBusGProxy *session_proxy = NULL; |
68 |
|
67 |
static gchar *filename_to_path(const gchar *filename) |
69 |
static gchar *filename_to_path(const gchar *filename) |
68 |
{ |
70 |
{ |
69 |
GFile *file; |
71 |
GFile *file; |
Lines 354-360
Link Here
|
354 |
static void error_occurred(DBusGProxy *proxy, const gchar *name, |
356 |
static void error_occurred(DBusGProxy *proxy, const gchar *name, |
355 |
const gchar *message, gpointer user_data) |
357 |
const gchar *message, gpointer user_data) |
356 |
{ |
358 |
{ |
357 |
transfer_completed(proxy, user_data); |
359 |
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), |
|
|
360 |
_("Error Occurred")); |
361 |
|
362 |
gchar *text = g_strdup_printf("<span foreground=\"red\">%s</span>", |
363 |
message); |
364 |
gtk_label_set_markup(GTK_LABEL(label_status), text); |
365 |
g_free(text); |
366 |
|
367 |
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), |
368 |
GTK_RESPONSE_CLOSE, TRUE); |
358 |
} |
369 |
} |
359 |
|
370 |
|
360 |
static void session_connected(DBusGProxy *proxy, gpointer user_data) |
371 |
static void session_connected(DBusGProxy *proxy, gpointer user_data) |
Lines 363-369
Link Here
|
363 |
|
374 |
|
364 |
first_update = get_system_time(); |
375 |
first_update = get_system_time(); |
365 |
|
376 |
|
366 |
send_file(proxy); |
377 |
send_file(session_proxy); |
367 |
} |
378 |
} |
368 |
|
379 |
|
369 |
#define OPENOBEX_CONNECTION_FAILED "org.openobex.Error.ConnectionAttemptFailed" |
380 |
#define OPENOBEX_CONNECTION_FAILED "org.openobex.Error.ConnectionAttemptFailed" |
Lines 407-466
Link Here
|
407 |
if (dbus_g_proxy_end_call(proxy, call, &error, |
418 |
if (dbus_g_proxy_end_call(proxy, call, &error, |
408 |
DBUS_TYPE_G_OBJECT_PATH, &path, |
419 |
DBUS_TYPE_G_OBJECT_PATH, &path, |
409 |
G_TYPE_INVALID) == FALSE) { |
420 |
G_TYPE_INVALID) == FALSE) { |
410 |
gchar *text, *message; |
421 |
gchar *message; |
411 |
|
422 |
|
412 |
message = get_error_message(error); |
423 |
message = get_error_message(error); |
413 |
|
424 |
|
414 |
text = g_strdup_printf("<span foreground=\"red\">%s</span>", |
425 |
error_occurred(proxy,NULL,message,NULL); |
415 |
message); |
|
|
416 |
gtk_label_set_markup(GTK_LABEL(label_status), text); |
417 |
g_free(text); |
418 |
|
426 |
|
419 |
g_free(message); |
427 |
g_free(message); |
420 |
|
428 |
|
421 |
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), |
|
|
422 |
GTK_RESPONSE_CLOSE, TRUE); |
423 |
return; |
429 |
return; |
424 |
} |
430 |
} |
425 |
|
431 |
session_proxy = dbus_g_proxy_new_for_name(conn, "org.openobex", |
426 |
proxy = dbus_g_proxy_new_for_name(conn, "org.openobex", |
|
|
427 |
path, "org.openobex.Session"); |
432 |
path, "org.openobex.Session"); |
428 |
|
433 |
|
429 |
dbus_g_proxy_add_signal(proxy, "Connected", G_TYPE_INVALID); |
434 |
dbus_g_proxy_add_signal(session_proxy, "Cancelled", |
430 |
|
435 |
G_TYPE_INVALID); |
431 |
dbus_g_proxy_connect_signal(proxy, "Connected", |
|
|
432 |
G_CALLBACK(session_connected), NULL, NULL); |
433 |
|
434 |
dbus_g_proxy_add_signal(proxy, "ErrorOccurred", |
435 |
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); |
436 |
|
437 |
dbus_g_proxy_connect_signal(proxy, "ErrorOccurred", |
438 |
G_CALLBACK(error_occurred), NULL, NULL); |
439 |
|
440 |
dbus_g_proxy_add_signal(proxy, "Cancelled", G_TYPE_INVALID); |
441 |
|
436 |
|
442 |
dbus_g_proxy_connect_signal(proxy, "Cancelled", |
437 |
dbus_g_proxy_connect_signal(session_proxy, "Cancelled", |
443 |
G_CALLBACK(transfer_cancelled), NULL, NULL); |
438 |
G_CALLBACK(transfer_cancelled), NULL, NULL); |
444 |
|
439 |
|
445 |
dbus_g_proxy_add_signal(proxy, "TransferStarted", G_TYPE_STRING, |
440 |
dbus_g_proxy_add_signal(session_proxy, "TransferStarted", |
446 |
G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID); |
441 |
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, |
|
|
442 |
G_TYPE_INVALID); |
447 |
|
443 |
|
448 |
dbus_g_proxy_connect_signal(proxy, "TransferStarted", |
444 |
dbus_g_proxy_connect_signal(session_proxy, "TransferStarted", |
449 |
G_CALLBACK(transfer_started), NULL, NULL); |
445 |
G_CALLBACK(transfer_started), NULL, NULL); |
450 |
|
446 |
|
451 |
dbus_g_proxy_add_signal(proxy, "TransferProgress", |
447 |
dbus_g_proxy_add_signal(session_proxy, "TransferProgress", |
452 |
G_TYPE_UINT64, G_TYPE_INVALID); |
448 |
G_TYPE_UINT64, G_TYPE_INVALID); |
453 |
|
449 |
|
454 |
dbus_g_proxy_connect_signal(proxy, "TransferProgress", |
450 |
dbus_g_proxy_connect_signal(session_proxy, "TransferProgress", |
455 |
G_CALLBACK(transfer_progress), NULL, NULL); |
451 |
G_CALLBACK(transfer_progress), NULL, NULL); |
456 |
|
452 |
|
457 |
dbus_g_proxy_add_signal(proxy, "TransferCompleted", G_TYPE_INVALID); |
453 |
dbus_g_proxy_add_signal(session_proxy, "TransferCompleted", |
|
|
454 |
G_TYPE_INVALID); |
458 |
|
455 |
|
459 |
dbus_g_proxy_connect_signal(proxy, "TransferCompleted", |
456 |
dbus_g_proxy_connect_signal(session_proxy, "TransferCompleted", |
460 |
G_CALLBACK(transfer_completed), NULL, NULL); |
457 |
G_CALLBACK(transfer_completed), NULL, NULL); |
461 |
|
458 |
|
462 |
dbus_g_proxy_call(proxy, "Connect", NULL, G_TYPE_INVALID, |
|
|
463 |
G_TYPE_INVALID); |
464 |
} |
459 |
} |
465 |
|
460 |
|
466 |
static gchar *get_name(DBusGProxy *device) |
461 |
static gchar *get_name(DBusGProxy *device) |
Lines 767-772
Link Here
|
767 |
dbus_g_object_register_marshaller(marshal_VOID__UINT64, |
762 |
dbus_g_object_register_marshaller(marshal_VOID__UINT64, |
768 |
G_TYPE_NONE, G_TYPE_UINT64, G_TYPE_INVALID); |
763 |
G_TYPE_NONE, G_TYPE_UINT64, G_TYPE_INVALID); |
769 |
|
764 |
|
|
|
765 |
dbus_g_object_register_marshaller(marshal_VOID__STRING_STRING_STRING, |
766 |
G_TYPE_NONE, DBUS_TYPE_G_OBJECT_PATH, |
767 |
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); |
768 |
|
770 |
device_name = get_device_name(option_device); |
769 |
device_name = get_device_name(option_device); |
771 |
if (device_name == NULL) |
770 |
if (device_name == NULL) |
772 |
device_name = g_strdup(option_device); |
771 |
device_name = g_strdup(option_device); |
Lines 787-795
Link Here
|
787 |
dbus_g_proxy_connect_signal(proxy, "NameOwnerChanged", |
786 |
dbus_g_proxy_connect_signal(proxy, "NameOwnerChanged", |
788 |
G_CALLBACK(name_owner_changed), NULL, NULL); |
787 |
G_CALLBACK(name_owner_changed), NULL, NULL); |
789 |
|
788 |
|
|
|
789 |
dbus_g_proxy_add_signal(proxy, "SessionConnected", |
790 |
DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); |
791 |
|
792 |
dbus_g_proxy_connect_signal(proxy, "SessionConnected", |
793 |
G_CALLBACK(session_connected), NULL, NULL); |
794 |
|
795 |
dbus_g_proxy_add_signal(proxy, "SessionConnectError", |
796 |
DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING, |
797 |
G_TYPE_STRING, G_TYPE_INVALID); |
798 |
|
799 |
dbus_g_proxy_connect_signal(proxy, "SessionConnectError", |
800 |
G_CALLBACK(error_occurred), NULL, NULL); |
801 |
|
790 |
dbus_g_proxy_begin_call(proxy, "CreateBluetoothSession", |
802 |
dbus_g_proxy_begin_call(proxy, "CreateBluetoothSession", |
791 |
create_notify, NULL, NULL, |
803 |
create_notify, NULL, NULL, |
792 |
G_TYPE_STRING, option_device, |
804 |
G_TYPE_STRING, option_device, |
|
|
805 |
G_TYPE_STRING, "00:00:00:00:00:00", |
793 |
G_TYPE_STRING, "opp", G_TYPE_INVALID); |
806 |
G_TYPE_STRING, "opp", G_TYPE_INVALID); |
794 |
} else { |
807 |
} else { |
795 |
GHashTable *hash = NULL; |
808 |
GHashTable *hash = NULL; |