--- a/gnome-media.spec Tue Nov 09 08:46:13 2004 +0000
+++ b/gnome-media.spec Tue Nov 09 09:16:32 2004 +0000
@@ -2,7 +2,7 @@
Summary: GNOME Multimedia
Group: System/GUI/GNOME
Version: 2.6.1
-Release: 32
+Release: 33
Distribution: Cinnabar
Vendor: Sun Microsystems, Inc.
License: GPL
@@ -36,6 +36,7 @@
Patch15: gnome-media-15-save-record.diff
Patch16: gnome-media-16-cddb-display.diff
Patch17: gnome-media-17-g11n-potfiles.diff
+Patch18: gnome-media-18-prompt-on-overwrite.diff
URL: http://www.gnome.org
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -83,6 +84,7 @@
%patch15 -p1
%patch16 -p1
%patch17 -p1
+%patch18 -p1
bzcat %SOURCE1 | tar xf -
bzcat %SOURCE2 | tar xf -
@@ -225,6 +227,11 @@
%{_mandir}/man5/*
%changelog
+* Wed Nov 09 2004 - [email protected]
+- Added gnome-media-18-prompt-on-overwrite.diff so that it asks before
+ overwriting any existing file.
+ Patch taken from bugzilla. Fixes bug# 6186579
+
* Thu Nov 04 2004 - [email protected]
- Added gnome-media-17-g11n-potfiles.diff to update POTFILES.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/gnome-media-18-prompt-on-overwrite.diff Tue Nov 09 09:16:32 2004 +0000
@@ -0,0 +1,134 @@
+--- gnome-media-2.6.1-old/grecord/src/gsr-window.c 2004-11-02 11:23:20.580125000 +0530
++++ gnome-media-2.6.1/grecord/src/gsr-window.c 2004-11-03 16:38:46.479915000 +0530
+@@ -510,6 +510,119 @@ pipeline_error_cb (GstElement *parent,
+ eos_done (ed);
+ }
+
++GtkWidget *
++gsr_button_new_with_stock_image (const gchar *text, const gchar *stock_id)
++{
++ GtkWidget *button;
++ GtkStockItem item;
++ GtkWidget *label;
++ GtkWidget *image;
++ GtkWidget *hbox;
++ GtkWidget *align;
++
++ button = gtk_button_new ();
++
++ if (GTK_BIN (button)->child)
++ gtk_container_remove (GTK_CONTAINER (button),
++ GTK_BIN (button)->child);
++
++ if (gtk_stock_lookup (stock_id, &item)) {
++ label = gtk_label_new_with_mnemonic (text);
++
++ gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
++
++ image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
++ hbox = gtk_hbox_new (FALSE, 2);
++
++ align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
++
++ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
++ gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
++
++ gtk_container_add (GTK_CONTAINER (button), align);
++ gtk_container_add (GTK_CONTAINER (align), hbox);
++
++ gtk_widget_show_all (align);
++
++ return button;
++
++ }
++
++ label = gtk_label_new_with_mnemonic (text);
++ gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (button));
++ gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
++
++ gtk_widget_show (label);
++ gtk_container_add (GTK_CONTAINER (button), label);
++
++ return button;
++}
++
++GtkWidget *
++gsr_dialog_add_button (GtkDialog *dialog, const gchar *text, const gchar *stock_id, gint response_id)
++{
++ GtkWidget *button;
++
++ g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
++ g_return_val_if_fail (text != NULL, NULL);
++ g_return_val_if_fail (stock_id != NULL, NULL);
++
++ button = gsr_button_new_with_stock_image (text, stock_id);
++ g_return_val_if_fail (button != NULL, NULL);
++
++ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
++
++ gtk_widget_show (button);
++
++ gtk_dialog_add_action_widget (dialog, button, response_id);
++
++ return button;
++}
++
++static gboolean
++replace_dialog (GtkWindow *parent,
++ const gchar *message,
++ const gchar *file_name)
++{
++ GtkWindow *message_dialog;
++ gint ret;
++
++ g_return_val_if_fail (file_name != NULL, FALSE);
++
++ message_dialog = gtk_message_dialog_new (parent,
++ GTK_DIALOG_DESTROY_WITH_PARENT,
++ GTK_MESSAGE_QUESTION,
++ GTK_BUTTONS_NONE,
++ message,
++ file_name);
++ /* Add cancel button */
++ gtk_dialog_add_button (GTK_DIALOG (message_dialog),
++ GTK_STOCK_CANCEL,
++ GTK_RESPONSE_CANCEL);
++ /* Add replace button */
++ gsr_dialog_add_button (GTK_DIALOG (message_dialog), _("_Replace"),
++ GTK_STOCK_REFRESH,
++ GTK_RESPONSE_YES);
++
++ gtk_dialog_set_default_response (GTK_DIALOG (message_dialog), GTK_RESPONSE_CANCEL);
++ gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
++ ret = gtk_dialog_run (GTK_DIALOG (message_dialog));
++ gtk_widget_destroy (GTK_WIDGET (message_dialog));
++
++ return (ret == GTK_RESPONSE_YES);
++}
++
++static gboolean
++replace_existing_file (GtkWindow *parent,
++ const gchar *file_name)
++{
++ return replace_dialog (parent,
++ _("A file named \"%s\" already exists. \n"
++ "Do you want to replace it with the "
++ "one you are saving?"),
++ file_name);
++}
++
+ static void
+ do_save_file (GSRWindow *window,
+ const char *name)
+@@ -528,6 +641,11 @@ do_save_file (GSRWindow *window,
+
+ tmp = g_strdup_printf ("%s.%s", name,
+ gm_audio_profile_get_extension (profile));
++
++ if (g_file_test (tmp, G_FILE_TEST_EXISTS)) {
++ if (! replace_existing_file (GTK_WINDOW (window), tmp))
++ return;
++ }
+
+ command = g_strdup_printf ("/bin/cp %s %s", priv->record_filename, tmp);
+