changeset 2467:13f021d53367

Added a plugin-services menu option to force re-scanning of CD, patch adapted from bugzilla #221 by Andrew O. Shadoura.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 29 Mar 2008 11:28:11 +0200
parents 59e8f118ad34
children 615b67c4e010
files src/cdaudio-ng/cdaudio-ng.c
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cdaudio-ng/cdaudio-ng.c	Sat Mar 29 11:14:39 2008 +0200
+++ b/src/cdaudio-ng/cdaudio-ng.c	Sat Mar 29 11:28:11 2008 +0200
@@ -86,6 +86,7 @@
 static Tuple            	*cdaudio_get_song_tuple(gchar *filename);
 
 static void			menu_click(void);
+static void			rescan_menu_click(void);
 static Tuple            	*create_tuple_from_trackinfo_and_filename(gchar *filename);
 static void			dae_play_loop(dae_params_t *pdae_params);
 static void			*scan_cd(void *nothing);
@@ -200,6 +201,13 @@
 		cdng_cfg.use_dae, cdng_cfg.limitspeed, cdng_cfg.use_cdtext, cdng_cfg.use_cddb,
 		cdng_cfg.cddb_server, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug);
 
+	menu_item_text = _("Rescan CD");
+	main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text);
+	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(main_menu_item), gtk_image_new_from_stock(GTK_STOCK_REFRESH, GTK_ICON_SIZE_MENU));
+	gtk_widget_show(main_menu_item);
+	audacious_menu_plugin_item_add(AUDACIOUS_MENU_MAIN, main_menu_item);
+	g_signal_connect(G_OBJECT(main_menu_item), "activate", G_CALLBACK(rescan_menu_click), NULL);
+
 	menu_item_text = _("Add CD");
 	main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text);
 	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(main_menu_item), gtk_image_new_from_stock(GTK_STOCK_CDROM, GTK_ICON_SIZE_MENU));
@@ -612,7 +620,7 @@
 /*
  * auxiliar functions
  */
-static void menu_click()
+static void menu_click(void)
 {
 	debug("plugin services menu option selected\n");
 
@@ -632,6 +640,13 @@
 	}
 }
 
+static void rescan_menu_click(void)
+{
+	debug("plugin services rescan option selected\n");
+	
+	scan_cd_threaded(0, 0);
+}
+
 static Tuple *create_tuple_from_trackinfo_and_filename(gchar *filename)
 {
 	Tuple *tuple = aud_tuple_new_from_filename(filename);