static void penge_grid_view_init (PengeGridView *self) { PengeGridViewPrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->everything_pane = g_object_new (PENGE_TYPE_EVERYTHING_PANE, NULL); mx_table_add_actor (MX_TABLE (self), priv->everything_pane, 0, 0); mx_table_set_row_spacing (MX_TABLE (self), 6); mx_table_set_column_spacing (MX_TABLE (self), 6); /* * Create a background and parent it to the grid. We paint and allocate this * in the overridden vfuncs */ priv->background = g_object_new (PENGE_TYPE_VIEW_BACKGROUND, NULL); clutter_actor_set_parent (priv->background, (ClutterActor *)self); clutter_actor_show (priv->background); priv->background_fade = clutter_texture_new_from_file (FADE_BG, NULL); clutter_actor_set_parent (priv->background_fade, (ClutterActor *)self); clutter_actor_show (priv->background_fade); priv->gconf_client = gconf_client_get_default (); _update_layout (self); }
static ClutterActor * _make_offline_banner (MnbPeoplePanel *pane, gint width) { ClutterActor *tile; ClutterActor *tmp_text; ClutterActor *label, *bin; tile = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (tile), 8); clutter_actor_set_width (tile, width); clutter_actor_set_name (tile, "people-pane-you-offline-banner"); label = mx_label_new_with_text (_("To see your IM contacts, " "you need to go online.")); clutter_actor_set_name (label, "people-pane-you-offline-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); bin = mx_frame_new (); 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), FALSE, TRUE); clutter_actor_set_name (bin, "people-pane-you-offline-bin"); mx_table_insert_actor_with_properties (MX_TABLE (tile), (ClutterActor *)bin, 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); return tile; }
static ClutterActor * _make_everybody_offline_tile (MnbPeoplePanel *pane) { ClutterActor *tile; ClutterActor *label, *bin; ClutterActor *tmp_text; tile = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (tile), 8); clutter_actor_set_name ((ClutterActor *)tile, "people-pane-everybody-offline-tile"); label = mx_label_new_with_text (_("Sorry, we can't find any people. " \ "It looks like they are all offline.")); clutter_actor_set_name ((ClutterActor *)label, "people-pane-everybody-offline-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); bin = mx_frame_new (); 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), FALSE, TRUE); clutter_actor_set_name (bin, "people-pane-everybody-offline-bin"); mx_table_insert_actor_with_properties (MX_TABLE (tile), (ClutterActor *)bin, 0, 0, "x-expand", TRUE, "y-expand", FALSE, "x-fill", TRUE, "y-fill", FALSE, "x-align", MX_ALIGN_START, NULL); return tile; }
static void penge_apps_pane_init (PengeAppsPane *self) { PengeAppsPanePrivate *priv = GET_PRIVATE_REAL (self); self->priv = priv; priv->manager = mpl_app_bookmark_manager_get_default (); g_signal_connect (priv->manager, "bookmarks-changed", (GCallback)_manager_bookmarks_changed_cb, self); priv->uris_to_actors = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); mx_table_set_column_spacing (MX_TABLE (self), TILE_COLUMN_SPACING); mx_table_set_row_spacing (MX_TABLE (self), TILE_ROW_SPACING); penge_apps_pane_update (self); }
static void mx_table_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { MxTable *table = MX_TABLE (gobject); switch (prop_id) { case PROP_COLUMN_SPACING: mx_table_set_column_spacing (table, g_value_get_int (value)); break; case PROP_ROW_SPACING: mx_table_set_row_spacing (table, g_value_get_int (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
static ClutterActor * make_status (DawatiStatusPanel *status_panel) { ClutterActor *pane; ClutterActor *table; ClutterActor *label; status_panel->client = sw_client_new (); #if 0 pane = mps_feed_pane_new (status_panel->client, sw_client_get_service (status_panel->client, "twitter")); #endif table = mx_table_new (); mx_table_set_row_spacing (MX_TABLE (table), 6); clutter_actor_set_name (table, "status-panel"); label = mx_label_new_with_text (_("Status")); clutter_actor_set_name (label, "status-panel-header-label"); mx_table_add_actor_with_properties (MX_TABLE (table), label, 0, 0, "x-expand", FALSE, "y-expand", FALSE, NULL); pane = mps_feed_switcher_new (status_panel->client); mx_table_add_actor_with_properties (MX_TABLE (table), pane, 1, 0, "x-expand", TRUE, "y-expand", TRUE, "x-fill", TRUE, "y-fill", TRUE, NULL); return table; }
static void penge_grid_view_init (PengeGridView *self) { PengeGridViewPrivate *priv = GET_PRIVATE_REAL (self); GError *error = NULL; self->priv = priv; priv->header_label = mx_label_new_with_text ("Myzone"); clutter_actor_set_name (priv->header_label, "myzone-panel-header-label"); mx_table_insert_actor_with_properties (MX_TABLE (self), priv->header_label, 0, 0, "x-expand", FALSE, "y-expand", FALSE, "column-span", 3, NULL); priv->calendar_pane = g_object_new (PENGE_TYPE_CALENDAR_PANE, NULL); clutter_actor_set_width (priv->calendar_pane, 280); mx_table_insert_actor (MX_TABLE (self), priv->calendar_pane, 1, 0); priv->email_pane = g_object_new (PENGE_TYPE_EMAIL_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->email_pane, 2, 0); priv->favourite_apps_pane = g_object_new (PENGE_TYPE_APPS_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->favourite_apps_pane, 3, 0); priv->div_tex = clutter_texture_new_from_file (V_DIV_LINE, &error); if (!priv->div_tex) { g_warning (G_STRLOC ": Error loading vertical divider: %s", error->message); g_clear_error (&error); } else { mx_table_insert_actor (MX_TABLE (self), priv->div_tex, 1, 1); } priv->everything_pane = g_object_new (PENGE_TYPE_EVERYTHING_PANE, NULL); mx_table_insert_actor (MX_TABLE (self), priv->everything_pane, 1, 2); mx_table_set_row_spacing (MX_TABLE (self), 6); mx_table_set_column_spacing (MX_TABLE (self), 6); /* * Create a background and parent it to the grid. We paint and allocate this * in the overridden vfuncs */ priv->background = g_object_new (PENGE_TYPE_VIEW_BACKGROUND, NULL); clutter_actor_set_parent (priv->background, (ClutterActor *)self); clutter_actor_show (priv->background); priv->background_fade = clutter_texture_new_from_file (FADE_BG, NULL); clutter_actor_set_parent (priv->background_fade, (ClutterActor *)self); clutter_actor_show (priv->background_fade); priv->gconf_client = gconf_client_get_default (); priv->show_calendar_notify_id = gconf_client_notify_add (priv->gconf_client, MEEGO_MYZONE_SHOW_CALENDAR, _gconf_show_calendar_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, MEEGO_MYZONE_SHOW_CALENDAR); } priv->show_email_notify_id = gconf_client_notify_add (priv->gconf_client, MEEGO_MYZONE_SHOW_EMAIL, _gconf_show_email_notify_cb, self, NULL, &error); if (error) { g_warning (G_STRLOC ": Error setting gconf key notification: %s", error->message); g_clear_error (&error); } else { gconf_client_notify (priv->gconf_client, MEEGO_MYZONE_SHOW_EMAIL); } }
static gboolean _create_settings_dialog (MexInfoBar *self) { MexInfoBarPrivate *priv = self->priv; ClutterActor *dialog, *network_graphic; ClutterActor *network_tile, *dialog_layout, *dialog_label; ClutterActor *network_button; MxAction *close_dialog, *network_settings; dialog = mx_dialog_new (); mx_stylable_set_style_class (MX_STYLABLE (dialog), "MexInfoBarDialog"); dialog_label = mx_label_new_with_text (_("Settings")); mx_stylable_set_style_class (MX_STYLABLE (dialog_label), "DialogHeader"); /* Create actions for settings dialog */ network_settings = _action_new_from_desktop_file ("mex-networks.desktop"); close_dialog = mx_action_new_full ("close", _("Close"), G_CALLBACK (_close_dialog_cb), self); dialog_layout = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (dialog_layout), 10); mx_table_set_row_spacing (MX_TABLE (dialog_layout), 30); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (dialog_label), 0, 0); if (network_settings) { gchar *tmp; network_graphic = mx_image_new (); mx_stylable_set_style_class (MX_STYLABLE (network_graphic), "NetworkGraphic"); tmp = g_build_filename (mex_get_data_dir (), "style", "graphic-network.png", NULL); mx_image_set_from_file (MX_IMAGE (network_graphic), tmp, NULL); g_free (tmp); network_tile = mex_tile_new (); mex_tile_set_label (MEX_TILE (network_tile), _("Network")); mex_tile_set_important (MEX_TILE (network_tile), TRUE); network_button = mx_button_new (); mx_button_set_action (MX_BUTTON (network_button), network_settings); mx_bin_set_child (MX_BIN (network_tile), network_button); mx_bin_set_child (MX_BIN (network_button), network_graphic); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (network_tile), 1, 1); } if (!network_settings) { ClutterActor *no_settings; no_settings = mx_label_new_with_text (_("No settings helpers installed")); clutter_actor_destroy (priv->settings_button); mx_table_insert_actor (MX_TABLE (dialog_layout), CLUTTER_ACTOR (no_settings), 1, 0); } mx_bin_set_child (MX_BIN (dialog), dialog_layout); mx_dialog_add_action (MX_DIALOG (dialog), close_dialog); priv->settings_dialog = g_object_ref (dialog); return TRUE; }
static void startup_cb (MxApplication *app) { MxWindow *window; ClutterActor *stage, *toggle, *label, *table, *button, *icon; window = mx_application_create_window (app, "Test Window"); stage = (ClutterActor *)mx_window_get_clutter_stage (window); mx_window_set_icon_name (window, "window-new"); clutter_actor_set_size (stage, 480, 320); table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 8); mx_table_set_row_spacing (MX_TABLE (table), 12); mx_window_set_child (window, table); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle small-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (small_screen_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 0, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 0, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle full-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (fullscreen_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 1, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 1, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle custom window icon"); g_signal_connect (toggle, "notify::active", G_CALLBACK (icon_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 2, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 2, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle user-resizable"); g_signal_connect (toggle, "notify::active", G_CALLBACK (resizable_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 3, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 3, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle toolbar"); g_signal_connect (toggle, "notify::active", G_CALLBACK (toolbar_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 4, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 4, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-right"); mx_icon_set_icon_size (MX_ICON (icon), 16); button = mx_button_new (); mx_bin_set_child (MX_BIN (button), icon); g_signal_connect (button, "clicked", G_CALLBACK (rotate_clicked_cb), window); clutter_container_add_actor ( CLUTTER_CONTAINER (mx_window_get_toolbar (window)), button); mx_bin_set_alignment (MX_BIN (mx_window_get_toolbar (window)), MX_ALIGN_END, MX_ALIGN_MIDDLE); clutter_actor_show (stage); }
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 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 ()); }
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 ()); }