87
87
/* First, get grid row number as if menubar weren't there */
88
var row = (MenuBar.HEIGHT + get_allocated_height ()) / grid_size;
88
var row = (MainWindow.MENUBAR_HEIGHT + get_allocated_height ()) / grid_size;
89
89
row = row - DEFAULT_BOX_HEIGHT; /* and no default dash box */
90
90
row = row / 2; /* and in the middle */
91
91
/* Now calculate y pixel spot keeping in mind menubar's allocation */
92
return row * grid_size - MenuBar.HEIGHT;
92
return row * grid_size - MainWindow.MENUBAR_HEIGHT;
437
437
protected virtual int get_position_y (double position)
439
double grid_number = position;
441
if (position >= 0.0 && position < 1.0)
443
var grids = get_greeter_box_height_grids ();
444
grid_number = position * grids; /* scaled to height of greeter box */
446
else if (position >= 1.0)
448
var grids = get_greeter_box_height_grids ();
449
grid_number = position + grids - 1.0;
452
return get_greeter_box_y () + (int)(grid_number * grid_size);
439
// Most position heights are just the grid height. Except for the one
440
// right above the greeter box and the greeter box itself. The greeter
441
// box is some number of grids to start with. And it is smaller by a
442
// bit, while the one above it is larger by the same amount, in order
443
// to line up names outside the greeter box in the middle of their
444
// grid, while the name inside the box is near the bottom of its first
446
int one_above_height = grid_size + PromptBox.NAME_MARGIN_TOP;
447
int box_height = get_greeter_box_height_grids () * grid_size -
448
PromptBox.NAME_MARGIN_TOP;
452
offset = (position + 1) * grid_size - one_above_height;
453
else if (position < 0)
454
offset = position * one_above_height;
455
else if (position < 1)
456
offset = position * box_height;
458
offset = (position - 1) * grid_size + box_height;
460
return get_greeter_box_y () + (int)offset;
455
463
private void move_entry (PromptBox entry, double position)
464
472
/* Some entry types may care where they are (e.g. wifi prompt) */
465
473
entry.position = position;
475
Gtk.Allocation allocation;
476
get_allocation (out allocation);
467
478
var child_allocation = Gtk.Allocation ();
468
479
child_allocation.width = grid_size * BOX_WIDTH - BORDER * 2;
469
480
entry.get_preferred_height_for_width (child_allocation.width, null, out child_allocation.height);
470
child_allocation.x = get_greeter_box_x ();
471
child_allocation.y = get_position_y (position);
481
child_allocation.x = allocation.x + get_greeter_box_x ();
482
child_allocation.y = allocation.y + get_position_y (position);
472
483
fixed.move (entry, child_allocation.x, child_allocation.y);
473
484
entry.size_allocate (child_allocation);
700
712
protected void connect_to_lightdm ()
702
UnityGreeter.greeter.show_message.connect (show_message_cb);
703
UnityGreeter.greeter.show_prompt.connect (show_prompt_cb);
704
UnityGreeter.greeter.authentication_complete.connect (authentication_complete_cb);
714
UnityGreeter.singleton.show_message.connect (show_message_cb);
715
UnityGreeter.singleton.show_prompt.connect (show_prompt_cb);
716
UnityGreeter.singleton.authentication_complete.connect (authentication_complete_cb);
707
719
protected void show_message_cb (string text, LightDM.MessageType type)
714
726
/* Notify the greeter on what user has been logged */
715
727
if (get_selected_id () == "*other" && manual_name == null)
717
if (UnityGreeter.test_mode)
729
if (UnityGreeter.singleton.test_mode)
718
730
manual_name = test_username;
720
manual_name = UnityGreeter.greeter.authentication_user;
732
manual_name = UnityGreeter.singleton.authentication_user();
745
757
bool is_authenticated;
746
if (UnityGreeter.test_mode)
758
if (UnityGreeter.singleton.test_mode)
747
759
is_authenticated = test_is_authenticated;
749
is_authenticated = UnityGreeter.greeter.is_authenticated;
761
is_authenticated = UnityGreeter.singleton.is_authenticated();
751
763
if (is_authenticated)
807
819
greeter_authenticating_user = get_selected_id ();
809
if (UnityGreeter.test_mode)
821
if (UnityGreeter.singleton.test_mode)
810
822
test_start_authentication ();
813
825
if (get_selected_id () == "*other")
814
UnityGreeter.greeter.authenticate ();
826
UnityGreeter.singleton.authenticate ();
815
827
else if (get_selected_id () == "*guest")
816
UnityGreeter.greeter.authenticate_as_guest ();
828
UnityGreeter.singleton.authenticate_as_guest ();
818
UnityGreeter.greeter.authenticate (get_selected_id ());
830
UnityGreeter.singleton.authenticate (get_selected_id ());
834
846
background.draw_grid = false;
835
847
background.queue_draw ();
837
UnityGreeter.start_session (get_lightdm_session ());
849
UnityGreeter.singleton.start_session (get_lightdm_session ());
840
852
public void login_complete ()