static void mex_telepathy_channel_create_incoming_video (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; ClutterActor *video_incoming_area; /* Setup the incoming surface to draw to */ priv->incoming_texture = clutter_texture_new (); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->incoming_texture), TRUE); video_incoming_area = mx_stack_new (); clutter_container_add (CLUTTER_CONTAINER (video_incoming_area), mex_telepathy_channel_create_static_image(), priv->incoming_texture, NULL); /* Create a frame for it with a styled border */ priv->full_frame = mx_frame_new(); clutter_actor_set_name (priv->full_frame, "Incoming Frame"); mx_bin_set_fill (MX_BIN (priv->full_frame), TRUE, TRUE); mx_stylable_set_style_class (MX_STYLABLE (priv->full_frame), "CallWindow"); clutter_actor_add_effect (priv->full_frame, CLUTTER_EFFECT ( mex_telepathy_channel_create_shadow ())); clutter_container_add_actor (CLUTTER_CONTAINER (priv->full_frame), video_incoming_area); priv->incoming_sink = clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->incoming_texture)); }
static void mex_telepathy_channel_create_preview (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; ClutterActor *video_preview_area; priv->video_outgoing = clutter_texture_new (); clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (priv->video_outgoing), TRUE); priv->outgoing_sink = clutter_gst_video_sink_new (CLUTTER_TEXTURE (priv->video_outgoing)); video_preview_area = mx_stack_new (); clutter_container_add (CLUTTER_CONTAINER (video_preview_area), mex_telepathy_channel_create_static_image(), priv->video_outgoing, NULL); mx_stylable_set_style_class (MX_STYLABLE (video_preview_area), "PreviewStack"); clutter_actor_set_height (video_preview_area, 150.0); clutter_actor_add_effect (video_preview_area, CLUTTER_EFFECT ( mex_telepathy_channel_create_shadow ())); priv->preview_area = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->preview_area), "PreviewPadding"); mx_bin_set_child (MX_BIN (priv->preview_area), video_preview_area); }
static void ntf_tray_constructed (GObject *object) { NtfTray *self = (NtfTray*) object; ClutterActor *actor = (ClutterActor*) self; NtfTrayPrivate *priv = self->priv; ClutterActor *button; if (G_OBJECT_CLASS (ntf_tray_parent_class)->constructed) G_OBJECT_CLASS (ntf_tray_parent_class)->constructed (object); priv->notifiers = mx_stack_new (); clutter_actor_add_child (actor, priv->notifiers); /* 'Overflow' control */ priv->control = mx_table_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->control), "notification-control"); button = mx_button_new (); mx_button_set_label (MX_BUTTON (button), _("Dismiss All")); mx_table_insert_actor (MX_TABLE (priv->control), button, 0, 1); g_signal_connect (button, "clicked", G_CALLBACK (ntf_tray_dismiss_all_cb), self); priv->control_text = mx_label_new (); mx_table_insert_actor (MX_TABLE (priv->control), CLUTTER_ACTOR (priv->control_text), 0, 0); clutter_actor_add_child (actor, priv->control); clutter_actor_hide (priv->control); clutter_actor_set_reactive (priv->notifiers, TRUE); clutter_actor_set_reactive (actor, TRUE); mnb_input_manager_push_actor (actor, MNB_INPUT_LAYER_TOP); }
static void mex_telepathy_channel_create_video_page (MexTelepathyChannel *self) { MexTelepathyChannelPrivate *priv = MEX_TELEPATHY_CHANNEL (self)->priv; /* Create the widgets to place */ mex_telepathy_channel_create_toolbar (self); mex_telepathy_channel_create_preview (self); mex_telepathy_channel_create_busy_box (self); mex_telepathy_channel_create_incoming_video (self); /* Top container */ priv->video_call_page = mx_stack_new (); clutter_container_add (CLUTTER_CONTAINER (priv->video_call_page), priv->full_frame, priv->preview_area, priv->toolbar_area, NULL); /* Arrange the preview video area on the page */ mx_stack_child_set_x_align (MX_STACK (priv->video_call_page), priv->preview_area, MX_ALIGN_END); mx_stack_child_set_y_align (MX_STACK (priv->video_call_page), priv->preview_area, MX_ALIGN_START); mx_stack_child_set_x_fill (MX_STACK (priv->video_call_page), priv->preview_area, FALSE); mx_stack_child_set_y_fill (MX_STACK (priv->video_call_page), priv->preview_area, FALSE); /* Arrange the incoming video area on the page */ mx_stack_child_set_x_fill (MX_STACK (priv->video_call_page), priv->full_frame, FALSE); mx_stack_child_set_y_fill (MX_STACK (priv->video_call_page), priv->full_frame, FALSE); /* Arrange the toolbar area on the page */ mx_stack_child_set_x_align (MX_STACK (priv->video_call_page), priv->toolbar_area, MX_ALIGN_MIDDLE); mx_stack_child_set_y_align (MX_STACK (priv->video_call_page), priv->toolbar_area, MX_ALIGN_END); mx_stack_child_set_x_fill (MX_STACK (priv->video_call_page), priv->toolbar_area, TRUE); mx_stack_child_set_y_fill (MX_STACK (priv->video_call_page), priv->toolbar_area, FALSE); /* Connect to hide signals. */ g_signal_connect (priv->video_call_page, "hide", G_CALLBACK (mex_telepathy_channel_on_video_closed), self); /* Connect to show signals. */ g_signal_connect (priv->video_call_page, "show", G_CALLBACK (mex_telepathy_channel_on_video_shown), self); if (priv->show_page) { g_signal_emit (self, mex_telepathy_channel_signals[SHOW_ACTOR], 0, g_object_ref (priv->video_call_page)); clutter_actor_show (priv->busy_box); clutter_actor_raise_top (priv->busy_box); priv->show_page = FALSE; } }
static void penge_apps_pane_update (PengeAppsPane *pane) { PengeAppsPanePrivate *priv = GET_PRIVATE (pane); GList *bookmarks, *l, *to_remove; ClutterActor *actor; gint count = 0; gchar *path; GError *error = NULL; const gchar *uri = NULL; bookmarks = mpl_app_bookmark_manager_get_bookmarks (priv->manager); to_remove = g_hash_table_get_keys (priv->uris_to_actors); for (l = bookmarks; l && count < MAX_COUNT; l = l->next) { uri = (gchar *)l->data; actor = g_hash_table_lookup (priv->uris_to_actors, uri); /* Check if this URI is on the system */ path = g_filename_from_uri (uri, NULL, &error); if (error) { g_warning (G_STRLOC ": Error converting uri to path: %s", error->message); g_clear_error (&error); if (actor) { clutter_container_remove_actor (CLUTTER_CONTAINER (pane), actor); } continue; } if (!g_file_test (path, G_FILE_TEST_EXISTS)) { /* skip those that have a missing .desktop file */ g_free (path); continue; } g_free (path); if (actor) { if (!priv->vertical) { clutter_container_child_set (CLUTTER_CONTAINER (pane), actor, "row", count / ROW_SIZE, "column", count % ROW_SIZE, NULL); } else { clutter_container_child_set (CLUTTER_CONTAINER (pane), actor, "row", count / 1, "column", count % 1, NULL); } } else { ClutterActor *overlay, *stack; stack = mx_stack_new (); actor = g_object_new (PENGE_TYPE_APP_TILE, "bookmark", uri, NULL); clutter_actor_set_name (actor, "tile"); overlay = mx_frame_new (); mx_stylable_set_style_class (MX_STYLABLE (overlay), "PengeAppTileOverlay"); clutter_container_add (CLUTTER_CONTAINER (stack), actor, overlay, NULL); /* actor's sizes have been set in PengeAppTile */ clutter_actor_set_size (overlay, clutter_actor_get_width (actor), clutter_actor_get_height (actor)); clutter_actor_set_size (stack, TILE_STACKED_SIZE, TILE_STACKED_SIZE); if (!priv->vertical) { mx_table_add_actor (MX_TABLE (pane), stack, count / ROW_SIZE, count % ROW_SIZE); } else { mx_table_add_actor (MX_TABLE (pane), stack, count / 1, count % 1); } clutter_container_child_set (CLUTTER_CONTAINER (pane), stack, "x-expand", FALSE, "y-expand", FALSE, "x-fill", FALSE, "y-fill", FALSE, NULL); g_hash_table_insert (priv->uris_to_actors, g_strdup (uri), stack); } /* Found, so don't remove */ /* This craziness is because the allocated string is probably different */ to_remove = g_list_delete_link (to_remove, g_list_find_custom (to_remove, uri, (GCompareFunc)g_strcmp0)); count++; } g_list_free (bookmarks); for (l = to_remove; l; l = g_list_delete_link (l, l)) { actor = g_hash_table_lookup (priv->uris_to_actors, (gchar *)(l->data)); clutter_container_remove_actor (CLUTTER_CONTAINER (pane), actor); g_hash_table_remove (priv->uris_to_actors, (gchar *)(l->data)); } }
static void penge_event_tile_init (PengeEventTile *self) { PengeEventTilePrivate *priv = GET_PRIVATE_REAL (self); ClutterActor *tmp_text; ClutterActor *indicator_container, *indicator_overlay; GError *error = NULL; self->priv = priv; priv->inner_table = mx_table_new (); mx_bin_set_child (MX_BIN (self), (ClutterActor *)priv->inner_table); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); indicator_container = mx_stack_new (); clutter_actor_set_size (indicator_container, 20, 20); priv->calendar_indicator = clutter_cairo_texture_new (20, 20); clutter_actor_set_size (priv->calendar_indicator, 20, 20); indicator_overlay = clutter_texture_new_from_file (CALENDAR_INDICATOR_OVERLAY_MASK, &error); if (error != NULL) { g_critical (G_STRLOC ": Loading calendar colour overlay failed: %s", error->message); g_clear_error (&error); indicator_overlay = NULL; } else { clutter_actor_set_size (indicator_overlay, 20, 20); } clutter_container_add (CLUTTER_CONTAINER (indicator_container), priv->calendar_indicator, indicator_overlay, NULL); priv->time_label = mx_label_new (); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->time_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_NONE); mx_stylable_set_style_class (MX_STYLABLE (priv->time_label), "PengeEventTimeLabel"); priv->summary_label = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->summary_label), "PengeEventSummary"); tmp_text = mx_label_get_clutter_text (MX_LABEL (priv->summary_label)); clutter_text_set_ellipsize (CLUTTER_TEXT (tmp_text), PANGO_ELLIPSIZE_END); clutter_text_set_single_line_mode (CLUTTER_TEXT (tmp_text), TRUE); /* Populate the table */ mx_table_add_actor (MX_TABLE (priv->inner_table), indicator_container, 0, 0); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->time_label, 0, 1); mx_table_add_actor (MX_TABLE (priv->inner_table), priv->summary_label, 0, 2); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), indicator_container, "x-expand", FALSE, "x-fill", FALSE, "y-expand", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), priv->time_label, "x-expand", FALSE, "x-fill", FALSE, "y-expand", FALSE, "y-fill", FALSE, NULL); clutter_container_child_set (CLUTTER_CONTAINER (priv->inner_table), priv->summary_label, "x-expand", TRUE, "x-fill", TRUE, "y-expand", FALSE, "y-fill", FALSE, NULL); /* Setup spacing and padding */ mx_table_set_column_spacing (MX_TABLE (priv->inner_table), 6); g_signal_connect (self, "clicked", (GCallback)_button_clicked_cb, self); clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); }