예제 #1
0
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
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
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
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
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
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
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
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
void
rut_light_free (RutLight *light)
{
  rut_refable_unref (light->context);

  rut_simple_introspectable_destroy (light);

  g_slice_free (RutLight, light);
}
예제 #15
0
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
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
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
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
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
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
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
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
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
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]);
}