@@ -370,6 +370,56 @@ mate_theme_install_real (GtkWindow *parent,
370370 theme_source_dir = g_file_new_for_path (tmp_dir );
371371 theme_dest_dir = g_file_new_for_path (target_dir );
372372
373+ if (g_file_test (target_dir , G_FILE_TEST_EXISTS )) {
374+ gchar * str ;
375+
376+ str = g_strdup_printf (_ ("The theme \"%s\" is already existed." ), theme_name );
377+ dialog = gtk_message_dialog_new (parent ,
378+ GTK_DIALOG_MODAL ,
379+ GTK_MESSAGE_INFO ,
380+ GTK_BUTTONS_NONE ,
381+ "%s" ,
382+ str );
383+ g_free (str );
384+
385+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog ),
386+ _ ("Do you want to install it again?" ));
387+
388+ gtk_dialog_add_button (GTK_DIALOG (dialog ),
389+ _ ("Cancel" ),
390+ GTK_RESPONSE_CLOSE );
391+
392+ apply_button = gtk_button_new_with_label (_ ("Install" ));
393+ gtk_button_set_image (GTK_BUTTON (apply_button ),
394+ gtk_image_new_from_icon_name ("gtk-apply" ,
395+ GTK_ICON_SIZE_BUTTON ));
396+ gtk_dialog_add_action_widget (GTK_DIALOG (dialog ), apply_button , GTK_RESPONSE_APPLY );
397+ gtk_widget_set_can_default (apply_button , TRUE);
398+ gtk_widget_show (apply_button );
399+
400+ gtk_dialog_set_default_response (GTK_DIALOG (dialog ), GTK_RESPONSE_APPLY );
401+
402+ if (gtk_dialog_run (GTK_DIALOG (dialog )) == GTK_RESPONSE_APPLY ) {
403+ gtk_widget_destroy (dialog );
404+
405+ if (!capplet_file_delete_recursive (theme_dest_dir , NULL )) {
406+ GtkWidget * info_dialog = gtk_message_dialog_new (NULL ,
407+ GTK_DIALOG_MODAL ,
408+ GTK_MESSAGE_ERROR ,
409+ GTK_BUTTONS_OK ,
410+ _ ("Theme cannot be deleted" ));
411+ gtk_dialog_run (GTK_DIALOG (info_dialog ));
412+ gtk_widget_destroy (info_dialog );
413+ success = FALSE;
414+ goto end ;
415+ }
416+ }else {
417+ gtk_widget_destroy (dialog );
418+ success = FALSE;
419+ goto end ;
420+ }
421+ }
422+
373423 if (!g_file_move (theme_source_dir , theme_dest_dir ,
374424 G_FILE_COPY_OVERWRITE , NULL , NULL ,
375425 NULL , & error )) {
@@ -490,6 +540,7 @@ mate_theme_install_real (GtkWindow *parent,
490540 }
491541 }
492542
543+ end :
493544 g_free (target_dir );
494545 g_object_unref (theme_source_dir );
495546 g_object_unref (theme_dest_dir );
0 commit comments