changeset 86:2d8234ea45e8 trunk

[svn] - Add a few things to the main menu. - Bring back classic XMMS behaviour of ``Play Location''.
author nenolod
date Mon, 31 Oct 2005 23:46:59 -0800
parents 8c8a20f72ace
children 8b1b817e0848
files audacious/mainwin.c audacious/util.c audacious/util.h
diffstat 3 files changed, 41 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/mainwin.c	Mon Oct 31 21:16:49 2005 -0800
+++ b/audacious/mainwin.c	Mon Oct 31 23:46:59 2005 -0800
@@ -358,15 +358,23 @@
 /* Main menu */
 
 GtkItemFactoryEntry mainwin_general_menu_entries[] = {
-    { N_("/View Track Details"), "<alt>I", mainwin_general_menu_callback,
+    {N_("/About Audacious"), NULL, mainwin_general_menu_callback,
+     MAINWIN_GENERAL_ABOUT, "<StockItem>", GTK_STOCK_DIALOG_INFO},
+    {"/-", NULL, NULL, 0, "<Separator>"},
+    {N_("/Play File"), "L", mainwin_general_menu_callback,
+     MAINWIN_GENERAL_PLAYFILE, "<StockItem>", GTK_STOCK_OPEN},
+    {N_("/Play Directory"), "<shift>L", mainwin_general_menu_callback,
+     MAINWIN_GENERAL_PLAYDIRECTORY, "<Item>"},
+    {N_("/Play Location"), "<control>L", mainwin_general_menu_callback,
+     MAINWIN_GENERAL_PLAYLOCATION, "<StockItem>", GTK_STOCK_NETWORK},
+    {"/-", NULL, NULL, 0, "<Separator>"},
+    {N_("/View Track Details"), "<alt>I", mainwin_general_menu_callback,
      MAINWIN_GENERAL_FILEINFO, "<ImageItem>", my_pixbuf},
     {"/-", NULL, NULL, 0, "<Separator>"},
     {N_("/Preferences"), "<control>P", mainwin_general_menu_callback,
      MAINWIN_GENERAL_PREFS, "<StockItem>", GTK_STOCK_PREFERENCES},
     {N_("/_View"), NULL, NULL, 0, "<Item>"},
     {"/-", NULL, NULL, 0, "<Separator>"},
-    {N_("/About Audacious"), NULL, mainwin_general_menu_callback,
-     MAINWIN_GENERAL_ABOUT, "<StockItem>", GTK_STOCK_DIALOG_INFO},
     {N_("/_Quit"), NULL, mainwin_general_menu_callback,
      MAINWIN_GENERAL_EXIT, "<StockItem>", GTK_STOCK_QUIT}
 };
@@ -1925,6 +1933,19 @@
         playlist_add_url(text);
 }
 
+static void
+on_add_url_ok_clicked(GtkWidget * widget,
+                      GtkWidget * entry)
+{
+    const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
+    if (text && *text)
+    {
+        playlist_clear();
+        playlist_add_url(text);
+        bmp_playback_initiate();
+    }
+}
+
 void
 mainwin_show_add_url_window(void)
 {
@@ -1932,7 +1953,8 @@
 
     if (!url_window) {
         url_window =
-            util_add_url_dialog_new(_("Add Internet Address"),
+            util_add_url_dialog_new(_("Enter location to play:"),
+				    G_CALLBACK(on_add_url_ok_clicked),
                                     G_CALLBACK(on_add_url_add_clicked));
         gtk_window_set_transient_for(GTK_WINDOW(url_window),
                                      GTK_WINDOW(mainwin));
--- a/audacious/util.c	Mon Oct 31 21:16:49 2005 -0800
+++ b/audacious/util.c	Mon Oct 31 23:46:59 2005 -0800
@@ -624,9 +624,10 @@
 }
 
 GtkWidget *
-util_add_url_dialog_new(const gchar * caption, GCallback enqueue_func)
+util_add_url_dialog_new(const gchar * caption, GCallback ok_func,
+    GCallback enqueue_func)
 {
-    GtkWidget *win, *vbox, *bbox, *enqueue, *cancel, *combo, *entry;
+    GtkWidget *win, *vbox, *bbox, *enqueue, *ok, *cancel, *combo, *entry;
     GList *url;
 
     win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -653,7 +654,7 @@
                      G_CALLBACK(util_add_url_callback),
                      entry);
     g_signal_connect(entry, "activate",
-                     G_CALLBACK(enqueue_func),
+                     G_CALLBACK(ok_func),
                      entry);
     g_signal_connect_swapped(entry, "activate",
                              G_CALLBACK(gtk_widget_destroy),
@@ -664,6 +665,16 @@
     gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5);
     gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
 
+    ok = gtk_button_new_from_stock(GTK_STOCK_OPEN);
+    g_signal_connect(ok, "clicked",
+		     G_CALLBACK(util_add_url_callback), entry);
+    g_signal_connect(ok, "clicked",
+		     G_CALLBACK(ok_func), entry);
+    g_signal_connect_swapped(ok, "clicked",
+                             G_CALLBACK(gtk_widget_destroy),
+                             win);
+    gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0);
+
     enqueue = gtk_button_new_from_stock(GTK_STOCK_ADD);
     gtk_box_pack_start(GTK_BOX(bbox), enqueue, FALSE, FALSE, 0);
 
--- a/audacious/util.h	Mon Oct 31 21:16:49 2005 -0800
+++ b/audacious/util.h	Mon Oct 31 23:46:59 2005 -0800
@@ -65,7 +65,7 @@
                                        GtkDestroyNotify destroy, guint x,
                                        guint y, guint mouse_button,
                                        guint32 time);
-GtkWidget *util_add_url_dialog_new(const gchar * caption,
+GtkWidget *util_add_url_dialog_new(const gchar * caption, GCallback ok_func,
                                    GCallback enqueue_func);
 void util_menu_position(GtkMenu * menu, gint * x, gint * y,
                         gboolean * push_in, gpointer data);