changeset 3392:d538aabf6df5

merge
author Cristi Magherusan <majeru@atheme-project.org>
date Tue, 14 Aug 2007 01:51:52 +0300
parents 0afbafec6cd8 (current diff) 7a4fcf84a34f (diff)
children 3fa4ee796bd1
files src/audacious/Makefile
diffstat 16 files changed, 51 insertions(+), 179 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/Makefile	Tue Aug 14 01:51:52 2007 +0300
@@ -39,6 +39,7 @@
 	custom_uri.h \
 	dbus.h \
 	discovery.h \
+	dbus-service.h \
 	eventqueue.h \
 	formatter.h \
 	rcfile.h \
--- a/src/audacious/actions-mainwin.h	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/actions-mainwin.h	Tue Aug 14 01:51:52 2007 +0300
@@ -68,7 +68,6 @@
 void action_playback_next(void);
 void action_playback_pause(void);
 void action_playback_play(void);
-void action_playback_playcd(void);
 void action_playback_previous(void);
 void action_playback_stop(void);
 void action_preferences(void);
--- a/src/audacious/actions-playlist.h	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/actions-playlist.h	Tue Aug 14 01:51:52 2007 +0300
@@ -45,7 +45,7 @@
 void action_playlist_remove_selected(void);
 void action_playlist_remove_unselected(void);
 
-void action_playlist_add_cd(void);
+/* void action_playlist_add_cd(void); - this is no longer needed, as the respective menu entry is added from within the cdaudio plugin */
 void action_playlist_add_url(void);
 void action_playlist_add_files(void);
 
--- a/src/audacious/dbus.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/dbus.c	Tue Aug 14 01:51:52 2007 +0300
@@ -209,7 +209,7 @@
 
     value = tuple_value_to_gvalue(tuple, "title");
     if (value != NULL) {
-        g_hash_table_insert(md, "name", value);
+        g_hash_table_insert(md, "title", value);
     }
 
     value = tuple_value_to_gvalue(tuple, "artist");
--- a/src/audacious/main.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/main.c	Tue Aug 14 01:51:52 2007 +0300
@@ -95,7 +95,7 @@
 struct _BmpCmdLineOpt {
     gchar **filenames;
     gint session;
-    gboolean play, stop, pause, fwd, rew, play_pause, playcd, show_jump_box;
+    gboolean play, stop, pause, fwd, rew, play_pause, show_jump_box;
     gboolean enqueue, mainwin, remote, activate;
     gboolean load_skins;
     gboolean headless;
@@ -1004,9 +1004,6 @@
 
         if (options->activate)
             audacious_remote_activate(session);
-
-        if (options->playcd)
-            play_medium();
     } else {
         if (options->rew)
             audacious_drct_playlist_prev();
@@ -1038,9 +1035,6 @@
 
         if (options->activate)
             audacious_drct_activate();
-
-        if (options->playcd)
-            play_medium();
     }
 
     if(remote) {
--- a/src/audacious/playback.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/playback.c	Tue Aug 14 01:51:52 2007 +0300
@@ -133,6 +133,9 @@
 
     entry = playlist_get_entry_to_play(playlist);
     g_return_if_fail(entry != NULL);
+#ifdef USE_DBUS
+    mpris_emit_track_change(mpris);
+#endif
     playback_play_file(entry);
 
 //    if (playback_get_time() != -1) {
--- a/src/audacious/playlist.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/playlist.c	Tue Aug 14 01:51:52 2007 +0300
@@ -238,7 +238,7 @@
 
     /* entry is still around */
     formatter = tuple_get_string(tuple, "formatter");
-    entry->title = tuple_formatter_process_string(tuple, formatter ?
+    entry->title = tuple_formatter_make_title_string(tuple, formatter ?
                                                   formatter : get_gentitle_format());
     entry->length = tuple_get_int(tuple, "length");
     entry->tuple = tuple;
@@ -520,12 +520,8 @@
 
     playlistwin_update_list(playlist);
     if (restart_playing) {
-        if (playlist->position) {
-#ifdef USE_DBUS
-            mpris_emit_track_change(mpris);
-#endif
+        if (playlist->position)
             playback_initiate();
-        }
         else {
             mainwin_clear_song_info();
         }
@@ -562,12 +558,8 @@
     playlistwin_update_list(playlist);
 
     if (restart_playing) {
-        if (playlist->position) {
-#ifdef USE_DBUS
-            mpris_emit_track_change(mpris);
-#endif
+        if (playlist->position)
             playback_initiate();
-        }
         else {
             mainwin_clear_song_info();
         }
@@ -606,12 +598,8 @@
     playlist_recalc_total_time(playlist);
 
     if (restart_playing) {
-        if (playlist->position) {
-#ifdef USE_DBUS
-            mpris_emit_track_change(mpris);
-#endif
+        if (playlist->position)
             playback_initiate();
-        }
         else {
             mainwin_clear_song_info();
         }
@@ -684,7 +672,7 @@
     PLAYLIST_UNLOCK( playlist->mutex );
     if (tuple != NULL) {
         const gchar *formatter = tuple_get_string(tuple, "formatter");
-        entry->title = tuple_formatter_process_string(tuple, formatter ?
+        entry->title = tuple_formatter_make_title_string(tuple, formatter ?
                                                       formatter : get_gentitle_format());
         entry->length = tuple_get_int(tuple, "length");
         entry->tuple = tuple;
@@ -1177,12 +1165,8 @@
     PLAYLIST_UNLOCK(playlist->mutex);
     playlist_check_pos_current(playlist);
 
-    if (restart_playing) {
-#ifdef USE_DBUS
-        mpris_emit_track_change(mpris);
-#endif
+    if (restart_playing)
         playback_initiate();
-    }
 
     playlistwin_update_list(playlist);
 }
@@ -1241,14 +1225,10 @@
 
     playlist_check_pos_current(playlist);
 
-    if (restart_playing) {
-#ifdef USE_DBUS
-        mpris_emit_track_change(mpris);
-#endif
+    if (restart_playing)
         playback_initiate();
-    } else {
+    else
         playlistwin_update_list(playlist);
-    }
 }
 
 void
@@ -1426,14 +1406,10 @@
     PLAYLIST_UNLOCK(playlist->mutex);
     playlist_check_pos_current(playlist);
 
-    if (restart_playing) {
-#ifdef USE_DBUS
-        mpris_emit_track_change(mpris);
-#endif
+    if (restart_playing)
         playback_initiate();
-    } else {
+    else
         playlistwin_update_list(playlist);
-    }
 }
 
 void
@@ -1498,9 +1474,6 @@
     PLAYLIST_UNLOCK(playlist->mutex);
 
     playlist_check_pos_current(playlist);
-#ifdef USE_DBUS
-    mpris_emit_track_change(mpris);
-#endif
     playback_initiate();
     playlistwin_update_list(playlist);
 }
--- a/src/audacious/tuple_formatter.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/tuple_formatter.c	Tue Aug 14 01:51:52 2007 +0300
@@ -509,3 +509,22 @@
 
     return tuple_formatter_process_construct(tuple, string);
 }
+
+/* wrapper function for making title string. it falls back to filename
+ * if process_string returns NULL or a blank string. */
+gchar *
+tuple_formatter_make_title_string(Tuple *tuple, const gchar *string)
+{
+    gchar *rv;
+
+    g_return_val_if_fail(tuple != NULL, NULL);
+
+    rv = tuple_formatter_process_construct(tuple, string);
+
+    if(!rv || !strcmp(rv, "")) {
+        g_free(rv);
+        rv = g_strdup(tuple_get_string(tuple, "file-name"));
+    }
+
+    return rv;
+}
--- a/src/audacious/tuple_formatter.h	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/tuple_formatter.h	Tue Aug 14 01:51:52 2007 +0300
@@ -27,6 +27,7 @@
 #include "tuple.h"
 
 gchar *tuple_formatter_process_string(Tuple *tuple, const gchar *string);
+gchar *tuple_formatter_make_title_string(Tuple *tuple, const gchar *string);
 void tuple_formatter_register_expression(const gchar *keyword,
         gboolean (*func)(Tuple *tuple, const gchar *argument));
 void tuple_formatter_register_function(const gchar *keyword,
--- a/src/audacious/ui/mainwin.ui	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui/mainwin.ui	Tue Aug 14 01:51:52 2007 +0300
@@ -14,7 +14,6 @@
 			<separator />
 			<menuitem action="play file" />
 			<menuitem action="play location" />
-			<menuitem action="playback play cd" />
 			<menuitem action="lastfm" />
         		<separator />
 			<menu action="visualization">
--- a/src/audacious/ui/playlist.ui	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui/playlist.ui	Tue Aug 14 01:51:52 2007 +0300
@@ -17,7 +17,6 @@
 		</menu>
 
 		<menu action="dummy" name="add-menu">
-			<menuitem action="playlist add cd" />
 			<menuitem action="playlist add url" />
 			<menuitem action="playlist add files" />
 		</menu>
--- a/src/audacious/ui_equalizer.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui_equalizer.c	Tue Aug 14 01:51:52 2007 +0300
@@ -287,6 +287,11 @@
                       GdkEventKey * event,
                       gpointer data)
 {
+    if (event->keyval == GDK_Tab && event->state & GDK_CONTROL_MASK) {
+        gtk_window_present(GTK_WINDOW(playlistwin));
+        return TRUE;
+    }
+
     if (!cfg.equalizer_shaded) {
         gtk_widget_event(mainwin, (GdkEvent *) event);
         return TRUE;
--- a/src/audacious/ui_main.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui_main.c	Tue Aug 14 01:51:52 2007 +0300
@@ -981,6 +981,10 @@
     case GDK_Escape:
         mainwin_minimize_cb();
         break;
+    case GDK_Tab:
+        if (event->state & GDK_CONTROL_MASK)
+            gtk_window_present(GTK_WINDOW(equalizerwin));
+        break;
     default:
         return FALSE;
     }
@@ -1774,12 +1778,6 @@
     case MAINWIN_GENERAL_PLAYFILE:
         run_filebrowser(NO_PLAY_BUTTON);
         break;
-    case MAINWIN_GENERAL_PLAYCD:
-        play_medium();
-        break;
-    case MAINWIN_GENERAL_ADDCD:
-        add_medium();
-        break;
     case MAINWIN_GENERAL_PLAYLOCATION:
         mainwin_show_add_url_window();
         break;
@@ -1951,23 +1949,6 @@
     mainwin_release_info_text();
 }
 
-static void
-run_no_audiocd_dialog(void)
-{
-    const gchar *markup =
-        N_("<b><big>No playable CD found.</big></b>\n\n"
-           "No CD inserted, or inserted CD is not an audio CD.\n");
-
-    GtkWidget *dialog =
-        gtk_message_dialog_new_with_markup(GTK_WINDOW(mainwin),
-                                           GTK_DIALOG_DESTROY_WITH_PARENT,
-                                           GTK_MESSAGE_ERROR,
-                                           GTK_BUTTONS_OK,
-                                           _(markup));
-    gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_destroy(dialog);
-}
-
 void
 run_no_output_device_dialog(gpointer hook_data, gpointer user_data)
 {
@@ -1990,84 +1971,6 @@
     GDK_THREADS_LEAVE();
 }
 
-
-void
-add_medium(void)
-{
-    GList *list, *node;
-    gchar *filename;
-	
-	/*
-    gchar *path;
-    ConfigDb *db;
-
-    db = bmp_cfg_db_open();
-
-    if ( bmp_cfg_db_get_string(db, "CDDA", "directory", &path) != TRUE )
-    {
-        bmp_cfg_db_close(db);
-        run_no_audiocd_dialog();
-        return;
-    }
-    else
-        bmp_cfg_db_close(db);
-	*/
-
-    if (!(list = input_scan_dir(CDDA_DUMMY_PATH))) {
-        run_no_audiocd_dialog();
-        return;
-    }
-
-    for (node = list; node; node = g_list_next(node)) {
-        filename = g_build_filename(CDDA_DUMMY_PATH, node->data, NULL);
-        playlist_add(playlist_get_active(), filename);
-        g_free(filename);
-        g_free(node->data);
-    }
-
-    /*g_free(path);*/
-    g_list_free(list);
-
-}
-
-void
-play_medium(void)
-{
-    GList *list, *node;
-    gchar *filename;
-	/*
-    gchar *path;
-    ConfigDb *db;
-	*/
-    Playlist *playlist = playlist_get_active();
-
-	/*
-    db = bmp_cfg_db_open();
-    bmp_cfg_db_get_string(db, "CDDA", "directory", &path);
-    bmp_cfg_db_close(db);
-	*/
-
-    if (!(list = input_scan_dir(CDDA_DUMMY_PATH))) {
-        run_no_audiocd_dialog();
-        return;
-    }
-
-    playlist_clear(playlist);
-
-    for (node = list; node; node = g_list_next(node)) {
-        filename = g_build_filename(CDDA_DUMMY_PATH, node->data, NULL);
-        playlist_add(playlist, filename);
-        g_free(filename);
-        g_free(node->data);
-    }
-
-    /*g_free(path);*/
-    g_list_free(list);
-
-    playlist_set_position(playlist, 0);
-    playback_initiate();
-}
-
 void
 read_volume(gint when)
 {
@@ -3099,12 +3002,6 @@
 }
 
 void
-action_playback_playcd( void )
-{
-    play_medium();
-}
-
-void
 action_playback_pause( void )
 {
     playback_pause();
--- a/src/audacious/ui_main.h	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui_main.h	Tue Aug 14 01:51:52 2007 +0300
@@ -42,8 +42,6 @@
 
 #define MAINWIN_DEFAULT_FONT     "Sans Bold 9"
 
-#define CDDA_DUMMY_PATH          "cdda://default"
-
 
 typedef enum {
     TIMER_ELAPSED,
@@ -67,11 +65,8 @@
     MAINWIN_GENERAL_FOCUSPLWIN,
 
     MAINWIN_GENERAL_SHOWEQWIN,
-    MAINWIN_GENERAL_PLAYCD,
     MAINWIN_GENERAL_EXIT,
 
-    MAINWIN_GENERAL_ADDCD,
-
     MAINWIN_GENERAL_PREV,
     MAINWIN_GENERAL_PLAY,
     MAINWIN_GENERAL_PAUSE,
@@ -121,10 +116,6 @@
 
 void mainwin_create(void);
 void read_volume(gint when);
-void play_medium(void);
-void add_medium(void);
-
-void draw_main_window(gboolean);
 
 void mainwin_quit_cb(void);
 void mainwin_lock_info_text(const gchar * text);
--- a/src/audacious/ui_manager.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui_manager.c	Tue Aug 14 01:51:52 2007 +0300
@@ -238,10 +238,6 @@
 };
 
 static GtkActionEntry action_entries_playlist_add[] = {
-        { "playlist add cd", GTK_STOCK_CDROM, N_("Add CD..."), "<Shift>C",
-          N_("Adds a CD to the playlist."),
-          G_CALLBACK(action_playlist_add_cd) },
-
         { "playlist add url", GTK_STOCK_NETWORK, N_("Add Internet Address..."), "<Ctrl>H",
           N_("Adds a remote track to the playlist."),
           G_CALLBACK(action_playlist_add_url) },
@@ -394,13 +390,10 @@
 	{ "play location", GTK_STOCK_NETWORK , N_("Play Location"), "<Ctrl>L",
 	  N_("Play media from the selected location"), G_CALLBACK(action_play_location) },
 
-        { "playback play cd", GTK_STOCK_CDROM , N_("Play CD"), "<Alt>C",
-	  N_("Play CD"), G_CALLBACK(action_playback_playcd) },
-
         { "lastfm", NULL, N_("Last.fm radio"), "<Alt>L",
           N_("Play Last.fm radio"), G_CALLBACK(action_lastfm) },
 
-   { "plugins", NULL , N_("Plugins") },
+        { "plugins", NULL , N_("Plugins") },
 
 	{ "preferences", GTK_STOCK_PREFERENCES , N_("Preferences"), "<Ctrl>P",
 	  N_("Open preferences window"), G_CALLBACK(action_preferences) },
--- a/src/audacious/ui_playlist.c	Mon Aug 13 02:18:04 2007 +0300
+++ b/src/audacious/ui_playlist.c	Tue Aug 14 01:51:52 2007 +0300
@@ -1275,6 +1275,10 @@
     case GDK_Escape:
         mainwin_minimize_cb();
         break;
+    case GDK_Tab:
+        if (event->state & GDK_CONTROL_MASK)
+            gtk_window_present(GTK_WINDOW(mainwin));
+        break;
     default:
         return FALSE;
     }
@@ -1827,12 +1831,6 @@
 }
 
 void
-action_playlist_add_cd(void)
-{
-    add_medium();
-}
-
-void
 action_playlist_add_url(void)
 {
     mainwin_show_add_url_window();