static void
gimp_rectangle_select_tool_constructed (GObject *object)
{
  GimpRectangleSelectTool        *rect_sel_tool;
  GimpRectangleSelectOptions     *options;
  GimpRectangleSelectToolPrivate *priv;

  if (G_OBJECT_CLASS (parent_class)->constructed)
    G_OBJECT_CLASS (parent_class)->constructed (object);

  gimp_rectangle_tool_constructor (object);

  rect_sel_tool = GIMP_RECTANGLE_SELECT_TOOL (object);
  options       = GIMP_RECTANGLE_SELECT_TOOL_GET_OPTIONS (rect_sel_tool);
  priv          = GIMP_RECTANGLE_SELECT_TOOL_GET_PRIVATE (rect_sel_tool);

  priv->round_corners = options->round_corners;
  priv->corner_radius = options->corner_radius;

  g_signal_connect_object (options, "notify::round-corners",
                           G_CALLBACK (gimp_rectangle_select_tool_round_corners_notify),
                           object, 0);
  g_signal_connect_object (options, "notify::corner-radius",
                           G_CALLBACK (gimp_rectangle_select_tool_round_corners_notify),
                           object, 0);

  gimp_rectangle_select_tool_update_option_defaults (rect_sel_tool, FALSE);
}
예제 #2
0
static void
gimp_crop_tool_constructed (GObject *object)
{
  GimpCropTool    *crop_tool = GIMP_CROP_TOOL (object);
  GimpCropOptions *options;
  GimpContext     *gimp_context;
  GimpToolInfo    *tool_info;

  G_OBJECT_CLASS (parent_class)->constructed (object);

  gimp_rectangle_tool_constructor (object);

  tool_info = GIMP_TOOL (crop_tool)->tool_info;

  gimp_context = gimp_get_user_context (tool_info->gimp);

  g_signal_connect_object (gimp_context, "image-changed",
                           G_CALLBACK (gimp_crop_tool_image_changed),
                           crop_tool,
                           G_CONNECT_SWAPPED);

  /* Make sure we are connected to "size-changed" for the initial
   * image.
   */
  gimp_crop_tool_image_changed (crop_tool,
                                gimp_context_get_image (gimp_context),
                                gimp_context);


  options = GIMP_CROP_TOOL_GET_OPTIONS (object);

  g_signal_connect_object (options, "notify::layer-only",
                           G_CALLBACK (gimp_crop_tool_options_notify),
                           object, 0);

  g_signal_connect_object (options, "notify::allow-growing",
                           G_CALLBACK (gimp_crop_tool_options_notify),
                           object, 0);

  gimp_rectangle_tool_set_constraint (GIMP_RECTANGLE_TOOL (object),
                                      gimp_crop_tool_get_constraint (crop_tool));

  gimp_crop_tool_update_option_defaults (crop_tool, FALSE);
}