示例#1
0
static void
finish_prepare_screenshot (GdkRectangle *rectangle)
{
  GdkRectangle rect;
  GdkWindow *window;

  window = find_current_window ();
  screenshot = screenshot_get_pixbuf (window, rectangle);

  if (screenshot_config->take_window_shot)
    {
      switch (screenshot_config->border_effect[0])
        {
        case 's': /* shadow */
          screenshot_add_shadow (&screenshot);
          break;
        case 'b': /* border */
          screenshot_add_border (&screenshot);
          break;
        case 'n': /* none */
        default:
          break;
        }
    }

  /* release now the lock, it was acquired when we were finding the window */
  screenshot_release_lock ();

  if (screenshot == NULL)
    {
      screenshot_show_error_dialog (NULL,
                                    _("Unable to take a screenshot of the current window"),
                                    NULL);
      exit (1);
    }

  flash = cheese_flash_new ();

  if (rectangle != NULL)
    rect = *rectangle;
  else
    screenshot_get_window_rect (window, &rect);

  cheese_flash_fire (flash, &rect);
  play_sound_effect (window);

  g_object_unref (flash);

  if (screenshot_config->copy_to_clipboard)
    {
      screenshot_save_to_clipboard ();
      gtk_main_quit ();

      return;
    }

  screenshot_ensure_icc_profile (window);
  screenshot_build_filename_async (screenshot_config->last_save_dir,
                                   build_filename_ready_cb, screenshot);
}
示例#2
0
/*
 * take_button_clicked_cb:
 * @button: the #GtkButton that was clicked
 * @widget: the #CheeseAvatarWidget
 *
 * Take a photo with the #CheeseCamera of @widget. When the photo has been
 * taken, call cheese_widget_photo_taken_cb().
 */
static void
take_button_clicked_cb (GtkButton           *button,
                        CheeseAvatarWidget *widget)
{
    CheeseAvatarWidgetPrivate *priv;
    GObject                    *camera;

    priv = cheese_avatar_widget_get_instance_private (widget);
    camera = cheese_widget_get_camera (CHEESE_WIDGET (priv->camera));
    if (priv->photo_taken_id == 0)
    {
        gtk_widget_set_sensitive (priv->take_button, FALSE);
        priv->photo_taken_id = g_signal_connect (G_OBJECT (camera), "photo-taken",
                               G_CALLBACK (cheese_widget_photo_taken_cb), widget);
    }
    if (cheese_camera_take_photo_pixbuf (CHEESE_CAMERA (camera)))
    {
        cheese_flash_fire (CHEESE_FLASH (priv->flash));
        ca_gtk_play_for_widget (GTK_WIDGET (widget), 0,
                                CA_PROP_EVENT_ID, "camera-shutter",
                                CA_PROP_MEDIA_ROLE, "event",
                                CA_PROP_EVENT_DESCRIPTION, _("Shutter sound"),
                                NULL);
    }
    else
    {
        g_assert_not_reached ();
    }
}
static void
screenshot_fallback_fire_flash (GdkWindow *window,
                                GdkRectangle *rectangle)
{
  GdkRectangle rect;
  CheeseFlash *flash = NULL;

  if (rectangle != NULL)
    rect = *rectangle;
  else
    screenshot_fallback_get_window_rect_coords (window,
                                                screenshot_config->include_border,
                                                NULL,
                                                &rect);

  flash = cheese_flash_new ();
  cheese_flash_fire (flash, &rect);

  g_object_unref (flash);
}