[cheese] Don't create Webcam dirs (in Pictures and Video user dirs) unless there is content to put on it, fix
- From: Laura Lucas Alday <lauralucas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Don't create Webcam dirs (in Pictures and Video user dirs) unless there is content to put on it, fix
- Date: Fri, 17 Dec 2010 22:18:48 +0000 (UTC)
commit b04912a836504f603bd3453a9e908751599fdccb
Author: Laura Lucas Alday <lauralucasalday gmail com>
Date: Fri Dec 17 18:50:22 2010 -0300
Don't create Webcam dirs (in Pictures and Video user dirs) unless there is content to put on it, fixes bug #563058
libcheese/cheese-fileutil.c | 2 +
src/cheese-window.vala | 5 +++
src/thumbview/cheese-thumb-view.c | 67 ++++++++++++++++++++++---------------
src/thumbview/cheese-thumb-view.h | 2 +
src/vapi/cheese-thumbview.vapi | 2 +
5 files changed, 51 insertions(+), 27 deletions(-)
---
diff --git a/libcheese/cheese-fileutil.c b/libcheese/cheese-fileutil.c
index c5f70a4..791a22f 100644
--- a/libcheese/cheese-fileutil.c
+++ b/libcheese/cheese-fileutil.c
@@ -94,6 +94,8 @@ cheese_fileutil_get_new_media_filename (CheeseFileUtil *fileutil, CheeseMediaMod
else
path = cheese_fileutil_get_video_path (fileutil);
+ g_mkdir_with_parents (path, 0775);
+
if (mode == CHEESE_MEDIA_MODE_PHOTO)
{
filename = g_strdup_printf ("%s%s%s%s", path, G_DIR_SEPARATOR_S, date, PHOTO_NAME_SUFFIX);
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index ddaf1b6..669eeb5 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -622,6 +622,11 @@ public class Cheese.MainWindow : Gtk.Window
{
string file_name = fileutil.get_new_media_filename (this.current_mode);
+ if (current_mode == MediaMode.VIDEO)
+ thumb_view.start_monitoring_video_path(fileutil.get_video_path ());
+ else
+ thumb_view.start_monitoring_photo_path(fileutil.get_photo_path ());
+
if (settings.get_boolean ("flash"))
{
this.flash.fire ();
diff --git a/src/thumbview/cheese-thumb-view.c b/src/thumbview/cheese-thumb-view.c
index c39a487..28e46b3 100644
--- a/src/thumbview/cheese-thumb-view.c
+++ b/src/thumbview/cheese-thumb-view.c
@@ -591,9 +591,8 @@ cheese_thumb_view_init (CheeseThumbView *thumb_view)
{
CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
- char *path_videos = NULL, *path_photos = NULL;
-
- GFile *file;
+ priv->video_file_monitor = NULL;
+ priv->photo_file_monitor = NULL;
cheese_thumbnail_init ();
@@ -621,32 +620,8 @@ cheese_thumb_view_init (CheeseThumbView *thumb_view)
gtk_icon_view_set_row_spacing (GTK_ICON_VIEW (thumb_view), 0);
gtk_icon_view_set_column_spacing (GTK_ICON_VIEW (thumb_view), 0);
- path_videos = cheese_fileutil_get_video_path (priv->fileutil);
- path_photos = cheese_fileutil_get_photo_path (priv->fileutil);
-
- g_mkdir_with_parents (path_videos, 0775);
- g_mkdir_with_parents (path_photos, 0775);
-
priv->factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_NORMAL);
- /* connect signal to video path */
- file = g_file_new_for_path (path_videos);
- priv->video_file_monitor = g_file_monitor_directory (file, 0, NULL, NULL);
- g_signal_connect (priv->video_file_monitor, "changed", G_CALLBACK (cheese_thumb_view_monitor_cb), thumb_view);
-
- /* if both paths are the same, make only one file monitor and point twice to the file monitor (photo_file_monitor = video_file_monitor) */
- if (strcmp (path_videos, path_photos) != 0)
- {
- /* connect signal to photo path */
- file = g_file_new_for_path (path_photos);
- priv->photo_file_monitor = g_file_monitor_directory (file, 0, NULL, NULL);
- g_signal_connect (priv->photo_file_monitor, "changed", G_CALLBACK (cheese_thumb_view_monitor_cb), thumb_view);
- }
- else
- {
- priv->photo_file_monitor = priv->video_file_monitor;
- }
-
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (thumb_view), 0);
gtk_icon_view_set_columns (GTK_ICON_VIEW (thumb_view), G_MAXINT);
@@ -672,3 +647,41 @@ cheese_thumb_view_new ()
thumb_view = g_object_new (CHEESE_TYPE_THUMB_VIEW, NULL);
return GTK_WIDGET (thumb_view);
}
+
+void
+cheese_thumb_view_start_monitoring_photo_path (CheeseThumbView *thumb_view, char *path_photos)
+{
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
+ if(priv->photo_file_monitor != NULL)
+ return;
+
+ GFile *file;
+
+ /* connect signal to photo path */
+ file = g_file_new_for_path (path_photos);
+ priv->photo_file_monitor = g_file_monitor_directory (file, 0, NULL, NULL);
+ g_signal_connect (priv->photo_file_monitor, "changed", G_CALLBACK (cheese_thumb_view_monitor_cb), thumb_view);
+
+ g_object_unref (file);
+
+}
+
+void
+cheese_thumb_view_start_monitoring_video_path (CheeseThumbView *thumb_view, char *path_videos)
+{
+ CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
+
+ if(priv->video_file_monitor != NULL)
+ return;
+
+ GFile *file;
+
+ /* connect signal to video path */
+ file = g_file_new_for_path (path_videos);
+ priv->video_file_monitor = g_file_monitor_directory (file, 0, NULL, NULL);
+ g_signal_connect (priv->video_file_monitor, "changed", G_CALLBACK (cheese_thumb_view_monitor_cb), thumb_view);
+
+ g_object_unref (file);
+
+}
diff --git a/src/thumbview/cheese-thumb-view.h b/src/thumbview/cheese-thumb-view.h
index 875e073..44480fc 100644
--- a/src/thumbview/cheese-thumb-view.h
+++ b/src/thumbview/cheese-thumb-view.h
@@ -54,6 +54,8 @@ GList *cheese_thumb_view_get_selected_images_list (CheeseThumbView *thumb_view);
char * cheese_thumb_view_get_selected_image (CheeseThumbView *thumb_view);
guint cheese_thumb_view_get_n_selected (CheeseThumbView *thumbview);
void cheese_thumb_view_remove_item (CheeseThumbView *thumb_view, GFile *file);
+void cheese_thumb_view_start_monitoring_photo_path (CheeseThumbView *thumbview, char *path_photos);
+void cheese_thumb_view_start_monitoring_video_path (CheeseThumbView *thumbview, char *path_videos);
G_END_DECLS
diff --git a/src/vapi/cheese-thumbview.vapi b/src/vapi/cheese-thumbview.vapi
index 50d2bd5..669b724 100644
--- a/src/vapi/cheese-thumbview.vapi
+++ b/src/vapi/cheese-thumbview.vapi
@@ -9,5 +9,7 @@ namespace Cheese
public List<GLib.File> get_selected_images_list ();
public int get_n_selected ();
public void remove_item (GLib.File file);
+ public void start_monitoring_photo_path (string path_photos);
+ public void start_monitoring_video_path (string path_videos);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]