static gboolean _get_active_player (void) { ol_log_func (); player = ol_player_get_active_player (); if (player == NULL) { gboolean ignore = FALSE; if (first_run) { OlConfig *config = ol_config_get_instance (); char *player_cmd = ol_config_get_string (config, "General", "startup-player"); if (!ol_is_string_empty (player_cmd)) { ignore = TRUE; ol_debugf ("Running %s\n", player_cmd); g_spawn_command_line_async (player_cmd, NULL); sleep (5); } g_free (player_cmd); } if (!ignore) { printf (_("No supported player is running, exit.\n")); gtk_main_quit (); } } ol_display_module_set_player (module, player); first_run = FALSE; return player != NULL; }
static gboolean _advance_to_nonempty_lyric (OlLrcIter *iter) { for (; ol_lrc_iter_is_valid (iter); ol_lrc_iter_next (iter)) { if (!ol_is_string_empty (ol_lrc_iter_get_text (iter))) return TRUE; } return FALSE; }
static void _launch_button_clicked_cb (GtkButton *button, OlPlayerChooser *window) { ol_assert (OL_IS_PLAYER_CHOOSER (window)); OlPlayerChooserPrivate *priv = OL_PLAYER_CHOOSER_GET_PRIVATE (window); const char *cmd = gtk_entry_get_text (priv->cmd_entry); if (ol_is_string_empty (cmd)) return; GAppInfo *app_info = G_APP_INFO (ol_app_info_new (cmd, NULL, NULL, OL_APP_INFO_PREFER_DESKTOP_FILE, NULL)); _launch_app (window, app_info); g_object_unref (app_info); }