static void
am_ready_cb (GObject      *source_object,
             GAsyncResult *result,
             gpointer      userdata)

{
  TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
  AnerleyFeed *feed;
  ClutterActor *stage;
  ClutterActor *scroll_view;
  ClutterActor *icon_view;
  ClutterModel *model;
  GError *error = NULL;

  if (!tp_account_manager_prepare_finish (account_manager, result, &error))
  {
    g_warning ("Failed to make account manager ready: %s", error->message);
    g_error_free (error);
    return;
  }

  feed = ANERLEY_FEED (anerley_aggregate_tp_feed_new ());
  model = CLUTTER_MODEL (anerley_feed_model_new (feed));
  stage = clutter_stage_get_default ();
  icon_view = anerley_tile_view_new (ANERLEY_FEED_MODEL (model));

  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                               CLUTTER_ACTOR (scroll_view));
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               CLUTTER_ACTOR (icon_view));
  clutter_actor_set_size (CLUTTER_ACTOR (scroll_view), 640, 480);
  clutter_actor_show_all (stage);
}
Пример #2
0
int
main (int argc, char *argv[])
{
  ClutterActor *stage, *box, *scrollview;

  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return 1;

  mx_style_load_from_file (mx_style_get_default(), "style/default.css", NULL);

  stage = clutter_stage_get_default ();
  clutter_actor_set_size (stage, 640, 480);
  clutter_stage_set_user_resizable ((ClutterStage *) stage, TRUE);

  scrollview = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), scrollview);

  clutter_actor_set_position (scrollview, 50, 50);
  clutter_actor_set_size (scrollview, 500, 300);

  box = mx_box_layout_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scrollview), box);

  add_actor ((ClutterContainer*) box);
  add_actor ((ClutterContainer*) box);
  add_actor ((ClutterContainer*) box);


  g_signal_connect (stage, "key-release-event", G_CALLBACK (key_release_cb),
                    box);
  g_signal_connect (stage, "notify::allocation",
                    G_CALLBACK (stage_size_changed_cb), scrollview);
  clutter_actor_show (stage);
  clutter_main ();

  return EXIT_SUCCESS;
}
Пример #3
0
void
scroll_grid_main (ClutterContainer *stage)
{
  ClutterActor *scroll, *grid, *table, *label, *visible_entry, *stride_entry;
  int i;

  scroll = mx_scroll_view_new ();
  clutter_container_add_actor (stage, scroll);
  clutter_actor_set_position (scroll, 10, 10);

  clutter_actor_set_size (scroll, 400, 400);

  grid = mx_grid_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll), grid);

  for (i = 1; i <= 200; i++)
    {
      ClutterActor *button;
      gchar *text;

      text = g_strdup_printf ("Button %d", i);

      button = mx_button_new_with_label (text);
      clutter_container_add_actor (CLUTTER_CONTAINER (grid), button);
      mx_widget_set_tooltip_text (MX_WIDGET (button), "test");
      if (i == 1)
        g_signal_connect (button,
                          "clicked",
                          G_CALLBACK (swap_orientation),
                          grid);

      g_free (text);
    }

  table = mx_table_new ();

  label = mx_label_new_with_text ("Make button visible:");
  visible_entry = mx_entry_new ();
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         label,
                                         0, 0,
                                         "x-expand", FALSE,
                                         NULL);
  mx_table_insert_actor (MX_TABLE (table), visible_entry, 0, 1);

  label = mx_label_new_with_text ("Set max-stride:");
  stride_entry = mx_entry_new ();
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         label,
                                         1, 0,
                                         "x-expand", FALSE,
                                         NULL);
  mx_table_insert_actor (MX_TABLE (table), stride_entry, 1, 1);

  clutter_actor_set_position (table, 10, 420);
  clutter_actor_set_width (table, 400);
  clutter_container_add_actor (stage, table);

  g_signal_connect (mx_entry_get_clutter_text (MX_ENTRY (visible_entry)),
                    "activate",
                    G_CALLBACK (ensure_visible),
                    grid);

  g_signal_connect (mx_entry_get_clutter_text (MX_ENTRY (stride_entry)),
                    "activate",
                    G_CALLBACK (set_max_stride), grid);
}
Пример #4
0
void
scroll_view_main (ClutterContainer *stage)
{
  gint width, height;
  MxAdjustment *hadjust, *vadjust;
  ClutterActor *label, *elastic, *overshoot, *scroll, *kinetic, *view, *texture;

  scroll = mx_scroll_view_new ();

  /* Make sure something underneath the kinetic scroll view swallows events
   * so that we don't end up moving the window.
   */
  g_signal_connect (scroll, "button-press-event", G_CALLBACK (true_cb), NULL);

  kinetic = mx_kinetic_scroll_view_new ();

  clutter_container_add_actor (stage, scroll);
  clutter_actor_set_position (scroll, 10, 10);
  clutter_actor_set_size (scroll, 300, 300);

  view = mx_viewport_new ();
  mx_viewport_set_sync_adjustments (MX_VIEWPORT (view), FALSE);
  clutter_container_add_actor (CLUTTER_CONTAINER (kinetic), view);
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll), kinetic);


  texture = clutter_texture_new_from_file ("redhand.png", NULL);
  clutter_container_add_actor (CLUTTER_CONTAINER (view), texture);
  g_object_set (texture, "repeat-x", TRUE, "repeat-y", TRUE, NULL);
  clutter_actor_set_size (texture, 1280, 1280);

  clutter_texture_get_base_size (CLUTTER_TEXTURE (texture),
                                 &width, &height);
  mx_scrollable_get_adjustments (MX_SCROLLABLE (view),
                                 &hadjust, &vadjust);
  mx_adjustment_set_values (hadjust,
                            0,
                            0,
                            1280,
                            width,
                            width * 3,
                            300);
  mx_adjustment_set_values (vadjust,
                            0,
                            0,
                            1280,
                            height,
                            height * 3,
                            300);

  label = mx_label_new_with_text ("Toggle over-shooting:");
  overshoot = mx_toggle_new ();
  clutter_actor_set_position (label, 320, 10);
  clutter_actor_set_position (overshoot, 330 + clutter_actor_get_width (label),
                              10);
  clutter_container_add (stage, label, overshoot, NULL);

  g_signal_connect (overshoot, "notify::active",
                    G_CALLBACK (notify_overshoot_cb), kinetic);

  label = mx_label_new_with_text ("Toggle elasticity:");
  elastic = mx_toggle_new ();
  clutter_actor_set_position (label, 320,
                              20 + clutter_actor_get_height (overshoot));
  clutter_actor_set_position (elastic, clutter_actor_get_x (overshoot),
                              clutter_actor_get_y (label));
  clutter_container_add (stage, label, elastic, NULL);

  g_signal_connect (elastic, "notify::active",
                    G_CALLBACK (notify_elastic_cb), kinetic);
}
Пример #5
0
static void
construct_completion (MnpWorldClock *world_clock)
{
    const ClutterColor transparent = { 0x00, 0x00, 0x00, 0x00 };

    ClutterActor *frame, *scroll, *view, *stage;
    MnpWorldClockPrivate *priv = GET_PRIVATE (world_clock);
    ClutterModel *model;
    MnpButtonItem *button_item;

    stage = priv->stage;

    /* Create an event-box to capture input when the completion list
     * displays.
     */
    priv->event_box = clutter_rectangle_new_with_color (&transparent);
    clutter_actor_set_size (priv->event_box,
                            clutter_actor_get_width (stage),
                            clutter_actor_get_height (stage));
    clutter_container_add_actor (CLUTTER_CONTAINER (stage),
                                 priv->event_box);
    clutter_actor_set_reactive (priv->event_box, TRUE);
    clutter_actor_hide (priv->event_box);
    g_signal_connect (priv->event_box, "button-press-event",
                      G_CALLBACK (event_box_clicked_cb), world_clock);

    if (!priv->zones_model) {
        model = mnp_get_world_timezones ();
        priv->zones_model = model;
    } else
        model = priv->zones_model;

    clutter_model_set_filter (model, filter_zone, world_clock, NULL);
    priv->search_text = "asd";

    frame = mx_frame_new ();
    clutter_actor_set_name (frame, "CompletionFrame");
    mx_bin_set_fill (MX_BIN (frame), TRUE, TRUE);

    scroll = mx_scroll_view_new ();
    clutter_actor_set_name (scroll, "CompletionScrollView");
    g_object_set (G_OBJECT (scroll), "clip-to-allocation", TRUE, NULL);
    clutter_actor_set_size (scroll, -1, 300);
    mx_bin_set_child (MX_BIN (frame), scroll);
    clutter_container_add_actor ((ClutterContainer *)stage, frame);
    clutter_actor_raise_top((ClutterActor *) frame);
    clutter_actor_set_position (frame, 14, 167);
    clutter_actor_hide (frame);

    priv->completion = frame;
    g_signal_connect (priv->completion, "show",
                      G_CALLBACK (completion_show_cb), world_clock);
    g_signal_connect (priv->completion, "hide",
                      G_CALLBACK (completion_hide_cb), world_clock);

    view = mx_list_view_new ();
    clutter_actor_set_name (view, "CompletionListView");
    priv->zones_list = (MxListView *)view;

    clutter_container_add_actor (CLUTTER_CONTAINER (scroll), view);
    mx_list_view_set_model (MX_LIST_VIEW (view), model);

    button_item = mnp_button_item_new ((gpointer)world_clock, mnp_completion_done);
    mx_list_view_set_factory (MX_LIST_VIEW (view), (MxItemFactory *)button_item);
    mx_list_view_add_attribute (MX_LIST_VIEW (view), "label", 0);
}
Пример #6
0
static void
mnb_people_panel_init (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  ClutterActor *label;
  ClutterActor *bin;
  ClutterActor *table;
  ClutterActor *scroll_view;
  ClutterActor *left_side;
  ClutterActor *right_side;
  AnerleyFeed *active_feed;

  priv->am = tp_account_manager_dup ();
  priv->aggregator = folks_individual_aggregator_new ();

  /* Populate top level table */
  label = mx_label_new_with_text (_("IM"));
  mx_stylable_set_style_class (MX_STYLABLE (label), "titleBar");
  mx_table_insert_actor_with_properties (MX_TABLE (self),
                                         CLUTTER_ACTOR (label),
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  table = mx_table_new ();
  mx_stylable_set_style_class (MX_STYLABLE (table), "contentPane");
  mx_table_set_column_spacing (MX_TABLE (table), 23);
  mx_table_insert_actor_with_properties (MX_TABLE (self),
                                         CLUTTER_ACTOR (table),
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  left_side = mx_table_new ();
  clutter_actor_set_width (left_side, 300);
  mx_table_set_row_spacing (MX_TABLE (left_side), 10);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         CLUTTER_ACTOR (left_side),
                                         0, 0,
                                         "x-expand", FALSE,
                                         "y-expand", TRUE,
                                         "x-fill", FALSE,
                                         "y-fill", TRUE,
                                         NULL);
  right_side = mx_table_new ();
  mx_table_set_row_spacing (MX_TABLE (right_side), 10);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         CLUTTER_ACTOR (right_side),
                                         0, 1,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);

  /* Populate left side */
  table = mx_table_new ();
  mx_table_set_column_spacing (MX_TABLE (table), 10);
  clutter_actor_set_name (table, "people-panel-me-table");
  mx_table_insert_actor_with_properties (MX_TABLE (left_side),
                                         CLUTTER_ACTOR (table),
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         NULL);
  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-me-avatar-frame");
  clutter_actor_set_size (bin, 84, 85);
  priv->avatar = anerley_tp_user_avatar_new ();
  clutter_actor_set_size (priv->avatar, 64, 64);
  mx_bin_set_child (MX_BIN (bin), priv->avatar);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         bin,
                                         0, 0,
                                         "row-span", 3,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", FALSE,
                                         "y-fill", FALSE,
                                         NULL);
  label = mx_label_new_with_text (_("Me"));
  clutter_actor_set_name (label, "people-panel-me-label");
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         label,
                                         0, 1,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "x-align", MX_ALIGN_START,
                                         NULL);
  priv->presence_message = mx_label_new ();
  clutter_actor_set_name (label, "people-panel-me-presence-message");
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->presence_message,
                                         1, 1,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         NULL);
  priv->presence_chooser = anerley_presence_chooser_new ();
  clutter_actor_set_height (priv->presence_chooser, 40);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->presence_chooser,
                                         2, 1,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         "y-align", MX_ALIGN_END,
                                         NULL);
  label = mx_label_new_with_text (_("You are chatting with:"));
  mx_stylable_set_style_class (MX_STYLABLE (label), "sectionHeader");
  mx_table_insert_actor_with_properties (MX_TABLE (left_side),
                                         label,
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", FALSE,
                                         NULL);
  scroll_view = mx_scroll_view_new ();
  mx_table_insert_actor_with_properties (MX_TABLE (left_side),
                                         scroll_view,
                                         2, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  active_feed = anerley_tp_monitor_feed_new (priv->aggregator,
                                             "DawatiPanelPeople");
  priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed);
  priv->active_list_view = anerley_compact_tile_view_new (priv->active_model);
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->active_list_view);

  /* Populate right side */
  table = mx_table_new ();
  clutter_actor_set_name (table, "people-panel-actions-box");
  mx_table_set_column_spacing (MX_TABLE (table), 10);
  mx_table_insert_actor_with_properties (MX_TABLE (right_side),
                                         CLUTTER_ACTOR (table),
                                         0, 0,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  create_sort_by_chooser (self);
  clutter_actor_set_size (priv->sort_by_chooser, 160, 40);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->sort_by_chooser,
                                         0, 0,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", FALSE,
                                         "y-fill", TRUE,
                                         NULL);
  create_new_chooser (self);
  clutter_actor_set_size (priv->new_chooser, 126, 40);
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->new_chooser,
                                         0, 1,
                                         "x-expand", FALSE,
                                         "y-expand", FALSE,
                                         "x-fill", FALSE,
                                         "y-fill", TRUE,
                                         NULL);
  create_search_entry (self);
  //clutter_actor_set_height (priv->search_entry, 30);
  mx_stylable_set_style_class (MX_STYLABLE (priv->search_entry), "searchBox");
  mx_table_insert_actor_with_properties (MX_TABLE (table),
                                         priv->search_entry,
                                         0, 2,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  priv->content_table = mx_table_new ();
  mx_stylable_set_style_class (MX_STYLABLE (priv->content_table), "contentPanel");
  mx_table_insert_actor_with_properties (MX_TABLE (right_side),
                                         priv->content_table,
                                         1, 0,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "x-fill", TRUE,
                                         "y-fill", TRUE,
                                         NULL);
  priv->tp_feed = ANERLEY_FEED (anerley_tp_feed_new (priv->aggregator));
  priv->model = (AnerleyFeedModel *)anerley_feed_model_new (priv->tp_feed);
  priv->tile_view = anerley_tile_view_new (priv->model);
  priv->main_scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->main_scroll_view),
                               priv->tile_view);
  mx_table_insert_actor (MX_TABLE (priv->content_table),
                         priv->main_scroll_view,
                         0, 0);

  /* No people && no accounts enabled */
  priv->no_people_tile = _make_empty_people_tile (self);
  clutter_actor_hide (priv->no_people_tile);

  mx_table_insert_actor_with_properties (MX_TABLE (priv->content_table),
                                         priv->no_people_tile,
                                         1, 0,
                                         "x-fill", TRUE,
                                         "x-expand", TRUE,
                                         "y-expand", TRUE,
                                         "y-fill", TRUE,
                                         NULL);

  /* No people && acounts are online */
  priv->everybody_offline_tile = _make_everybody_offline_tile (self);
  clutter_actor_hide (priv->everybody_offline_tile);

  mx_table_insert_actor_with_properties (MX_TABLE (priv->content_table),
                                         priv->everybody_offline_tile,
                                         2, 0,
                                         "x-fill", TRUE,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "y-fill", FALSE,
                                         "y-align", MX_ALIGN_START,
                                         "row-span", 1,
                                         NULL);

  priv->offline_banner =
    _make_offline_banner (self,
                          clutter_actor_get_width (priv->main_scroll_view));
  clutter_actor_hide (priv->offline_banner);
  mx_table_insert_actor_with_properties (MX_TABLE (priv->content_table),
                                         priv->offline_banner,
                                         3, 0,
                                         "x-fill", TRUE,
                                         "x-expand", TRUE,
                                         "y-expand", FALSE,
                                         "y-fill", FALSE,
                                         "y-align", MX_ALIGN_START,
                                         "row-span", 1,
                                         NULL);

  g_signal_connect (priv->tile_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  g_signal_connect (priv->active_list_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);


  g_signal_connect (priv->model,
                    "bulk-change-end",
                    (GCallback)_model_bulk_changed_end_cb,
                    self);
  g_signal_connect (priv->active_model,
                    "bulk-change-end",
                    (GCallback)_active_model_bulk_change_end_cb,
                    self);
  clutter_actor_hide ((ClutterActor *)priv->main_scroll_view);

  /* Placeholder changes based on onlineness or not */
  _update_placeholder_state (self);

  sw_online_add_notify (_online_notify_cb, self);
  _update_online_state (self, sw_is_online ());

  tp_proxy_prepare_async (priv->am, NULL, am_prepared_cb, self);
}
static void
mnb_people_panel_init (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  ClutterActor *label;
  ClutterActor *scroll_view, *bin, *tmp_text;
  AnerleyFeed *active_feed;
  ClutterActor *settings_launcher;

  mx_table_set_column_spacing (MX_TABLE (self), 6);
  mx_table_set_row_spacing (MX_TABLE (self), 6);

  /* Populate top level table */
  priv->header_box = mx_table_new ();
  clutter_actor_set_name (priv->header_box, "people-panel-header-box");
  mx_table_set_column_spacing (MX_TABLE (priv->header_box), 20);
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->header_box),
                                      0, 0,
                                      "column-span", 2,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_START,
                                      NULL);

  priv->content_table = mx_table_new ();
  clutter_actor_set_name (priv->content_table, "people-panel-content-box");
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->content_table),
                                      1, 0,
                                      "x-expand", TRUE,
                                      "y-expand", TRUE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      NULL);

  priv->side_table = mx_table_new ();
  clutter_actor_set_width (priv->side_table, 288);
  clutter_actor_set_name (priv->side_table, "people-panel-side-box");
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->side_table),
                                      1, 1,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      NULL);


  /* Populate header */
  label = mx_label_new_with_text (_("People"));
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      CLUTTER_ACTOR (label),
                                      0, 0,
                                      "x-expand", FALSE,
                                      "y-expand", FALSE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);
  clutter_actor_set_name (label, "people-panel-header-label");

  /* Main body table */

  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-content-header");
  label = mx_label_new_with_text (_("Me and my people"));
  clutter_actor_set_name (label, "people-panel-content-header-label");
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      CLUTTER_ACTOR (bin),
                                      0, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);

  /* Me table containing avatar, name and presence chooser */
  priv->me_table = mx_table_new ();

  mx_table_set_column_spacing (MX_TABLE (priv->me_table), 16);
  mx_table_set_row_spacing (MX_TABLE (priv->me_table), 8);

  clutter_actor_set_name (priv->me_table, "people-panel-me-box");

  priv->avatar = anerley_tp_user_avatar_new ();
  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-me-avatar-frame");
  mx_bin_set_child (MX_BIN (bin), priv->avatar);
  clutter_actor_set_size (priv->avatar, 48, 48);
  mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      bin,
                                      0, 0,
                                      "row-span", 2,
                                      "x-expand", FALSE,
                                      "y-expand", TRUE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      NULL);
  label = mx_label_new_with_text (_("Me"));
  clutter_actor_set_name (label, "people-panel-me-label");
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      label,
                                      0, 1,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      NULL);
  priv->presence_chooser = anerley_presence_chooser_new ();
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      priv->presence_chooser,
                                      1, 1,
                                      "x-expand", TRUE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      NULL);

  settings_launcher = _make_settings_launcher (self);
  mx_table_add_actor_with_properties (MX_TABLE (priv->me_table),
                                      settings_launcher,
                                      0, 2,
                                      "x-expand", TRUE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_END,
                                      "y-expand", TRUE,
                                      "y-fill", FALSE,
                                      "row-span", 2,
                                      NULL);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      CLUTTER_ACTOR (priv->me_table),
                                      1, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);

  priv->tp_feed = anerley_aggregate_tp_feed_new ();

  priv->model = (AnerleyFeedModel *)anerley_feed_model_new (priv->tp_feed);
  priv->tile_view = anerley_tile_view_new (priv->model);

  priv->main_scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (priv->main_scroll_view),
                               priv->tile_view);

  mx_table_add_actor (MX_TABLE (priv->content_table),
                      priv->main_scroll_view,
                      2,
                      0);

  /* No people && no accounts enabled */
  priv->no_people_tile = _make_empty_people_tile (self);
  clutter_actor_hide (priv->no_people_tile);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->no_people_tile,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      NULL);

  /* No people && acounts are online */
  priv->everybody_offline_tile = _make_everybody_offline_tile (self);
  clutter_actor_hide (priv->everybody_offline_tile);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->everybody_offline_tile,
                                      2, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  priv->offline_banner =
    _make_offline_banner (self,
                          clutter_actor_get_width (priv->main_scroll_view));
  clutter_actor_hide (priv->offline_banner);
  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->offline_banner,
                                      2, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  /* Side table */
  label = mx_label_new_with_text (_("My conversations"));
  clutter_actor_set_name (label, "people-panel-side-box-header-label");
  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-side-box-header");
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_table_add_actor_with_properties (MX_TABLE (priv->side_table),
                                      CLUTTER_ACTOR (bin),
                                      0, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);
  mx_table_add_actor_with_properties (MX_TABLE (priv->side_table),
                                      _make_messenger_launcher_tile (self),
                                      1, 0,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", FALSE,
                                      NULL);


  active_feed = anerley_tp_monitor_feed_new ((AnerleyAggregateTpFeed *)priv->tp_feed,
                                             "MeegoPanelPeople");
  priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed);


  priv->active_list_view = anerley_compact_tile_view_new (priv->active_model);
  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->active_list_view);

  /* active conversations */
  priv->active_content_table = mx_table_new ();
  clutter_actor_set_name (priv->active_content_table,
                          "people-panel-active-content-box");

  bin = mx_frame_new ();
  clutter_actor_set_name (bin, "people-panel-active-content-header");
  label = mx_label_new_with_text (_("You are chatting with:"));
  clutter_actor_set_name (label, "people-panel-active-content-header-label");
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_ellipsize (CLUTTER_TEXT(tmp_text), PANGO_ELLIPSIZE_NONE);
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);

  mx_table_add_actor_with_properties (MX_TABLE (priv->active_content_table),
                                      bin,
                                      0, 0,
                                      "y-expand", FALSE,
                                      NULL);


  mx_table_add_actor (MX_TABLE (priv->active_content_table),
                      scroll_view,
                      1, 0);

  mx_table_add_actor_with_properties (MX_TABLE (priv->side_table),
                                      priv->active_content_table,
                                      2, 0,
                                      "x-expand", TRUE,
                                      NULL);



  g_signal_connect (priv->tile_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  g_signal_connect (priv->active_list_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);


  g_signal_connect (priv->model,
                    "bulk-change-end",
                    (GCallback)_model_bulk_changed_end_cb,
                    self);
  g_signal_connect (priv->active_model,
                    "bulk-change-end",
                    (GCallback)_active_model_bulk_change_end_cb,
                    self);
  clutter_actor_hide ((ClutterActor *)priv->main_scroll_view);

  /* Placeholder changes based on onlineness or not */
  _update_placeholder_state (self);

  g_signal_connect (priv->tp_feed,
                    "notify::accounts-online",
                    (GCallback)_tp_feed_online_notify_cb,
                    self);
  g_signal_connect (priv->tp_feed,
                    "notify::accounts-available",
                    (GCallback)_tp_feed_available_notify_cb,
                    self);

  sw_online_add_notify (_online_notify_cb, self);
  _update_online_state (self, sw_is_online ());
}
static void
mnb_people_panel_init (MnbPeoplePanel *self)
{
  MnbPeoplePanelPrivate *priv = GET_PRIVATE (self);
  ClutterActor *label;
  ClutterActor *scroll_view, *scroll_bin, *bin, *tmp_text;
  AnerleyFeed *active_feed;

  mx_table_set_column_spacing (MX_TABLE (self), 4);
  mx_table_set_row_spacing (MX_TABLE (self), 6);
  clutter_actor_set_name (CLUTTER_ACTOR (self), "people-vbox");

  priv->header_box = mx_table_new ();
  clutter_actor_set_name (CLUTTER_ACTOR (priv->header_box), "people-search");
  mx_table_set_column_spacing (MX_TABLE (priv->header_box), 20);
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      CLUTTER_ACTOR (priv->header_box),
                                      0, 0,
                                      "row-span", 1,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "x-fill", TRUE,
                                      "y-fill", TRUE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_START,
                                      NULL);

  label = mx_label_new_with_text (_("People"));
  clutter_actor_set_name (CLUTTER_ACTOR (label), "people-search-label");
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      CLUTTER_ACTOR (label),
                                      0, 0,
                                      "x-expand", FALSE,
                                      "y-expand", FALSE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);

  priv->entry = (ClutterActor *) mpl_entry_new (_("Search"));
  clutter_actor_set_name (CLUTTER_ACTOR (priv->entry), "people-search-entry");
  clutter_actor_set_width (CLUTTER_ACTOR (priv->entry), 600);
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      CLUTTER_ACTOR (priv->entry),
                                      0, 1,
                                      "x-expand", FALSE,
                                      "y-expand", FALSE,
                                      "x-fill", FALSE,
                                      "y-fill", FALSE,
                                      "x-align", MX_ALIGN_START,
                                      "y-align", MX_ALIGN_MIDDLE,
                                      NULL);
  priv->presence_chooser = anerley_presence_chooser_new ();
  mx_table_add_actor_with_properties (MX_TABLE (priv->header_box),
                                      priv->presence_chooser,
                                      0, 2,
                                      "x-expand", TRUE,
                                      "x-fill", FALSE,
                                      "x-align", MX_ALIGN_END,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      NULL);
  g_signal_connect (priv->entry,
                    "text-changed",
                    (GCallback)_entry_text_changed_cb,
                    self);

  priv->tp_feed = anerley_aggregate_tp_feed_new ();

  priv->model = (AnerleyFeedModel *)anerley_feed_model_new (priv->tp_feed);
  priv->tile_view = anerley_tile_view_new (priv->model);

  active_feed = anerley_tp_monitor_feed_new ((AnerleyAggregateTpFeed *)priv->tp_feed,
                                             "MeegoPanelPeople");
  priv->active_model = (AnerleyFeedModel *)anerley_feed_model_new (active_feed);

  priv->active_list_view = anerley_compact_tile_view_new (priv->active_model);
  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->active_list_view);
  priv->content_table = mx_table_new ();
  clutter_actor_set_name (priv->content_table, "content-table");

  /* active conversations */
  priv->active_content_table = mx_table_new ();

  clutter_actor_hide (priv->active_content_table);
  clutter_actor_set_name (priv->active_content_table, "active-content-table");

  bin = mx_frame_new ();
  label = mx_label_new_with_text (_("You are chatting with:"));
  tmp_text = mx_label_get_clutter_text (MX_LABEL (label));
  clutter_text_set_ellipsize (CLUTTER_TEXT(tmp_text), PANGO_ELLIPSIZE_NONE);
  clutter_actor_set_name (label, "active-content-header-label");
  mx_bin_set_child (MX_BIN (bin), label);
  mx_bin_set_alignment (MX_BIN (bin), MX_ALIGN_START, MX_ALIGN_MIDDLE);
  mx_bin_set_fill (MX_BIN (bin), TRUE, TRUE);
  clutter_actor_set_name (bin, "active-content-header");

  mx_table_add_actor_with_properties (MX_TABLE (priv->active_content_table),
                                      bin,
                                      0, 0,
                                      "y-expand", FALSE,
                                      NULL);

  mx_table_add_actor (MX_TABLE (priv->active_content_table),
                      scroll_view,
                      1, 0);

  mx_table_add_actor_with_properties (MX_TABLE (priv->content_table),
                                      priv->active_content_table,
                                      0, 1,
                                      "x-expand", FALSE,
                                      NULL);


  /* main area */
  scroll_view = mx_scroll_view_new ();
  clutter_container_add_actor (CLUTTER_CONTAINER (scroll_view),
                               priv->tile_view);

  scroll_bin = mx_table_new ();
  mx_table_add_actor (MX_TABLE (scroll_bin),
                      scroll_view,
                      0,
                      0);
  mx_table_add_actor (MX_TABLE (priv->content_table),
                      scroll_bin,
                      0,
                      0);
  clutter_actor_set_name (scroll_bin, "people-scroll-bin");


  /* No people && no accounts enabled */
  priv->no_people_tile = _make_empty_people_tile (self);

  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->no_people_tile,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  /* No people && acounts are online */
  priv->everybody_offline_tile = _make_everybody_offline_tile (self);
  clutter_actor_hide (priv->everybody_offline_tile);

  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->everybody_offline_tile,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  priv->offline_banner =
    _make_offline_banner (self,
                          clutter_actor_get_width (scroll_view));
  clutter_actor_hide (priv->offline_banner);
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->offline_banner,
                                      1, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", FALSE,
                                      "y-fill", FALSE,
                                      "y-align", MX_ALIGN_START,
                                      "row-span", 1,
                                      NULL);

  /* Real content stuff */
  mx_table_add_actor_with_properties (MX_TABLE (self),
                                      priv->content_table,
                                      2, 0,
                                      "x-fill", TRUE,
                                      "x-expand", TRUE,
                                      "y-expand", TRUE,
                                      "y-fill", TRUE,
                                      "row-span", 1,
                                      NULL);

  g_signal_connect (priv->tile_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  g_signal_connect (priv->active_list_view,
                    "item-activated",
                    (GCallback)_tile_view_item_activated_cb,
                    self);

  /* Put into the no people state */
  clutter_actor_hide ((ClutterActor *)priv->content_table);

  g_signal_connect (priv->model,
                    "bulk-change-end",
                    (GCallback)_model_bulk_changed_end_cb,
                    self);
  g_signal_connect (priv->active_model,
                    "bulk-change-end",
                    (GCallback)_active_model_bulk_change_end_cb,
                    self);

  /* Placeholder changes based on onlineness or not */
  _update_placeholder_state (self);

  g_signal_connect (priv->tp_feed,
                    "notify::accounts-online",
                    (GCallback)_tp_feed_online_notify_cb,
                    self);
  g_signal_connect (priv->tp_feed,
                    "notify::accounts-available",
                    (GCallback)_tp_feed_available_notify_cb,
                    self);

  sw_online_add_notify (_online_notify_cb, self);
  _update_online_state (self, sw_is_online ());
}