1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2004-2011 Qball Cow <qball@gmpclient.org>
3 * Project homepage: http://gmpclient.org/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include <libxml/parser.h>
27 /** Gtk/glib glade stuff */
30 #include <libmpd/debug_printf.h>
33 #include "playlist3.h"
36 #include "advanced-search.h"
37 #include "gmpc_easy_download.h"
39 #include "setup-assistant.h"
41 #include "gmpc-mpddata-model-playlist.h"
42 #include "bug-information.h"
44 #include "pixbuf-cache.h"
46 #include "preferences.h"
48 #include "plugin-man.h"
49 #include "browsers/playlist3-playlist-editor.h"
55 #define LOG_DOMAIN "Gmpc"
62 #include "internal-plugins.h"
64 #include "mpd-easy-commands.h"
67 * Global objects that give signals
69 /* gives signal on connection changes, and state changes of mpd.*/
70 GmpcConnection
*gmpcconn
= NULL
;
71 /* Implements, and gives signals on profiles */
72 GmpcProfiles
*gmpc_profiles
= NULL
;
73 /* Implements, and gives signals on meta_data*/
74 GmpcMetaWatcher
*gmw
= NULL
;
76 GmpcEasyCommand
*gmpc_easy_command
= NULL
;
77 /* Playlist3 messages */
78 Playlist3MessagePlugin
*pl3_messages
= NULL
;
80 /* The playlist backend */
81 GtkTreeModel
*playlist
= NULL
;
83 GObject
*paned_size_group
= NULL
;
85 * This flag indicate the requested connection state by the user.
86 * If the user presses disconnect, you don't want to auto-connect anymore.
88 int gmpc_connected
= FALSE
;
90 static void connection_changed_real(
91 GmpcConnection
* gmpcconn
,
96 static void gmpc_status_changed_callback_real(
97 GmpcConnection
* gmpcconn
,
99 ChangedStatusType what
,
103 * Define some local functions
106 static void gmpc_easy_command_set_default_entries(void);
107 static void gmpc_mmkeys_connect_signals(GObject
*keys
);
108 /** handle connection changed */
109 static void connection_changed(MpdObj
* mi
, int connect
, gpointer data
);
111 /** Error callback */
112 static int error_callback(MpdObj
* mi
,
117 /** init stock icons */
118 static void init_stock_icons(void);
121 * the xml fle pointer to the player window
123 static GtkBuilder
*xml_password_window
= NULL
;
124 static int autoconnect_callback(void);
127 * the ID of the autoconnect timeout callback
129 static guint autoconnect_timeout
= 0;
134 config_obj
*config
= NULL
;
137 * The Connection object
139 MpdObj
*connection
= NULL
;
141 /* Glade prototypes, these would be static otherwise */
142 void send_password(void);
144 static void print_version(void);
148 * Forward libxml errors into GLib.log errors with LibXML error domain
150 static void xml_error_func(void *ctx
, const char *msg
, ...)
154 g_logv("LibXML", G_LOG_LEVEL_DEBUG
, msg
, ap
);
157 /* \todo why is this here? */
158 static xmlGenericErrorFunc handler
= (xmlGenericErrorFunc
) xml_error_func
;
161 static gboolean
hide_on_start(void)
168 int main(int argc
, char **argv
)
171 gchar
*packagedir
= NULL
;
180 /* A string used severall times to create a path */
191 g_log(LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
, "Setting NLS");
192 bindtextdomain(GETTEXT_PACKAGE
, PACKAGE_LOCALE_DIR
);
193 bind_textdomain_codeset(GETTEXT_PACKAGE
, "UTF-8");
194 textdomain(GETTEXT_PACKAGE
);
199 TEC("Setting up locale");
201 parse_options(&argc
, &argv
);
203 /* Show the version, if requested */
204 if (settings
.show_version
)
209 TEC("Parsing command line options");
211 log_set_debug_level(settings
.debug_level
);
212 TEC("Set debug level")
213 /* Show the bug-information dialog */
214 if (settings
.show_bug_information
)
216 bug_information_file_new(stdout
);
223 * Libxml is not used (directly) by gmpc.
224 * But via glade and several plugins use it.
225 * I need to initialize it before the threading is started.
228 * This fixes the plugin crasher bug on windows.
231 initGenericErrorDefaultFunc(&handler
);
234 * Check if threading is supported, if so, start it.
235 * Don't fail here, stuff like can cause that it is allready initialized.
237 if (!g_thread_supported())
240 TEC("Initializing threading");
244 g_log(LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
, "Initializing gtk ");
248 * This loads an extra gtk rc file on windows.
249 * This is used to re-enable rule-hint in the treeview.
250 * (this is forced off on windows).
252 packagedir
= g_win32_get_package_installation_directory_of_module(NULL
);
253 url
= g_build_filename(packagedir
,
255 "gmpc-gtk-win32.rc", NULL
);
257 gtk_rc_add_default_file(url
);
262 gtk_init(&argc
, &argv
);
265 /* Hack to override the icon theme, on recursive zeltak request */
266 if(settings
.icon_theme
!= NULL
) {
267 gtk_settings_set_string_property(gtk_settings_get_default(),
268 "gtk-icon-theme-name" , settings
.icon_theme
,NULL
);
272 * Call create_gmpc_paths();
273 * This function checks if the path needed path are available
274 * and creates them if needed.
277 TEC("Check version and create paths");
280 * COMMANDLINE_OPTION:
281 * Cleanup the metadata database and quit.
283 if (settings
.clean_config
)
285 /* start the metadata system */
287 //printf("Cleaning up cover file..\n");
288 /* Call the cleanup */
289 //metadata_cache_cleanup();
291 /* Destroy the meta data system and exit. */
293 TEC("Database cleanup");
298 * Open the config file
301 * Check if the user has forced a different config file location.
302 * else set to ~/.gmpc/gmpc.cfg
304 if (!settings
.config_path
)
306 url
= gmpc_get_user_path("gmpc.cfg");
309 url
= g_strdup(settings
.config_path
);
315 g_log(LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
,
316 "Trying to open the config file: %s", url
);
317 config
= cfg_open(url
);
320 * Show gtk error message and quit if config failed to open.
324 g_log(LOG_DOMAIN
, G_LOG_LEVEL_ERROR
,
325 "Failed to save/load configuration:\n%s\n", url
);
326 show_error_message(_("Failed to load the configuration system."));
329 TEC("Opening config file: %s", url
);
333 * \TODO, Check if version changed, then say something about it
335 * Enable this function if we need todo some upgrading on version change.
336 * Removal of this current content destroys config conversion from 0.17 and
339 url
= cfg_get_single_value_as_string(config
, "Default", "version");
340 if (url
== NULL
|| strcmp(url
, VERSION
))
342 cfg_set_single_value_as_string(config
, "Default", "version", VERSION
);
344 if (url
) q_free(url
);
345 TEC("New version check");
349 if (cfg_get_single_value_as_int_with_default(config
,
354 ipc
= gmpc_tools_ipc_new();
355 if(gmpc_tools_ipc_is_running(ipc
))
358 gmpc_tools_ipc_send(ipc
, COMMAND_EASYCOMMAND
,"quit");
360 gmpc_tools_ipc_send(ipc
, COMMAND_EASYCOMMAND
,"show");
364 TEC("IPC setup and quitting");
376 gmpc_easy_command
= gmpc_easy_command_new();
377 TEC("Init easy command")
378 gmpc_easy_command_set_default_entries();
379 TEC("Set easy commands")
380 mpd_easy_commands_init();
381 TEC("Set MPD Easy commands");
382 /* Advanced search */
383 advanced_search_init();
384 TEC("Init advanced search");
387 paned_size_group
= (GObject
*) gmpc_paned_size_group_new();
389 gmpc_profiles
= gmpc_profiles_new();
390 /* If user requested a profile, look it up and set it active */
391 if (settings
.profile_name
)
393 gmpc_profiles_set_profile_from_name(gmpc_profiles
,
394 settings
.profile_name
);
396 TEC("Setting up gmpc idle,signals and profiles");
398 * Initialize the new metadata subsystem.
402 TEC("Initializing metadata system");
403 pixbuf_cache_create();
404 TEC("Pixbuf cache create()");
409 g_log(LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
, "Loading stock icons");
411 TEC("Init stock icons");
413 * Create connection object
415 connection
= mpd_new_default();
416 if (connection
== NULL
)
419 * if failed, print error message
423 "Failed to create connection object\n");
424 show_error_message(_("Failed to setup libmpd"));
427 TEC("Setting up mpd connection object");
429 * Connect signals to the connection object
431 mpd_signal_connect_status_changed(connection
,
432 GmpcStatusChangedCallback
, NULL
);
433 mpd_signal_connect_error(connection
,
434 error_callback
, NULL
);
435 mpd_signal_connect_connection_changed(connection
,
436 connection_changed
, NULL
);
438 * Just some trick to provide glib signals
440 gmpcconn
= (GmpcConnection
*) gmpc_connection_new();
441 g_signal_connect(G_OBJECT(gmpcconn
),
442 "connection_changed",
443 G_CALLBACK(connection_changed_real
), NULL
);
444 g_signal_connect(G_OBJECT(gmpcconn
),
446 G_CALLBACK(gmpc_status_changed_callback_real
), NULL
);
448 TEC("Setting up mpd object signal system");
450 * New Metadata object
452 gmw
= gmpc_meta_watcher_new();
453 TEC("Initializing metadata watcher");
457 /** init the error messages */
458 pl3_messages
= playlist3_message_plugin_new();
460 playlist
= (GtkTreeModel
*)gmpc_mpddata_model_playlist_new(
463 gmpc_mpddata_model_disable_image(GMPC_MPDDATA_MODEL(playlist
));
466 * Add the internall plugins
468 plugin_manager_load_internal_plugins();
472 * load dynamic plugins
474 if (!settings
.disable_plugins
)
476 plugin_manager_load_plugins();
478 /* time todo some initialisation of plugins */
479 plugin_manager_initialize_plugins();
482 * Create the main window
485 TEC("Creating playlist window");
489 gmpc_tools_ipc_watch_window(ipc
, GTK_WINDOW(playlist3_get_window()));
490 TEC("Setup unique app to watch main window");
497 * If gmpc is ran for the first time, we want to show a wizard that helps
498 * the user getting started.
500 if (cfg_get_single_value_as_int_with_default(config
,
506 cfg_set_single_value_as_int(config
, "Default", "first-run", 0);
507 TEC("Setup first run assistant");
511 * If autoconnect is enabled, tell gmpc that it's in state it should connect
513 if (cfg_get_single_value_as_int_with_default(config
,
516 DEFAULT_AUTOCONNECT
))
518 gmpc_connected
= TRUE
;
522 * get the status every 1/2 second should be enough, but it's configurable.
524 g_timeout_add(cfg_get_single_value_as_int_with_default(config
,
527 500), (GSourceFunc
) update_mpd_status
, NULL
);
529 * create the autoconnect timeout,
530 * if autoconnect enable, it will check every 5 seconds
531 * if you are still connected, and reconnects you if not.
533 autoconnect_timeout
= g_timeout_add_seconds(5,
534 (GSourceFunc
) autoconnect_callback
, NULL
);
537 * Call this when entering the main loop,
538 * so you are connected on startup, not 5 seconds later
540 gtk_init_add((GSourceFunc
) autoconnect_callback
, NULL
);
541 if (settings
.fullscreen
)
543 gtk_init_add((GSourceFunc
) pl3_window_fullscreen
, NULL
);
547 * If the user wants gmpc to be started hidden,
548 * call pl3_hide after the mainloop started running
550 if (cfg_get_single_value_as_int_with_default(config
,
554 settings
.start_hidden
)
556 g_timeout_add(250, (GSourceFunc
) hide_on_start
, NULL
);
558 TEC("Setting up timers");
562 * Setup Multimedia Keys
565 gmpc_mmkeys_connect_signals(G_OBJECT(keys
));
566 TEC("Setting up multimedia keys");
569 url
= gmpc_get_user_path("gmpc.key");
570 gtk_accel_map_load(url
);
583 url
= gmpc_get_user_path("gmpc.key");
584 gtk_accel_map_save(url
);
593 /* Quit _all_ downloads */
594 gmpc_easy_async_quit();
596 /* tell the plugins to save themself. */
597 plugin_manager_save_state();
599 /* Should fix some possible crashes */
600 gtk_tree_view_set_model(playlist3_get_category_tree_view(), NULL
);
603 * Clear metadata struct
607 /* time todo some destruction of plugins */
608 plugin_manager_destroy_plugins();
612 g_object_unref(playlist
);
613 g_object_unref(G_OBJECT(gmw
));
615 /* Destroy PanedSizeGroup */
616 g_object_unref(paned_size_group
);
618 * Close the config file
620 TOC("Starting save config");
623 g_object_unref(gmpc_profiles
);
624 g_object_unref(gmpcconn
);
626 pixbuf_cache_destroy();
628 * This now gets destroyed with the plugins
630 advanced_search_destroy();
632 * Destroy the connection object
634 mpd_free(connection
);
636 /* Reset xml error function and cleanup */
637 initGenericErrorDefaultFunc((xmlGenericErrorFunc
*) NULL
);
640 gmpc_mpddata_treeview_cleanup();
642 g_log(LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
, "Quit....\n");
648 * Function to quiet the program
652 g_log(LOG_DOMAIN
, G_LOG_LEVEL_DEBUG
, "Quiting gmpc....");
654 * close playlist and store size
658 * Remove the autoconnect timeout,
660 if (autoconnect_timeout
)
661 g_source_remove(autoconnect_timeout
);
664 * Call the connection changed.
665 * so it saves the playlist pos
667 mpd_signal_connect_connection_changed(connection
, NULL
, NULL
);
670 * Disconnect when connected
672 if (mpd_check_connected(connection
))
674 if (cfg_get_single_value_as_int_with_default(config
,
675 "connection", "stop-on-exit", FALSE
))
677 mpd_player_stop(connection
);
679 mpd_disconnect(connection
);
689 * Callback that get's called every 5 seconds,
690 * and tries to autoconnect
694 static int autoconnect_backoff
= 0;
695 static int autoconnect_callback(void)
697 /* Don't autoconnect while showing the first start assistant */
698 if (setup_assistant_is_running())
701 /* check if there is an connection. */
702 if (!mpd_check_connected(connection
))
704 /* connect when autoconnect is enabled, the user wants to be connected
707 && cfg_get_single_value_as_int_with_default(config
,
708 "connection", "autoconnect", DEFAULT_AUTOCONNECT
))
713 if (autoconnect_backoff
< 60)
714 autoconnect_backoff
+= 1;
715 /* keep the timeout running */
716 if (autoconnect_timeout
)
717 g_source_remove(autoconnect_timeout
);
718 autoconnect_timeout
= g_timeout_add_seconds(5 + autoconnect_backoff
,
719 (GSourceFunc
) autoconnect_callback
, NULL
);
724 static void init_stock_icons(void)
728 path
= gmpc_get_full_image_path();
729 gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), path
);
732 gtk_window_set_default_icon_name("gmpc");
735 /* The Windows gtkrc sets this to 0, so images don't work on buttons */
736 gtk_settings_set_long_property(gtk_settings_get_default(),
737 "gtk-button-images", TRUE
, "main");
745 * Handle status changed callback from the libmpd object
746 * This involves propegating the signal
748 void GmpcStatusChangedCallback(MpdObj
* mi
,
749 ChangedStatusType what
,
752 g_signal_emit_by_name(gmpcconn
, "status-changed", mi
, what
);
756 /* The actual handling of the status changed signal */
757 static void gmpc_status_changed_callback_real(GmpcConnection
* conn
,
759 ChangedStatusType what
,
762 /* When permission changes, update the advanced search regex */
763 if (what
& MPD_CST_PERMISSION
)
765 advanced_search_update_taglist();
768 * Make the plugins recieve the signals
770 plugin_manager_status_changed(mi
, what
);
774 /*******************************
776 * TODO: Needs to be redone/rethought
779 static void password_dialog_response(
789 case GTK_RESPONSE_OK
:
791 path
= (char *)gtk_entry_get_text(
792 GTK_ENTRY(gtk_builder_get_object(xml_password_window
,
794 mpd_set_password(connection
, path
);
795 if (gtk_toggle_button_get_active
796 (GTK_TOGGLE_BUTTON(gtk_builder_get_object(
800 connection_set_password(path
);
802 mpd_send_password(connection
);
806 if (mpd_server_check_command_allowed(connection
, "status") !=
807 MPD_SERVER_COMMAND_ALLOWED
)
809 playlist3_show_error_message(
810 _("GMPC has insufficient permissions on the mpd server."),
812 mpd_disconnect(connection
);
817 (GtkWidget
*) gtk_builder_get_object(xml_password_window
,
819 g_object_unref(xml_password_window
);
820 xml_password_window
= NULL
;
824 static void password_dialog(int failed
)
826 GtkWidget
*pl3_win
= playlist3_get_window();
828 if (xml_password_window
)
830 path
= gmpc_get_full_glade_path("password-dialog.ui");
831 xml_password_window
= gtk_builder_new();
832 gtk_builder_add_from_file(xml_password_window
, path
, NULL
);
833 gtk_window_set_transient_for(GTK_WINDOW
834 (gtk_builder_get_object(xml_password_window
, "password-dialog")),
835 GTK_WINDOW(pl3_win
));
837 if (!xml_password_window
)
841 path
= g_strdup_printf(
842 _("Failed to set password on: '%s'\nPlease try again"),
843 mpd_get_hostname(connection
));
846 path
= g_strdup_printf(
847 _("Please enter your password for: '%s'"),
848 mpd_get_hostname(connection
));
851 GTK_LABEL(gtk_builder_get_object(xml_password_window
, "pass_label")),
855 g_signal_connect(G_OBJECT
856 (gtk_builder_get_object
857 (xml_password_window
, "password-dialog")), "response",
858 G_CALLBACK(password_dialog_response
), xml_password_window
);
862 void send_password(void)
864 password_dialog(FALSE
);
867 static void playlist_support_help_button_clicked(GObject
*a
)
869 open_help("ghelp:gmpc?ProblemSolving");
873 static int error_callback(MpdObj
* mi
,
878 int autoconnect
= cfg_get_single_value_as_int_with_default(config
,
881 DEFAULT_AUTOCONNECT
);
883 /* if we are not connected we show a reconnect */
884 if (!mpd_check_connected(mi
))
888 /* no response? then we just ignore it when autoconnecting. */
889 if (error_id
== 15 && autoconnect
)
892 str
= g_markup_printf_escaped("<b>%s %i: %s</b>",
896 playlist3_show_error_message(str
, ERROR_CRITICAL
);
897 button
= gtk_button_new_from_stock(GTK_STOCK_CONNECT
);
898 g_signal_connect(G_OBJECT(button
),
900 G_CALLBACK(connect_to_mpd
), NULL
);
901 playlist3_error_add_widget(button
);
905 if (setup_assistant_is_running()
906 && (error_id
== MPD_ACK_ERROR_PERMISSION
||
907 error_id
== MPD_ACK_ERROR_PASSWORD
))
909 gchar
*str
= g_markup_printf_escaped("<b>%s</b>",
910 _("Insufficient permission to connect to mpd. Check password"));
911 setup_assistant_set_error(str
);
915 if(error_id
== MPD_ACK_ERROR_SYSTEM
|| error_id
== MPD_ACK_ERROR_NO_EXIST
) {
916 if(g_regex_match_simple(".*{.*playlist.*}.*", error_msg
,
917 0,G_REGEX_MATCH_NOTEMPTY
))
919 GtkWidget
*button
= NULL
;
920 if(favorites
!= NULL
) {
921 gmpc_favorites_list_set_disable(favorites
,TRUE
);
923 playlist_editor_set_disabled();
924 playlist3_show_error_message(
925 _("Playlist support in MPD is not working. See the "
926 "manual on possible fixes.\n"
927 "Playlist editor and favorites are now disabled."
931 button
= gtk_button_new_from_stock(GTK_STOCK_HELP
);
932 g_signal_connect(G_OBJECT(button
), "clicked",
933 G_CALLBACK(playlist_support_help_button_clicked
), NULL
);
934 playlist3_error_add_widget(button
);
938 if (error_id
== MPD_ACK_ERROR_PASSWORD
)
940 password_dialog(TRUE
);
941 } else if (error_id
== MPD_ACK_ERROR_PERMISSION
)
943 password_dialog(FALSE
);
946 gchar
*str
= g_markup_printf_escaped("<b>%s %i: %s</b>",
947 _("error code"), error_id
,
949 playlist3_show_error_message(str
, ERROR_CRITICAL
);
958 * handle a connection changed
960 static void connection_changed(MpdObj
* mi
, int connected
, gpointer data
)
962 /* propagate the signal to the connection object */
963 if (mpd_check_connected(mi
) != connected
)
967 "Connection state differs from actual state: act: %i\n",
973 if (connected
&& !mpd_server_check_version(mi
, 0, 13, 0))
975 gchar
*value
= g_markup_printf_escaped("<b>%s</b>",
976 _("MPD versions before 0.13.0 are not supported"));
977 /* disable user connect ! */
978 gmpc_connected
= FALSE
;
981 playlist3_show_error_message(value
, ERROR_CRITICAL
);
987 if (autoconnect_timeout
)
988 g_source_remove(autoconnect_timeout
);
989 autoconnect_timeout
= 0;
990 autoconnect_backoff
= 0;
994 advanced_search_update_taglist();
997 * force an update of status, to check password
1001 mpd_status_update(mi
);
1002 if (connected
!= mpd_check_connected(mi
))
1004 g_log(LOG_DOMAIN
, G_LOG_LEVEL_WARNING
, "State differs, exit");
1005 /* Probly disconnected when getting status.. exiting */
1010 /* remove this when it does not fix it */
1011 g_signal_emit_by_name(gmpcconn
,
1012 "connection-changed",
1014 mpd_check_connected(mi
));
1018 static void connection_changed_real(
1019 GmpcConnection
* obj
,
1029 "Connection changed %i-%i \n",
1031 mpd_check_connected(mi
));
1032 plugin_manager_connection_changed(mi
, connected
);
1035 * force an update of status
1038 mpd_status_update(mi
);
1042 playlist3_show_error_message(_("Connected to mpd"), ERROR_INFO
);
1045 playlist3_show_error_message(_("Disconnected from mpd"), ERROR_INFO
);
1050 if (autoconnect_timeout
)
1051 g_source_remove(autoconnect_timeout
);
1052 autoconnect_timeout
= g_timeout_add_seconds(5,
1053 (GSourceFunc
) autoconnect_callback
, NULL
);
1054 autoconnect_backoff
= 0;
1060 * Shows an error message.
1062 void show_error_message(const gchar
* string
)
1064 GtkWidget
*dialog
= gtk_message_dialog_new_with_markup(NULL
,
1069 gtk_widget_show(dialog
);
1070 gtk_dialog_run(GTK_DIALOG(dialog
));
1073 static void print_version(void)
1075 printf("%s\n", _("Gnome Music Player Client"));
1076 printf(GMPC_COPYRIGHT
"\n\n");
1077 printf("%-25s: %s\n", _("Tagline"), GMPC_TAGLINE
);
1078 printf("%-25s: %i.%i.%i\n", _("Version"),
1081 GMPC_MICRO_VERSION
);
1082 if (revision
&& revision
[0] != '\0')
1084 printf("%-25s: %s\n", _("Revision"), revision
);
1089 * Set a basic set of easycommand handlers.
1091 static void gmpc_easy_command_set_default_entries(void)
1093 gmpc_easy_command_add_entry_stock_id(gmpc_easy_command
,
1096 (GmpcEasyCommandCallback
*) main_quit
,
1097 NULL
,GTK_STOCK_QUIT
);
1099 gmpc_easy_command_add_entry(gmpc_easy_command
,
1102 (GmpcEasyCommandCallback
*) pl3_hide
,
1105 gmpc_easy_command_add_entry(gmpc_easy_command
,
1108 (GmpcEasyCommandCallback
*) create_playlist3
,
1111 gmpc_easy_command_add_entry(gmpc_easy_command
,
1113 _("Toggle gmpc visibility"),
1114 (GmpcEasyCommandCallback
*) pl3_toggle_hidden
,
1117 gmpc_easy_command_add_entry(gmpc_easy_command
,
1118 _("show notification"), "",
1119 _("Show trayicon notification"),
1120 (GmpcEasyCommandCallback
*) tray_icon2_create_tooltip
,
1122 gmpc_easy_command_add_entry_stock_id(gmpc_easy_command
,
1123 _("preferences"), "",
1124 _("Show preferences window"),
1125 (GmpcEasyCommandCallback
*) create_preferences_window
,
1126 NULL
, GTK_STOCK_PREFERENCES
);
1128 gmpc_easy_command_add_entry(gmpc_easy_command
,
1129 _("bug information"), "",
1130 _("Show bug information"),
1131 (GmpcEasyCommandCallback
*) bug_information_window_new
,
1134 gmpc_easy_command_add_entry_icon_name(gmpc_easy_command
,
1136 _("Show add url window"),
1137 (GmpcEasyCommandCallback
*) url_start
,
1140 gmpc_easy_command_add_entry_icon_name(gmpc_easy_command
,
1141 _("url"), ".*://.*",
1142 _("Add url <scheme>://<path>"),
1143 (GmpcEasyCommandCallback
*) url_start_easy_command
,
1147 static void gmpc_mmkeys_connect_signals(GObject
*keys
)
1149 g_signal_connect(keys
,
1151 G_CALLBACK(play_song
), NULL
);
1153 g_signal_connect(keys
,
1155 G_CALLBACK(real_play_song
), NULL
);
1157 g_signal_connect(keys
,
1159 G_CALLBACK(real_pause_song
), NULL
);
1161 g_signal_connect(keys
,
1163 G_CALLBACK(next_song
), NULL
);
1165 g_signal_connect(keys
,
1167 G_CALLBACK(prev_song
), NULL
);
1169 g_signal_connect(keys
,
1171 G_CALLBACK(stop_song
), NULL
);
1173 g_signal_connect(keys
,
1175 G_CALLBACK(song_fastforward
), NULL
);
1177 g_signal_connect(keys
,
1179 G_CALLBACK(song_fastbackward
), NULL
);
1181 g_signal_connect(keys
,
1183 G_CALLBACK(repeat_toggle
), NULL
);
1185 g_signal_connect(keys
,
1187 G_CALLBACK(random_toggle
), NULL
);
1189 g_signal_connect(keys
,
1191 G_CALLBACK(create_playlist3
), NULL
);
1193 g_signal_connect(keys
,
1195 G_CALLBACK(pl3_hide
), NULL
);
1197 g_signal_connect(keys
,
1199 G_CALLBACK(pl3_toggle_hidden
), NULL
);
1201 g_signal_connect(keys
,
1203 G_CALLBACK(volume_up
), NULL
);
1205 g_signal_connect(keys
,
1207 G_CALLBACK(volume_down
), NULL
);
1209 g_signal_connect(keys
,
1211 G_CALLBACK(volume_toggle_mute
), NULL
);
1213 g_signal_connect(keys
,
1214 "mm_show_notification",
1215 G_CALLBACK(tray_icon2_create_tooltip
), NULL
);
1217 g_signal_connect_swapped(keys
,
1218 "mm_show_easy_command",
1219 G_CALLBACK(gmpc_easy_command_popup
),
1223 /* vim: set noexpandtab ts=4 sw=4 sts=4 tw=80: */