/** * st_box_layout_insert_actor: * @self: A #StBoxLayout * @actor: A #ClutterActor * @pos: position to insert actor * * Adds @actor to @self at position @pos. If @pos is * negative or larger than the number of elements in the * list then @actor is added after all the others previously * added. */ void st_box_layout_insert_actor (StBoxLayout *self, ClutterActor *actor, int pos) { clutter_actor_insert_child_at_index (CLUTTER_ACTOR (self), actor, pos); }
/* A workspace was created */ static void _xfdashboard_workspace_selector_on_workspace_added(XfdashboardWorkspaceSelector *self, XfdashboardWindowTrackerWorkspace *inWorkspace, gpointer inUserData) { ClutterActor *actor; gint index; ClutterAction *action; g_return_if_fail(XFDASHBOARD_IS_WORKSPACE_SELECTOR(self)); g_return_if_fail(XFDASHBOARD_IS_WINDOW_TRACKER_WORKSPACE(inWorkspace)); /* Get index of workspace for insertion */ index=xfdashboard_window_tracker_workspace_get_number(inWorkspace); /* Create new live workspace actor and insert at index */ actor=xfdashboard_live_workspace_new_for_workspace(inWorkspace); g_signal_connect_swapped(actor, "clicked", G_CALLBACK(_xfdashboard_workspace_selector_on_workspace_clicked), self); clutter_actor_insert_child_at_index(CLUTTER_ACTOR(self), actor, index); action=xfdashboard_drop_action_new(); clutter_actor_add_action(actor, action); g_signal_connect_swapped(action, "begin", G_CALLBACK(_xfdashboard_workspace_selector_on_drop_begin), actor); g_signal_connect_swapped(action, "drop", G_CALLBACK(_xfdashboard_workspace_selector_on_drop_drop), actor); }
static void mex_grid_view_init (MexGridView *self) { MexGridViewPrivate *priv = self->priv = GRID_VIEW_PRIVATE (self); ClutterActor *scroll_view; priv->state = STATE_CLOSED; /* Create the menu */ priv->menu_layout = mex_menu_new (); mex_resizing_hbox_set_max_depth (MEX_RESIZING_HBOX (priv->menu_layout), 1); /* Add a title/icon */ priv->menu_title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->menu_title), "Header"); clutter_actor_set_name (priv->menu_title, "menu-header"); priv->menu = (ClutterActor*) mex_menu_get_layout (MEX_MENU (priv->menu_layout)); clutter_actor_set_width (priv->menu, MENU_MIN_WIDTH); clutter_actor_insert_child_at_index (priv->menu, priv->menu_title, 0); /* Add the grid */ priv->grid_layout = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (priv->grid_layout), MX_ORIENTATION_VERTICAL); /* header */ priv->grid_title = mx_label_new (); mx_stylable_set_style_class (MX_STYLABLE (priv->grid_title), "Header"); clutter_actor_add_child (priv->grid_layout, priv->grid_title); /* scroll view */ scroll_view = mex_scroll_view_new (); mx_kinetic_scroll_view_set_scroll_policy (MX_KINETIC_SCROLL_VIEW (scroll_view), MX_SCROLL_POLICY_VERTICAL); mx_stylable_set_style_class (MX_STYLABLE (scroll_view), "Grid"); mx_box_layout_insert_actor_with_properties (MX_BOX_LAYOUT (priv->grid_layout), scroll_view, 1, "expand", TRUE, NULL); /* grid */ priv->grid = mex_grid_new (); mx_bin_set_child (MX_BIN (scroll_view), priv->grid); clutter_actor_set_opacity (priv->grid, 0); /* Name actors so we can style */ clutter_actor_set_name (CLUTTER_ACTOR (self), "grid-page"); clutter_actor_set_name (priv->grid_layout, "content"); clutter_actor_push_internal (CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->menu_layout, CLUTTER_ACTOR (self)); clutter_actor_set_parent (priv->grid_layout, CLUTTER_ACTOR (self)); clutter_actor_pop_internal (CLUTTER_ACTOR (self)); /* timeline for animations */ priv->timeline = clutter_timeline_new (ANIMATION_DURATION); priv->alpha = clutter_alpha_new_full (priv->timeline, CLUTTER_EASE_IN_OUT_CUBIC); g_signal_connect (priv->timeline, "new-frame", G_CALLBACK (mex_grid_view_timeline_cb), self); g_signal_connect (priv->timeline, "completed", G_CALLBACK (mex_grid_view_timeline_complete_cb), self); }