comparison src/audacious/legacy/ui_main.c @ 4717:d59d0c490a61

hookify urlopener
author Tomasz Mon <desowin@gmail.com>
date Wed, 09 Jul 2008 16:08:45 +0200
parents 3a56d2786063
children 1a13d88b72f3
comparison
equal deleted inserted replaced
4716:8e62ba58ea6e 4717:d59d0c490a61
70 #include "ui_main_evlisteners.h" 70 #include "ui_main_evlisteners.h"
71 #include "ui_manager.h" 71 #include "ui_manager.h"
72 #include "ui_playlist.h" 72 #include "ui_playlist.h"
73 #include "ui_preferences.h" 73 #include "ui_preferences.h"
74 #include "ui_skinselector.h" 74 #include "ui_skinselector.h"
75 #include "ui_urlopener.h"
76 #include "util.h" 75 #include "util.h"
77 #include "visualization.h" 76 #include "visualization.h"
78 77
79 #include "ui_skinned_window.h" 78 #include "ui_skinned_window.h"
80 #include "ui_skinned_button.h" 79 #include "ui_skinned_button.h"
1087 playlist_add_url(playlist, (gchar *) selection_data->data); 1086 playlist_add_url(playlist, (gchar *) selection_data->data);
1088 playback_initiate(); 1087 playback_initiate();
1089 } 1088 }
1090 1089
1091 static void 1090 static void
1092 on_add_url_add_clicked(GtkWidget * widget,
1093 GtkWidget * entry)
1094 {
1095 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
1096 if (text && *text)
1097 playlist_add_url(playlist_get_active(), text);
1098 }
1099
1100 static void
1101 on_add_url_ok_clicked(GtkWidget * widget,
1102 GtkWidget * entry)
1103 {
1104 Playlist *playlist = playlist_get_active();
1105
1106 const gchar *text = gtk_entry_get_text(GTK_ENTRY(entry));
1107 if (text && *text)
1108 {
1109 playlist_clear(playlist);
1110 playlist_add_url(playlist, text);
1111 playback_initiate();
1112 }
1113 }
1114
1115 static void
1116 on_visibility_warning_toggle(GtkToggleButton *tbt, gpointer unused) 1091 on_visibility_warning_toggle(GtkToggleButton *tbt, gpointer unused)
1117 { 1092 {
1118 cfg.warn_about_win_visibility = !gtk_toggle_button_get_active(tbt); 1093 cfg.warn_about_win_visibility = !gtk_toggle_button_get_active(tbt);
1119 } 1094 }
1120 1095
1234 cfg.disable_inline_gtk = TRUE; 1209 cfg.disable_inline_gtk = TRUE;
1235 1210
1236 g_free(theme); 1211 g_free(theme);
1237 } 1212 }
1238 1213
1239 void
1240 mainwin_show_add_url_window(void)
1241 {
1242 static GtkWidget *url_window = NULL;
1243
1244 if (!url_window) {
1245 url_window =
1246 util_add_url_dialog_new(_("Enter location to play:"),
1247 G_CALLBACK(on_add_url_ok_clicked),
1248 G_CALLBACK(on_add_url_add_clicked));
1249 gtk_window_set_transient_for(GTK_WINDOW(url_window),
1250 GTK_WINDOW(mainwin));
1251 g_signal_connect(url_window, "destroy",
1252 G_CALLBACK(gtk_widget_destroyed),
1253 &url_window);
1254 }
1255
1256 gtk_window_present(GTK_WINDOW(url_window));
1257 }
1258
1259 static void 1214 static void
1260 check_set( GtkActionGroup * action_group , 1215 check_set( GtkActionGroup * action_group ,
1261 const gchar * action_name , 1216 const gchar * action_name ,
1262 gboolean is_on ) 1217 gboolean is_on )
1263 { 1218 {
1759 break; 1714 break;
1760 case MAINWIN_GENERAL_PLAYFILE: 1715 case MAINWIN_GENERAL_PLAYFILE:
1761 run_filebrowser(FALSE); 1716 run_filebrowser(FALSE);
1762 break; 1717 break;
1763 case MAINWIN_GENERAL_PLAYLOCATION: 1718 case MAINWIN_GENERAL_PLAYLOCATION:
1764 mainwin_show_add_url_window(); 1719 hook_call("urlopener show", NULL);
1765 break; 1720 break;
1766 case MAINWIN_GENERAL_FILEINFO: 1721 case MAINWIN_GENERAL_FILEINFO:
1767 ui_fileinfo_show_current(playlist); 1722 ui_fileinfo_show_current(playlist);
1768 break; 1723 break;
1769 case MAINWIN_GENERAL_FOCUSPLWIN: 1724 case MAINWIN_GENERAL_FOCUSPLWIN:
2727 } 2682 }
2728 2683
2729 void 2684 void
2730 action_play_location( void ) 2685 action_play_location( void )
2731 { 2686 {
2732 mainwin_show_add_url_window(); 2687 hook_call("urlopener show", NULL);
2733 } 2688 }
2734 2689
2735 void 2690 void
2736 action_ab_set( void ) 2691 action_ab_set( void )
2737 { 2692 {