コード例 #1
0
ファイル: rut-prop-inspector.c プロジェクト: cee1/rig
static void
add_controlled_toggle (RutPropInspector *inspector,
                       RutProperty *prop)
{
  RutBin *bin;
  RutIconToggle *toggle;

  bin = rut_bin_new (inspector->context);
  rut_bin_set_right_padding (bin, 5);
  rut_box_layout_add (inspector->top_hbox, false, bin);
  rut_refable_unref (bin);

  toggle = rut_icon_toggle_new (inspector->context,
                                "record-button-selected.png",
                                "record-button.png");

  rut_icon_toggle_set_state (toggle, false);

  rut_icon_toggle_add_on_toggle_callback (toggle,
                                          controlled_toggle_cb,
                                          inspector,
                                          NULL /* destroy_cb */);

  rut_bin_set_child (bin, toggle);
  rut_refable_unref (toggle);

  inspector->controlled_toggle = toggle;
}
コード例 #2
0
ファイル: rut-button.c プロジェクト: cee1/rig
static void
destroy_button_slices (RutButton *button)
{
  if (button->background_normal)
    {
      rut_refable_unref (button->background_normal);
      button->background_normal = NULL;
    }

  if (button->background_hover)
    {
      rut_refable_unref (button->background_hover);
      button->background_hover = NULL;
    }

  if (button->background_active)
    {
      rut_refable_unref (button->background_active);
      button->background_active = NULL;
    }

  if (button->background_disabled)
    {
      rut_refable_unref (button->background_disabled);
      button->background_disabled = NULL;
    }
}
コード例 #3
0
ファイル: rut-icon-button.c プロジェクト: ChrisCummins/rig
static void
destroy_icons (RutIconButton *button)
{
  if (button->icon_normal)
    {
      rut_refable_unref (button->icon_normal);
      button->icon_normal = NULL;
    }

  if (button->icon_hover)
    {
      rut_refable_unref (button->icon_hover);
      button->icon_hover = NULL;
    }

  if (button->icon_active)
    {
      rut_refable_unref (button->icon_active);
      button->icon_active = NULL;
    }

  if (button->icon_disabled)
    {
      rut_refable_unref (button->icon_disabled);
      button->icon_disabled = NULL;
    }
}
コード例 #4
0
ファイル: rut-diamond.c プロジェクト: ChrisCummins/rig
static void
_rut_diamond_free (void *object)
{
  RutDiamond *diamond = object;

  rut_refable_unref (diamond->slice);
  rut_refable_unref (diamond->pick_mesh);

  g_slice_free (RutDiamond, diamond);
}
コード例 #5
0
ファイル: rig-rpc-network.c プロジェクト: cee1/rig
static void
_rig_rpc_peer_free (void *object)
{
  RigRPCPeer *rpc_peer = object;

  rut_refable_unref (rpc_peer->pb_rpc_client);
  rut_refable_unref (rpc_peer->pb_rpc_server);
  rut_refable_unref (rpc_peer->pb_rpc_peer);

  g_slice_free (RigRPCPeer, rpc_peer);
}
コード例 #6
0
ファイル: rut-pointalism-grid.c プロジェクト: cee1/rig
static void
_rut_pointalism_grid_free (void *object)
{
  RutPointalismGrid *grid = object;

  rut_closure_list_disconnect_all (&grid->updated_cb_list);

  rut_refable_unref (grid->slice);
  rut_refable_unref (grid->pick_mesh);

  rut_simple_introspectable_destroy (grid);

  g_slice_free (RutPointalismGrid, grid);
}
コード例 #7
0
ファイル: rut-fold.c プロジェクト: cee1/rig
static void
_rut_fold_free (void *object)
{
  RutFold *fold = object;

  rut_fold_set_child (fold, NULL);

  rut_refable_unref (fold->fold_up_icon);
  rut_refable_unref (fold->fold_down_icon);

  rut_graphable_destroy (fold);
  rut_simple_introspectable_destroy (fold);

  g_slice_free (RutFold, fold);
}
コード例 #8
0
ファイル: rut-shim.c プロジェクト: cee1/rig
void
rut_shim_set_child (RutShim *shim, RutObject *child)
{
  g_return_if_fail (rut_object_get_type (shim) == &rut_shim_type);

  if (shim->child == child)
    return;

  if (shim->child)
    {
      rut_graphable_remove_child (shim->child);
      rut_closure_disconnect (shim->child_preferred_size_closure);
      shim->child_preferred_size_closure = NULL;
      rut_refable_unref (shim->child);
    }

  if (child)
    {
      shim->child = rut_refable_ref (child);
      rut_graphable_add_child (shim, child);

      shim->child_preferred_size_closure =
        rut_sizable_add_preferred_size_callback (child,
                                                 child_preferred_size_cb,
                                                 shim,
                                                 NULL /* destroy */);
      queue_allocation (shim);
    }
  else
    shim->child = NULL;

  rut_shell_queue_redraw (shim->context->shell);
}
コード例 #9
0
ファイル: rut-bin.c プロジェクト: sanyaade-mobiledev/rig
void
rut_bin_set_child (RutBin *bin,
                   RutObject *child_widget)
{
    if (child_widget)
        rut_refable_ref (child_widget);

    if (bin->child)
    {
        rut_graphable_remove_child (bin->child);
        rut_closure_disconnect (bin->child_preferred_size_closure);
        bin->child_preferred_size_closure = NULL;
        rut_refable_unref (bin->child);
    }

    bin->child = child_widget;

    if (child_widget)
    {
        rut_graphable_add_child (bin->child_transform, child_widget);
        bin->child_preferred_size_closure =
            rut_sizable_add_preferred_size_callback (child_widget,
                    child_preferred_size_cb,
                    bin,
                    NULL /* destroy */);
        queue_allocation (bin);
    }

    preferred_size_changed (bin);
}
コード例 #10
0
ファイル: rut-prop-inspector.c プロジェクト: cee1/rig
static void
_rut_prop_inspector_free (void *object)
{
  RutPropInspector *inspector = object;

  if (inspector->inspector_prop_closure)
    rut_property_closure_destroy (inspector->inspector_prop_closure);
  if (inspector->target_prop_closure)
    rut_property_closure_destroy (inspector->target_prop_closure);

  rut_graphable_destroy (inspector);

  rut_refable_unref (inspector->disabled_overlay);
  rut_refable_unref (inspector->input_region);

  g_slice_free (RutPropInspector, inspector);
}
コード例 #11
0
ファイル: rut-property.c プロジェクト: ChrisCummins/rig
void
rut_boxed_destroy (RutBoxed *boxed)
{
    if (boxed->type == RUT_PROPERTY_TYPE_OBJECT && boxed->d.object_val)
        rut_refable_unref (boxed->d.object_val);
    else if (boxed->type == RUT_PROPERTY_TYPE_TEXT)
        g_free (boxed->d.text_val);
}
コード例 #12
0
ファイル: rut-button.c プロジェクト: cee1/rig
static void
_rut_button_free (void *object)
{
  RutButton *button = object;

  rut_closure_list_disconnect_all (&button->on_click_cb_list);

  destroy_button_slices (button);

  if (button->normal_texture)
    {
      cogl_object_unref (button->normal_texture);
      button->normal_texture = NULL;
    }

  if (button->hover_texture)
    {
      cogl_object_unref (button->hover_texture);
      button->hover_texture = NULL;
    }

  if (button->active_texture)
    {
      cogl_object_unref (button->active_texture);
      button->active_texture = NULL;
    }

  if (button->disabled_texture)
    {
      cogl_object_unref (button->disabled_texture);
      button->disabled_texture = NULL;
    }

  rut_graphable_remove_child (button->text);
  rut_refable_unref (button->text);

  rut_graphable_remove_child (button->text_transform);
  rut_refable_unref (button->text_transform);

  rut_graphable_destroy (button);

  rut_shell_remove_pre_paint_callback_by_graphable (button->ctx->shell, button);

  g_slice_free (RutButton, object);
}
コード例 #13
0
ファイル: rut-pointalism-grid.c プロジェクト: cee1/rig
static void
_pointalism_grid_slice_free (void *object)
{
  RutPointalismGridSlice *pointalism_grid_slice = object;

  rut_refable_unref (pointalism_grid_slice->mesh);

  g_slice_free (RutPointalismGridSlice, object);
}
コード例 #14
0
ファイル: rut-light.c プロジェクト: ChrisCummins/rig
void
rut_light_free (RutLight *light)
{
  rut_refable_unref (light->context);

  rut_simple_introspectable_destroy (light);

  g_slice_free (RutLight, light);
}
コード例 #15
0
ファイル: rut-prop-inspector.c プロジェクト: cee1/rig
static void
add_control (RutPropInspector *inspector,
             RutProperty *prop,
             bool with_label)
{
  RutProperty *widget_prop;
  RutObject *widget;
  const char *label_text;

  widget = create_widget_for_property (inspector->context,
                                       prop,
                                       &widget_prop,
                                       &label_text);

  if (!widget)
    return;

  if (with_label && label_text)
    {
      RutText *label =
        rut_text_new_with_text (inspector->context,
                                NULL, /* font_name */
                                label_text);
      rut_text_set_selectable (label, FALSE);
      rut_box_layout_add (inspector->widget_hbox, false, label);
      rut_refable_unref (label);
    }

  if (!(inspector->target_prop->spec->flags & RUT_PROPERTY_FLAG_WRITABLE))
    set_disabled (inspector, DISABLED_STATE_WIDGET);

  rut_box_layout_add (inspector->widget_hbox, true, widget);
  rut_refable_unref (widget);

  if (widget_prop)
    {
      inspector->inspector_prop_closure =
        rut_property_connect_callback (widget_prop,
                                       inspector_property_changed_cb,
                                       inspector);
      inspector->widget_prop = widget_prop;
    }
}
コード例 #16
0
ファイル: rut-bin.c プロジェクト: sanyaade-mobiledev/rig
static void
_rut_bin_free (void *object)
{
    RutBin *bin = object;

    rut_closure_list_disconnect_all (&bin->preferred_size_cb_list);

    rut_bin_set_child (bin, NULL);

    rut_shell_remove_pre_paint_callback (bin->context->shell, bin);

    rut_refable_unref (bin->context);

    rut_graphable_remove_child (bin->child_transform);
    rut_refable_unref (bin->child_transform);

    rut_graphable_destroy (bin);

    g_slice_free (RutBin, bin);
}
コード例 #17
0
ファイル: rig-rpc-network.c プロジェクト: cee1/rig
void
rig_rpc_server_shutdown (RigRPCServer *server)
{
  g_warning ("Stopping RPC server");

#warning "todo: explicitly shutdown via new rig_pb_rpc_server_shutdown() api"
  rut_refable_unref (server->pb_rpc_server);
  server->pb_rpc_server = NULL;

  g_source_remove (server->source_id);
}
コード例 #18
0
ファイル: rut-shape.c プロジェクト: ChrisCummins/rig
static void
_shape_model_free (void *object)
{
  RutShapeModel *shape_model = object;

  cogl_object_unref (shape_model->shape_texture);
  cogl_object_unref (shape_model->primitive);
  rut_refable_unref (shape_model->pick_mesh);

  g_slice_free (RutShapeModel, object);
}
コード例 #19
0
static void
free_prop_data_cb (void *engine)
{
  RigTransitionPropData *prop_data = engine;

  if (prop_data->path)
    rut_refable_unref (prop_data->path);

  rut_boxed_destroy (&prop_data->constant_value);

  g_slice_free (RigTransitionPropData, prop_data);
}
コード例 #20
0
ファイル: rut-camera.c プロジェクト: cee1/rig
void
rut_camera_remove_input_region (RutCamera *camera,
                                RutInputRegion *region)
{
  GList *link = g_list_find (camera->input_regions, region);
  if (link)
    {
      rut_refable_unref (region);
      camera->input_regions =
        g_list_delete_link (camera->input_regions, link);
    }
}
コード例 #21
0
void
rig_transition_free (RigTransition *transition)
{
  rut_closure_list_disconnect_all (&transition->operation_cb_list);

  rut_simple_introspectable_destroy (transition);

  g_hash_table_destroy (transition->properties);

  rut_refable_unref (transition->context);

  g_slice_free (RigTransition, transition);
}
コード例 #22
0
ファイル: rut-shape.c プロジェクト: ChrisCummins/rig
static void
_rut_shape_free (void *object)
{
  RutShape *shape = object;

  rut_refable_unref (shape->model);

  rut_simple_introspectable_destroy (shape);

  rut_closure_list_disconnect_all (&shape->reshaped_cb_list);

  g_slice_free (RutShape, shape);
}
コード例 #23
0
ファイル: rig-selection-tool.c プロジェクト: cee1/rig
static void
create_dummy_control_points (EntityState *entity_state)
{
  RigSelectionTool *tool = entity_state->tool;
  CoglTexture *tex = rut_load_texture_from_data_file (tool->ctx, "dot.png", NULL);
  ControlPoint *point;

  point = g_slice_new0 (ControlPoint);
  point->entity_state = entity_state;
  point->x = 0;
  point->y = 0;
  point->z = 0;

  point->transform = rut_transform_new (tool->ctx);
  rut_graphable_add_child (tool->tool_overlay, point->transform);
  rut_refable_unref (point->transform);

  point->marker = rut_nine_slice_new (tool->ctx, tex, 0, 0, 0, 0, 10, 10);
  rut_graphable_add_child (point->transform, point->marker);
  rut_refable_unref (point->marker);

  point->input_region =
    rut_input_region_new_circle (0, 0, 5,
                                 control_point_input_cb,
                                 point);
  rut_graphable_add_child (tool->tool_overlay, point->input_region);
  rut_refable_unref (point->input_region);
  entity_state->control_points =
    g_list_prepend (entity_state->control_points, point);


  point = g_slice_new0 (ControlPoint);
  point->entity_state = entity_state;
  point->x = 100;
  point->y = 0;
  point->z = 0;

  point->transform = rut_transform_new (tool->ctx);
  rut_graphable_add_child (tool->tool_overlay, point->transform);
  rut_refable_unref (point->transform);

  point->marker = rut_nine_slice_new (tool->ctx, tex, 0, 0, 0, 0, 10, 10);
  rut_graphable_add_child (point->transform, point->marker);
  rut_refable_unref (point->marker);

  point->input_region =
    rut_input_region_new_circle (0, 0, 5,
                                 control_point_input_cb,
                                 point);
  rut_graphable_add_child (tool->tool_overlay, point->input_region);
  rut_refable_unref (point->input_region);
  entity_state->control_points =
    g_list_prepend (entity_state->control_points, point);

  cogl_object_unref (tex);
}
コード例 #24
0
ファイル: rig-selection-tool.c プロジェクト: cee1/rig
static void
entity_state_destroy (EntityState *entity_state)
{
  GList *l;

  for (l = entity_state->control_points; l; l = l->next)
    {
      ControlPoint *point = l->data;
      rut_graphable_remove_child (point->input_region);
      rut_graphable_remove_child (point->transform);
    }

  rut_refable_unref (entity_state->entity);

  g_slice_free (EntityState, entity_state);
}
コード例 #25
0
ファイル: rig-rpc-network.c プロジェクト: cee1/rig
void
rig_rpc_client_disconnect (RigRPCClient *rpc_client)
{
  if (!rpc_client->pb_rpc_client)
    return;

  g_source_remove (rpc_client->source_id);
  rpc_client->source_id = 0;

  g_source_unref (rpc_client->protobuf_source);
  rpc_client->protobuf_source = NULL;

#warning "TODO: need explicit rig_pb_rpc_client_disconnect() api"
  rut_refable_unref (rpc_client->pb_rpc_client);
  rpc_client->pb_rpc_client = NULL;
}
コード例 #26
0
ファイル: rut-icon-button.c プロジェクト: ChrisCummins/rig
static void
set_icon (RutIconButton *button,
          RutIcon **icon,
          const char *icon_name)
{
  if (*icon)
    {
      rut_refable_unref (*icon);
      if (button->current_icon == *icon)
        {
          rut_bin_set_child (button->bin, NULL);
          button->current_icon = NULL;
        }
    }

  *icon = rut_icon_new (button->ctx, icon_name);
  update_current_icon (button);
}
コード例 #27
0
ファイル: rut-icon-button.c プロジェクト: ChrisCummins/rig
static void
_rut_icon_button_free (void *object)
{
  RutIconButton *button = object;

  rut_closure_list_disconnect_all (&button->on_click_cb_list);

  destroy_icons (button);

  if (button->label)
    {
      rut_graphable_remove_child (button->label);
      rut_refable_unref (button->label);
    }

  /* NB: This will destroy the stack, layout and input_region which
   * we don't hold extra references for... */
  rut_graphable_destroy (button);

  g_slice_free (RutIconButton, object);
}
コード例 #28
0
ファイル: rut-shape.c プロジェクト: ChrisCummins/rig
void
rut_shape_set_texture_size (RutShape *shape,
                            int tex_width,
                            int tex_height)
{
  if (shape->tex_width == tex_width &&
      shape->tex_height == tex_height)
    return;

  shape->tex_width = tex_width;
  shape->tex_height = tex_height;

  if (shape->model)
    {
      rut_refable_unref (shape->model);
      shape->model = NULL;
    }

  rut_closure_list_invoke (&shape->reshaped_cb_list,
                           RutShapeReShapedCallback,
                           shape);
}
コード例 #29
0
ファイル: rut-bin.c プロジェクト: cee1/rig
RutBin *
rut_bin_new (RutContext *ctx)
{
  RutBin *bin = rut_object_alloc0 (RutBin,
                                   &rut_bin_type,
                                   _rut_bin_init_type);

  bin->ref_count = 1;
  bin->context = ctx;

  bin->x_position = RUT_BIN_POSITION_EXPAND;
  bin->y_position = RUT_BIN_POSITION_EXPAND;

  rut_list_init (&bin->preferred_size_cb_list);

  rut_graphable_init (RUT_OBJECT (bin));

  bin->child_transform = rut_transform_new (ctx);
  rut_graphable_add_child (bin, bin->child_transform);
  rut_refable_unref (bin->child_transform);

  return bin;
}
コード例 #30
0
ファイル: rut-shape.c プロジェクト: ChrisCummins/rig
void
rut_shape_set_shaped (RutObject *obj,
                      CoglBool shaped)
{
  RutShape *shape = RUT_SHAPE (obj);

  if (shape->shaped == shaped)
    return;

  shape->shaped = shaped;

  if (shape->model)
    {
      rut_refable_unref (shape->model);
      shape->model = NULL;
    }

  rut_closure_list_invoke (&shape->reshaped_cb_list,
                           RutShapeReShapedCallback,
                           shape);

  rut_property_dirty (&shape->ctx->property_ctx,
                      &shape->properties[RUT_SHAPE_PROP_SHAPED]);
}