static ClutterActor * _make_messenger_launcher_tile (MnbPeoplePanel *panel) { ClutterActor *table; ClutterActor *icon_tex; ClutterActor *button; GAppInfo *app_info; gchar *button_str; ClutterActor *bin; bin = mx_frame_new (); clutter_actor_set_name (bin, "people-panel-messenger-launcher-tile"); table = mx_table_new (); mx_bin_set_child (MX_BIN (bin), table); mx_table_set_column_spacing (MX_TABLE (table), 16); app_info = (GAppInfo *)g_desktop_app_info_new ("empathy.desktop"); icon_tex = g_object_new (MX_TYPE_ICON, "icon-name", "netbook-empathy", NULL); mx_table_add_actor_with_properties (MX_TABLE (table), icon_tex, 0, 0, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, NULL); button_str = g_strdup_printf (_("Open %s"), g_app_info_get_name (app_info)); button = mx_button_new_with_label (button_str); g_free (button_str); g_signal_connect (button, "clicked", (GCallback)_messenger_launcher_button_clicked_cb, panel); mx_table_add_actor_with_properties (MX_TABLE (table), button, 0, 1, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, NULL); g_object_unref (app_info); return bin; }
ClutterActor * _make_settings_launcher (MnbPeoplePanel *people_panel) { ClutterActor *table; ClutterActor *icon_tex; ClutterActor *button; GAppInfo *app_info; gchar *button_str; app_info = (GAppInfo *)g_desktop_app_info_new ("empathy-accounts.desktop"); table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 16); app_info = (GAppInfo *)g_desktop_app_info_new ("empathy-accounts.desktop"); icon_tex = g_object_new (MX_TYPE_ICON, "icon-name", "netbook-empathy-accounts", NULL); mx_table_add_actor_with_properties (MX_TABLE (table), icon_tex, 0, 0, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, NULL); button_str = g_strdup_printf (_("Open %s"), g_app_info_get_name (app_info)); button = mx_button_new_with_label (button_str); g_free (button_str); g_signal_connect (button, "clicked", (GCallback)_settings_launcher_button_clicked_cb, people_panel); mx_table_add_actor_with_properties (MX_TABLE (table), button, 0, 1, "x-expand", FALSE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, NULL); g_object_unref (app_info); return table; }
static void create_network_row (MpdComputerTile *tile, const gchar *label_text, gint row) { MpdComputerTilePrivate *priv = tile->priv; ClutterActor *label, *toggle, *frame; label = mx_label_new_with_text (label_text); mx_table_add_actor_with_properties (MX_TABLE (tile), label, row, 0, "x-expand", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); frame = mx_frame_new (); toggle = mx_toggle_new (); mx_bin_set_child (MX_BIN (frame), toggle); mx_table_add_actor_with_properties (MX_TABLE (tile), frame, row, 1, "x-expand", FALSE, "x-fill", FALSE, "x-align", MX_ALIGN_START, NULL); priv->toggled_data[row].tile = tile; priv->toggled_data[row].row = row; g_signal_connect (toggle, "notify::active", G_CALLBACK (on_switch_toggled), &priv->toggled_data[row]); priv->rows[row].label = label; priv->rows[row].frame = frame; priv->rows[row].toggle = toggle; }
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 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_add_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_add_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_interesting_tile_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { PengeInterestingTilePrivate *priv = GET_PRIVATE (object); GError *error = NULL; const gchar *path; switch (property_id) { case PROP_BODY: if (priv->body) { clutter_container_remove_actor (CLUTTER_CONTAINER (priv->inner_table), priv->body); } priv->body = g_value_get_object (value); if (!priv->body) return; mx_table_add_actor_with_properties (MX_TABLE (priv->inner_table), priv->body, 0, 0, "y-align", MX_ALIGN_START, "x-align", MX_ALIGN_START, "y-fill", TRUE, "y-expand", TRUE, NULL); break; case PROP_ICON_PATH: path = g_value_get_string (value); if (path && !clutter_texture_set_from_file (CLUTTER_TEXTURE (priv->icon), path, &error)) { g_critical (G_STRLOC ": error setting icon texture from file: %s", error->message); g_clear_error (&error); } if (path) { clutter_actor_show (priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->primary_text, "column", 1, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->secondary_text, "column", 1, NULL); } else { clutter_actor_hide (priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->primary_text, "column", 0, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->secondary_text, "column", 0, NULL); } break; case PROP_PRIMARY_TEXT: mx_label_set_text (MX_LABEL (priv->primary_text), g_value_get_string (value)); break; case PROP_SECONDARY_TEXT: mx_label_set_text (MX_LABEL (priv->secondary_text), g_value_get_string (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
static void penge_interesting_tile_init (PengeInterestingTile *self) { PengeInterestingTilePrivate *priv = GET_PRIVATE_REAL (self); ClutterActor *tmp_text; ClutterActor *icon; self->priv = priv; priv->inner_table = mx_table_new (); mx_bin_set_child (MX_BIN (self), priv->inner_table); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); priv->primary_text = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->primary_text), "PengeInterestingTilePrimaryLabel"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->primary_text)); clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text), PANGO_ALIGN_LEFT); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); g_signal_connect (priv->primary_text, "notify::allocation", (GCallback)_label_notify_allocation_cb, self); priv->secondary_text = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->secondary_text), "PengeInterestingTileSecondaryLabel"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->secondary_text)); clutter_text_set_line_alignment (CLUTTER_TEXT (tmp_text), PANGO_ALIGN_LEFT); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); g_signal_connect (priv->secondary_text, "notify::allocation", (GCallback)_label_notify_allocation_cb, self); priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, 28, 28); clutter_actor_hide (priv->icon); /* This gets added to ourself table after our body because of ordering */ priv->details_overlay = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->details_overlay), "PengeInterestingTileDetails"); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->details_overlay, 1, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), (ClutterActor *)priv->details_overlay, "x-expand", TRUE, "y-expand", FALSE, "y-fill", FALSE, "y-align", MX_ALIGN_END, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->primary_text, 0, 1); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), (ClutterActor *)priv->primary_text, "x-expand", TRUE, "y-expand", FALSE, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->secondary_text, 1, 1); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), (ClutterActor *)priv->secondary_text, "x-expand", TRUE, "y-expand", FALSE, NULL); mx_table_add_actor (MX_TABLE (priv->details_overlay), priv->icon, 0, 0); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->icon, "row-span", 2, "y-expand", FALSE, "x-expand", FALSE, "y-fill", FALSE, "x-fill", FALSE, NULL); priv->remove_button = mx_button_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->remove_button), "PengeInterestingTileRemoveButton"); icon = (ClutterActor *)mx_icon_new (); mx_stylable_set_style_class (MX_STYLABLE (icon), "PengeInterestingTileIcon"); mx_bin_set_child (MX_BIN (priv->remove_button), (ClutterActor *)icon); mx_table_add_actor_with_properties (MX_TABLE (priv->details_overlay), priv->remove_button, 0, 2, "row-span", 2, "x-expand", TRUE, "y-expand", TRUE, "x-fill", FALSE, "y-fill", FALSE, "x-align", MX_ALIGN_END, "y-align", MX_ALIGN_MIDDLE, NULL); g_signal_connect (priv->remove_button, "clicked", (GCallback)_remove_button_clicked, self); mx_table_set_column_spacing (MX_TABLE (priv->details_overlay), 4); clutter_actor_set_reactive ((ClutterActor *) self, TRUE); clutter_actor_hide (priv->icon); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->primary_text, "column", 0, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->details_overlay), priv->secondary_text, "column", 0, NULL); }
static void mpd_computer_tile_init (MpdComputerTile *self) { MpdComputerTilePrivate *priv; ClutterActor *tile, *label; MpdDisplayDevice *display; bool show_brightness_tile; int row; self->priv = priv = COMPUTER_TILE_PRIVATE (self); priv->cm = carrick_connman_manager_new (); g_signal_connect (priv->cm, "notify::available-technologies", G_CALLBACK (_available_techs_changed), self); g_signal_connect (priv->cm, "notify::enabled-technologies", G_CALLBACK (_enabled_techs_changed), self); g_signal_connect (priv->cm, "notify::offline-mode", G_CALLBACK (_offline_mode_changed), self); /* Let's reserve some room (rows) for the different "radios", we need: * WiFi (0) * Wimax (1) * Bluetooth (2) * 3G (3) * Air plane mode (4) */ create_network_row (self, _("Wifi"), RADIO_WIFI); create_network_row (self, _("Wimax"), RADIO_WIMAX); create_network_row (self, _("Bluetooth"), RADIO_BLUETOOTH); create_network_row (self, _("3G"), RADIO_3G); create_network_row (self, _("Offline mode"), OFFLINE_MODE); show_tech (self, RADIO_WIFI, FALSE); show_tech (self, RADIO_WIMAX, FALSE); show_tech (self, RADIO_BLUETOOTH, FALSE); show_tech (self, RADIO_3G, FALSE); show_airplane_mode (self, FALSE); row = 5; /* Volume */ /* Note to translators, volume here is sound volume */ label = mx_label_new_with_text (_("Volume")); mx_table_add_actor_with_properties (MX_TABLE (self), label, row, 0, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); tile = mpd_volume_tile_new (); mx_table_add_actor_with_properties (MX_TABLE (self), tile, row, 1, "y-expand", FALSE, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, "x-expand", TRUE, NULL); row++; /* Brightness */ display = mpd_display_device_new (); show_brightness_tile = mpd_display_device_is_enabled (display); if (show_brightness_tile) { label = mx_label_new_with_text (_("Brightness")); mx_table_add_actor_with_properties (MX_TABLE (self), label, row, 0, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); tile = mpd_brightness_tile_new (); mx_table_add_actor_with_properties (MX_TABLE (self), tile, row, 1, "x-expand", TRUE, NULL); row++; } /* Battery */ label = mx_label_new_with_text (_("Battery")); mx_table_add_actor_with_properties (MX_TABLE (self), label, row, 0, "y-align", MX_ALIGN_MIDDLE, "y-fill", FALSE, NULL); tile = mpd_battery_tile_new (); g_signal_connect (tile, "show-me", G_CALLBACK (_show_me), self); mx_table_add_actor_with_properties (MX_TABLE (self), tile, row, 1, "x-expand", TRUE, NULL); priv->battery_label = label; priv->battery_tile = tile; row++; /* FIXME: Makes crash when unref'd. * GpmBrightnessXRandR doesn't remove filter from root window in ::finalize() * but doesn't seem to be it. * g_object_unref (display); */ }
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 ()); }
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_add_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_add_actor_with_properties (MX_TABLE (tile), frame, 1, 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); settings_launcher = _make_settings_launcher (people_panel); clutter_actor_set_name (settings_launcher, "people-panel-settings-launcher-tile"); mx_table_add_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); if (picture) mx_table_add_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); else g_warning("no people.png in %s", THEMEDIR); return tile; }
static void mpd_storage_device_tile_init (MpdStorageDeviceTile *self) { MpdStorageDeviceTilePrivate *priv = GET_PRIVATE (self); ClutterText *text; ClutterActor *separator; mx_box_layout_set_orientation (MX_BOX_LAYOUT (self), MX_ORIENTATION_VERTICAL); mx_box_layout_set_enable_animations (MX_BOX_LAYOUT (self), true); priv->table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (priv->table), 5); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->table, -1, "x-fill", true, NULL); /* 0 1 2 +--------------------------+ Table 0 | | Text | Open | 1 | Icon | Progress | Eject | +------+-----------+-------+ Vbox 2 | <message> .. Import data | +--------------------------+ 3 | ======================== | +--------------------------+ */ /* * Column 0: icon */ priv->icon = clutter_texture_new (); clutter_actor_set_size (priv->icon, MPD_STORAGE_DEVICE_TILE_ICON_SIZE, MPD_STORAGE_DEVICE_TILE_ICON_SIZE); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->icon, 0, 0, "row-span", 2, "column-span", 1, "x-align", MX_ALIGN_START, "x-expand", false, "x-fill", false, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 1 */ /* Text */ priv->label = mx_label_new (); clutter_actor_set_width (priv->label, 200.0); text = (ClutterText *) mx_label_get_clutter_text (MX_LABEL (priv->label)); clutter_text_set_line_wrap (text, true); clutter_text_set_line_wrap_mode (text, PANGO_WRAP_WORD); clutter_text_set_single_line_mode (text, false); clutter_text_set_ellipsize (text, PANGO_ELLIPSIZE_END); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->label, 0, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* Progress */ priv->meter = mx_progress_bar_new (); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->meter, 1, 1, "x-align", MX_ALIGN_START, "x-expand", true, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Column 2: buttons */ /* Open button */ priv->open = mx_button_new_with_label (_("Open")); g_signal_connect (priv->open, "clicked", G_CALLBACK (_open_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->open, 0, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_END, "y-expand", false, "y-fill", false, NULL); /* Eject button */ priv->eject = mx_button_new_with_label (_("Eject")); g_signal_connect (priv->eject, "clicked", G_CALLBACK (_eject_clicked_cb), self); mx_table_add_actor_with_properties (MX_TABLE (priv->table), priv->eject, 1, 2, "x-align", MX_ALIGN_END, "x-expand", false, "x-fill", true, "y-align", MX_ALIGN_MIDDLE, "y-expand", false, "y-fill", false, NULL); /* * Row 2 */ /* Import button */ priv->import = mx_button_new (); clutter_actor_set_name (priv->import, "import"); g_signal_connect (priv->import, "clicked", G_CALLBACK (_import_clicked_cb), self); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), priv->import, -1, "expand", false, "x-align", MX_ALIGN_END, "x-fill", false, NULL); /* * 4th row: separator */ /* Separator */ separator = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (separator), "separator"); mx_box_layout_add_actor_with_properties (MX_BOX_LAYOUT (self), separator, -1, "expand", false, "x-align", MX_ALIGN_MIDDLE, "x-fill", true, "y-align", MX_ALIGN_START, "y-fill", false, NULL); }