GNOME Bugzilla – Bug 130653
gnome-sound-recorder doesn't prompt on overwrite
Last modified: 2005-02-04 08:45:24 UTC
Here's a pretty simple JDS patch that should be applied.
Created attachment 22995 [details] [review] prompt on overwrite
Created attachment 24713 [details] [review] Patch applied
Patch applied to head with a small addition to make sure that you're doing a save as and not just a save. (Ofcourse a save should already exist right?) Thanks for the patch! Sorry again to the i18n folks.
Hrm, dont' think you actually applied this, apart from the ChangeLog. Unfortunately we now have string freeze, so it'll have to wait until next time.
I'm adding the BLOCKED_BY_FREEZE keyword.
Note that the GStreamer gnomevfssink element also has overwrite-ask functionalities, we might want to use that... That'd also integrate GSR more into GNOME, since it'd actually use gnome-vfs then for file saving (it currently uses the GStreamer filesink element).
Comment on attachment 22995 [details] [review] prompt on overwrite >--- gnome-media-2.2.2/grecord/src/gsr-window.c 2003-06-09 02:50:10.000000000 -0700 >+++ gnome-media-2.2.2-hacked/grecord/src/gsr-window.c 2003-08-06 08:34:09.000000000 -0700 >@@ -468,6 +468,118 @@ > GST_STATE_NULL); > } > >+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) >+{ >+ GtkWidget *msgbox; >+ gint ret; >+ >+ g_return_val_if_fail (file_name != NULL, FALSE); >+ msgbox = gtk_message_dialog_new (parent, >+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, >+ GTK_MESSAGE_QUESTION, >+ GTK_BUTTONS_NONE, >+ message, >+ file_name); >+ >+ /* Add Cancel button */ >+ gtk_dialog_add_button (GTK_DIALOG (msgbox), >+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); >+ >+ /* Add Replace button */ >+ gsr_dialog_add_button (GTK_DIALOG (msgbox), >+ _("_Replace"), GTK_STOCK_REFRESH, GTK_RESPONSE_YES); >+ >+ gtk_dialog_set_default_response (GTK_DIALOG (msgbox), GTK_RESPONSE_CANCEL); >+ >+ gtk_window_set_resizable (GTK_WINDOW (msgbox), FALSE); >+ >+ ret = gtk_dialog_run (GTK_DIALOG (msgbox)); >+ >+ gtk_widget_destroy (msgbox); >+ >+ 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) >@@ -478,6 +590,11 @@ > GstElement *pipeline, *src, *encoder, *spider, *sink; > GdkCursor *cursor; > >+ if (g_file_test (name, G_FILE_TEST_EXISTS)) { >+ if (!replace_existing_file (GTK_WINDOW (window), name)) >+ return; >+ } >+ > ext = strrchr (name, '.'); > if (ext == NULL || *ext == 0) { > mime = MIME_TYPE_WAV;
Curtis, are you sure this patch still applies to gnome 2.6 and higher ? I don't understand why you based yourself on an old version. Let me know so I can verify.
Attaching a patch created with the latest sources. It is created on top of the patch submitted in #155088 "gnome-sound-recorder does not save files". Ronald has approved that patch and will be checking in. Please let me know if anything else is to be done.
Created attachment 33382 [details] [review] Patch created with the latest sources
Hey, Just a ping :-) Please have a look at the patch.
*** Bug 162303 has been marked as a duplicate of this bug. ***
reopening this bug is probably not waiting for new informations
Comment on attachment 33382 [details] [review] Patch created with the latest sources Hi, I've requested the release team to break the UI freeze, I'm convinced we should apply this. If we don't get permission, we'll apply after the next UI round.
pong, applied, thanks for the kick.