414
/* HACK, to access the GtkAssistant buttons */
415
struct RealGtkAssistant
427
GtkAssistantPrivate *priv;
429
typedef struct RealGtkAssistant RealGtkAssistant;
432
prepare_idle_cb (gpointer data)
434
RealGtkAssistant *assistant = (RealGtkAssistant *) window_assistant;
437
page = gtk_assistant_get_current_page (GTK_ASSISTANT (window_assistant));
438
if (page == PAGE_FAILURE) {
439
gtk_widget_hide (assistant->cancel);
440
gtk_widget_hide (assistant->forward);
441
gtk_widget_hide (assistant->back);
442
gtk_widget_hide (assistant->apply);
443
gtk_widget_hide (assistant->last);
444
gtk_widget_show (assistant->close);
445
gtk_widget_set_sensitive (assistant->close, TRUE);
447
if (page == PAGE_CONNECTING) {
448
gtk_widget_hide (assistant->forward);
449
gtk_widget_hide (assistant->back);
450
gtk_widget_hide (assistant->apply);
451
gtk_widget_hide (assistant->last);
452
gtk_widget_hide (assistant->close);
453
gtk_widget_show (assistant->cancel);
454
gtk_widget_set_sensitive (assistant->cancel, TRUE);
456
if (page == PAGE_SETUP) {
457
gtk_widget_hide (assistant->forward);
458
gtk_widget_hide (assistant->back);
459
gtk_widget_hide (assistant->apply);
460
gtk_widget_hide (assistant->last);
461
gtk_widget_hide (assistant->close);
462
gtk_widget_show (assistant->cancel);
463
gtk_widget_set_sensitive (assistant->cancel, TRUE);
465
if (page == PAGE_SSP_SETUP) {
466
gtk_widget_hide (assistant->forward);
467
gtk_widget_hide (assistant->back);
468
gtk_widget_hide (assistant->apply);
469
gtk_widget_hide (assistant->last);
470
gtk_widget_hide (assistant->close);
471
if (display_called == FALSE) {
472
gtk_widget_hide (assistant->cancel);
474
gtk_widget_show (assistant->cancel);
475
gtk_widget_set_sensitive (assistant->cancel, TRUE);
478
if (page == PAGE_FINISHING) {
479
gtk_widget_hide (assistant->forward);
480
gtk_widget_hide (assistant->back);
481
gtk_widget_hide (assistant->apply);
482
gtk_widget_hide (assistant->last);
483
gtk_widget_hide (assistant->cancel);
484
gtk_widget_show (assistant->close);
485
gtk_widget_set_sensitive (assistant->close, FALSE);
490
415
void prepare_callback (GtkWidget *assistant,
494
419
gboolean complete = TRUE;
421
gtk_widget_hide (button_close);
422
gtk_widget_hide (button_cancel);
496
424
if (page == page_search) {
497
425
complete = set_page_search_complete ();
498
426
bluetooth_chooser_start_discovery(selector);
506
434
complete = FALSE;
508
bling_spinner_start (BLING_SPINNER (spinner_connecting));
436
gtk_spinner_start (GTK_SPINNER (spinner_connecting));
511
439
* The '%s' is the device name, for example:
512
* Connecting to 'Sony Bluetooth Headset' now...
440
* Connecting to 'Sony Bluetooth Headset'...
514
442
text = g_strdup_printf (_("Connecting to '%s'..."), target_name);
515
443
gtk_label_set_text (GTK_LABEL (label_connecting), text);
446
gtk_widget_show (button_cancel);
518
bling_spinner_stop (BLING_SPINNER (spinner_connecting));
448
gtk_spinner_stop (GTK_SPINNER (spinner_connecting));
521
451
if ((page == page_setup || page == page_connecting) && (create_started == FALSE)) {
617
551
if (page == page_failure) {
618
552
complete = FALSE;
619
553
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), W("restart_button"));
554
gtk_widget_show (button_close);
621
556
if (gtk_widget_get_parent (W("restart_button")) != NULL)
622
557
gtk_assistant_remove_action_widget (GTK_ASSISTANT (assistant), W("restart_button"));
625
if (page == page_ssp_setup && display_called == FALSE) {
627
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), W("matches_button"));
628
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), W("does_not_match_button"));
560
if (page == page_ssp_setup) {
561
if (display_called == FALSE) {
563
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), W("matches_button"));
564
gtk_assistant_add_action_widget (GTK_ASSISTANT (assistant), W("does_not_match_button"));
566
gtk_widget_show (button_cancel);
630
569
if (gtk_widget_get_parent (W("does_not_match_button")) != NULL)
631
570
gtk_assistant_remove_action_widget (GTK_ASSISTANT (assistant), W("does_not_match_button"));
895
829
gtk_assistant_set_forward_page_func (assistant, page_func, NULL, NULL);
831
/* The 2 custom buttons */
832
button_close = W("close_button");
833
button_cancel = W("cancel_button");
834
gtk_assistant_add_action_widget (assistant, button_close);
835
gtk_assistant_add_action_widget (assistant, button_cancel);
836
gtk_widget_hide (button_close);
837
gtk_widget_hide (button_cancel);
898
840
combo = gtk_combo_box_new();
972
915
g_object_set_data (G_OBJECT (radio_0000), "pin", "0000");
973
916
g_object_set_data (G_OBJECT (radio_1111), "pin", "1111");
974
917
g_object_set_data (G_OBJECT (radio_1234), "pin", "1234");
918
g_object_set_data (G_OBJECT (radio_none), "pin", "NULL");
975
919
g_object_set_data (G_OBJECT (radio_custom), "entry", entry_custom);
977
921
gtk_builder_connect_signals(builder, NULL);
983
927
return assistant;
986
static UniqueResponse
987
message_received_cb (UniqueApp *app,
989
UniqueMessageData *message_data,
931
activate_cb (GApplication *app,
993
gtk_window_present (GTK_WINDOW (user_data));
995
return UNIQUE_RESPONSE_OK;
934
gtk_window_present_with_time (GTK_WINDOW (user_data), GDK_CURRENT_TIME);
998
937
static GOptionEntry options[] = {
1022
app = unique_app_new ("org.gnome.Bluetooth.wizard", NULL);
1023
if (unique_app_is_running (app)) {
961
app = gtk_application_new ("org.gnome.Bluetooth.wizard", G_APPLICATION_FLAGS_NONE);
962
if (g_application_register (G_APPLICATION (app), NULL, &error) == FALSE) {
963
g_warning ("Could not register application: %s", error->message);
964
g_error_free (error);
968
if (g_application_get_is_remote (G_APPLICATION (app))) {
969
g_application_activate (G_APPLICATION (app));
1024
970
gdk_notify_startup_complete ();
1025
unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
1046
992
window_assistant = create_wizard();
1047
993
if (window_assistant == NULL)
1050
g_signal_connect (app, "message-received",
1051
G_CALLBACK (message_received_cb), window_assistant);
995
gtk_application_add_window (app,
996
GTK_WINDOW (window_assistant));
998
g_signal_connect (app, "activate",
999
G_CALLBACK (activate_cb), window_assistant);
1001
g_application_run (G_APPLICATION (app), argc, argv);
1055
1003
bluetooth_plugin_manager_cleanup ();
1057
g_object_unref(agent);
1006
g_object_unref (agent);
1059
1008
g_object_unref(client);