static ClutterActor * _make_empty_people_tile (MnbPeoplePanel *people_panel) { ClutterActor *tile; ClutterActor *frame; ClutterActor *label; ClutterActor *tmp_text; ClutterActor *settings_launcher; ClutterActor *picture; tile = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (tile), 8); clutter_actor_set_name ((ClutterActor *)tile, "people-pane-no-people-tile"); /* title */ frame = mx_frame_new (); clutter_actor_set_name (frame, "people-no-people-message-bin"); label = mx_label_new_with_text (_("This is the People panel.")); clutter_actor_set_name (label, "people-no-people-message-title"); mx_bin_set_child (MX_BIN (frame), label); mx_table_insert_actor_with_properties (MX_TABLE (tile), frame, 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE); /* message */ frame = mx_frame_new (); clutter_actor_set_name (frame, "people-no-people-message-bin"); label = mx_label_new_with_text (PLACEHOLDER_MESSAGE); clutter_actor_set_name (label, "people-no-people-message-label"); tmp_text = mx_label_get_clutter_text (MX_LABEL (label)); clutter_text_set_line_wrap (CLUTTER_TEXT (tmp_text), TRUE); clutter_text_set_line_wrap_mode (CLUTTER_TEXT (tmp_text), PANGO_WRAP_WORD_CHAR); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); clutter_actor_set_width (label, 500); mx_bin_set_child (MX_BIN (frame), label); mx_table_insert_actor_with_properties (MX_TABLE (tile), frame, 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, "x-align", MX_ALIGN_START, NULL); mx_bin_set_alignment (MX_BIN (frame), MX_ALIGN_START, MX_ALIGN_MIDDLE); settings_launcher = _make_settings_launcher (people_panel); clutter_actor_set_name (settings_launcher, "people-panel-settings-launcher-tile"); mx_table_insert_actor_with_properties (MX_TABLE (tile), settings_launcher, 2, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); picture = clutter_texture_new_from_file (PLACEHOLDER_IMAGE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (tile), picture, 3, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_END, NULL); return tile; }
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 ()); }