Example #1
0
static void
cinnamon_contact_system_constructed (GObject *obj)
{
  CinnamonContactSystem *self = CINNAMON_CONTACT_SYSTEM (obj);

  G_OBJECT_CLASS (cinnamon_contact_system_parent_class)->constructed (obj);

  /* We intentionally do not care about the "individuals-changed" signal, as
   * we don't intend to update searches after they've been performed.
   * Therefore, we will simply retrieve the "individuals" property which
   * represents a snapshot of the individuals in the aggregator.
   */
  self->priv->aggregator = folks_individual_aggregator_new ();
  folks_individual_aggregator_prepare (self->priv->aggregator, prepare_individual_aggregator_cb, NULL);
}
static void
empathy_individual_manager_init (EmpathyIndividualManager *self)
{
  EmpathyIndividualManagerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
      EMPATHY_TYPE_INDIVIDUAL_MANAGER, EmpathyIndividualManagerPriv);

  self->priv = priv;
  priv->individuals = g_hash_table_new_full (g_str_hash, g_str_equal,
      g_free, g_object_unref);

  priv->aggregator = folks_individual_aggregator_new ();
  g_signal_connect (priv->aggregator, "individuals-changed-detailed",
      G_CALLBACK (aggregator_individuals_changed_cb), self);
  g_signal_connect (priv->aggregator, "notify::is-quiescent",
      G_CALLBACK (aggregator_is_quiescent_notify_cb), self);
  folks_individual_aggregator_prepare (priv->aggregator, NULL, NULL);
}
Example #3
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);
}