[cheese] fix the abortion of burst mode with the escape key, fixes bug #595073



commit 19846e6b44d41053b90e46801093f4a0678fc231
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Sun Sep 13 18:20:01 2009 +0200

    fix the abortion of burst mode with the escape key, fixes bug #595073
    
    burst mode can now be aborted with the Escape key, no matter if
    the countdown is active or not.
    when burst mode is running you could start it again with spacebar,
    this has been disabled during the burst session.

 src/cheese-flash.c  |    1 +
 src/cheese-window.c |   97 +++++++++++++++++++++++++++++++-------------------
 2 files changed, 61 insertions(+), 37 deletions(-)
---
diff --git a/src/cheese-flash.c b/src/cheese-flash.c
index 38ec0c1..be55ae9 100644
--- a/src/cheese-flash.c
+++ b/src/cheese-flash.c
@@ -84,6 +84,7 @@ cheese_flash_init (CheeseFlash *self)
 
   /* Don't take focus */
   gtk_window_set_accept_focus (window, FALSE);
+  gtk_window_set_focus_on_map (window, FALSE);
 
   /* Don't consume input */
   gtk_widget_realize (GTK_WIDGET (window));
diff --git a/src/cheese-window.c b/src/cheese-window.c
index 7f43114..f753b02 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -1353,6 +1353,20 @@ cheese_window_escape_key_cb (CheeseWindow *cheese_window,
     gtk_widget_set_sensitive (cheese_window->take_picture, TRUE);
     gtk_widget_set_sensitive (cheese_window->take_picture_fullscreen, TRUE);
   }
+  else  if (cheese_window->webcam_mode == WEBCAM_MODE_BURST)
+  {
+    cheese_window->repeat_count = 0;
+    cheese_window->is_bursting = FALSE;
+
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->notebook_bar), 0);
+    gtk_notebook_set_current_page (GTK_NOTEBOOK (cheese_window->fullscreen_bar), 0);
+
+    gtk_action_group_set_sensitive (cheese_window->actions_effects, TRUE);
+    gtk_action_group_set_sensitive (cheese_window->actions_toggle, TRUE);
+
+    gtk_widget_set_sensitive (cheese_window->take_picture, TRUE);
+    gtk_widget_set_sensitive (cheese_window->take_picture_fullscreen, TRUE);
+  }
   else
   {
     cheese_window_stop_recording (cheese_window);
@@ -1366,6 +1380,11 @@ cheese_window_take_photo (gpointer data)
   gboolean      countdown;
   CheeseWindow *cheese_window = (CheeseWindow *) data;
 
+  // return if burst mode was cancelled
+  if (cheese_window->webcam_mode == WEBCAM_MODE_BURST && !cheese_window->is_bursting && cheese_window->repeat_count <= 0) {
+    return FALSE;
+  }
+
   g_object_get (cheese_window->gconf, "gconf_prop_countdown", &countdown, NULL);
   if (countdown)
   {
@@ -1433,45 +1452,49 @@ cheese_window_take_photo (gpointer data)
 static void
 cheese_window_action_button_clicked_cb (GtkWidget *widget, CheeseWindow *cheese_window)
 {
-  char     *str;
+  char *str;
 
   switch (cheese_window->webcam_mode) {
-  case WEBCAM_MODE_BURST:
-    gtk_action_group_set_sensitive (cheese_window->actions_effects, FALSE);
-    gtk_action_group_set_sensitive (cheese_window->actions_toggle, FALSE);
-    g_object_get (cheese_window->gconf, "gconf_prop_burst_repeat", &cheese_window->repeat_count, NULL); /* reset burst counter */
-  case WEBCAM_MODE_PHOTO:
-    cheese_window_take_photo (cheese_window);
-    break;
-  case WEBCAM_MODE_VIDEO:
-    if (!cheese_window->recording)
-    {
+    case WEBCAM_MODE_BURST:
+      // ignore keybindings and other while bursting
+      if (cheese_window->is_bursting) {
+        break;
+      }
       gtk_action_group_set_sensitive (cheese_window->actions_effects, FALSE);
       gtk_action_group_set_sensitive (cheese_window->actions_toggle, FALSE);
-      str = g_strconcat ("<b>", _("_Stop Recording"), "</b>", NULL);
-      gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo), str);
-      gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo_fullscreen), str);
-      g_free (str);
-      gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
-      gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo), GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
-      gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo_fullscreen), TRUE);
-      gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo_fullscreen),
-                                GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
-
-      cheese_window->video_filename = cheese_fileutil_get_new_media_filename (cheese_window->fileutil,
-                                                                              WEBCAM_MODE_VIDEO);
-      cheese_webcam_start_video_recording (cheese_window->webcam, cheese_window->video_filename);
-
-      cheese_window->recording = TRUE;
-    }
-    else
-    {
-      cheese_window_stop_recording (cheese_window);
-    }
-    break;
-  default:
-    g_assert_not_reached ();
-    break;
+      g_object_get (cheese_window->gconf, "gconf_prop_burst_repeat", &cheese_window->repeat_count, NULL); /* reset burst counter */
+    case WEBCAM_MODE_PHOTO:
+      cheese_window_take_photo (cheese_window);
+      break;
+    case WEBCAM_MODE_VIDEO:
+      if (!cheese_window->recording)
+      {
+        gtk_action_group_set_sensitive (cheese_window->actions_effects, FALSE);
+        gtk_action_group_set_sensitive (cheese_window->actions_toggle, FALSE);
+        str = g_strconcat ("<b>", _("_Stop Recording"), "</b>", NULL);
+        gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo), str);
+        gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo_fullscreen), str);
+        g_free (str);
+        gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
+        gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo), GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
+        gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo_fullscreen), TRUE);
+        gtk_image_set_from_stock (GTK_IMAGE (cheese_window->image_take_photo_fullscreen),
+                                  GTK_STOCK_MEDIA_STOP, GTK_ICON_SIZE_BUTTON);
+
+        cheese_window->video_filename = cheese_fileutil_get_new_media_filename (cheese_window->fileutil,
+                                                                                WEBCAM_MODE_VIDEO);
+        cheese_webcam_start_video_recording (cheese_window->webcam, cheese_window->video_filename);
+
+        cheese_window->recording = TRUE;
+      }
+      else
+      {
+        cheese_window_stop_recording (cheese_window);
+      }
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
   }
 }
 
@@ -1593,9 +1616,9 @@ cheese_window_activate_radio_action (GtkAction *action, GtkRadioAction *current,
     gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo), TRUE);
     gtk_label_set_text_with_mnemonic (GTK_LABEL (cheese_window->label_take_photo_fullscreen), g_strdup (str));
     gtk_label_set_use_markup (GTK_LABEL (cheese_window->label_take_photo_fullscreen), TRUE);
-    gtk_action_group_set_sensitive (cheese_window->actions_burst, TRUE);
-    gtk_action_group_set_sensitive (cheese_window->actions_video, FALSE);
     gtk_action_group_set_sensitive (cheese_window->actions_photo, FALSE);
+    gtk_action_group_set_sensitive (cheese_window->actions_video, FALSE);
+    gtk_action_group_set_sensitive (cheese_window->actions_burst, TRUE);
   }
   else
   {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]